[mutter] window: Don't queue move/resizes if the extents are the same



commit d87093fe29a61923037e5682739918a1fbfdc485
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Wed Sep 17 10:41:14 2014 -0600

    window: Don't queue move/resizes if the extents are the same
    
    GTK+ sets the frame extents on every allocation, so don't bother doing
    any extra work if things are the same.

 src/x11/window-props.c |   19 ++++++++++++++++---
 1 files changed, 16 insertions(+), 3 deletions(-)
---
diff --git a/src/x11/window-props.c b/src/x11/window-props.c
index 1b4fa6e..e857788 100644
--- a/src/x11/window-props.c
+++ b/src/x11/window-props.c
@@ -338,17 +338,33 @@ reload_icon_geometry (MetaWindow    *window,
     }
 }
 
+static gboolean
+gtk_border_equal (GtkBorder *a,
+                  GtkBorder *b)
+{
+  return (a->left == b->left &&
+          a->right == b->right &&
+          a->top == b->top &&
+          a->bottom == b->bottom);
+}
+
 static void
 meta_window_set_custom_frame_extents (MetaWindow *window,
                                       GtkBorder  *extents)
 {
   if (extents)
     {
+      if (window->has_custom_frame_extents && gtk_border_equal (&window->custom_frame_extents, extents))
+        return;
+
       window->has_custom_frame_extents = TRUE;
       window->custom_frame_extents = *extents;
     }
   else
     {
+      if (!window->has_custom_frame_extents)
+        return;
+
       window->has_custom_frame_extents = FALSE;
       memset (&window->custom_frame_extents, 0, sizeof (window->custom_frame_extents));
     }
@@ -382,9 +398,6 @@ reload_gtk_frame_extents (MetaWindow    *window,
     {
       meta_window_set_custom_frame_extents (window, NULL);
     }
-
-  if (!initial)
-    meta_window_queue(window, META_QUEUE_MOVE_RESIZE);
 }
 
 static void


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