qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v5 0/2] cocoa: keyboard quality of life


From: Programmingkid
Subject: Re: [PATCH v5 0/2] cocoa: keyboard quality of life
Date: Thu, 15 Jul 2021 16:53:20 -0400

> From: Gustavo Noronha Silva <gustavo@noronha.dev.br>
> 
> v5 addresses the casting issue pointed out by Akihiko Odaki.
> Sorry it took me so long to update the patches, but here
> they are! Hopefully we can get them in now ;D
> 
> Btw I also changed my email address slightly (.dev.br
> instead of .eti.br).
> 
> -----
> 
> This series adds two new options to the cocoa display:
> 
> - full-grab causes it to use a global tap to steal system combos
>   away from Mac OS X, so they can be handled by the VM
> 
> - swap-option-command does what it says on the tin; while that is
>   something you can do at the Mac OS X level or even supported by
>   some keyboards, it is much more convenient to have qemu put
>   Meta/Super and Alt where they belong if you are running a
>   non-Mac VM
> 
> Both are off by default. For full-grab in particular, it is off also
> because unfortunately it needs accessibility permissions for input
> grabbing, so it requires more deliberate action by the user anyway.
> 
> Gustavo Noronha Silva (2):
>  ui/cocoa: capture all keys and combos when mouse is grabbed
>  ui/cocoa: add option to swap Option and Command
> 
> qapi/ui.json    |  22 +++++++++
> qemu-options.hx |   4 ++
> ui/cocoa.m      | 129 ++++++++++++++++++++++++++++++++++++++++++++----
> 3 files changed, 146 insertions(+), 9 deletions(-)
> 
> -- 
> 2.30.1 (Apple Git-130)

I could not make the full-grab feature work. I tried this:
./build/qemu-system-ppc -display cocoa,full_grab=on

This is the error message I saw:
qemu-system-ppc: -display cocoa,full_grab=on: Parameter 'full_grab' is 
unexpected

The command and option key swapping feature does work. This should be a very 
useful feature to those with a PC keyboard.

I totally suggest that a new menu called Options be made with these features 
added. 

This is how it could look like:

Options
- Full Keyboard Grab
- Swap Command and Option Keys

Right now the user has to restart QEMU if he or she wants to swap the command 
and options keys to initiate a full keyboard grab. This is not fun. With a menu 
the user could change these options while QEMU remains running.

This code can be used to add the Options menu:

 ui/cocoa.m | 137 +++++++++++++++++++++++++++++++++++++++++++++++++----
 1 file changed, 128 insertions(+), 9 deletions(-)

diff --git a/ui/cocoa.m b/ui/cocoa.m
index 9f72844b07..de85305c7a 100644
--- a/ui/cocoa.m
+++ b/ui/cocoa.m

@@ -1655,6 +1755,14 @@ static void create_initial_menus(void)
     [menuItem setSubmenu:menu];
     [[NSApp mainMenu] addItem:menuItem];
 
+    // Options menu
+    menu = [[NSMenu alloc] initWithTitle:@"Options"];
+    [menu addItem: [[[NSMenuItem alloc] initWithTitle:@"Full Keyboard Grab" 
action:@selector(setFullGrab:) keyEquivalent:@""] autorelease]];
+    [menu addItem: [[[NSMenuItem alloc] initWithTitle:@"Swap Command and 
Option Keys" action:@selector(setSwapOptionCommand:) keyEquivalent:@""] 
autorelease]];
+    menuItem = [[[NSMenuItem alloc] initWithTitle:@"Options" action:nil 
keyEquivalent:@""] autorelease];
+    [menuItem setSubmenu:menu];
+    [[NSApp mainMenu] addItem:menuItem];
+
     // Window menu
     menu = [[NSMenu alloc] initWithTitle:@"Window"];
     [menu addItem: [[[NSMenuItem alloc] initWithTitle:@"Minimize" 
action:@selector(performMiniaturize:) keyEquivalent:@"m"] autorelease]]; // 
Miniaturize


To be able to check and uncheck menu items you could see the method 
(void)adjustSpeed:(id)sender.

Please let me know if there is anything else I could do to help.

Thank you.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]