diff options
author | Peter Hutterer <peter.hutterer@who-t.net> | 2012-03-26 09:07:34 +1000 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2012-03-26 09:07:34 +1000 |
commit | 2ac185d2fd2b884f4f59a7f7f61f414d139859aa (patch) | |
tree | 714e17a7d9d904985ceba77d5b9cc1970bf2220f /src | |
parent | dfc101e4c6cdac4ff9a51732b2754287fbdc8582 (diff) |
Set the RawEvent sourceid (#34240)
XI 2.2 and later include the sourceid in raw events.
X.Org Bug 34240 <http://bugs.freedesktop.org/show_bug.cgi?id=34240>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/XExtInt.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/XExtInt.c b/src/XExtInt.c index 4f85667..43738a2 100644 --- a/src/XExtInt.c +++ b/src/XExtInt.c @@ -145,7 +145,7 @@ wireToDeviceChangedEvent(xXIDeviceChangedEvent *in, XGenericEventCookie *cookie) static int wireToHierarchyChangedEvent(xXIHierarchyEvent *in, XGenericEventCookie *cookie); static int -wireToRawEvent(xXIRawEvent *in, XGenericEventCookie *cookie); +wireToRawEvent(XExtDisplayInfo *info, xXIRawEvent *in, XGenericEventCookie *cookie); static int wireToEnterLeave(xXIEnterEvent *in, XGenericEventCookie *cookie); static int @@ -1012,7 +1012,7 @@ XInputWireToCookie( case XI_RawTouchUpdate: case XI_RawTouchEnd: *cookie = *(XGenericEventCookie*)save; - if (!wireToRawEvent((xXIRawEvent*)event, cookie)) + if (!wireToRawEvent(info, (xXIRawEvent*)event, cookie)) { printf("XInputWireToCookie: CONVERSION FAILURE! evtype=%d\n", ge->evtype); @@ -1832,14 +1832,13 @@ wireToHierarchyChangedEvent(xXIHierarchyEvent *in, XGenericEventCookie *cookie) } static int -wireToRawEvent(xXIRawEvent *in, XGenericEventCookie *cookie) +wireToRawEvent(XExtDisplayInfo *info, xXIRawEvent *in, XGenericEventCookie *cookie) { int len, i, bits; FP3232 *values; XIRawEvent *out; void *ptr; - len = sizeof(XIRawEvent) + in->valuators_len * 4; bits = count_bits((unsigned char*)&in[1], in->valuators_len * 4); len += bits * sizeof(double) * 2; /* raw + normal */ @@ -1857,9 +1856,14 @@ wireToRawEvent(xXIRawEvent *in, XGenericEventCookie *cookie) out->time = in->time; out->detail = in->detail; out->deviceid = in->deviceid; - out->sourceid = 0; /* https://bugs.freedesktop.org/show_bug.cgi?id=34240 */ out->flags = in->flags; + /* https://bugs.freedesktop.org/show_bug.cgi?id=34240 */ + if (_XiCheckVersion(info, XInput_2_2) >= 0) + out->sourceid = in->sourceid; + else + out->sourceid = 0; + out->valuators.mask_len = in->valuators_len * 4; out->valuators.mask = next_block(&ptr, out->valuators.mask_len); memcpy(out->valuators.mask, &in[1], out->valuators.mask_len); |