[PATCH] ui/cocoa: Respect left-command-key option

Akihiko Odaki posted 1 patch 2 years, 1 month ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20220317152949.68666-1-akihiko.odaki@gmail.com
Test checkpatch passed
Maintainers: Peter Maydell <peter.maydell@linaro.org>, "Philippe Mathieu-Daudé" <f4bug@amsat.org>, Akihiko Odaki <akihiko.odaki@gmail.com>, Gerd Hoffmann <kraxel@redhat.com>
ui/cocoa.m | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
[PATCH] ui/cocoa: Respect left-command-key option
Posted by Akihiko Odaki 2 years, 1 month ago
Signed-off-by: Akihiko Odaki <akihiko.odaki@gmail.com>
---
 ui/cocoa.m | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/ui/cocoa.m b/ui/cocoa.m
index cb6e7c41dc6..c4e5468f9e6 100644
--- a/ui/cocoa.m
+++ b/ui/cocoa.m
@@ -923,7 +923,8 @@ - (bool) handleEventLocked:(NSEvent *)event
                 /* Don't pass command key changes to guest unless mouse is grabbed */
                 case kVK_Command:
                     if (isMouseGrabbed &&
-                        !!(modifiers & NSEventModifierFlagCommand)) {
+                        !!(modifiers & NSEventModifierFlagCommand) &&
+                        left_command_key_enabled) {
                         if (swap_opt_cmd) {
                             [self toggleKey:Q_KEY_CODE_ALT];
                         } else {
-- 
2.32.0 (Apple Git-132)
Re: [PATCH-for-7.0] ui/cocoa: Respect left-command-key option
Posted by Philippe Mathieu-Daudé 2 years, 1 month ago
On 17/3/22 16:29, Akihiko Odaki wrote:
> Signed-off-by: Akihiko Odaki <akihiko.odaki@gmail.com>
> ---
>   ui/cocoa.m | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/ui/cocoa.m b/ui/cocoa.m
> index cb6e7c41dc6..c4e5468f9e6 100644
> --- a/ui/cocoa.m
> +++ b/ui/cocoa.m
> @@ -923,7 +923,8 @@ - (bool) handleEventLocked:(NSEvent *)event
>                   /* Don't pass command key changes to guest unless mouse is grabbed */
>                   case kVK_Command:
>                       if (isMouseGrabbed &&
> -                        !!(modifiers & NSEventModifierFlagCommand)) {
> +                        !!(modifiers & NSEventModifierFlagCommand) &&
> +                        left_command_key_enabled) {

My bad for trying to resolve merge conflict myself sigh :(

Fixes: 4797adce5f ("ui/cocoa: add option to swap Option and Command")
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>

>                           if (swap_opt_cmd) {
>                               [self toggleKey:Q_KEY_CODE_ALT];
>                           } else {

Re: [PATCH] ui/cocoa: Respect left-command-key option
Posted by Philippe Mathieu-Daudé 2 years, 1 month ago
On 17/3/22 16:29, Akihiko Odaki wrote:
> Signed-off-by: Akihiko Odaki <akihiko.odaki@gmail.com>
> ---
>   ui/cocoa.m | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)

Thanks, queued to darwin-fixes.