diff options
| author | Akihiko Odaki <akihiko.odaki@gmail.com> | 2021-03-10 23:46:02 +0900 |
|---|---|---|
| committer | Gerd Hoffmann <kraxel@redhat.com> | 2021-03-11 10:06:44 +0100 |
| commit | 6d73bb643aa725348aabe6a885ac5fb0b7f70252 (patch) | |
| tree | b450eebba94917bd80712d59acad50267a806ab1 /linux-user/syscall.c | |
| parent | a0f973f931680ae8bd847054aca7f658abb9c18f (diff) | |
| download | focaccia-qemu-6d73bb643aa725348aabe6a885ac5fb0b7f70252.tar.gz focaccia-qemu-6d73bb643aa725348aabe6a885ac5fb0b7f70252.zip | |
ui/cocoa: Clear modifiers whenever possible
ui/cocoa does not receive NSEventTypeFlagsChanged when it is not active, and the modifier state can be desynchronized in such a situation. [NSEvent -modifierFlags] tells whether a modifier is *not* pressed, so check it whenever receiving an event and clear the modifier if it is not pressed. Note that [NSEvent -modifierFlags] does not tell if a certain modifier *is* pressed because the documented mask for [NSEvent -modifierFlags] generalizes left shift and right shift, for example. CapsLock is the only exception. The pressed state is synchronized only with NSEventTypeFlagsChanged. This change also removes modifier keys from keycode map. If they are input with NSEventTypeKeyDown or NSEventTypeKeyUp, it leads to desynchronization. Although such a situation is not observed, they are removed just in case. Moreover, QKbdState is introduced for automatic key state tracking. Thanks to Konstantin Nazarov for testing and finding a bug in this change: https://gist.github.com/akihikodaki/87df4149e7ca87f18dc56807ec5a1bc5#gistcomment-3659419 Signed-off-by: Akihiko Odaki <akihiko.odaki@gmail.com> Message-Id: <20210310144602.58528-1-akihiko.odaki@gmail.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Diffstat (limited to 'linux-user/syscall.c')
0 files changed, 0 insertions, 0 deletions