* [PATCH] ui/sdl2: use correct key names in win title on mac
@ 2023-10-30 2:41 Adrian Wowk
2023-10-31 10:19 ` Marc-André Lureau
2023-11-02 8:59 ` Philippe Mathieu-Daudé
0 siblings, 2 replies; 3+ messages in thread
From: Adrian Wowk @ 2023-10-30 2:41 UTC (permalink / raw)
To: qemu-devel; +Cc: Adrian Wowk
Previously, when using the SDL2 UI on MacOS, the title bar uses incorrect
key names (such as Ctrl and Alt instead of the standard MacOS key symbols
like ⌃ and ⌥). This commit changes sdl_update_caption in ui/sdl2.c to
use the correct symbols when compiling for MacOS (CONFIG_DARWIN is
defined).
Unfortunately, standard Mac keyboards do not include a "Right-Ctrl" key,
so in the case that the SDL grab mode is set to HOT_KEY_MOD_RCTRL, the
default text is still used.
Signed-off-by: Adrian Wowk <dev@adrianwowk.com>
---
Hi! I created this patch after having to compile QEMU from source with the SDL UI enabled to avoid an unrelated bug in the Cocoa UI. I noticed that the title of the window was not correct so I added a quick fix. I have tested this change on MacOS Sonoma (Version 14.1), and it works as expected. I did my best to ensure correctness, but this is my first time contrbuting to QEMU (and also my first time sending git patches over email), so if there is anything I can do better then please let me know. Thank You!
ui/sdl2.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/ui/sdl2.c b/ui/sdl2.c
index fbfdb64e90..4971963f00 100644
--- a/ui/sdl2.c
+++ b/ui/sdl2.c
@@ -172,11 +172,19 @@ static void sdl_update_caption(struct sdl2_console *scon)
status = " [Stopped]";
} else if (gui_grab) {
if (alt_grab) {
+#ifdef CONFIG_DARWIN
+ status = " - Press ⌃⌥⇧G to exit grab";
+#else
status = " - Press Ctrl-Alt-Shift-G to exit grab";
+#endif
} else if (ctrl_grab) {
status = " - Press Right-Ctrl-G to exit grab";
} else {
+#ifdef CONFIG_DARWIN
+ status = " - Press ⌃⌥G to exit grab";
+#else
status = " - Press Ctrl-Alt-G to exit grab";
+#endif
}
}
--
2.39.3 (Apple Git-145)
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] ui/sdl2: use correct key names in win title on mac
2023-10-30 2:41 [PATCH] ui/sdl2: use correct key names in win title on mac Adrian Wowk
@ 2023-10-31 10:19 ` Marc-André Lureau
2023-11-02 8:59 ` Philippe Mathieu-Daudé
1 sibling, 0 replies; 3+ messages in thread
From: Marc-André Lureau @ 2023-10-31 10:19 UTC (permalink / raw)
To: Adrian Wowk; +Cc: qemu-devel
On Mon, Oct 30, 2023 at 6:11 PM Adrian Wowk <dev@adrianwowk.com> wrote:
>
> Previously, when using the SDL2 UI on MacOS, the title bar uses incorrect
> key names (such as Ctrl and Alt instead of the standard MacOS key symbols
> like ⌃ and ⌥). This commit changes sdl_update_caption in ui/sdl2.c to
> use the correct symbols when compiling for MacOS (CONFIG_DARWIN is
> defined).
>
> Unfortunately, standard Mac keyboards do not include a "Right-Ctrl" key,
> so in the case that the SDL grab mode is set to HOT_KEY_MOD_RCTRL, the
> default text is still used.
>
> Signed-off-by: Adrian Wowk <dev@adrianwowk.com>
Acked-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> ---
> Hi! I created this patch after having to compile QEMU from source with the SDL UI enabled to avoid an unrelated bug in the Cocoa UI. I noticed that the title of the window was not correct so I added a quick fix. I have tested this change on MacOS Sonoma (Version 14.1), and it works as expected. I did my best to ensure correctness, but this is my first time contrbuting to QEMU (and also my first time sending git patches over email), so if there is anything I can do better then please let me know. Thank You!
>
> ui/sdl2.c | 8 ++++++++
> 1 file changed, 8 insertions(+)
>
> diff --git a/ui/sdl2.c b/ui/sdl2.c
> index fbfdb64e90..4971963f00 100644
> --- a/ui/sdl2.c
> +++ b/ui/sdl2.c
> @@ -172,11 +172,19 @@ static void sdl_update_caption(struct sdl2_console *scon)
> status = " [Stopped]";
> } else if (gui_grab) {
> if (alt_grab) {
> +#ifdef CONFIG_DARWIN
> + status = " - Press ⌃⌥⇧G to exit grab";
> +#else
> status = " - Press Ctrl-Alt-Shift-G to exit grab";
> +#endif
> } else if (ctrl_grab) {
> status = " - Press Right-Ctrl-G to exit grab";
> } else {
> +#ifdef CONFIG_DARWIN
> + status = " - Press ⌃⌥G to exit grab";
> +#else
> status = " - Press Ctrl-Alt-G to exit grab";
> +#endif
> }
> }
>
> --
> 2.39.3 (Apple Git-145)
>
>
--
Marc-André Lureau
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] ui/sdl2: use correct key names in win title on mac
2023-10-30 2:41 [PATCH] ui/sdl2: use correct key names in win title on mac Adrian Wowk
2023-10-31 10:19 ` Marc-André Lureau
@ 2023-11-02 8:59 ` Philippe Mathieu-Daudé
1 sibling, 0 replies; 3+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-11-02 8:59 UTC (permalink / raw)
To: Adrian Wowk, qemu-devel
On 30/10/23 03:41, Adrian Wowk wrote:
> Previously, when using the SDL2 UI on MacOS, the title bar uses incorrect
> key names (such as Ctrl and Alt instead of the standard MacOS key symbols
> like ⌃ and ⌥). This commit changes sdl_update_caption in ui/sdl2.c to
> use the correct symbols when compiling for MacOS (CONFIG_DARWIN is
> defined).
>
> Unfortunately, standard Mac keyboards do not include a "Right-Ctrl" key,
> so in the case that the SDL grab mode is set to HOT_KEY_MOD_RCTRL, the
> default text is still used.
>
> Signed-off-by: Adrian Wowk <dev@adrianwowk.com>
> ---
> Hi! I created this patch after having to compile QEMU from source with the SDL UI enabled to avoid an unrelated bug in the Cocoa UI. I noticed that the title of the window was not correct so I added a quick fix. I have tested this change on MacOS Sonoma (Version 14.1), and it works as expected. I did my best to ensure correctness, but this is my first time contrbuting to QEMU (and also my first time sending git patches over email), so if there is anything I can do better then please let me know. Thank You!
Tested-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
And patch queued, thank you for your contribution!
>
> ui/sdl2.c | 8 ++++++++
> 1 file changed, 8 insertions(+)
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-11-02 9:00 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-10-30 2:41 [PATCH] ui/sdl2: use correct key names in win title on mac Adrian Wowk
2023-10-31 10:19 ` Marc-André Lureau
2023-11-02 8:59 ` Philippe Mathieu-Daudé
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).