[gtk+/touch-for-3.4] gdk: Get the right event window for pointer emulated events



commit 8d419898b75ee8037ee560fff651f44b22b366be
Author: Carlos Garnacho <carlosg gnome org>
Date:   Mon Feb 27 13:09:59 2012 +0100

    gdk: Get the right event window for pointer emulated events
    
    get_event_window() just checked on GDK_TOUCH_MASK, including for emulated
    pointer events, so at the very least those should also match evmasks with
    no touch events whatsoever

 gdk/gdkwindow.c |   33 +++++++++++++++++++++++++++------
 1 files changed, 27 insertions(+), 6 deletions(-)
---
diff --git a/gdk/gdkwindow.c b/gdk/gdkwindow.c
index 3c8ddcf..58c4294 100644
--- a/gdk/gdkwindow.c
+++ b/gdk/gdkwindow.c
@@ -9138,9 +9138,10 @@ get_event_window (GdkDisplay                 *display,
                   GdkEventType                type,
                   GdkModifierType             mask,
                   guint                      *evmask_out,
+                  gboolean                    pointer_emulated,
                   gulong                      serial)
 {
-  guint evmask;
+  guint evmask, emulated_mask = 0;
   GdkWindow *grab_window;
   GdkDeviceGrabInfo *grab;
   GdkTouchGrabInfo *touch_grab;
@@ -9148,13 +9149,30 @@ get_event_window (GdkDisplay                 *display,
   touch_grab = _gdk_display_has_touch_grab (display, device, touch_sequence, serial);
   grab = _gdk_display_get_last_device_grab (display, device);
 
+  if (is_touch_type (type) && pointer_emulated)
+    {
+      switch (type)
+        {
+        case GDK_TOUCH_BEGIN:
+          emulated_mask |= GDK_BUTTON_PRESS_MASK;
+          break;
+        case GDK_TOUCH_UPDATE:
+          emulated_mask |= GDK_BUTTON_MOTION_MASK;
+          break;
+        case GDK_TOUCH_END:
+          emulated_mask |= GDK_BUTTON_RELEASE_MASK;
+        default:
+          break;
+        }
+    }
+
   if (touch_grab != NULL &&
       (!grab || grab->implicit || touch_grab->serial >= grab->serial_start))
     {
       evmask = touch_grab->event_mask;
       evmask = update_evmask_for_button_motion (evmask, mask);
 
-      if (evmask & type_masks[type])
+      if (evmask & (type_masks[type] | emulated_mask))
         {
           if (evmask_out)
             *evmask_out = evmask;
@@ -9171,7 +9189,7 @@ get_event_window (GdkDisplay                 *display,
 
       grab_window = grab->window;
 
-      if (evmask & type_masks[type])
+      if (evmask & (type_masks[type] | emulated_mask))
 	{
 	  if (evmask_out)
 	    *evmask_out = evmask;
@@ -9186,7 +9204,7 @@ get_event_window (GdkDisplay                 *display,
       evmask = pointer_window->event_mask;
       evmask = update_evmask_for_button_motion (evmask, mask);
 
-      if (evmask & type_masks[type])
+      if (evmask & (type_masks[type] | emulated_mask))
 	{
 	  if (evmask_out)
 	    *evmask_out = evmask;
@@ -9202,7 +9220,7 @@ get_event_window (GdkDisplay                 *display,
       evmask = grab->event_mask;
       evmask = update_evmask_for_button_motion (evmask, mask);
 
-      if (evmask & type_masks[type])
+      if (evmask & (type_masks[type] | emulated_mask))
 	{
 	  if (evmask_out)
 	    *evmask_out = evmask;
@@ -9383,6 +9401,7 @@ proxy_pointer_event (GdkDisplay                 *display,
                                     source_event->type,
                                     state,
                                     &evmask,
+                                    _gdk_event_get_pointer_emulated (source_event),
                                     serial);
 
       if (event_type == GDK_TOUCH_UPDATE)
@@ -9619,7 +9638,9 @@ proxy_button_event (GdkEvent *source_event,
                                 touch_sequence,
                                 pointer_window,
                                 type, state,
-                                &evmask, serial);
+                                &evmask,
+                                _gdk_event_get_pointer_emulated (source_event),
+                                serial);
 
   if (type == GDK_TOUCH_BEGIN || type == GDK_TOUCH_END)
     {



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