Skip to content

Commit

Permalink
x11: Always use correct window ID for XInput2 events
Browse files Browse the repository at this point in the history
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.

Additionally, the `CursorMoved` event sent alongside `Focused` now uses the correct device
ID; it previously used the ID of a master keyboard, but now uses the ID of the pointer
paired to that keyboard. Note that for those using multi-pointer X, the correctness of this
ID is dependent on the correctness of the window manager's focus model.
  • Loading branch information
francesca64 committed Dec 28, 2017
1 parent 198d9ff commit a888cdc
Show file tree
Hide file tree
Showing 2 changed files with 286 additions and 153 deletions.
Loading

0 comments on commit a888cdc

Please sign in to comment.