提交 5929e36c 编写于 作者: J John Arbuckle 提交者: Peter Maydell

ui/cocoa.m: move ungrab to ctrl-alt-g

Currently the cocoa user interface relis on the user pushing
control-alt to ungrab the mouse.  This is patch changes the key
combination to control-alt-g to be in line with the GTK user
interface.
Signed-off-by: NJohn Arbuckle <programmingkidx@gmail.com>
Message-id: 20171102213907.11443-1-programmingkidx@gmail.com
Reviewed-by: NPeter Maydell <peter.maydell@linaro.org>
Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
上级 9c3a418e
......@@ -674,10 +674,6 @@ QemuCocoaView *cocoaView;
}
}
// release Mouse grab when pressing ctrl+alt
if (([event modifierFlags] & NSEventModifierFlagControl) && ([event modifierFlags] & NSEventModifierFlagOption)) {
[self ungrabMouse];
}
break;
case NSEventTypeKeyDown:
keycode = cocoa_keycode_to_qemu([event keyCode]);
......@@ -690,14 +686,23 @@ QemuCocoaView *cocoaView;
// default
// handle control + alt Key Combos (ctrl+alt is reserved for QEMU)
// handle control + alt Key Combos (ctrl+alt+[1..9,g] is reserved for QEMU)
if (([event modifierFlags] & NSEventModifierFlagControl) && ([event modifierFlags] & NSEventModifierFlagOption)) {
switch (keycode) {
// enable graphic console
case Q_KEY_CODE_1 ... Q_KEY_CODE_9: // '1' to '9' keys
console_select(keycode - Q_KEY_CODE_1);
break;
NSString *keychar = [event charactersIgnoringModifiers];
if ([keychar length] == 1) {
char key = [keychar characterAtIndex:0];
switch (key) {
// enable graphic console
case '1' ... '9':
console_select(key - '0' - 1); /* ascii math */
return;
// release the mouse grab
case 'g':
[self ungrabMouse];
return;
}
}
// handle keys for graphic console
......@@ -840,9 +845,9 @@ QemuCocoaView *cocoaView;
if (!isFullscreen) {
if (qemu_name)
[normalWindow setTitle:[NSString stringWithFormat:@"QEMU %s - (Press ctrl + alt to release Mouse)", qemu_name]];
[normalWindow setTitle:[NSString stringWithFormat:@"QEMU %s - (Press ctrl + alt + g to release Mouse)", qemu_name]];
else
[normalWindow setTitle:@"QEMU - (Press ctrl + alt to release Mouse)"];
[normalWindow setTitle:@"QEMU - (Press ctrl + alt + g to release Mouse)"];
}
[self hideCursor];
if (!isAbsoluteEnabled) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册