[Qemu-devel] [PATCH] ui/sdl2: Ignore key repeats for shortcut keys

Thomas Huth posted 1 patch 6 years, 3 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/1515607608-18250-1-git-send-email-thuth@redhat.com
Test checkpatch passed
Test docker passed
Test ppc passed
Test s390x passed
ui/sdl2.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[Qemu-devel] [PATCH] ui/sdl2: Ignore key repeats for shortcut keys
Posted by Thomas Huth 6 years, 3 months ago
Holding down a shortcut key currently continuesly triggers the shortcut
event, e.g. holding CTRL-ALT-f continuesly switches between windowed and
fullscreen mode, or holding CTRL-ALT-u even crashes QEMU with a segfault.
This is ugly, we should rather ignore automatic key repeats when handling
the keyboard shortcuts.

Reported-by: Michael Tokarev <mjt@tls.msk.ru>
Signed-off-by: Thomas Huth <thuth@redhat.com>
---
 ui/sdl2.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ui/sdl2.c b/ui/sdl2.c
index 8718cf3..18664b4 100644
--- a/ui/sdl2.c
+++ b/ui/sdl2.c
@@ -349,7 +349,7 @@ static void handle_keydown(SDL_Event *ev)
     }
     gui_key_modifier_pressed = mod_state;
 
-    if (gui_key_modifier_pressed) {
+    if (gui_key_modifier_pressed && !ev->key.repeat) {
         switch (ev->key.keysym.scancode) {
         case SDL_SCANCODE_2:
         case SDL_SCANCODE_3:
-- 
1.8.3.1


Re: [Qemu-devel] [PATCH] ui/sdl2: Ignore key repeats for shortcut keys
Posted by Michael Tokarev 6 years, 3 months ago
10.01.2018 21:06, Thomas Huth wrote:
> Holding down a shortcut key currently continuesly triggers the shortcut
> event, e.g. holding CTRL-ALT-f continuesly switches between windowed and
> fullscreen mode, or holding CTRL-ALT-u even crashes QEMU with a segfault.
> This is ugly, we should rather ignore automatic key repeats when handling
> the keyboard shortcuts.

Applied to -trivial, thank you!

/mjt