All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/1] SDL2: fix handling of the AltGr key on Windows again
@ 2023-04-18  6:52 Volker Rümelin
  2023-04-18  6:56 ` [PATCH v2 1/1] ui/sdl2: disable SDL_HINT_GRAB_KEYBOARD on Windows Volker Rümelin
  0 siblings, 1 reply; 5+ messages in thread
From: Volker Rümelin @ 2023-04-18  6:52 UTC (permalink / raw)
  To: Marc-André Lureau, Gerd Hoffmann
  Cc: Bernhard Beschow, Stefan Weil, qemu-devel

Based-on: <20230417192139.43263-1-shentey@gmail.com>
([PATCH v2 0/2] SDL2 usability fixes)

Windows sends an extra left control key up/down input event for
every right alt key up/down input event for keyboards with
international layout. Since commit 830473455f ("ui/sdl2: fix
handling of AltGr key on Windows") QEMU uses a Windows low level
keyboard hook procedure to reliably filter out the special left
control key and to grab the keyboard on Windows.

SDL2 version 2.0.16 introduced its own Windows low level keyboard
hook procedure to grab the keyboard. When enabled with a grabbed
keyboard, this disables the special left control key filter and
handling of the AltGr key on Windows is broken again.

This patch fixes handling of the AltGr key on Windows with
international keyboard layout.

v2:
Fixed the cover letter subject, so that :patchew applies this
patch series to the correct QEMU branch.

Volker Rümelin (1):
   ui/sdl2: disable SDL_HINT_GRAB_KEYBOARD on Windows

  ui/sdl2.c | 3 +++
  1 file changed, 3 insertions(+)

-- 
2.35.3



^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH v2 1/1] ui/sdl2: disable SDL_HINT_GRAB_KEYBOARD on Windows
  2023-04-18  6:52 [PATCH v2 0/1] SDL2: fix handling of the AltGr key on Windows again Volker Rümelin
@ 2023-04-18  6:56 ` Volker Rümelin
  2023-04-18 18:14   ` Bernhard Beschow
  2023-04-24  3:33   ` Stefan Weil via
  0 siblings, 2 replies; 5+ messages in thread
From: Volker Rümelin @ 2023-04-18  6:56 UTC (permalink / raw)
  To: Marc-André Lureau, Gerd Hoffmann
  Cc: qemu-devel, Bernhard Beschow, Stefan Weil

