gtk3/gtk3-Wayland-do-not-resize.patch

90 lines
3.3 KiB
Diff

From 82b735170006cf4beacf38ab9c5ce1db0920352f Mon Sep 17 00:00:00 2001
From: Olivier Fourdan <ofourdan@redhat.com>
Date: Mon, 4 Apr 2016 14:55:38 +0200
Subject: [PATCH] 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 file 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;
--
2.5.5