[gtk+/touch-for-3.4: 37/65] xi2: Set GDK_BUTTON1_MASK on touch events



commit 910ca064e4b749e6224dc5e23cb904a0fc0c3e54
Author: Carlos Garnacho <carlosg gnome org>
Date:   Sat Dec 24 14:38:32 2011 +0100

    xi2: Set GDK_BUTTON1_MASK on touch events
    
    GTK+ handles both touch and pointer events through the same
    event handlers, so enable this modifier on touch events to
    avoid much special casing.

 gdk/x11/gdkdevicemanager-xi2.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
---
diff --git a/gdk/x11/gdkdevicemanager-xi2.c b/gdk/x11/gdkdevicemanager-xi2.c
index ec54f9b..846a025 100644
--- a/gdk/x11/gdkdevicemanager-xi2.c
+++ b/gdk/x11/gdkdevicemanager-xi2.c
@@ -1190,6 +1190,9 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator,
 
             event->button.state = _gdk_x11_device_xi2_translate_state (&xev->mods, &xev->buttons, &xev->group);
 
+            if (ev->evtype == XI_TouchBegin)
+              event->button.state |= GDK_BUTTON1_MASK;
+
 #ifdef XINPUT_2_2
             if (ev->evtype == XI_TouchBegin ||
                 ev->evtype == XI_TouchEnd)
@@ -1254,6 +1257,9 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator,
 
         event->motion.state = _gdk_x11_device_xi2_translate_state (&xev->mods, &xev->buttons, &xev->group);
 
+	if (ev->evtype == XI_TouchUpdate)
+          event->motion.state |= GDK_BUTTON1_MASK;
+
         /* There doesn't seem to be motion hints in XI */
         event->motion.is_hint = FALSE;
 



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