From 2ac185d2fd2b884f4f59a7f7f61f414d139859aa Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Mon, 26 Mar 2012 09:07:34 +1000 Subject: Set the RawEvent sourceid (#34240) XI 2.2 and later include the sourceid in raw events. X.Org Bug 34240 Signed-off-by: Peter Hutterer Reviewed-by: Chase Douglas --- src/XExtInt.c | 14 +++++++++----- 1 file 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); -- cgit v1.2.3