Skip to content

[Big endian] Linux - select_xinput_events is not endian agnostic #1880

Description

@msirringhaus

Trying the examples on a Linux machine s390x (big endian), I got errors upon cargo run --example window:

2021-03-11 16:14:17,387 ERROR [winit::platform_impl::platform] X11 error: XError {
    description: "BadValue (integer parameter out of range for operation)",
    error_code: 2,
    request_code: 132,
    minor_code: 46,
}

This is, I think, because select_xinput_events() deconstructs mask: i32 to an array of bytes (see here). This leads to wrong results on a big endian machine.
Putting mask: &mask.to_le_bytes() as *const _ as *mut c_uchar, the examples seem to work fine. But this is probably a very hacky solution, as I haven't thought very hard about possible consequences.

Metadata

Metadata

Assignees

No one assigned

    Labels

    B - bugDang, that shouldn't have happenedDS - x11Affects the X11 backend, or generally free Unix platforms

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions