Am 09.09.24 um 09:26 schrieb Marc-André Lureau:
Hi
On Mon, Sep 9, 2024 at 10:22 AM Volker Rümelin <vr_q...@t-online.de> wrote:
Windows only:
The libSDL2 Windows message loop needs the libSDL2 Windows low
level keyboard hook procedure to grab the left and right Windows
keys correctly. Reenable the SDL2 Windows keyboard hook procedure.
Because the QEMU Windows keyboard hook procedure is still needed
to filter out the special left Control key event for every Alt Gr
key event, it's important to install the two keyboard hook
procedures in the following order. First the SDL2 procedure, then
the QEMU procedure.
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2139
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2323
Tested-by: Howard Spoelstra <hsp.c...@gmail.com>
Signed-off-by: Volker Rümelin <vr_q...@t-online.de>
---
ui/sdl2.c | 53 ++++++++++++++++++++++++++++++---------------
ui/win32-kbd-hook.c | 3 +++
2 files changed, 38 insertions(+), 18 deletions(-)
diff --git a/ui/sdl2.c b/ui/sdl2.c
index 98ed974371..ac37c173a1 100644
--- a/ui/sdl2.c
+++ b/ui/sdl2.c
[...]
@@ -877,6 +883,17 @@ static void sdl2_display_init(DisplayState *ds,
DisplayOptions *o)
SDL_EnableScreenSaver();
memset(&info, 0, sizeof(info));
SDL_VERSION(&info.version);
+ /*
+ * Since version 2.16.0 under Windows, SDL2 has its own low level
+ * keyboard hook procedure to grab the keyboard. The remaining task of
+ * QEMU's low level keyboard hook procedure is to filter out the special
+ * left Control up/down key event for every Alt Gr key event on keyboards
+ * with an international layout.
+ */
+ SDL_GetVersion(&ver);
+ if (ver.major == 2 && ver.minor < 16) {
+ win32_kbd_grab = true;
+ }
Note: there is no 2.16 release. They jumped from 2.0.22 to 2.24 (see
https://github.com/libsdl-org/SDL/releases/tag/release-2.24.0)
The windows hook was indeed added in 2.0.16, released on Aug 10, 2021.
Given the distribution nature of the Windows binaries, I think we
could simply depend on a much recent version without worrying about
compatibility with < 2.0.16. This would help reduce the potential
combinations of versions and bugs reports.
[...]
I agree. My builds for Windows typically use the very latest versions,
for example mingw-w64-i686-SDL2-2.30.7-1-any for the next build. So
depending on a recent SDL version would be fine for me.
Stefan W.