Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
macOS: Remove
is_key_down
from ViewState
Fixes #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`.
- Loading branch information