[PATCH] Xi: Honor pointer-emulating touch when setting the button mask in XIQueryDevice

Carlos Garnacho carlosg at gnome.org
Fri Jan 3 08:41:45 PST 2014


If a touch is currently active and emulating pointer events, XIQueryDevice must
set the button 1 in the mask so pointer emulation is complete, as clients using
XI2 would get inconsistent button states wrt events if querying the device. This
is already handled correctly on the core protocol requests.

Signed-off-by: Carlos Garnacho <carlosg at gnome.org>
---
 Xi/xiquerydevice.c | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/Xi/xiquerydevice.c b/Xi/xiquerydevice.c
index 4e544f0..762968a 100644
--- a/Xi/xiquerydevice.c
+++ b/Xi/xiquerydevice.c
@@ -261,11 +261,23 @@ ListButtonInfo(DeviceIntPtr dev, xXIButtonInfo * info, Bool reportState)
     bits = (unsigned char *) &info[1];
     memset(bits, 0, mask_len * 4);
 
-    if (reportState)
+    if (reportState) {
         for (i = 0; i < dev->button->numButtons; i++)
             if (BitIsOn(dev->button->down, i))
                 SetBit(bits, i);
 
+        /* Cater for touch pointer-emulation */
+        if (dev->touch) {
+            for (i = 0; i < dev->touch->num_touches; i++) {
+                TouchPointInfoPtr ti = dev->touch->touches + i;
+                if (ti->active && ti->emulate_pointer) {
+                    SetBit(bits, 1);
+                    break;
+                }
+            }
+        }
+    }
+
     bits += mask_len * 4;
     memcpy(bits, dev->button->labels, dev->button->numButtons * sizeof(Atom));
 
-- 
1.8.5.2



More information about the xorg-devel mailing list