Windows sends an extra left control key up/down input event for
every right alt key up/down input event for keyboards with
international layout. Since commit 830473455f ("ui/sdl2: fix
handling of AltGr key on Windows") QEMU uses a Windows low level
keyboard hook procedure to reliably filter out the special left
control key and to grab the keyboard on Windows.

The SDL2 version 2.0.16 introduced its own Windows low level
keyboard hook procedure to grab the keyboard. Windows calls this
callback before the QEMU keyboard hook procedure. This disables
the special left control key filter when the keyboard is grabbed.

To fix the problem, disable the SDL2 Windows low level keyboard
hook procedure.

Reported-by: Bernhard Beschow <shentey@gmail.com>
Signed-off-by: Volker Rümelin <vr_qemu@t-online.de>
---
 ui/sdl2.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/ui/sdl2.c b/ui/sdl2.c
index 00aadfae37..9d703200bf 100644
--- a/ui/sdl2.c
+++ b/ui/sdl2.c
@@ -855,7 +855,10 @@ static void sdl2_display_init(DisplayState *ds, DisplayOptions *o)
 #ifdef SDL_HINT_VIDEO_X11_NET_WM_BYPASS_COMPOSITOR /* only available since SDL 2.0.8 */
     SDL_SetHint(SDL_HINT_VIDEO_X11_NET_WM_BYPASS_COMPOSITOR, "0");
 #endif
+#ifndef CONFIG_WIN32
+    /* QEMU uses its own low level keyboard hook procecure on Windows */
     SDL_SetHint(SDL_HINT_GRAB_KEYBOARD, "1");
+#endif
 #ifdef SDL_HINT_ALLOW_ALT_TAB_WHILE_GRABBED
     SDL_SetHint(SDL_HINT_ALLOW_ALT_TAB_WHILE_GRABBED, "0");
 #endif
-- 
2.35.3



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH v2 1/1] ui/sdl2: disable SDL_HINT_GRAB_KEYBOARD on Windows
  2023-04-18  6:56 ` [PATCH v2 1/1] ui/sdl2: disable SDL_HINT_GRAB_KEYBOARD on Windows Volker Rümelin
@ 2023-04-18 18:14   ` Bernhard Beschow
  2023-04-24  3:33   ` Stefan Weil via
  1 sibling, 0 replies; 5+ messages in thread
From: Bernhard Beschow @ 2023-04-18 18:14 UTC (permalink / raw)
  To: Volker Rümelin, Marc-André Lureau, Gerd Hoffmann
  Cc: qemu-devel, Stefan Weil



Am 18. April 2023 06:56:52 UTC schrieb "Volker Rümelin" <vr_qemu@t-online.de>:
>Windows sends an extra left control key up/down input event for
>every right alt key up/down input event for keyboards with
>international layout. Since commit 830473455f ("ui/sdl2: fix
>handling of AltGr key on Windows") QEMU uses a Windows low level
>keyboard hook procedure to reliably filter out the special left
>control key and to grab the keyboard on Windows.
>
>The SDL2 version 2.0.16 introduced its own Windows low level
>keyboard hook procedure to grab the keyboard. Windows calls this
>callback before the QEMU keyboard hook procedure. This disables
>the special left control key filter when the keyboard is grabbed.
>
>To fix the problem, disable the SDL2 Windows low level keyboard
>hook procedure.
>
>Reported-by: Bernhard Beschow <shentey@gmail.com>
>Signed-off-by: Volker Rümelin <vr_qemu@t-online.de>

FWIW:

Tested-by: Bernhard Beschow <shentey@gmail.com>

>---
> ui/sdl2.c | 3 +++
> 1 file changed, 3 insertions(+)
>
>diff --git a/ui/sdl2.c b/ui/sdl2.c
>index 00aadfae37..9d703200bf 100644
>--- a/ui/sdl2.c
>+++ b/ui/sdl2.c
>@@ -855,7 +855,10 @@ static void sdl2_display_init(DisplayState *ds, DisplayOptions *o)
> #ifdef SDL_HINT_VIDEO_X11_NET_WM_BYPASS_COMPOSITOR /* only available since SDL 2.0.8 */
>     SDL_SetHint(SDL_HINT_VIDEO_X11_NET_WM_BYPASS_COMPOSITOR, "0");
> #endif
>+#ifndef CONFIG_WIN32
>+    /* QEMU uses its own low level keyboard hook procecure on Windows */
>     SDL_SetHint(SDL_HINT_GRAB_KEYBOARD, "1");
>+#endif
> #ifdef SDL_HINT_ALLOW_ALT_TAB_WHILE_GRABBED
>     SDL_SetHint(SDL_HINT_ALLOW_ALT_TAB_WHILE_GRABBED, "0");
> #endif


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2 1/1] ui/sdl2: disable SDL_HINT_GRAB_KEYBOARD on Windows
  2023-04-18  6:56 ` [PATCH v2 1/1] ui/sdl2: disable SDL_HINT_GRAB_KEYBOARD on Windows Volker Rümelin
  2023-04-18 18:14   ` Bernhard Beschow
@ 2023-04-24  3:33   ` Stefan Weil via
  2023-05-10 18:43     ` Bernhard Beschow
  1 sibling, 1 reply; 5+ messages in thread
From: Stefan Weil via @ 2023-04-24  3:33 UTC (permalink / raw)
  To: Volker Rümelin, Marc-André Lureau, Gerd Hoffmann
  Cc: qemu-devel, Bernhard Beschow

Am 18.04.23 um 08:56 schrieb Volker Rümelin:

> Windows sends an extra left control key up/down input event for
> every right alt key up/down input event for keyboards with
> international layout. Since commit 830473455f ("ui/sdl2: fix
> handling of AltGr key on Windows") QEMU uses a Windows low level
> keyboard hook procedure to reliably filter out the special left
> control key and to grab the keyboard on Windows.
>
> The SDL2 version 2.0.16 introduced its own Windows low level
> keyboard hook procedure to grab the keyboard. Windows calls this
> callback before the QEMU keyboard hook procedure. This disables
> the special left control key filter when the keyboard is grabbed.
>
> To fix the problem, disable the SDL2 Windows low level keyboard
> hook procedure.
>
> Reported-by: Bernhard Beschow <shentey@gmail.com>
> Signed-off-by: Volker Rümelin <vr_qemu@t-online.de>
> ---
>   ui/sdl2.c | 3 +++
>   1 file changed, 3 insertions(+)
>
> diff --git a/ui/sdl2.c b/ui/sdl2.c
> index 00aadfae37..9d703200bf 100644
> --- a/ui/sdl2.c
> +++ b/ui/sdl2.c
> @@ -855,7 +855,10 @@ static void sdl2_display_init(DisplayState *ds, DisplayOptions *o)
>   #ifdef SDL_HINT_VIDEO_X11_NET_WM_BYPASS_COMPOSITOR /* only available since SDL 2.0.8 */
>       SDL_SetHint(SDL_HINT_VIDEO_X11_NET_WM_BYPASS_COMPOSITOR, "0");
>   #endif
> +#ifndef CONFIG_WIN32
> +    /* QEMU uses its own low level keyboard hook procecure on Windows */


s/procecure/procedure/


>       SDL_SetHint(SDL_HINT_GRAB_KEYBOARD, "1");
> +#endif
>   #ifdef SDL_HINT_ALLOW_ALT_TAB_WHILE_GRABBED
>       SDL_SetHint(SDL_HINT_ALLOW_ALT_TAB_WHILE_GRABBED, "0");
>   #endif


The typo fix for the comment does not require a v3 and can be applied in 
the pull request.

Reviewed-by: Stefan Weil <sw@weilnetz.de>




^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2 1/1] ui/sdl2: disable SDL_HINT_GRAB_KEYBOARD on Windows
  2023-04-24  3:33   ` Stefan Weil via
