-
Notifications
You must be signed in to change notification settings - Fork 912
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
macOS: Repeated key's ReceivedCharacter cancelled by previous key's keyUp event #1488
Labels
B - bug
Dang, that shouldn't have happened
C - needs investigation
Issue must be confirmed and researched
DS - macos
Comments
jayache80
added a commit
to jayache80/winit
that referenced
this issue
Mar 1, 2020
…dowing#1488 Checking state.is_key_down is redundant, since we are handling keyDown. Moreover, state.is_key_down can be affected by a previous repeated key's keyUp.
@chrisduerr it'll be nice if you can test it, since IIRC you don't have this issue on your macOS machine, so checking that it doesn't break anything could be a good check. |
8 tasks
ryanisaacg
added
DS - macos
C - needs investigation
Issue must be confirmed and researched
B - bug
Dang, that shouldn't have happened
labels
Mar 3, 2020
jayache80
added a commit
to jayache80/winit
that referenced
this issue
Jul 11, 2021
Fixes rust-windowing#1488. `is_key_down` was only set to true when `insertText` was called. Therefore `is_key_down` was actually meant to store whether the most recently pressed key generated an `insertText` event, at which, winit produces a `ReceivedCharacter`. The issue is that `insertText` is *not* called for "key repeat", but winit wants to send `ReceivedCharacter` events for "key repeat" too. To solve this, the `is_key_down` variable was then checked in the `key_down` function to determine whether it was valid to produce repeated `ReceivedCharacter` events during "key repeat". However this check is not needed since `ReceivedCharacter` must always be called if the key event has a non-empty `characters` property. Furthermore `is_key_down` didnt actually store whether the previously pressed character had an `insertText` event, because it was incorrectly set to false on every "key up". This meant that if two keys were pressed consecutively and then the first was released, then `is_key_down` was set to false even if the most recent keypress did actually produce an `insertText`.
jayache80
added a commit
to jayache80/winit
that referenced
this issue
Jul 13, 2021
Fixes rust-windowing#1488. `is_key_down` was only set to true when `insertText` was called. Therefore `is_key_down` was actually meant to store whether the most recently pressed key generated an `insertText` event, at which, winit produces a `ReceivedCharacter`. The issue is that `insertText` is *not* called for "key repeat", but winit wants to send `ReceivedCharacter` events for "key repeat" too. To solve this, the `is_key_down` variable was then checked in the `key_down` function to determine whether it was valid to produce repeated `ReceivedCharacter` events during "key repeat". However this check is not needed since `ReceivedCharacter` must always be called if the key event has a non-empty `characters` property. Furthermore `is_key_down` didn't actually store whether the previously pressed character had an `insertText` event, because it was incorrectly set to false on every "key up". This meant that if two keys were pressed consecutively and then the first was released, then `is_key_down` was set to false even if the most recent keypress did actually produce an `insertText`. Update changelog.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
B - bug
Dang, that shouldn't have happened
C - needs investigation
Issue must be confirmed and researched
DS - macos
On macOS only, with some combinations of repeated keys, the action of releasing the first repeated key will cause the remaining repeated key to no longer call
ReceivedCharacter
.Steps to reproduce:
ReceivedCharacter
s will stop, superseded by k'sReceivedCharacter
s, as expected.)ReceivedCharacter
s to stop.Expected behavior:
ReceivedCharacter
s will stop, superseded by k'sReceivedCharacter
s, as expected.)ReceivedCharacter
s should continue until k is released.This causes much frustration to, say,
vim
andless
users with "lazy fingers" while trying to scroll in a terminal emulator utilizing winit.This is likely to be the cause of alacritty/alacritty#2788
The text was updated successfully, but these errors were encountered: