[gtk+] wayland: Don't try to guess the popup menu placement when it was set



commit 9e464252c02e65425179d6c583c76d5685880ba4
Author: Jonas Ådahl <jadahl gmail com>
Date:   Fri Jun 5 13:35:21 2015 +0800

    wayland: Don't try to guess the popup menu placement when it was set
    
    If a position was already explicitly set, don't try to guess the
    position of popup menus by looking at the pointer position, just use
    the set coordinates.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=748951

 gdk/wayland/gdkwindow-wayland.c |   13 +++++++++----
 1 files changed, 9 insertions(+), 4 deletions(-)
---
diff --git a/gdk/wayland/gdkwindow-wayland.c b/gdk/wayland/gdkwindow-wayland.c
index 19d9224..590ff4d 100644
--- a/gdk/wayland/gdkwindow-wayland.c
+++ b/gdk/wayland/gdkwindow-wayland.c
@@ -108,6 +108,7 @@ struct _GdkWindowImplWayland
   unsigned int use_custom_surface : 1;
   unsigned int pending_commit : 1;
   unsigned int awaiting_frame : 1;
+  unsigned int position_set : 1;
   GdkWindowTypeHint hint;
   GdkWindow *transient_for;
 
@@ -1190,10 +1191,13 @@ gdk_wayland_window_map (GdkWindow *window)
           transient_for = gdk_device_get_window_at_position (impl->grab_device, NULL, NULL);
           transient_for = gdk_window_get_toplevel (transient_for);
 
-          /* start the popup at the position of the device that holds the grab */
-          gdk_window_get_device_position (transient_for,
-                                          impl->grab_device,
-                                          &window->x, &window->y, NULL);
+          /* If the position was not explicitly set, start the popup at the
+           * position of the device that holds the grab.
+           */
+          if (!impl->position_set)
+            gdk_window_get_device_position (transient_for,
+                                            impl->grab_device,
+                                            &window->x, &window->y, NULL);
         }
       else
         transient_for = impl->transient_for;
@@ -1412,6 +1416,7 @@ gdk_window_wayland_move_resize (GdkWindow *window,
         {
           window->x = x;
           window->y = y;
+          impl->position_set = 1;
 
           if (impl->subsurface)
             {


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