[gtk/wip/carlosg/track-implicit-grabs] gdk: Keep track again of implicit grabs



commit 28079a438ed8993f171ea472c11b5c0837c9b25e
Author: Carlos Garnacho <carlosg gnome org>
Date:   Thu Apr 2 19:33:00 2020 +0200

    gdk: Keep track again of implicit grabs
    
    Tracking of those broke sometime along the gdk cleanups, so we
    started missing some GDK_GRAB_BROKEN events from being emitted
    (eg. after a button press/implicit grab triggers an active grab).
    
    Fixes broken gesture state after opening menus.
    
    Closes: https://gitlab.gnome.org/GNOME/gtk/-/issues/2446

 gdk/gdksurface.c | 20 +++++++++++++++++---
 1 file changed, 17 insertions(+), 3 deletions(-)
---
diff --git a/gdk/gdksurface.c b/gdk/gdksurface.c
index 7432a9b348..e9cf1d8a1b 100644
--- a/gdk/gdksurface.c
+++ b/gdk/gdksurface.c
@@ -2252,9 +2252,23 @@ _gdk_windowing_got_event (GdkDisplay *display,
   else if (type == GDK_LEAVE_NOTIFY)
     _gdk_display_set_surface_under_pointer (display, device, NULL);
 
-  if (type == GDK_BUTTON_RELEASE ||
-      type == GDK_TOUCH_CANCEL ||
-      type == GDK_TOUCH_END)
+  if (type == GDK_BUTTON_PRESS)
+    {
+      _gdk_display_add_device_grab  (display,
+                                     device,
+                                     event_surface,
+                                     GDK_OWNERSHIP_NONE,
+                                     FALSE,
+                                     GDK_ALL_EVENTS_MASK,
+                                     serial,
+                                     gdk_event_get_time (event),
+                                     TRUE);
+      _gdk_display_device_grab_update (display, device,
+                                       source_device, serial);
+    }
+  else if (type == GDK_BUTTON_RELEASE ||
+           type == GDK_TOUCH_CANCEL ||
+           type == GDK_TOUCH_END)
     {
       if (type == GDK_BUTTON_RELEASE ||
           gdk_event_get_pointer_emulated (event))


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