Bug 89478 - XSendEvent() fails on XInput2 events
Summary: XSendEvent() fails on XInput2 events
Alias: None
Product: xorg
Classification: Unclassified
Component: Lib/Xlib (show other bugs)
Version: unspecified
Hardware: Other All
: medium normal
Assignee: Xorg Project Team
QA Contact: Xorg Project Team
Depends on:
Reported: 2015-03-06 22:19 UTC by Andrew Church
Modified: 2018-08-10 20:10 UTC (History)
2 users (show)

See Also:
i915 platform:
i915 features:


Description Andrew Church 2015-03-06 22:19:41 UTC
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().
Comment 1 GitLab Migration User 2018-08-10 20:10:59 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/xorg/lib/libx11/issues/42.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.