[gtk+] wayland: Do not resize with the same size



commit be6784c7ea59bd18bf2ce954e83870494686967a
Author: Olivier Fourdan <ofourdan redhat com>
Date:   Mon Apr 4 14:55:38 2016 +0200

    wayland: Do not resize with the same size
    
    gnome-control-center is calling gtk_window_resize() on configure-event
    signals which leads to a busy loop.
    
    Avoids such a busy loop by not re-configuring a window with the same
    size, unless this is coming from and xdg-shell configure.
    
    bugzilla: https://bugzilla.gnome.org/show_bug.cgi?id=764374

 gdk/wayland/gdkwindow-wayland.c |   30 +++++++++++++++++++++++-------
 1 files changed, 23 insertions(+), 7 deletions(-)
---
diff --git a/gdk/wayland/gdkwindow-wayland.c b/gdk/wayland/gdkwindow-wayland.c
index 46255ef..8f94472 100644
--- a/gdk/wayland/gdkwindow-wayland.c
+++ b/gdk/wayland/gdkwindow-wayland.c
@@ -168,10 +168,10 @@ struct _GdkWindowImplWaylandClass
   GdkWindowImplClass parent_class;
 };
 
-static void gdk_wayland_window_configure (GdkWindow *window,
-                                          int        width,
-                                          int        height,
-                                          int        scale);
+static void gdk_wayland_window_maybe_configure (GdkWindow *window,
+                                                int        width,
+                                                int        height,
+                                                int        scale);
 
 static void maybe_set_gtk_surface_dbus_properties (GdkWindow *window);
 static void maybe_set_gtk_surface_modal (GdkWindow *window);
@@ -571,7 +571,7 @@ window_update_scale (GdkWindow *window)
     }
 
   /* Notify app that scale changed */
-  gdk_wayland_window_configure (window, window->width, window->height, scale);
+  gdk_wayland_window_maybe_configure (window, window->width, window->height, scale);
 }
 
 static void
@@ -927,6 +927,22 @@ gdk_wayland_window_configure (GdkWindow *window,
 }
 
 static void
+gdk_wayland_window_maybe_configure (GdkWindow *window,
+                                    int        width,
+                                    int        height,
+                                    int        scale)
+{
+  GdkWindowImplWayland *impl = GDK_WINDOW_IMPL_WAYLAND (window->impl);
+
+  if (window->width == width &&
+      window->height == height &&
+      impl->scale == scale)
+    return;
+
+  gdk_wayland_window_configure (window, width, height, scale);
+}
+
+static void
 gdk_wayland_window_sync_parent (GdkWindow *window,
                                 GdkWindow *parent)
 {
@@ -1936,7 +1952,7 @@ gdk_window_wayland_move_resize (GdkWindow *window,
    * just move the window - don't update its size
    */
   if (width > 0 && height > 0)
-    gdk_wayland_window_configure (window, width, height, impl->scale);
+    gdk_wayland_window_maybe_configure (window, width, height, impl->scale);
 }
 
 static void
@@ -2744,7 +2760,7 @@ gdk_wayland_window_set_shadow_width (GdkWindow *window,
     (impl->margin_left + impl->margin_right) + (left + right);
   new_height = window->height -
     (impl->margin_top + impl->margin_bottom) + (top + bottom);
-  gdk_wayland_window_configure (window, new_width, new_height, impl->scale);
+  gdk_wayland_window_maybe_configure (window, new_width, new_height, impl->scale);
 
   impl->margin_left = left;
   impl->margin_right = right;


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