[PATCH v2 27/28] Input: Add POINTER_EMULATED flag to GetPointerEvents
Daniel Stone
daniel at fooishbar.org
Thu Jun 9 10:17:35 PDT 2011
POINTER_EMULATED merely sets XIPointerEmulated in the generated
DeviceEvent.
Signed-off-by: Daniel Stone <daniel at fooishbar.org>
---
dix/getevents.c | 6 ++++++
include/input.h | 1 +
test/xi2/protocol-eventconvert.c | 18 +++++++++++++++++-
3 files changed, 24 insertions(+), 1 deletions(-)
v2: Also add flags to the RawEvent.
diff --git a/dix/getevents.c b/dix/getevents.c
index 7088b1a..03c7938 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"
@@ -1174,6 +1175,11 @@ fill_pointer_events(InternalEvent *events, DeviceIntPtr pDev, int type,
event->root_x_frac = screenx - trunc(screenx);
event->root_y_frac = screeny - trunc(screeny);
+ if (flags & POINTER_EMULATED) {
+ raw->flags = XIRawEmulated;
+ event->flags = XIPointerEmulated;
+ }
+
set_valuators(pDev, event, &mask);
return num_events;
diff --git a/include/input.h b/include/input.h
index 512e12c..caf5196 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 7db3fd2..e0de7d3 100644
--- a/test/xi2/protocol-eventconvert.c
+++ b/test/xi2/protocol-eventconvert.c
@@ -41,6 +41,7 @@ static void test_values_XIRawEvent(RawDeviceEvent *in, xXIRawEvent *out,
int nvals = 0;
int bits_set;
int len;
+ uint32_t flagmask = 0;
if (swap)
{
@@ -64,7 +65,17 @@ static void test_values_XIRawEvent(RawDeviceEvent *in, xXIRawEvent *out,
assert(out->detail == in->detail.button);
assert(out->deviceid == in->deviceid);
assert(out->valuators_len >= bytes_to_int32(bits_to_bytes(sizeof(in->valuators.mask))));
- assert(out->flags == 0); /* FIXME: we don't set the flags yet */
+
+ switch (in->type) {
+ case ET_RawMotion:
+ case ET_RawButtonPress:
+ case ET_RawButtonRelease:
+ flagmask = XIRawEmulated;
+ break;
+ default:
+ flagmask = 0;
+ }
+ assert((out->flags & ~flagmask) == 0);
ptr = (unsigned char*)&out[1];
bits_set = 0;
@@ -310,6 +321,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