mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-06 01:03:55 -06:00
ui/cocoa: add option to disable left-command forwarding to guest
When switching between guest and host on a Mac using command-tab the command key is sent to the guest which can trigger functionality in the guest OS. Specifying left-command-key=off disables forwarding this key to the guest. Defaults to enabled. Also updated the cocoa display documentation to reference the new left-command-key option along with the existing show-cursor option. Signed-off-by: Carwyn Ellis <carwynellis@gmail.com> Reviewed-by: Akihiko Odaki <akihiko.odaki@gmail.com> [PMD: Set QAPI structure @since tag to 7.0] Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
This commit is contained in:
parent
9459262dc4
commit
48941a52c2
3 changed files with 37 additions and 1 deletions
|
@ -95,6 +95,7 @@ static DisplayChangeListener dcl = {
|
|||
};
|
||||
static int last_buttons;
|
||||
static int cursor_hide = 1;
|
||||
static int left_command_key_enabled = 1;
|
||||
|
||||
static int gArgc;
|
||||
static char **gArgv;
|
||||
|
@ -853,7 +854,8 @@ QemuCocoaView *cocoaView;
|
|||
/* 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) {
|
||||
[self toggleKey:Q_KEY_CODE_META_L];
|
||||
}
|
||||
break;
|
||||
|
@ -2002,6 +2004,10 @@ static void cocoa_display_init(DisplayState *ds, DisplayOptions *opts)
|
|||
cursor_hide = 0;
|
||||
}
|
||||
|
||||
if (opts->u.cocoa.has_left_command_key && !opts->u.cocoa.left_command_key) {
|
||||
left_command_key_enabled = 0;
|
||||
}
|
||||
|
||||
// register vga output callbacks
|
||||
register_displaychangelistener(&dcl);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue