diff options
author | infirit <[email protected]> | 2014-10-24 23:14:55 +0200 |
---|---|---|
committer | infirit <[email protected]> | 2014-10-25 13:21:57 +0200 |
commit | bc8eb8bd2f943b69c87eb7c9e154928f1dd861bb (patch) | |
tree | b54aef6f59e0ff03341882095b8481667f502f30 /src/compositor/compositor-xrender.c | |
parent | a3ebadff7d433a4d5c481b194587891b2aecdb9f (diff) | |
download | marco-bc8eb8bd2f943b69c87eb7c9e154928f1dd861bb.tar.bz2 marco-bc8eb8bd2f943b69c87eb7c9e154928f1dd861bb.tar.xz |
compositor-xrender: add new atom - METACITY_WINDOW_HAVE_SHADOW
Based on metacity commit: c52cd2e1d6ae50627bc9056ea6eae773e2aedfe5
From: Alberts Muktupāvels <[email protected]>
Diffstat (limited to 'src/compositor/compositor-xrender.c')
-rw-r--r-- | src/compositor/compositor-xrender.c | 57 |
1 files changed, 56 insertions, 1 deletions
diff --git a/src/compositor/compositor-xrender.c b/src/compositor/compositor-xrender.c index 68898257..8397df92 100644 --- a/src/compositor/compositor-xrender.c +++ b/src/compositor/compositor-xrender.c @@ -131,6 +131,8 @@ typedef struct _MetaCompositorXRender Atom atom_net_wm_window_type_dropdown_menu; Atom atom_net_wm_window_type_tooltip; + Atom atom_metacity_window_have_shadow; + #ifdef USE_IDLE_REPAINT guint repaint_id; #endif @@ -207,6 +209,7 @@ typedef struct _MetaCompWindow Picture picture; Picture alpha_pict; + gboolean have_shadow; gboolean needs_shadow; MetaShadowType shadow_type; Picture shadow_pict; @@ -900,6 +903,9 @@ window_has_shadow (MetaCompWindow *cw) if (info == NULL || info->have_shadows == FALSE) return FALSE; + if (cw->have_shadow == FALSE) + return FALSE; + /* Always put a shadow around windows with a frame - This should override the restriction about not putting a shadow around shaped windows as the frame might be the reason the window is shaped */ @@ -1890,6 +1896,8 @@ add_win (MetaScreen *screen, cw->border_clip = None; + cw->have_shadow = TRUE; + determine_mode (display, screen, cw); cw->needs_shadow = window_has_shadow (cw); @@ -2255,6 +2263,51 @@ process_property_notify (MetaCompositorXRender *compositor, } } + /* Check for have_shadow changing */ + if (event->atom == compositor->atom_metacity_window_have_shadow) + { + MetaCompWindow *cw = find_window_in_display (display, event->window); + gulong value; + + if (!cw) + { + /* Applications can set this for their toplevel windows, so + * this must be propagated to the window managed by the compositor + */ + cw = find_window_for_child_window_in_display (display, event->window); + } + + if (!cw) + return; + + if (meta_prop_get_cardinal (display, event->window, + compositor->atom_metacity_window_have_shadow, + &value) == FALSE) + value = 1; + + cw->have_shadow = (gboolean) value; + + determine_mode (display, cw->screen, cw); + cw->needs_shadow = window_has_shadow (cw); + + if (cw->shadow) + { + XRenderFreePicture (xdisplay, cw->shadow); + cw->shadow = None; + } + + if (cw->extents) + XFixesDestroyRegion (xdisplay, cw->extents); + cw->extents = win_extents (cw); + + cw->damaged = TRUE; +#ifdef USE_IDLE_REPAINT + add_repair (display); +#endif + + return; + } + /* Check for the opacity changing */ if (event->atom == compositor->atom_net_wm_window_opacity) { @@ -3083,7 +3136,8 @@ meta_compositor_xrender_new (MetaDisplay *display) "_NET_WM_WINDOW_TYPE_SPLASH", "_NET_WM_WINDOW_TYPE_TOOLBAR", "_NET_WM_WINDOW_TYPE_DROPDOWN_MENU", - "_NET_WM_WINDOW_TYPE_TOOLTIP" + "_NET_WM_WINDOW_TYPE_TOOLTIP", + "METACITY_WINDOW_HAVE_SHADOW", }; Atom atoms[G_N_ELEMENTS(atom_names)]; MetaCompositorXRender *xrc; @@ -3116,6 +3170,7 @@ meta_compositor_xrender_new (MetaDisplay *display) xrc->atom_net_wm_window_type_toolbar = atoms[12]; xrc->atom_net_wm_window_type_dropdown_menu = atoms[13]; xrc->atom_net_wm_window_type_tooltip = atoms[14]; + xrc->atom_metacity_window_have_shadow = atoms[15]; xrc->show_redraw = FALSE; xrc->debug = FALSE; |