From dee842aca131787aa79695781ead9148953c4716 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alberts=20Muktup=C4=81vels?= Date: Mon, 9 Jun 2014 10:58:33 +0300 Subject: [PATCH] tabpopup.c: don't show shadow for outline window --- src/compositor/compositor-xrender.c | 60 ++++++++++++++++++++++++++++++++++++- src/ui/tabpopup.c | 21 +++++++++++++ 2 files changed, 80 insertions(+), 1 deletion(-) diff --git a/src/compositor/compositor-xrender.c b/src/compositor/compositor-xrender.c index d8f533b..8d8a91a 100644 --- a/src/compositor/compositor-xrender.c +++ b/src/compositor/compositor-xrender.c @@ -123,6 +123,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 @@ -199,6 +201,7 @@ typedef struct _MetaCompWindow Picture picture; Picture alpha_pict; + gboolean have_shadow; gboolean needs_shadow; MetaShadowType shadow_type; Picture shadow_pict; @@ -892,6 +895,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 */ @@ -1862,6 +1868,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); @@ -2227,6 +2235,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) { @@ -3021,7 +3074,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; @@ -3043,6 +3097,7 @@ meta_compositor_xrender_new (MetaDisplay *display) xrc->atom_x_set_root = atoms[1]; xrc->atom_net_wm_window_opacity = atoms[2]; xrc->atom_net_wm_window_type_dnd = atoms[3]; + xrc->atom_net_wm_window_type = atoms[4]; xrc->atom_net_wm_window_type_desktop = atoms[5]; xrc->atom_net_wm_window_type_dock = atoms[6]; @@ -3054,6 +3109,9 @@ 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; diff --git a/src/ui/tabpopup.c b/src/ui/tabpopup.c index f9fcafd..9288075 100644 --- a/src/ui/tabpopup.c +++ b/src/ui/tabpopup.c @@ -33,6 +33,7 @@ #include "draw-workspace.h" #include #include +#include #define OUTSIDE_SELECT_RECT 2 #define INSIDE_SELECT_RECT 2 @@ -207,6 +208,23 @@ tab_entry_new (const MetaTabEntry *entry, return te; } +static void +outline_window_set_have_shadow (GdkWindow *window, + gboolean have_shadow) +{ + Display *xdisplay; + Window xwindow; + + xdisplay = GDK_WINDOW_XDISPLAY (window); + xwindow = GDK_WINDOW_XID (window); + + gdk_error_trap_push (); + XChangeProperty (xdisplay, xwindow, XInternAtom (xdisplay, "_METACITY_WINDOW_HAVE_SHADOW", False), + XA_CARDINAL, 32, PropModeReplace, + (guchar *) &have_shadow, 1); + gdk_error_trap_pop_ignored (); +} + MetaTabPopup* meta_ui_tab_popup_new (const MetaTabEntry *entries, int screen_number, @@ -247,6 +265,9 @@ meta_ui_tab_popup_new (const MetaTabEntry *entries, gdk_window_set_background_rgba (gtk_widget_get_window (popup->outline_window), &black); + outline_window_set_have_shadow (gtk_widget_get_window (popup->outline_window), + FALSE); + g_signal_connect (G_OBJECT (popup->outline_window), "draw", G_CALLBACK (outline_window_draw), popup); -- 2.0.0