[PATCH 06/27] Input: Add POINTER_EMULATED flag to GetPointerEvents

Daniel Stone daniel at fooishbar.org
Fri Jun 3 07:59:42 PDT 2011


POINTER_EMULATED merely sets XIPointerEmulated in the generated
DeviceEvent.

Signed-off-by: Daniel Stone <daniel at fooishbar.org>
---
 dix/getevents.c                  |    4 ++++
 include/input.h                  |    1 +
 test/xi2/protocol-eventconvert.c |    5 +++++
 3 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/dix/getevents.c b/dix/getevents.c
index 13789f6..61ff51f 100644
--- a/dix/getevents.c
+++ b/dix/getevents.c
@@ -58,6 +58,7 @@
 #endif
 
 #include <X11/extensions/XI.h>
+#include <X11/extensions/XI2.h>
 #include <X11/extensions/XIproto.h>
 #include <pixman.h>
 #include "exglobals.h"
@@ -1235,6 +1236,9 @@ GetPointerEvents(InternalEvent *events, DeviceIntPtr pDev, int type, int buttons
     event->root_x_frac = cx_frac;
     event->root_y_frac = cy_frac;
 
+    if (flags & POINTER_EMULATED)
+        event->flags = XIPointerEmulated;
+
     set_valuators(pDev, event, &mask);
 
     return num_events;
diff --git a/include/input.h b/include/input.h
index db56b25..4a39f80 100644
--- a/include/input.h
+++ b/include/input.h
@@ -66,6 +66,7 @@ SOFTWARE.
 #define POINTER_ABSOLUTE (1 << 2)
 #define POINTER_ACCELERATE (1 << 3)
 #define POINTER_SCREEN (1 << 4) /* Data in screen coordinates */
+#define POINTER_EMULATED (1 << 5) /* Event was emulated from another event */
 
 /*int constants for pointer acceleration schemes*/
 #define PtrAccelNoOp            0
diff --git a/test/xi2/protocol-eventconvert.c b/test/xi2/protocol-eventconvert.c
index 6e61d74..34e9155 100644
--- a/test/xi2/protocol-eventconvert.c
+++ b/test/xi2/protocol-eventconvert.c
@@ -311,6 +311,11 @@ static void test_values_XIDeviceEvent(DeviceEvent *in, xXIDeviceEvent *out,
     assert(out->sourceid == in->sourceid);
 
     switch (in->type) {
+        case ET_ButtonPress:
+        case ET_Motion:
+        case ET_ButtonRelease:
+            flagmask = XIPointerEmulated;
+            break;
         case ET_KeyPress:
             flagmask = XIKeyRepeat;
             break;
-- 
1.7.5.3



More information about the xorg-devel mailing list