Fixed handling of _NET_WM_WINDOW_OPACITY.

This commit is contained in:
Tomas Frydrych 2009-02-06 11:16:33 +00:00
parent 6ac54641c6
commit c7686b2977

View File

@ -314,6 +314,12 @@ mutter_window_constructed (GObject *object)
Window xwindow = priv->xwindow; Window xwindow = priv->xwindow;
Display *xdisplay = meta_display_get_xdisplay (display); Display *xdisplay = meta_display_get_xdisplay (display);
XRenderPictFormat *format; 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); mutter_window_query_window_type (self);
@ -335,11 +341,21 @@ mutter_window_constructed (GObject *object)
if (format && format->type == PictTypeDirect && format->direct.alphaMask) if (format && format->type == PictTypeDirect && format->direct.alphaMask)
priv->argb32 = TRUE; 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)) if (mutter_window_has_shadow (self))
{ {
Mutter *compositor =
(Mutter*)meta_display_get_compositor (display);
priv->shadow = priv->shadow =
tidy_texture_frame_new (CLUTTER_TEXTURE (compositor->shadow_src), tidy_texture_frame_new (CLUTTER_TEXTURE (compositor->shadow_src),
MAX_TILE_SZ, MAX_TILE_SZ,
@ -360,9 +376,7 @@ mutter_window_constructed (GObject *object)
clutter_container_add_actor (CLUTTER_CONTAINER (self), priv->actor); clutter_container_add_actor (CLUTTER_CONTAINER (self), priv->actor);
update_shape ((Mutter *) update_shape (compositor, self);
meta_display_get_compositor (display),
self);
} }
static void static void
@ -1513,12 +1527,13 @@ process_property_notify (Mutter *compositor,
if (meta_prop_get_cardinal (display, event->window, if (meta_prop_get_cardinal (display, event->window,
compositor->atom_net_wm_window_opacity, compositor->atom_net_wm_window_opacity,
&value) == FALSE) &value))
{ {
guint8 opacity; guint8 opacity;
opacity = (guint8)((gfloat)value * 255.0 / ((gfloat)0xffffffff)); opacity = (guint8)((gfloat)value * 255.0 / ((gfloat)0xffffffff));
printf ("setting opacity to %d\n", opacity);
cw->priv->opacity = opacity; cw->priv->opacity = opacity;
clutter_actor_set_opacity (CLUTTER_ACTOR (cw), opacity); clutter_actor_set_opacity (CLUTTER_ACTOR (cw), opacity);
} }