Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

X11: Fix modifiers being reported after release #1262

Merged
merged 2 commits into from
Nov 10, 2019

Conversation

murarth
Copy link
Contributor

@murarth murarth commented Nov 5, 2019

  • Moves ModifiersChanged variant from WindowEvent to DeviceEvent

Fixes #1259

  • Tested on all platforms changed
  • Compilation warnings were addressed
  • cargo fmt has been run on this branch
  • Added an entry to CHANGELOG.md if knowledge of this change could be valuable to users
  • Updated documentation to reflect any user-facing changes, including notes of platform-specific behavior
  • Created or updated an example program if it would help users understand this functionality
  • Updated feature matrix, if new features were added or implemented

* Moves `ModifiersChanged` variant from `WindowEvent` to `DeviceEvent`
@goddessfreya goddessfreya self-requested a review November 6, 2019 05:17
@chrisduerr
Copy link
Contributor

I can't reproduce the bug on my machine, but I can verify that the modifiers now behave the same way on X11 as they do on macOS. So when pressing shift, the modifiers state has shift set both for the shift key press itself and for all following events.

So everything looking good with regards to functionality from a consumer perspective. Thanks for the quick work @murarth, nicely done.

Copy link
Contributor

@goddessfreya goddessfreya left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prior to this PR I was getting this shit: https://gist.github.com/goddessfreya/0192aa8d9920dba7c933c98190c42d90

See those pairs of ModifiersChanged? I'd get them both when releasing Mod-; back onto winit's window. The first is obviously wrong, as mod was held and never released the whole time. Unfortunately, we also didn't get the matching Released for the:

WindowEvent { window_id: WindowId(X(WindowId(46137345))), event: KeyboardInput { device_id: DeviceId(X(DeviceId(3))), input: KeyboardInput { scancode: 125, state: Pressed, virtual_keycode: None, modifiers: ModifiersState { shift: false, ctrl: false, alt: false, logo: false } } } }

While this PR fixes the first issue, it doesn't fix the second, but I guess that is out of scope. Anyways, good job!

@goddessfreya goddessfreya merged commit c667849 into rust-windowing:master Nov 10, 2019
@murarth murarth deleted the fix-modifiers branch November 10, 2019 15:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

X11 reporting modifiers after release
3 participants