XSendEvent() fails on XInput2 events
Submitted by Andrew Church
Assigned to Xorg Project Team
Description
Attempting to send a synthetic XInput2 event through XSendEvent() fails with a BadValue error:
Display display = /* ... */;
Window window = /* ... */;
XIDeviceEvent event = {
.type = GenericEvent,
.display = display,
.extension = xinput2_opcode,
.evtype = XI_TouchBegin,
/* ... */
};
XSendEvent(display, window, False, 0, (XEvent *)&event); // => BadValue
The same happens if I try to wrap the XIDeviceEvent in an XGenericEventCookie:
XGenericEventCookie cookie;
memcpy(&cookie, &event, sizeof(cookie));
cookie.cookie = 0;
cookie.data = &event;
XSendEvent(display, window, False, 0, (XEvent *)&cookie); // => BadValue
This issue appears to have been raised previously in bug 30357 (through 30361), but despite that being marked FIXED, XSendEvent() still fails with xorg-server 1.17.1, libX11 1.6.2, and libXi 1.7.4, and I don't see that any of the patches from those bugs have been applied. FWIW, after applying those patches (with minor tweaks) I can successfully send wrapped XIDeviceEvent events through XSendEvent().