[gtk+/gtk-3-20] wayland: return child only in device_query_state()



commit ff99d89f8f4cef733e91f7e0e681e056e2e6f1e0
Author: Olivier Fourdan <ofourdan redhat com>
Date:   Wed Jun 29 15:08:06 2016 +0200

    wayland: return child only in device_query_state()
    
    On X11, device_query_state() uses XIQueryPointer() which will return a
    child window only if the pointer is within an actual child of the given
    window.
    
    Wayland backend would return the pointer->focus window independently of
    the given window, but that breaks the logic in get_device_state() and
    later in gdk_window_get_device_position_double() because the window is
    searched based on coordinates from another window without sibling
    relationship, breaking gtkmenu sub-menus further down the line.
    
    Fix the Wayland backend to mimic X11's XIQueryPointer() to return a
    child only if really a child of the given window.
    
    That's the most sensible thing to do to fix the issue, but the API here
    seems to be modeled after the X11 implementation and the description of
    gdk_window_get_device_position_double() is not entirely accurate.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=768016
    
    (cherry picked from commit 298221bfba9b784cddaf5d6ac121e9bb3f25c0db)

 gdk/wayland/gdkdevice-wayland.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
---
diff --git a/gdk/wayland/gdkdevice-wayland.c b/gdk/wayland/gdkdevice-wayland.c
index 11b2f69..8999cb4 100644
--- a/gdk/wayland/gdkdevice-wayland.c
+++ b/gdk/wayland/gdkdevice-wayland.c
@@ -405,7 +405,8 @@ gdk_wayland_device_query_state (GdkDevice        *device,
   if (root_window)
     *root_window = gdk_screen_get_root_window (default_screen);
   if (child_window)
-    *child_window = seat->pointer_focus;
+    /* Set child only if actually a child of the given window, as XIQueryPointer() does */
+    *child_window = g_list_find (window->children, seat->pointer_focus) ? seat->pointer_focus : NULL;
   if (mask)
     *mask = seat->button_modifiers | seat->key_modifiers;
 


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