[metacity] xrender: stop handling ConfigureNotify events



commit 8b0ed193cfa771ec1f3ba70b272b9b14e02e6d3c
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date:   Sat Mar 18 12:48:06 2017 +0200

    xrender: stop handling ConfigureNotify events
    
    https://git.gnome.org/browse/mutter/commit/?id=f9568535509e40a35e9a875b4d91686ab2969e42

 src/compositor/meta-compositor-none.c    |    7 +
 src/compositor/meta-compositor-private.h |    3 +
 src/compositor/meta-compositor-vulkan.c  |    7 +
 src/compositor/meta-compositor-xrender.c |  322 ++++++++++++++---------------
 src/compositor/meta-compositor.c         |   11 +
 src/core/window.c                        |    4 +
 src/include/meta-compositor.h            |    3 +
 7 files changed, 190 insertions(+), 167 deletions(-)
---
diff --git a/src/compositor/meta-compositor-none.c b/src/compositor/meta-compositor-none.c
index d195113..6fdcbed 100644
--- a/src/compositor/meta-compositor-none.c
+++ b/src/compositor/meta-compositor-none.c
@@ -116,6 +116,12 @@ meta_compositor_none_sync_stack (MetaCompositor *compositor,
 }
 
 static void
+meta_compositor_none_sync_window_geometry (MetaCompositor *compositor,
+                                           MetaWindow     *window)
+{
+}
+
+static void
 meta_compositor_none_redraw (MetaCompositor *compositor)
 {
 }
@@ -141,6 +147,7 @@ meta_compositor_none_class_init (MetaCompositorNoneClass *none_class)
   compositor_class->unmaximize_window = meta_compositor_none_unmaximize_window;
   compositor_class->sync_screen_size = meta_compositor_none_sync_screen_size;
   compositor_class->sync_stack = meta_compositor_none_sync_stack;
+  compositor_class->sync_window_geometry = meta_compositor_none_sync_window_geometry;
   compositor_class->redraw = meta_compositor_none_redraw;
 }
 
diff --git a/src/compositor/meta-compositor-private.h b/src/compositor/meta-compositor-private.h
index a615e99..1a394b3 100644
--- a/src/compositor/meta-compositor-private.h
+++ b/src/compositor/meta-compositor-private.h
@@ -72,6 +72,9 @@ struct _MetaCompositorClass
   void              (* sync_stack)             (MetaCompositor     *compositor,
                                                 GList              *stack);
 
+  void              (* sync_window_geometry)   (MetaCompositor     *compositor,
+                                                MetaWindow         *window);
+
   void              (* redraw)                 (MetaCompositor     *compositor);
 };
 
diff --git a/src/compositor/meta-compositor-vulkan.c b/src/compositor/meta-compositor-vulkan.c
index 43332b6..5327937 100644
--- a/src/compositor/meta-compositor-vulkan.c
+++ b/src/compositor/meta-compositor-vulkan.c
@@ -1302,6 +1302,12 @@ meta_compositor_vulkan_sync_stack (MetaCompositor *compositor,
 }
 
 static void
+meta_compositor_vulkan_sync_window_geometry (MetaCompositor *compositor,
+                                             MetaWindow     *window)
+{
+}
+
+static void
 meta_compositor_vulkan_redraw (MetaCompositor *compositor)
 {
 }
@@ -1331,6 +1337,7 @@ meta_compositor_vulkan_class_init (MetaCompositorVulkanClass *vulkan_class)
   compositor_class->unmaximize_window = meta_compositor_vulkan_unmaximize_window;
   compositor_class->sync_screen_size = meta_compositor_vulkan_sync_screen_size;
   compositor_class->sync_stack = meta_compositor_vulkan_sync_stack;
+  compositor_class->sync_window_geometry = meta_compositor_vulkan_sync_window_geometry;
   compositor_class->redraw = meta_compositor_vulkan_redraw;
 }
 
diff --git a/src/compositor/meta-compositor-xrender.c b/src/compositor/meta-compositor-xrender.c
index b7fb9e9..ab7c04b 100644
--- a/src/compositor/meta-compositor-xrender.c
+++ b/src/compositor/meta-compositor-xrender.c
@@ -2178,171 +2178,8 @@ notify_decorated_cb (MetaWindow            *window,
   add_repair (xrender);
 }
 
