diff --git a/src/big/rectangle.c b/src/big/rectangle.c index 2b1fb7d37..8ca104d50 100644 --- a/src/big/rectangle.c +++ b/src/big/rectangle.c @@ -362,7 +362,7 @@ big_rectangle_paint(ClutterActor *actor) if (radius != 0) { cogl_color_set_from_4ub(&tmp_color, - 0xff, 0xff, 0xff, actor_opacity); + actor_opacity, actor_opacity, actor_opacity, actor_opacity); cogl_material_set_color(rectangle->corner_material, &tmp_color); cogl_set_source(rectangle->corner_material); @@ -401,6 +401,7 @@ big_rectangle_paint(ClutterActor *actor) border_color->green, border_color->blue, actor_opacity * border_color->alpha / 255); + cogl_color_premultiply (&tmp_color); cogl_material_set_color(rectangle->border_material, &tmp_color); cogl_set_source(rectangle->border_material); @@ -429,6 +430,7 @@ big_rectangle_paint(ClutterActor *actor) color->green, color->blue, actor_opacity * color->alpha / 255); + cogl_color_premultiply (&tmp_color); cogl_material_set_color(rectangle->background_material, &tmp_color); cogl_set_source(rectangle->background_material); diff --git a/src/shell-global.c b/src/shell-global.c index 1dffc29a2..070c962ac 100644 --- a/src/shell-global.c +++ b/src/shell-global.c @@ -980,6 +980,7 @@ update_root_window_pixmap (ShellGlobal *global) gulong nitems; gulong bytes_after; guchar *data; + Pixmap root_pixmap_id = None; if (!XGetWindowProperty (gdk_x11_get_default_xdisplay (), gdk_x11_get_default_root_xwindow (), @@ -994,8 +995,7 @@ update_root_window_pixmap (ShellGlobal *global) if (type == XA_PIXMAP && format == 32 && nitems == 1) { /* Was what we expected. */ - clutter_x11_texture_pixmap_set_pixmap (CLUTTER_X11_TEXTURE_PIXMAP (global->root_pixmap), - *(Pixmap *)data); + root_pixmap_id = *(Pixmap *)data; } else { @@ -1004,6 +1004,9 @@ update_root_window_pixmap (ShellGlobal *global) XFree(data); } + + clutter_x11_texture_pixmap_set_pixmap (CLUTTER_X11_TEXTURE_PIXMAP (global->root_pixmap), + root_pixmap_id); } /* @@ -1023,6 +1026,22 @@ root_window_filter (GdkXEvent *native, GdkEvent *event, gpointer data) return GDK_FILTER_CONTINUE; } +/* Workaround for a clutter bug where if ClutterGLXTexturePixmap + * is painted without the pixmap being set, a crash will occur inside + * Cogl. + * + * http://bugzilla.openedhand.com/show_bug.cgi?id=1644 + */ +static void +root_pixmap_paint (ClutterActor *actor, gpointer data) +{ + Pixmap pixmap; + + g_object_get (G_OBJECT (actor), "pixmap", &pixmap, NULL); + if (!pixmap) + g_signal_stop_emission_by_name (actor, "paint"); +} + /* * Called when the root window pixmap actor is destroyed. */ @@ -1068,6 +1087,9 @@ shell_global_create_root_pixmap_actor (ShellGlobal *global) clutter_container_add_actor (CLUTTER_CONTAINER (stage), global->root_pixmap); + g_signal_connect (global->root_pixmap, "paint", + G_CALLBACK (root_pixmap_paint), NULL); + /* This really should never happen; but just in case... */ g_signal_connect (global->root_pixmap, "destroy", G_CALLBACK (root_pixmap_destroy), global);