diff --git a/dix/getevents.c b/dix/getevents.c index 4eb1b3afe..45243df5c 100644 --- a/dix/getevents.c +++ b/dix/getevents.c @@ -58,6 +58,7 @@ #endif #include +#include #include #include #include "exglobals.h" @@ -1159,6 +1160,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 = XIPointerEmulated; + event->flags = XIPointerEmulated; + } + set_valuators(pDev, event, &mask); return num_events; diff --git a/include/input.h b/include/input.h index 577f5d992..6ba1ab200 100644 --- a/include/input.h +++ b/include/input.h @@ -68,6 +68,7 @@ SOFTWARE. #define POINTER_ACCELERATE (1 << 3) #define POINTER_SCREEN (1 << 4) /* Data in screen coordinates */ #define POINTER_NORAW (1 << 5) /* Don't generate RawEvents */ +#define POINTER_EMULATED (1 << 6) /* 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 d7a9ee420..bfa23b51f 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) { @@ -62,7 +63,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 = XIPointerEmulated; + break; + default: + flagmask = 0; + } + assert((out->flags & ~flagmask) == 0); ptr = (unsigned char*)&out[1]; bits_set = 0; @@ -304,6 +315,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;