Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
x11: Always use correct window ID for XInput2 events
The `CursorMoved` events that are used to send position updates alongside `Focused` and `CursorEntered` events were using incorrect values for the window ID. This is a direct result of the X11 backend being hard to understand, as those values came from variables in the top-level scope of the function, which one would assume to be valid throughout the entirety of their scope. In reality, their validity is dependent on the event belonging to the `XEvent` union, so very surprising things can happen if those variables are read in the case of XInput2/XKB/etc. events. To prevent future accidents, the aforementioned variables have been removed, and are now defined per-event instead. However, the `CursorMoved` event sent alongside `Focused` events is still imperfect. The associated `DeviceId` is for the core virtual keyboard, as opposed to the core virtual pointer, which is the expected value on all other `CursorMoved` events. I'm not aware of any straightforward solution to this, as window focus isn't inherently tied to pointer devices.
- Loading branch information