-static void
-resize_win (MetaCompositorXRender *xrender,
-            MetaCompWindow        *cw,
-            int                    x,
-            int                    y,
-            int                    width,
-            int                    height)
-{
-  MetaDisplay *display = meta_screen_get_display (xrender->screen);
-  Display *xdisplay = meta_display_get_xdisplay (display);
-  XserverRegion damage;
-
-  if (cw->extents)
-    {
-      damage = XFixesCreateRegion (xdisplay, NULL, 0);
-      XFixesCopyRegion (xdisplay, damage, cw->extents);
-    }
-  else
-    {
-      damage = None;
-      if (xrender->debug)
-        fprintf (stderr, "no extents to damage !\n");
-    }
-
-  if (cw->rect.width != width || cw->rect.height != height)
-    {
-      if (cw->shaded.back_pixmap)
-        {
-          XFreePixmap (xdisplay, cw->shaded.back_pixmap);
-          cw->shaded.back_pixmap = None;
-        }
-
-      if (cw->shaded.mask_pixmap)
-        {
-          XFreePixmap (xdisplay, cw->shaded.mask_pixmap);
-          cw->shaded.mask_pixmap = None;
-        }
-
-      if (cw->shaded.client_region)
-        {
-          XFixesDestroyRegion (xdisplay, cw->shaded.client_region);
-          cw->shaded.client_region = None;
-        }
-
-      if (cw->back_pixmap)
-        {
-          /* If the window is shaded, we store the old backing pixmap
-           * so we can return a proper image of the window
-           */
-          if (cw->window && meta_window_is_shaded (cw->window))
-            {
-              cw->shaded.back_pixmap = cw->back_pixmap;
-              cw->back_pixmap = None;
-            }
-          else
-            {
-              XFreePixmap (xdisplay, cw->back_pixmap);
-              cw->back_pixmap = None;
-            }
-        }
-
-      if (cw->mask_pixmap)
-        {
-          /* If the window is shaded, we store the old backing pixmap
-           * so we can return a proper image of the window
-           */
-          if (cw->window && meta_window_is_shaded (cw->window))
-            {
-              cw->shaded.mask_pixmap = cw->mask_pixmap;
-              cw->mask_pixmap = None;
-            }
-          else
-            {
-              XFreePixmap (xdisplay, cw->mask_pixmap);
-              cw->mask_pixmap = None;
-            }
-        }
-
-      if (cw->window && meta_window_is_shaded (cw->window))
-        {
-          cw->shaded.x = cw->rect.x;
-          cw->shaded.y = cw->rect.y;
-          cw->shaded.width = cw->rect.width;
-          cw->shaded.height = cw->rect.height;
-
-          if (cw->client_region != None)
-            {
-              cw->shaded.client_region = XFixesCreateRegion (xdisplay, NULL, 0);
-
-              XFixesCopyRegion (xdisplay, cw->shaded.client_region,
-                                cw->client_region);
-            }
-        }
-
-      if (cw->picture)
-        {
-          XRenderFreePicture (xdisplay, cw->picture);
-          cw->picture = None;
-        }
-
-      if (cw->mask)
-        {
-          XRenderFreePicture (xdisplay, cw->mask);
-          cw->mask = None;
-        }
-
-      if (cw->shadow)
-        {
-          XRenderFreePicture (xdisplay, cw->shadow);
-          cw->shadow = None;
-        }
-    }
-
-  cw->rect.x = x;
-  cw->rect.y = y;
-  cw->rect.width = width;
-  cw->rect.height = height;
-
-  if (cw->extents)
-    XFixesDestroyRegion (xdisplay, cw->extents);
-
-  cw->extents = win_extents (xrender, cw);
-
-  if (damage)
-    {
-      if (xrender->debug)
-        fprintf (stderr, "Inexplicable intersection with new extents!\n");
-
-      XFixesUnionRegion (xdisplay, damage, damage, cw->extents);
-    }
-  else
-    {
-      damage = XFixesCreateRegion (xdisplay, NULL, 0);
-      XFixesCopyRegion (xdisplay, damage, cw->extents);
-    }
-
-  dump_xserver_region (xrender, "resize_win", damage);
-  add_damage (xrender, damage);
-
-  xrender->clip_changed = TRUE;
-}
-
 /* event processors must all be called with an error trap in place */
 static void
-process_configure_notify (MetaCompositorXRender *xrender,
-                          XConfigureEvent       *event)
-{
-  MetaCompWindow *cw = find_comp_window_by_xwindow (xrender, event->window);
-
-  if (cw)
-    {
-      if (xrender->debug)
-        {
-          fprintf (stderr, "configure notify %d %d %d\n", cw->damaged,
-                   cw->shape_region != None, cw->needs_shadow);
-          dump_xserver_region (xrender, "\textents", cw->extents);
-          fprintf (stderr, "\txy (%d %d), wh (%d %d)\n",
-                   event->x, event->y, event->width, event->height);
-        }
-
-      resize_win (xrender, cw, event->x, event->y, event->width, event->height);
-    }
-}
-
-static void
 process_property_notify (MetaCompositorXRender *xrender,
                          XPropertyEvent        *event)
 {
@@ -2870,10 +2707,6 @@ meta_compositor_xrender_process_event (MetaCompositor *compositor,
 
   switch (event->type)
     {
-    case ConfigureNotify:
-      process_configure_notify (xrender, (XConfigureEvent *) event);
-      break;
-
     case PropertyNotify:
       process_property_notify (xrender, (XPropertyEvent *) event);
       break;
@@ -3090,6 +2923,160 @@ meta_compositor_xrender_sync_stack (MetaCompositor *compositor,
 }
 
 static void
+meta_compositor_xrender_sync_window_geometry (MetaCompositor *compositor,
+                                              MetaWindow     *window)
+{
+  MetaCompositorXRender *xrender;
+  MetaCompWindow *cw;
+  MetaRectangle rect;
+  XserverRegion damage;
+
+  xrender = META_COMPOSITOR_XRENDER (compositor);
+  cw = find_comp_window_by_window (xrender, window);
+
+  if (cw == NULL)
+    return;
+
+  meta_window_get_input_rect (window, &rect);
+
+  if (xrender->debug)
+    {
+      fprintf (stderr, "configure notify %d %d %d\n", cw->damaged,
+               cw->shape_region != None, cw->needs_shadow);
+      dump_xserver_region (xrender, "\textents", cw->extents);
+      fprintf (stderr, "\txy (%d %d), wh (%d %d)\n",
+               rect.x, rect.y, rect.width, rect.height);
+    }
+
+  if (cw->extents)
+    {
+      damage = XFixesCreateRegion (xrender->xdisplay, NULL, 0);
+      XFixesCopyRegion (xrender->xdisplay, damage, cw->extents);
+    }
+  else
+    {
+      damage = None;
+      if (xrender->debug)
+        fprintf (stderr, "no extents to damage !\n");
+    }
+
+  if (cw->rect.width != rect.width || cw->rect.height != rect.height)
+    {
+      if (cw->shaded.back_pixmap != None)
+        {
+          XFreePixmap (xrender->xdisplay, cw->shaded.back_pixmap);
+          cw->shaded.back_pixmap = None;
+        }
+
+      if (cw->shaded.mask_pixmap != None)
+        {
+          XFreePixmap (xrender->xdisplay, cw->shaded.mask_pixmap);
+          cw->shaded.mask_pixmap = None;
+        }
+
+      if (cw->shaded.client_region != None)
+        {
+          XFixesDestroyRegion (xrender->xdisplay, cw->shaded.client_region);
+          cw->shaded.client_region = None;
+        }
+
+      if (cw->back_pixmap != None)
+        {
+          /* If the window is shaded, we store the old backing pixmap
+           * so we can return a proper image of the window
+           */
+          if (cw->window && meta_window_is_shaded (cw->window))
+            {
+              cw->shaded.back_pixmap = cw->back_pixmap;
+              cw->back_pixmap = None;
+            }
+          else
+            {
+              XFreePixmap (xrender->xdisplay, cw->back_pixmap);
+              cw->back_pixmap = None;
+            }
+        }
+
+      if (cw->mask_pixmap != None)
+        {
+          /* If the window is shaded, we store the old backing pixmap
+           * so we can return a proper image of the window
+           */
+          if (cw->window && meta_window_is_shaded (cw->window))
+            {
+              cw->shaded.mask_pixmap = cw->mask_pixmap;
+              cw->mask_pixmap = None;
+            }
+          else
+            {
+              XFreePixmap (xrender->xdisplay, cw->mask_pixmap);
+              cw->mask_pixmap = None;
+            }
+        }
+
+      if (cw->window && meta_window_is_shaded (cw->window))
+        {
+          cw->shaded.x = cw->rect.x;
+          cw->shaded.y = cw->rect.y;
+          cw->shaded.width = cw->rect.width;
+          cw->shaded.height = cw->rect.height;
+
+          if (cw->client_region != None)
+            {
+              cw->shaded.client_region = XFixesCreateRegion (xrender->xdisplay,
+                                                             NULL, 0);
+
+              XFixesCopyRegion (xrender->xdisplay, cw->shaded.client_region,
+                                cw->client_region);
+            }
+        }
+
+      if (cw->picture != None)
+        {
+          XRenderFreePicture (xrender->xdisplay, cw->picture);
+          cw->picture = None;
+        }
+
+      if (cw->mask != None)
+        {
+          XRenderFreePicture (xrender->xdisplay, cw->mask);
+          cw->mask = None;
+        }
+
+      if (cw->shadow != None)
+        {
+          XRenderFreePicture (xrender->xdisplay, cw->shadow);
+          cw->shadow = None;
+        }
+    }
+
+  cw->rect = rect;
+
+  if (cw->extents)
+    XFixesDestroyRegion (xrender->xdisplay, cw->extents);
+
+  cw->extents = win_extents (xrender, cw);
+
+  if (damage)
+    {
+      if (xrender->debug)
+        fprintf (stderr, "Inexplicable intersection with new extents!\n");
+
+      XFixesUnionRegion (xrender->xdisplay, damage, damage, cw->extents);
+    }
+  else
+    {
+      damage = XFixesCreateRegion (xrender->xdisplay, NULL, 0);
+      XFixesCopyRegion (xrender->xdisplay, damage, cw->extents);
+    }
+
+  dump_xserver_region (xrender, "sync_window_geometry", damage);
+  add_damage (xrender, damage);
+
+  xrender->clip_changed = TRUE;
+}
+
+static void
 meta_compositor_xrender_redraw (MetaCompositor *compositor)
 {
   MetaCompositorXRender *xrender;
@@ -3137,6 +3124,7 @@ meta_compositor_xrender_class_init (MetaCompositorXRenderClass *xrender_class)
   compositor_class->unmaximize_window = meta_compositor_xrender_unmaximize_window;
   compositor_class->sync_screen_size = meta_compositor_xrender_sync_screen_size;
   compositor_class->sync_stack = meta_compositor_xrender_sync_stack;
+  compositor_class->sync_window_geometry = meta_compositor_xrender_sync_window_geometry;
   compositor_class->redraw = meta_compositor_xrender_redraw;
 }
 
diff --git a/src/compositor/meta-compositor.c b/src/compositor/meta-compositor.c
index 3b4ed22..dc7bfdc 100644
--- a/src/compositor/meta-compositor.c
+++ b/src/compositor/meta-compositor.c
@@ -462,6 +462,17 @@ meta_compositor_sync_stack (MetaCompositor *compositor,
   compositor_class->sync_stack (compositor, stack);
 }
 
+void
+meta_compositor_sync_window_geometry (MetaCompositor *compositor,
+                                      MetaWindow     *window)
+{
+  MetaCompositorClass *compositor_class;
+
+  compositor_class = META_COMPOSITOR_GET_CLASS (compositor);
+
+  compositor_class->sync_window_geometry (compositor, window);
+}
+
 gboolean
 meta_compositor_is_our_xwindow (MetaCompositor *compositor,
                                 Window          xwindow)
diff --git a/src/core/window.c b/src/core/window.c
index 76ec1ea..3f8d461 100644
--- a/src/core/window.c
+++ b/src/core/window.c
@@ -3982,6 +3982,8 @@ meta_window_move_resize_internal (MetaWindow          *window,
                   newx, newy, window->rect.width, window->rect.height,
                   window->user_rect.x, window->user_rect.y,
                   window->user_rect.width, window->user_rect.height);
+
+      meta_compositor_sync_window_geometry (window->display->compositor, window);
     }
   else
     {
@@ -4161,6 +4163,8 @@ meta_window_configure_notify (MetaWindow      *window,
     {
       g_warning ("Unhandled change of windows override redirect status");
     }
+
+  meta_compositor_sync_window_geometry (window->display->compositor, window);
 }
 
 void
diff --git a/src/include/meta-compositor.h b/src/include/meta-compositor.h
index 2d5cab6..9f2229d 100644
--- a/src/include/meta-compositor.h
+++ b/src/include/meta-compositor.h
@@ -92,6 +92,9 @@ void             meta_compositor_sync_screen_size       (MetaCompositor     *com
 void             meta_compositor_sync_stack             (MetaCompositor     *compositor,
                                                          GList              *stack);
 
+void             meta_compositor_sync_window_geometry   (MetaCompositor     *compositor,
+                                                         MetaWindow         *window);
+
 gboolean         meta_compositor_is_our_xwindow         (MetaCompositor     *compositor,
                                                          Window              xwindow);
 


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