[PATCH inputproto XI 2.2] Set a flag on the pointer-emulating touch event

Peter Hutterer peter.hutterer at who-t.net
Mon Jan 2 15:29:58 PST 2012


Toolkits need to know which touch event emulated a pointer event and which
ones do not. To quote Carlos Garnacho:

    GTK+ does client-side windows by default (GdkWindows without a backing X
    window), for this to work the toplevel window in the client needs to
    select for more events that it wouldn't normally select for in order to
    cater for the event masks in such child "windows". This means that
    ideally GTK+ should set the touch events mask in the toplevel, and then
    find out whether the "window" would receive pointer or touch events for
    the sequence emulating the pointer, and perform the emulation itself.

Reported-by: Carlos Garnacho <carlosg at gnome.org>
Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
IIRC we did discuss this months ago and decided not to set the flag but the
above use-case cannot easily be solved right now. Adding this flag in the
server is simple enough.

 XI2.h              |    1 +
 specs/XI2proto.txt |    8 ++++++--
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/XI2.h b/XI2.h
index 4368006..e864b06 100644
--- a/XI2.h
+++ b/XI2.h
@@ -158,6 +158,7 @@
 #define XIPointerEmulated                       (1 << 16)
 /* Device event flags (touch events only) */
 #define XITouchPendingEnd                       (1 << 16)
+#define XITouchEmulatingPointer                 (1 << 17)
 
 /* Touch modes */
 #define XIDirectTouch                           1
diff --git a/specs/XI2proto.txt b/specs/XI2proto.txt
index 8e2eea8..6ab2559 100644
--- a/specs/XI2proto.txt
+++ b/specs/XI2proto.txt
@@ -505,7 +505,8 @@ window set has been reached, the event is delivered:
 - otherwise, to the next parent window in the window set until a selection has
   been found.
 
-Emulated pointer events will have the PointerEmulated flag set.
+Emulated pointer events will have the PointerEmulated flag set. A touch
+event that emulates pointer events has the TouchEmulatingPointer flag set.
 
 [[glossary-notations]]
 Notations used in this document
@@ -2048,7 +2049,8 @@ For a detailed description of classes, see the XIQueryDevice request.
     DEVICEEVENTFLAGS (all events): none
     DEVICEEVENTFLAGS (key events only): { KeyRepeat }
     DEVICEEVENTFLAGS (pointer events only): { PointerEmulated }
-    DEVICEEVENTFLAGS (touch events only): { TouchPendingEnd }
+    DEVICEEVENTFLAGS (touch events only): { TouchPendingEnd,
+                                            TouchEmulatingPointer }
 
 An XIDeviceEvent is generated whenever the logical state of a device
 changes in response to a button press, a button release, a motion, a key
@@ -2108,6 +2110,8 @@ KeyRelease, ButtonPress, ButtonRelease, Motion.
         accepted or passed on ownership.  The touch will not generate any
         further TouchUpdate events once an event with TouchPendingEnd has been
         received.
+        TouchEmulatingPointer is set on touch events that emulate pointer
+        events.
 
 Modifier state in mods is detailed as follows:
 
-- 
1.7.7.4



More information about the xorg-devel mailing list