[metacity] compositor-xrender: add new atom - METACITY_WINDOW_HAVE_SHADOW



commit c52cd2e1d6ae50627bc9056ea6eae773e2aedfe5
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date:   Mon Jun 9 12:59:40 2014 +0300

    compositor-xrender: add new atom - METACITY_WINDOW_HAVE_SHADOW

 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 d8f533b..118a0d9 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;
@@ -3054,6 +3108,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;
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]