ui/cocoa: user friendly characters for release mouse
PATCH 1/1 ui/cocoa: user friendly characters for release mouse
While mouse is grabbed, window title contains a hint for the user what keyboard keys to press to release the mouse. Make that hint text a bit more user friendly for a Mac user:
- Replace "Ctrl" and "Alt" by appropriate symbols for those keyboard keys typically displayed for them on a Mac (encode those symbols by using UTF-8 characters).
- Drop " + " in between the keys, as that's not common on macOS for documenting keyboard shortcuts.
- Convert lower case "g" to upper case "G", as that's common on macOS.
- Add one additional space at start and end of key stroke set, to visually separate the key strokes from the rest of the text.
--- ui/cocoa.m | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
ui/cocoa.m +5 -2
@@ -72,6 +72,9 @@ #define cgrect(nsrect) (*(CGRect *)&(nsrect)) +#define UC_CTRL_KEY "\xe2\x8c\x83" +#define UC_ALT_KEY "\xe2\x8c\xa5" + typedef struct { int width; int height;
@@ -1135,9 +1138,9 @@ - (void) grabMouse if (!isFullscreen) { if (qemu_name) - [normalWindow setTitle:[NSString stringWithFormat:@"QEMU %s - (Press ctrl + alt + g to release Mouse)", qemu_name]]; + [normalWindow setTitle:[NSString stringWithFormat:@"QEMU %s - (Press " UC_CTRL_KEY " " UC_ALT_KEY " G to release Mouse)", qemu_name]]; else - [normalWindow setTitle:@"QEMU - (Press ctrl + alt + g to release Mouse)"]; + [normalWindow setTitle:@"QEMU - (Press " UC_CTRL_KEY " " UC_ALT_KEY " G to release Mouse)"]; } [self hideCursor]; CGAssociateMouseAndMouseCursorPosition(isAbsoluteEnabled);
Signature · 1 line
2.32.0 (Apple Git-132)
Quoted 13 lines · CET Christian Schoenebeck
While mouse is grabbed, window title contains a hint for the user what keyboard keys to press to release the mouse. Make that hint text a bit more user friendly for a Mac user:
- Replace "Ctrl" and "Alt" by appropriate symbols for those keyboard keys typically displayed for them on a Mac (encode those symbols by using UTF-8 characters).
- Drop " + " in between the keys, as that's not common on macOS for documenting keyboard shortcuts.
- Convert lower case "g" to upper case "G", as that's common on macOS.
Quoted 7 lines
- Add one additional space at start and end of key stroke set, to visually separate the key strokes from the rest of the text.
Signed-off-by Christian Schoenebeck <[email protected]>--- ui/cocoa.m | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
Screenshot attached how title bar looks like (on Mac hosts) after this change.
Quoted 27 lines
ui/cocoa.m +5
-2@@ -72,6 +72,9 @@ #define cgrect(nsrect) (*(CGRect *)&(nsrect)) +#define UC_CTRL_KEY "\xe2\x8c\x83" +#define UC_ALT_KEY "\xe2\x8c\xa5" + typedef struct { int width; int height;@@ -1135,9 +1138,9 @@ - (void) grabMouse if (!isFullscreen) { if (qemu_name) - [normalWindow setTitle:[NSString stringWithFormat:@"QEMU %s - (Press ctrl + alt + g to release Mouse)", qemu_name]]; + [normalWindow setTitle:[NSString stringWithFormat:@"QEMU %s - (Press " UC_CTRL_KEY " " UC_ALT_KEY " G to release Mouse)", qemu_name]]; else - [normalWindow setTitle:@"QEMU - (Press ctrl + alt + g to release Mouse)"]; + [normalWindow setTitle:@"QEMU - (Press " UC_CTRL_KEY " " UC_ALT_KEY " G to release Mouse)"]; } [self hideCursor]; CGAssociateMouseAndMouseCursorPosition(isAbsoluteEnabled);
Quoted 36 lines · Christian Schoenebeck
While mouse is grabbed, window title contains a hint for the user what keyboard keys to press to release the mouse. Make that hint text a bit more user friendly for a Mac user:
- Replace "Ctrl" and "Alt" by appropriate symbols for those keyboard keys typically displayed for them on a Mac (encode those symbols by using UTF-8 characters).
- Drop " + " in between the keys, as that's not common on macOS for documenting keyboard shortcuts.
- Convert lower case "g" to upper case "G", as that's common on macOS.
- Add one additional space at start and end of key stroke set, to visually separate the key strokes from the rest of the text.
Signed-off-by Christian Schoenebeck <[email protected]>--- ui/cocoa.m | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)ui/cocoa.m +3
-0@@ -72,6 +72,9 @@ #define cgrect(nsrect) (*(CGRect *)&(nsrect)) +#define UC_CTRL_KEY "\xe2\x8c\x83" +#define UC_ALT_KEY "\xe2\x8c\xa5" + typedef struct { int width; int height;
ui/cocoa.m - (void) grabMouse · line 1141
Quoted 5 lines
ui/cocoa.m +1
-1@@ -1135,9 +1138,9 @@ - (void) grabMouse if (!isFullscreen) { if (qemu_name) - [normalWindow setTitle:[NSString stringWithFormat:@"QEMU %s - (Press ctrl + alt + g to release Mouse)", qemu_name]]; + [normalWindow setTitle:[NSString stringWithFormat:@"QEMU %s - (Press " UC_CTRL_KEY " " UC_ALT_KEY " G to release Mouse)", qemu_name]];
I was a bit confused by the control symbol at first and tough I had to press '^'; thus I'm not sure keeping 'ctrl' wouldn't be clearer. The UC_ALT_KEY symbol certainly is. Anyhow,
Quoted 6 lines
ui/cocoa.m +1
-1else - [normalWindow setTitle:@"QEMU - (Press ctrl + alt + g to release Mouse)"]; + [normalWindow setTitle:@"QEMU - (Press " UC_CTRL_KEY " " UC_ALT_KEY " G to release Mouse)"]; } [self hideCursor]; CGAssociateMouseAndMouseCursorPosition(isAbsoluteEnabled);
Quoted 38 lines · CET Philippe Mathieu-Daudé
Quoted 37 lines · Christian Schoenebeck
While mouse is grabbed, window title contains a hint for the user what keyboard keys to press to release the mouse. Make that hint text a bit more user friendly for a Mac user:
- Replace "Ctrl" and "Alt" by appropriate symbols for those keyboard keys typically displayed for them on a Mac (encode those symbols by using UTF-8 characters).
- Drop " + " in between the keys, as that's not common on macOS for documenting keyboard shortcuts.
- Convert lower case "g" to upper case "G", as that's common on macOS.
- Add one additional space at start and end of key stroke set, to visually separate the key strokes from the rest of the text.
Signed-off-by Christian Schoenebeck <[email protected]>--- ui/cocoa.m | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)ui/cocoa.m +3
-0@@ -72,6 +72,9 @@ #define cgrect(nsrect) (*(CGRect *)&(nsrect)) +#define UC_CTRL_KEY "\xe2\x8c\x83" +#define UC_ALT_KEY "\xe2\x8c\xa5" + typedef struct { int width; int height;@@ -1135,9 +1138,9 @@ - (void) grabMouse
Quoted 8 lines
ui/cocoa.m - (void) grabMouse · line 1141
Quoted 4 lines
ui/cocoa.m +1
-1if (!isFullscreen) { if (qemu_name) - [normalWindow setTitle:[NSString stringWithFormat:@"QEMU %s - (Press ctrl + alt + g to release Mouse)", qemu_name]]; + [normalWindow setTitle:[NSString stringWithFormat:@"QEMU %s - (Press " UC_CTRL_KEY " " UC_ALT_KEY " G to release Mouse)", qemu_name]];I was a bit confused by the control symbol at first and tough I had to press '^'; thus I'm not sure keeping 'ctrl' wouldn't be clearer. The
UC_ALT_KEYsymbol certainly is. Anyhow,
It _should_ be clear to Mac users that "^" == "control" key on a Mac keyboard, as that's how it is presented for keyboard shortcuts in all Mac menus. But if it's really irritating then we can also revert that to either "Ctrl" or "control". It's a quick change.
I just got itched by the "Alt" hint actually, which is not printed on any Mac keyboard.
Quoted 2 lines
Reviewed-by Philippe Mathieu-Daudé <[email protected]>
Thanks!
Quoted 9 lines
Quoted 6 lines
ui/cocoa.m +1
-1else - [normalWindow setTitle:@"QEMU - (Press ctrl + alt + g to release Mouse)"]; + [normalWindow setTitle:@"QEMU - (Press " UC_CTRL_KEY " " UC_ALT_KEY " G to release Mouse)"]; } [self hideCursor]; CGAssociateMouseAndMouseCursorPosition(isAbsoluteEnabled);
Quoted 11 lines · CET Christian Schoenebeck
While mouse is grabbed, window title contains a hint for the user what keyboard keys to press to release the mouse. Make that hint text a bit more user friendly for a Mac user:
- Replace "Ctrl" and "Alt" by appropriate symbols for those keyboard keys typically displayed for them on a Mac (encode those symbols by using UTF-8 characters).
- Drop " + " in between the keys, as that's not common on macOS for documenting keyboard shortcuts.
Quoted 7 lines
- Convert lower case "g" to upper case "G", as that's common on macOS.
- Add one additional space at start and end of key stroke set, to visually separate the key strokes from the rest of the text.
Signed-off-by Christian Schoenebeck <[email protected]>---
Ping
Quoted 30 lines
ui/cocoa.m | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)ui/cocoa.m +5
-2@@ -72,6 +72,9 @@ #define cgrect(nsrect) (*(CGRect *)&(nsrect)) +#define UC_CTRL_KEY "\xe2\x8c\x83" +#define UC_ALT_KEY "\xe2\x8c\xa5" + typedef struct { int width; int height;@@ -1135,9 +1138,9 @@ - (void) grabMouse if (!isFullscreen) { if (qemu_name) - [normalWindow setTitle:[NSString stringWithFormat:@"QEMU %s - (Press ctrl + alt + g to release Mouse)", qemu_name]]; + [normalWindow setTitle:[NSString stringWithFormat:@"QEMU %s - (Press " UC_CTRL_KEY " " UC_ALT_KEY " G to release Mouse)", qemu_name]]; else - [normalWindow setTitle:@"QEMU - (Press ctrl + alt + g to release Mouse)"]; + [normalWindow setTitle:@"QEMU - (Press " UC_CTRL_KEY " " UC_ALT_KEY " G to release Mouse)"]; } [self hideCursor]; CGAssociateMouseAndMouseCursorPosition(isAbsoluteEnabled);
Quoted 14 lines · CET Christian Schoenebeck
Quoted 13 lines · CET Christian Schoenebeck
While mouse is grabbed, window title contains a hint for the user what keyboard keys to press to release the mouse. Make that hint text a bit more user friendly for a Mac user:
- Replace "Ctrl" and "Alt" by appropriate symbols for those keyboard keys typically displayed for them on a Mac (encode those symbols by using UTF-8 characters).
- Drop " + " in between the keys, as that's not common on macOS for documenting keyboard shortcuts.
- Convert lower case "g" to upper case "G", as that's common on macOS.
Quoted 7 lines
Quoted 5 lines
- Add one additional space at start and end of key stroke set, to visually separate the key strokes from the rest of the text.
Signed-off-by Christian Schoenebeck <[email protected]>---
Ping
Gerd,
given that I got a RB and TB from Philippe, would you queue this minor macOS patch please?
Best regards,
Christian Schoenebeck
Quoted 34 lines
Quoted 30 lines
ui/cocoa.m | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)ui/cocoa.m +5
-2@@ -72,6 +72,9 @@ #define cgrect(nsrect) (*(CGRect *)&(nsrect)) +#define UC_CTRL_KEY "\xe2\x8c\x83" +#define UC_ALT_KEY "\xe2\x8c\xa5" + typedef struct { int width; int height;@@ -1135,9 +1138,9 @@ - (void) grabMouse if (!isFullscreen) { if (qemu_name) - [normalWindow setTitle:[NSString stringWithFormat:@"QEMU %s - (Press ctrl + alt + g to release Mouse)", qemu_name]]; + [normalWindow setTitle:[NSString stringWithFormat:@"QEMU %s - (Press " UC_CTRL_KEY " " UC_ALT_KEY " G to release Mouse)", qemu_name]]; else - [normalWindow setTitle:@"QEMU - (Press ctrl + alt + g to release Mouse)"]; + [normalWindow setTitle:@"QEMU - (Press " UC_CTRL_KEY " " UC_ALT_KEY " G to release Mouse)"]; } [self hideCursor]; CGAssociateMouseAndMouseCursorPosition(isAbsoluteEnabled);
Quoted 21 lines · Christian Schoenebeck
Quoted 20 lines · CET Christian Schoenebeck
Quoted 18 lines · CET Christian Schoenebeck
While mouse is grabbed, window title contains a hint for the user what keyboard keys to press to release the mouse. Make that hint text a bit more user friendly for a Mac user:
- Replace "Ctrl" and "Alt" by appropriate symbols for those keyboard keys typically displayed for them on a Mac (encode those symbols by using UTF-8 characters).
- Drop " + " in between the keys, as that's not common on macOS for documenting keyboard shortcuts.
- Convert lower case "g" to upper case "G", as that's common on macOS.
- Add one additional space at start and end of key stroke set, to visually separate the key strokes from the rest of the text.
Signed-off-by Christian Schoenebeck <[email protected]>---
Quoted 6 lines
Quoted 1 line
Ping
Gerd,
given that I got a RB and TB from Philippe, would you queue this minor macOS patch please?
Isn't this already merged as 23bdd0de97a18 ?
Regards,
BALATON Zoltan
Quoted 42 lines
Best regards,
Christian SchoenebeckQuoted 34 lines
Quoted 30 lines
ui/cocoa.m | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)ui/cocoa.m +5
-2@@ -72,6 +72,9 @@ #define cgrect(nsrect) (*(CGRect *)&(nsrect)) +#define UC_CTRL_KEY "\xe2\x8c\x83" +#define UC_ALT_KEY "\xe2\x8c\xa5" + typedef struct { int width; int height;@@ -1135,9 +1138,9 @@ - (void) grabMouse if (!isFullscreen) { if (qemu_name) - [normalWindow setTitle:[NSString stringWithFormat:@"QEMU %s - (Press ctrl + alt + g to release Mouse)", qemu_name]]; + [normalWindow setTitle:[NSString stringWithFormat:@"QEMU %s - (Press " UC_CTRL_KEY " " UC_ALT_KEY " G to release Mouse)", qemu_name]]; else - [normalWindow setTitle:@"QEMU - (Press ctrl + alt + g to release Mouse)"]; + [normalWindow setTitle:@"QEMU - (Press " UC_CTRL_KEY " " UC_ALT_KEY " G to release Mouse)"]; } [self hideCursor]; CGAssociateMouseAndMouseCursorPosition(isAbsoluteEnabled);
Quoted 22 lines · CET BALATON Zoltan
Quoted 21 lines · Christian Schoenebeck
Quoted 20 lines · CET Christian Schoenebeck
Quoted 18 lines · CET Christian Schoenebeck
While mouse is grabbed, window title contains a hint for the user what keyboard keys to press to release the mouse. Make that hint text a bit more user friendly for a Mac user:
- Replace "Ctrl" and "Alt" by appropriate symbols for those keyboard keys typically displayed for them on a Mac (encode those symbols by using UTF-8 characters).
- Drop " + " in between the keys, as that's not common on macOS for documenting keyboard shortcuts.
- Convert lower case "g" to upper case "G", as that's common on macOS.
- Add one additional space at start and end of key stroke set, to visually separate the key strokes from the rest of the text.
Signed-off-by Christian Schoenebeck <[email protected]>---
Quoted 8 lines
Quoted 6 lines
Quoted 1 line
Ping
Gerd,
given that I got a RB and TB from Philippe, would you queue this minor macOS patch please?
Isn't this already merged as
23bdd0de97a18?
Ah yes, thanks! Sorry for the noise!
Best regards,
Christian Schoenebeck
Quoted 25 lines · Christian Schoenebeck
Quoted 24 lines · CET BALATON Zoltan
Quoted 23 lines · Christian Schoenebeck
Quoted 21 lines · CET Christian Schoenebeck
Quoted 11 lines · CET Christian Schoenebeck
While mouse is grabbed, window title contains a hint for the user what keyboard keys to press to release the mouse. Make that hint text a bit more user friendly for a Mac user:
- Replace "Ctrl" and "Alt" by appropriate symbols for those keyboard keys typically displayed for them on a Mac (encode those symbols by using UTF-8 characters).
- Drop " + " in between the keys, as that's not common on macOS for documenting keyboard shortcuts.
Quoted 7 lines
- Convert lower case "g" to upper case "G", as that's common on macOS.
- Add one additional space at start and end of key stroke set, to visually separate the key strokes from the rest of the text.
Signed-off-by Christian Schoenebeck <[email protected]>---
Ping
Quoted 8 lines
Quoted 6 lines
Quoted 4 lines
Gerd,
given that I got a RB and TB from Philippe, would you queue this minor macOS patch please?
Isn't this already merged as
23bdd0de97a18?Ah yes, thanks! Sorry for the noise!
Sorry my bad, back then I forgot to reply to the patch mentioning I'd queue this patch.