From e7332a377845e944f874594c67b9d109242c579d Mon Sep 17 00:00:00 2001 From: Matthew Allum Date: Tue, 19 Jun 2007 14:10:25 +0000 Subject: [PATCH] 2007-06-19 Matthew Allum * TODO: Sync up a little. * clutter/clutter-main.c: Set a default window title based on g_prgname(). * clutter/clutter-stage.c: * clutter/clutter-stage.h: * clutter/egl/clutter-stage-egl.c: * clutter/glx/clutter-stage-glx.c: * clutter/sdl/clutter-stage-sdl.c: Alter draw_to_pixbuf to return a pixbuf * configure.ac: Only full in gdk-pixbuf-xlib as a GLX backend dep. * tests/test-entry.c: Fix a couple of warnings. --- ChangeLog | 20 ++++++++++++++++++++ TODO | 20 ++++++++++---------- clutter/clutter-main.c | 12 ++++++++++++ clutter/clutter-stage.c | 8 +------- clutter/clutter-stage.h | 3 +-- clutter/egl/clutter-stage-egl.c | 4 ++-- clutter/glx/clutter-stage-glx.c | 34 ++++++++++++++++++++-------------- clutter/sdl/clutter-stage-sdl.c | 3 ++- configure.ac | 10 +++++++--- tests/test-entry.c | 4 ++-- 10 files changed, 77 insertions(+), 41 deletions(-) diff --git a/ChangeLog b/ChangeLog index 467d414..c2dd6cc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,23 @@ +2007-06-19 Matthew Allum + + * TODO: + Sync up a little. + * clutter/clutter-main.c: + Set a default window title based on g_prgname(). + + * clutter/clutter-stage.c: + * clutter/clutter-stage.h: + * clutter/egl/clutter-stage-egl.c: + * clutter/glx/clutter-stage-glx.c: + * clutter/sdl/clutter-stage-sdl.c: + Alter draw_to_pixbuf to return a pixbuf + + * configure.ac: + Only full in gdk-pixbuf-xlib as a GLX backend dep. + + * tests/test-entry.c: + Fix a couple of warnings. + 2007-06-19 Emmanuele Bassi * Makefile.am: Add README.in to the EXTRA_DIST. diff --git a/TODO b/TODO index 2c30f02..afd1fd8 100644 --- a/TODO +++ b/TODO @@ -9,23 +9,23 @@ Last updated 31/05/2007 Definetly: - - YUV texture data, premulled alpha texture data. (ma) - - Basic layout code. (eb) - - Basic text entry (np) - - Perspective setup (ma) + - YUV texture data [DONE] premulled alpha texture data. (ma) + - Basic layout code. [DONE] (eb) + - Basic text entry [DONE] (np) + - Perspective setup [DONE] (ma) - API doc fixups (all) - - main loop scheduling - paints vs timelimes vs events (ma, eb) + - main loop scheduling - paints vs timelimes vs events [DONE] ((ma, eb) - ClutterProxyTexture (ma) - - event queue fixups (eb) - - clutter_actor_get_vertices (tf) - - fix up event queue (eb) + - event queue fixups [DONE} (eb) + - clutter_actor_get_vertices [Partly DONE?] (tf) + - fix up event queue [DONE] (eb) Maybe: - - SDL event fixups + - SDL event fixups [DONE - roughly] - Application developers manual - Lookat type functionality. - + - Mipmaps for pango renderer to improving text scaling quality 0.6 === diff --git a/clutter/clutter-main.c b/clutter/clutter-main.c index d8357a0..86a1748 100644 --- a/clutter/clutter-main.c +++ b/clutter/clutter-main.c @@ -598,6 +598,9 @@ clutter_init_with_args (int *argc, if (clutter_is_initialized) return CLUTTER_INIT_SUCCESS; + if (*argc > 0) + g_set_prgname (*argv[0]); + clutter_base_init (); group = clutter_get_option_group (); @@ -630,6 +633,9 @@ clutter_init_with_args (int *argc, _clutter_feature_init (); + clutter_stage_set_title (CLUTTER_STAGE(clutter_stage_get_default()), + g_get_prgname ()); + return CLUTTER_INIT_SUCCESS; } @@ -688,6 +694,9 @@ clutter_init (int *argc, if (clutter_is_initialized) return CLUTTER_INIT_SUCCESS; + if (*argc > 0) + g_set_prgname (*argv[0]); + clutter_base_init (); /* parse_args will trigger backend creation and things like @@ -720,6 +729,9 @@ clutter_init (int *argc, /* finally features - will call to backend and cogl */ _clutter_feature_init (); + clutter_stage_set_title (CLUTTER_STAGE(clutter_stage_get_default()), + g_get_prgname()); + return CLUTTER_INIT_SUCCESS; } diff --git a/clutter/clutter-stage.c b/clutter/clutter-stage.c index 18968ce..f82d290 100644 --- a/clutter/clutter-stage.c +++ b/clutter/clutter-stage.c @@ -742,13 +742,7 @@ clutter_stage_snapshot (ClutterStage *stage, klass = CLUTTER_STAGE_GET_CLASS (stage); if (klass->draw_to_pixbuf) - { - GdkPixbuf *retval = NULL; - - klass->draw_to_pixbuf (stage, retval, x, y, width, height); - - return retval; - } + return klass->draw_to_pixbuf (stage, x, y, width, height); return NULL; } diff --git a/clutter/clutter-stage.h b/clutter/clutter-stage.h index c32dced..ac8d158 100644 --- a/clutter/clutter-stage.h +++ b/clutter/clutter-stage.h @@ -84,8 +84,7 @@ struct _ClutterStageClass gboolean visible); void (* set_offscreen) (ClutterStage *stage, gboolean offscreen); - void (* draw_to_pixbuf) (ClutterStage *stage, - GdkPixbuf *dest, + GdkPixbuf* (* draw_to_pixbuf) (ClutterStage *stage, gint x, gint y, gint width, diff --git a/clutter/egl/clutter-stage-egl.c b/clutter/egl/clutter-stage-egl.c index def7bb3..42aec44 100644 --- a/clutter/egl/clutter-stage-egl.c +++ b/clutter/egl/clutter-stage-egl.c @@ -323,9 +323,8 @@ clutter_stage_egl_set_offscreen (ClutterStage *stage, G_OBJECT_TYPE_NAME (stage)); } -static void +static GdkPixbuf* clutter_stage_egl_draw_to_pixbuf (ClutterStage *stage, - GdkPixbuf *dest, gint x, gint y, gint width, @@ -333,6 +332,7 @@ clutter_stage_egl_draw_to_pixbuf (ClutterStage *stage, { g_warning ("Stage of type `%s' do not support ClutterStage::draw_to_pixbuf", G_OBJECT_TYPE_NAME (stage)); + return NULL; } static void diff --git a/clutter/glx/clutter-stage-glx.c b/clutter/glx/clutter-stage-glx.c index 43d4450..4935f2b 100644 --- a/clutter/glx/clutter-stage-glx.c +++ b/clutter/glx/clutter-stage-glx.c @@ -488,9 +488,8 @@ snapshot_pixbuf_free (guchar *pixels, g_free (pixels); } -static void +static GdkPixbuf* clutter_stage_glx_draw_to_pixbuf (ClutterStage *stage, - GdkPixbuf *dest, gint x, gint y, gint width, @@ -517,7 +516,7 @@ clutter_stage_glx_draw_to_pixbuf (ClutterStage *stage, { gdk_pixbuf_xlib_init (stage_glx->xdpy, stage_glx->xscreen); - dest = gdk_pixbuf_xlib_get_from_drawable (NULL, + pixb = gdk_pixbuf_xlib_get_from_drawable (NULL, (Drawable) stage_glx->xpixmap, DefaultColormap (stage_glx->xdpy, stage_glx->xscreen), @@ -528,26 +527,33 @@ clutter_stage_glx_draw_to_pixbuf (ClutterStage *stage, } else { - data = g_malloc0 (sizeof (guchar) * width * height * 4); + GdkPixbuf *tmp = NULL; + gint stride; + + stride = ((width * 4 + 3) &~ 3); + + data = g_malloc0 (sizeof (guchar) * stride * height); glReadPixels (x, clutter_actor_get_height (actor) - y - height, width, height, GL_RGBA, GL_UNSIGNED_BYTE, data); - pixb = gdk_pixbuf_new_from_data (data, - GDK_COLORSPACE_RGB, - TRUE, - 8, - width, height, - width * 4, - snapshot_pixbuf_free, - NULL); + tmp = gdk_pixbuf_new_from_data (data, + GDK_COLORSPACE_RGB, + TRUE, + 8, + width, height, + stride, + snapshot_pixbuf_free, + NULL); - dest = gdk_pixbuf_flip (pixb, TRUE); + pixb = gdk_pixbuf_flip (tmp, TRUE); - g_object_unref (pixb); + g_object_unref (tmp); } + + return pixb; } static void diff --git a/clutter/sdl/clutter-stage-sdl.c b/clutter/sdl/clutter-stage-sdl.c index 8d7a0ff..d950b30 100644 --- a/clutter/sdl/clutter-stage-sdl.c +++ b/clutter/sdl/clutter-stage-sdl.c @@ -159,7 +159,7 @@ clutter_stage_sdl_set_offscreen (ClutterStage *stage, G_OBJECT_TYPE_NAME (stage)); } -static void +static GdkPixbuf* clutter_stage_sdl_draw_to_pixbuf (ClutterStage *stage, GdkPixbuf *dest, gint x, @@ -169,6 +169,7 @@ clutter_stage_sdl_draw_to_pixbuf (ClutterStage *stage, { g_warning ("Stage of type `%s' do not support ClutterStage::draw_to_pixbuf", G_OBJECT_TYPE_NAME (stage)); + return NULL; } static void diff --git a/configure.ac b/configure.ac index 80794a4..d4e0387 100644 --- a/configure.ac +++ b/configure.ac @@ -111,6 +111,8 @@ AC_ARG_WITH([flavour], [Select the Clutter backend]), clutterbackend=$with_flavour) +BACKEND_PC_FILES="" + case $clutterbackend in sdl) @@ -181,6 +183,9 @@ case $clutterbackend in AC_MSG_ERROR([GLX not found and GLX backend requested]); fi + # xlib pixbuf needed for exporting the stage + BACKEND_PC_FILES="gdk-pixbuf-xlib-2.0" + GLX_LIBS="$X11_LIBS -lGL" GLX_CFLAGS="$X11_CFLAGS" ;; @@ -198,10 +203,9 @@ case $clutterbackend in if test "x$HAVE_OGLES" = "xno"; then AC_MSG_ERROR([libvincent (ogles) not found and egl backend requested.]); fi - + EGL_LIBS="$EGL_LIBS $X11_LIBS" EGL_CFLAGS="$EGL_CFLAGS $X11_CFLAGS" - ;; *) AC_MSG_ERROR([Invalid backend for Clutter: use glx or egl]) @@ -218,7 +222,7 @@ AC_SUBST([clutterbackendlib]) dnl ======================================================================== -pkg_modules="pangoft2 glib-2.0 >= 2.10 gobject-2.0 gthread-2.0 gdk-pixbuf-2.0 gdk-pixbuf-xlib-2.0" +pkg_modules="pangoft2 glib-2.0 >= 2.10 gobject-2.0 gthread-2.0 gdk-pixbuf-2.0 $BACKEND_PC_FILES" PKG_CHECK_MODULES(CLUTTER_DEPS, [$pkg_modules]) dnl ======================================================================== diff --git a/tests/test-entry.c b/tests/test-entry.c index e392ead..206fc09 100644 --- a/tests/test-entry.c +++ b/tests/test-entry.c @@ -40,7 +40,7 @@ main (int argc, char *argv[]) clutter_actor_set_size (stage, 800, 600); clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_color); - clutter_stage_set_title (stage, "ClutterEntry Test"); + clutter_stage_set_title (CLUTTER_STAGE (stage), "ClutterEntry Test"); entry = clutter_entry_new_with_text ("Sans 14", "Type something, be sure to use the " @@ -53,7 +53,7 @@ main (int argc, char *argv[]) /*clutter_entry_set_max_length (CLUTTER_ENTRY (entry), 50);*/ clutter_group_add (CLUTTER_GROUP (stage), entry); - clutter_actor_show_all (CLUTTER_GROUP (stage)); + clutter_actor_show_all (stage); g_signal_connect (stage, "key-release-event", G_CALLBACK (on_key_release_cb), (gpointer)entry); -- 2.7.4