From c7686b2977ca14d9b24f11d5b01130d86bfdeaaa Mon Sep 17 00:00:00 2001 From: Tomas Frydrych Date: Fri, 6 Feb 2009 11:16:33 +0000 Subject: [PATCH] Fixed handling of _NET_WM_WINDOW_OPACITY. --- src/compositor/mutter/compositor-mutter.c | 39 ++++++++++++++++------- 1 file changed, 27 insertions(+), 12 deletions(-) diff --git a/src/compositor/mutter/compositor-mutter.c b/src/compositor/mutter/compositor-mutter.c index 12eb85419..695e19586 100644 --- a/src/compositor/mutter/compositor-mutter.c +++ b/src/compositor/mutter/compositor-mutter.c @@ -309,11 +309,17 @@ mutter_window_constructed (GObject *object) { MutterWindow *self = MUTTER_WINDOW (object); MutterWindowPrivate *priv = self->priv; - MetaScreen *screen = priv->screen; - MetaDisplay *display = meta_screen_get_display (screen); - Window xwindow = priv->xwindow; - Display *xdisplay = meta_display_get_xdisplay (display); - XRenderPictFormat *format; + MetaScreen *screen = priv->screen; + MetaDisplay *display = meta_screen_get_display (screen); + Window xwindow = priv->xwindow; + Display *xdisplay = meta_display_get_xdisplay (display); + XRenderPictFormat *format; + gulong value; + Mutter *compositor; + Window xwin_child; + + compositor = (Mutter*) meta_display_get_compositor (display); + xwin_child = meta_window_get_xwindow (priv->window); mutter_window_query_window_type (self); @@ -335,11 +341,21 @@ mutter_window_constructed (GObject *object) if (format && format->type == PictTypeDirect && format->direct.alphaMask) priv->argb32 = TRUE; + if (meta_prop_get_cardinal (display, xwin_child, + compositor->atom_net_wm_window_opacity, + &value)) + { + guint8 opacity; + + opacity = (guint8)((gfloat)value * 255.0 / ((gfloat)0xffffffff)); + + printf ("setting opacity to %d\n", opacity); + priv->opacity = opacity; + clutter_actor_set_opacity (CLUTTER_ACTOR (self), opacity); + } + if (mutter_window_has_shadow (self)) { - Mutter *compositor = - (Mutter*)meta_display_get_compositor (display); - priv->shadow = tidy_texture_frame_new (CLUTTER_TEXTURE (compositor->shadow_src), MAX_TILE_SZ, @@ -360,9 +376,7 @@ mutter_window_constructed (GObject *object) clutter_container_add_actor (CLUTTER_CONTAINER (self), priv->actor); - update_shape ((Mutter *) - meta_display_get_compositor (display), - self); + update_shape (compositor, self); } static void @@ -1513,12 +1527,13 @@ process_property_notify (Mutter *compositor, if (meta_prop_get_cardinal (display, event->window, compositor->atom_net_wm_window_opacity, - &value) == FALSE) + &value)) { guint8 opacity; opacity = (guint8)((gfloat)value * 255.0 / ((gfloat)0xffffffff)); + printf ("setting opacity to %d\n", opacity); cw->priv->opacity = opacity; clutter_actor_set_opacity (CLUTTER_ACTOR (cw), opacity); }