[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 53/56] ui/sdl2: release all modifiers
From: |
Philippe Mathieu-Daudé |
Subject: |
[PULL 53/56] ui/sdl2: release all modifiers |
Date: |
Wed, 11 Sep 2024 14:14:18 +0200 |
From: Volker Rümelin <vr_qemu@t-online.de>
Each virtual console in the SDL2 frontend has a key state map.
When switching windows with GUI keys we have to release all
pressed modifier keys in the currently active window, because
after the switch the now inactive window no longer receives the
key release events.
To reproduce the issue open a text editor in the SDL UI and then
press Ctrl-Alt-2 to open a Compat Monitor Console. Close the
console with the mouse. Try to enter text in the text editor and
notice that the modifier keys Ctrl and Alt are stuck and need to
be pressed once to be released.
Tested-by: Howard Spoelstra <hsp.cat7@gmail.com>
Signed-off-by: Volker Rümelin <vr_qemu@t-online.de>
Tested-by: Bernhard Beschow <shentey@gmail.com>
Message-ID: <20240909061552.6122-2-vr_qemu@t-online.de>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
include/ui/sdl2.h | 1 +
ui/sdl2-input.c | 5 +++++
ui/sdl2.c | 1 +
3 files changed, 7 insertions(+)
diff --git a/include/ui/sdl2.h b/include/ui/sdl2.h
index e3acc7c82a..6907115809 100644
--- a/include/ui/sdl2.h
+++ b/include/ui/sdl2.h
@@ -60,6 +60,7 @@ void sdl2_poll_events(struct sdl2_console *scon);
void sdl2_process_key(struct sdl2_console *scon,
SDL_KeyboardEvent *ev);
+void sdl2_release_modifiers(struct sdl2_console *scon);
void sdl2_2d_update(DisplayChangeListener *dcl,
int x, int y, int w, int h);
diff --git a/ui/sdl2-input.c b/ui/sdl2-input.c
index b02a89ee7c..2286df4223 100644
--- a/ui/sdl2-input.c
+++ b/ui/sdl2-input.c
@@ -58,3 +58,8 @@ void sdl2_process_key(struct sdl2_console *scon,
}
}
}
+
+void sdl2_release_modifiers(struct sdl2_console *scon)
+{
+ qkbd_state_lift_all_keys(scon->kbd);
+}
diff --git a/ui/sdl2.c b/ui/sdl2.c
index 98ed974371..bf6868f204 100644
--- a/ui/sdl2.c
+++ b/ui/sdl2.c
@@ -418,6 +418,7 @@ static void handle_keydown(SDL_Event *ev)
SDL_ShowWindow(sdl2_console[win].real_window);
}
}
+ sdl2_release_modifiers(scon);
gui_keysym = 1;
}
break;
--
2.45.2
- [PULL 40/56] tests/unit: add test-fifo unit test, (continued)
- [PULL 40/56] tests/unit: add test-fifo unit test, Philippe Mathieu-Daudé, 2024/09/11
- [PULL 41/56] tests/unit: Strengthen FIFO8 tests, Philippe Mathieu-Daudé, 2024/09/11
- [PULL 45/56] hw/input/adb-mouse: convert to use QemuInputHandler, Philippe Mathieu-Daudé, 2024/09/11
- [PULL 46/56] hw/char: replace assert(0) with g_assert_not_reached(), Philippe Mathieu-Daudé, 2024/09/11
- [PULL 47/56] hw/core: replace assert(0) with g_assert_not_reached(), Philippe Mathieu-Daudé, 2024/09/11
- [PULL 48/56] hw/watchdog: replace assert(0) with g_assert_not_reached(), Philippe Mathieu-Daudé, 2024/09/11
- [PULL 49/56] hw/gpio: remove break after g_assert_not_reached(), Philippe Mathieu-Daudé, 2024/09/11
- [PULL 50/56] hw/misc: remove break after g_assert_not_reached(), Philippe Mathieu-Daudé, 2024/09/11
- [PULL 51/56] hw/pci-host: remove break after g_assert_not_reached(), Philippe Mathieu-Daudé, 2024/09/11
- [PULL 52/56] system: replace assert(0) with g_assert_not_reached(), Philippe Mathieu-Daudé, 2024/09/11
- [PULL 53/56] ui/sdl2: release all modifiers,
Philippe Mathieu-Daudé <=
- [PULL 54/56] ui/sdl2: ignore GUI keys in SDL_TEXTINPUT handler, Philippe Mathieu-Daudé, 2024/09/11
- [PULL 55/56] ui/sdl2: set swap interval explicitly when OpenGL is enabled, Philippe Mathieu-Daudé, 2024/09/11
- [PULL 56/56] ui: remove break after g_assert_not_reached(), Philippe Mathieu-Daudé, 2024/09/11
- Re: [PULL 00/56] Misc HW & UI patches, Philippe Mathieu-Daudé, 2024/09/12