[gtk+] gdk: Don't fully destroy the implicit touch grab on ::grab-broken



commit b897ba0cd8f874877c35a204abf89dbe755f1d09
Author: Carlos Garnacho <carlosg gnome org>
Date:   Tue Feb 21 03:12:10 2012 +0100

    gdk: Don't fully destroy the implicit touch grab on ::grab-broken
    
    the backing GdkTouchGrabInfo will be needed if the overriding device
    grab finishes before the touch does in order to send events back to
    the implicit grab window. Instead, wait until the touch is physically
    finished before removing the matching GdkTouchGrabInfo

 gdk/gdkdisplay.c |   16 +++++-----------
 gdk/gdkwindow.c  |    7 ++++---
 2 files changed, 9 insertions(+), 14 deletions(-)
---
diff --git a/gdk/gdkdisplay.c b/gdk/gdkdisplay.c
index b62b810..63bb316 100644
--- a/gdk/gdkdisplay.c
+++ b/gdk/gdkdisplay.c
@@ -700,24 +700,18 @@ _gdk_display_break_touch_grabs (GdkDisplay *display,
                                 GdkDevice  *device,
                                 GdkWindow  *new_grab_window)
 {
-  guint i = 0;
+  guint i;
 
-  while (i < display->touch_implicit_grabs->len)
+  for (i = 0; i < display->touch_implicit_grabs->len; i++)
     {
       GdkTouchGrabInfo *info;
 
       info = &g_array_index (display->touch_implicit_grabs,
                              GdkTouchGrabInfo, i);
 
-      if (info->device == device &&
-          info->window != new_grab_window)
-        {
-          generate_grab_broken_event (GDK_WINDOW (info->window),
-                                      device, TRUE, new_grab_window);
-          g_array_remove_index_fast (display->touch_implicit_grabs, i);
-        }
-      else
-        i++;
+      if (info->device == device && info->window != new_grab_window)
+        generate_grab_broken_event (GDK_WINDOW (info->window),
+                                    device, TRUE, new_grab_window);
     }
 }
 
diff --git a/gdk/gdkwindow.c b/gdk/gdkwindow.c
index 27eb343..e05a6ec 100644
--- a/gdk/gdkwindow.c
+++ b/gdk/gdkwindow.c
@@ -9252,9 +9252,9 @@ proxy_pointer_event (GdkDisplay                 *display,
 
   if (pointer_info->need_touch_press_enter &&
       gdk_device_get_source (pointer_info->last_slave) != GDK_SOURCE_TOUCHSCREEN &&
-      gdk_device_get_source (pointer_info->last_slave) != GDK_SOURCE_TOUCHPAD) &&
+      gdk_device_get_source (pointer_info->last_slave) != GDK_SOURCE_TOUCHPAD &&
       (source_event->type != GDK_TOUCH_UPDATE ||
-       _gdk_event_get_pointer_emulated (source_event))
+       _gdk_event_get_pointer_emulated (source_event)))
     {
       pointer_info->need_touch_press_enter = FALSE;
       need_synthetic_enter = TRUE;
@@ -9687,7 +9687,8 @@ proxy_button_event (GdkEvent *source_event,
       if ((type == GDK_TOUCH_END &&
            _gdk_event_get_pointer_emulated (source_event)) &&
            pointer_window == pointer_info->window_under_pointer &&
-           gdk_device_get_source (source_device) == GDK_SOURCE_TOUCHSCREEN)
+           (gdk_device_get_source (source_device) == GDK_SOURCE_TOUCHSCREEN ||
+            gdk_device_get_source (source_device) == GDK_SOURCE_TOUCHPAD))
         {
           /* Synthesize a leave notify event
            * whenever a touch device is released



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