[gtk/gtk-3-24: 1/2] window/wayland: Reset position when hiding popup




commit d74b01636b6d4dfbf4acd6a9907fdf2c0e37dbfb
Author: Jonas Ã…dahl <jadahl gmail com>
Date:   Thu Sep 2 09:58:52 2021 +0200

    window/wayland: Reset position when hiding popup
    
    When a popup is remapped, if the GdkWindow::x/y position is negative,
    some best-effort hueristics used to ignore internal X11-style hackery
    windows incorrectly scooped up remapped popup windows.
    
    Avoid these hueristics by resetting the x and y fields of GdkWindow to 0
    whe hiding a popup. It'll then appear as if it was newly initialized,
    and escape the mentioned hueristics.
    
    Closes: https://gitlab.gnome.org/GNOME/gtk/-/issues/4071

 gdk/wayland/gdkwindow-wayland.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)
---
diff --git a/gdk/wayland/gdkwindow-wayland.c b/gdk/wayland/gdkwindow-wayland.c
index 2d7c42bd7a..2064fbb38f 100644
--- a/gdk/wayland/gdkwindow-wayland.c
+++ b/gdk/wayland/gdkwindow-wayland.c
@@ -3330,6 +3330,12 @@ gdk_wayland_window_hide_surface (GdkWindow *window)
           impl->display_server.xdg_popup = NULL;
           display_wayland->current_popups =
             g_list_remove (display_wayland->current_popups, window);
+
+          if (impl->position_method == POSITION_METHOD_MOVE_TO_RECT)
+            {
+              window->x = 0;
+              window->y = 0;
+            }
         }
       if (impl->display_server.xdg_surface)
         {
@@ -3352,6 +3358,12 @@ gdk_wayland_window_hide_surface (GdkWindow *window)
           impl->display_server.zxdg_popup_v6 = NULL;
           display_wayland->current_popups =
             g_list_remove (display_wayland->current_popups, window);
+
+          if (impl->position_method == POSITION_METHOD_MOVE_TO_RECT)
+            {
+              window->x = 0;
+              window->y = 0;
+            }
         }
       if (impl->display_server.zxdg_surface_v6)
         {


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