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.

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
francesca64 committed Dec 24, 2017
1 parent 463f316 commit f2ac868
Showing 1 changed file with 165 additions and 80 deletions.
Loading

0 comments on commit f2ac868

Please sign in to comment.