[gtk+/multitouch: 96/123] gdk, xi2: Set GDK_BUTTON1_MASK on touch events



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

    gdk,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 63f9bf8..2efc39c 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]