[gtk/gtk-3-24: 1/2] Check if size changed before hiding a surface




commit 23c7e6e13bbe2c6b736e817f501dc0dd5b242787
Author: Ronan Pigott <rpigott berkeley edu>
Date:   Mon Sep 13 17:14:14 2021 -0700

    Check if size changed before hiding a surface
    
    Commit 68188fc948 introduces a workaround for clients that try to
    change the size of a popup after it is created, but inadvertently
    introduces an infinite loop of surface creation when the popup enters
    two or more wl_outputs with different scales on creation.
    
    This commit checks if the size actually changed before applying the
    workaround and avoids the loop.

 gdk/wayland/gdkwindow-wayland.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
---
diff --git a/gdk/wayland/gdkwindow-wayland.c b/gdk/wayland/gdkwindow-wayland.c
index 1e82dcae3e..5d300a94ce 100644
--- a/gdk/wayland/gdkwindow-wayland.c
+++ b/gdk/wayland/gdkwindow-wayland.c
@@ -1199,6 +1199,7 @@ gdk_wayland_window_maybe_configure (GdkWindow *window,
   GdkWindowImplWayland *impl = GDK_WINDOW_IMPL_WAYLAND (window->impl);
   gboolean is_xdg_popup;
   gboolean is_visible;
+  gboolean size_changed;
 
   impl->unconfigured_width = calculate_width_without_margin (window, width);
   impl->unconfigured_height = calculate_height_without_margin (window, height);
@@ -1206,9 +1207,8 @@ gdk_wayland_window_maybe_configure (GdkWindow *window,
   if (should_inhibit_resize (window))
     return;
 
-  if (window->width == width &&
-      window->height == height &&
-      impl->scale == scale)
+  size_changed = (window->width != width || window->height != height);
+  if (!size_changed && impl->scale == scale)
     return;
 
   /* For xdg_popup using an xdg_positioner, there is a race condition if
@@ -1222,6 +1222,7 @@ gdk_wayland_window_maybe_configure (GdkWindow *window,
 
   if (is_xdg_popup &&
       is_visible &&
+      size_changed &&
       !impl->initial_configure_received &&
       !impl->configuring_popup)
     gdk_window_hide (window);
@@ -1230,6 +1231,7 @@ gdk_wayland_window_maybe_configure (GdkWindow *window,
 
   if (is_xdg_popup &&
       is_visible &&
+      size_changed &&
       !impl->initial_configure_received &&
       !impl->configuring_popup)
     gdk_window_show (window);


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