@ 2023-05-10 18:43     ` Bernhard Beschow
  0 siblings, 0 replies; 5+ messages in thread
From: Bernhard Beschow @ 2023-05-10 18:43 UTC (permalink / raw)
  To: Stefan Weil, Volker Rümelin, Marc-André Lureau, Gerd Hoffmann
  Cc: qemu-devel



Am 24. April 2023 03:33:05 UTC schrieb Stefan Weil <sw@weilnetz.de>:
>Am 18.04.23 um 08:56 schrieb Volker Rümelin:
>
>> Windows sends an extra left control key up/down input event for
>> every right alt key up/down input event for keyboards with
>> international layout. Since commit 830473455f ("ui/sdl2: fix
>> handling of AltGr key on Windows") QEMU uses a Windows low level
>> keyboard hook procedure to reliably filter out the special left
>> control key and to grab the keyboard on Windows.
>> 
>> The SDL2 version 2.0.16 introduced its own Windows low level
>> keyboard hook procedure to grab the keyboard. Windows calls this
>> callback before the QEMU keyboard hook procedure. This disables
>> the special left control key filter when the keyboard is grabbed.
>> 
>> To fix the problem, disable the SDL2 Windows low level keyboard
>> hook procedure.
>> 
>> Reported-by: Bernhard Beschow <shentey@gmail.com>
>> Signed-off-by: Volker Rümelin <vr_qemu@t-online.de>
>> ---
>>   ui/sdl2.c | 3 +++
>>   1 file changed, 3 insertions(+)
>> 
>> diff --git a/ui/sdl2.c b/ui/sdl2.c
>> index 00aadfae37..9d703200bf 100644
>> --- a/ui/sdl2.c
>> +++ b/ui/sdl2.c
>> @@ -855,7 +855,10 @@ static void sdl2_display_init(DisplayState *ds, DisplayOptions *o)
>>   #ifdef SDL_HINT_VIDEO_X11_NET_WM_BYPASS_COMPOSITOR /* only available since SDL 2.0.8 */
>>       SDL_SetHint(SDL_HINT_VIDEO_X11_NET_WM_BYPASS_COMPOSITOR, "0");
>>   #endif
>> +#ifndef CONFIG_WIN32
>> +    /* QEMU uses its own low level keyboard hook procecure on Windows */
>
>
>s/procecure/procedure/
>
>
>>       SDL_SetHint(SDL_HINT_GRAB_KEYBOARD, "1");
>> +#endif
>>   #ifdef SDL_HINT_ALLOW_ALT_TAB_WHILE_GRABBED
>>       SDL_SetHint(SDL_HINT_ALLOW_ALT_TAB_WHILE_GRABBED, "0");
>>   #endif
>
>
>The typo fix for the comment does not require a v3 and can be applied in the pull request.
>
>Reviewed-by: Stefan Weil <sw@weilnetz.de>

Ping



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-05-10 18:44 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-18  6:52 [PATCH v2 0/1] SDL2: fix handling of the AltGr key on Windows again Volker Rümelin
2023-04-18  6:56 ` [PATCH v2 1/1] ui/sdl2: disable SDL_HINT_GRAB_KEYBOARD on Windows Volker Rümelin
2023-04-18 18:14   ` Bernhard Beschow
2023-04-24  3:33   ` Stefan Weil via
2023-05-10 18:43     ` Bernhard Beschow

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.