[PATCH] Xi: Call UpdateDeviceState() after the first emulated motion event

Carlos Garnacho carlosg at gnome.org
Mon Oct 29 10:33:50 PDT 2012


From: Carlos Garnacho <carlosg at gnome.org>

The emulated motion event that happens before TouchBegin/ButtonPress should
contain no buttons set in the mask, as it virtually happens at a time when
the button is not yet pressed. This is known to confuse GTK+ and Abiword
to different degrees, as enclosing button press/release events are expected
around changes in the button mask.

Signed-off-by: Carlos Garnacho <carlosg at gnome.org>
---
 Xi/exevents.c | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/Xi/exevents.c b/Xi/exevents.c
index 6ed4991..8a2f7ee 100644
--- a/Xi/exevents.c
+++ b/Xi/exevents.c
@@ -1568,15 +1568,16 @@ ProcessTouchEvent(InternalEvent *ev, DeviceIntPtr dev)
     else
         touchid = ev->device_event.touchid;
 
-    if (emulate_pointer)
-        UpdateDeviceState(dev, &ev->device_event);
-
     if (type == ET_TouchBegin) {
         ti = TouchBeginTouch(dev, ev->device_event.sourceid, touchid,
                              emulate_pointer);
     }
-    else
+    else {
+        if (emulate_pointer)
+            UpdateDeviceState(dev, &ev->device_event);
+
         ti = TouchFindByClientID(dev, touchid);
+    }
 
     /* Under the following circumstances we create a new touch record for an
      * existing touch:
@@ -1615,8 +1616,12 @@ ProcessTouchEvent(InternalEvent *ev, DeviceIntPtr dev)
     /* if emulate_pointer is set, emulate the motion event right
      * here, so we can ignore it for button event emulation. TouchUpdate
      * events which _only_ emulate motion just work normally */
-    if (emulate_pointer && ev->any.type != ET_TouchUpdate)
+    if (emulate_pointer && ev->any.type != ET_TouchUpdate) {
         DeliverEmulatedMotionEvent(dev, ti, ev);
+
+	if (ev->any.type == ET_TouchBegin)
+            UpdateDeviceState(dev, &ev->device_event);
+    }
     if (emulate_pointer && IsMaster(dev))
         CheckMotion(&ev->device_event, dev);
 
-- 
1.7.11.7



More information about the xorg-devel mailing list