From: Peter Maydell <peter.maydell@linaro.org>
To: qemu-devel@nongnu.org
Cc: programmingkidx@gmail.com
Subject: [Qemu-devel] [PULL 2/3] ui/cocoa.m: move ungrab to ctrl-alt-g
Date: Tue, 7 Nov 2017 10:16:01 +0000 [thread overview]
Message-ID: <1510049762-4609-3-git-send-email-peter.maydell@linaro.org> (raw)
In-Reply-To: <1510049762-4609-1-git-send-email-peter.maydell@linaro.org>
From: John Arbuckle <programmingkidx@gmail.com>
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: John Arbuckle <programmingkidx@gmail.com>
Message-id: 20171102213907.11443-1-programmingkidx@gmail.com
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
ui/cocoa.m | 31 ++++++++++++++++++-------------
1 file changed, 18 insertions(+), 13 deletions(-)
diff --git a/ui/cocoa.m b/ui/cocoa.m
index 2f76dac..f39c792 100644
--- a/ui/cocoa.m
+++ b/ui/cocoa.m
@@ -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) {
--
2.7.4
next prev parent reply other threads:[~2017-11-07 10:15 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-11-07 10:15 [Qemu-devel] [PULL 0/3] cocoa queue Peter Maydell
2017-11-07 10:16 ` [Qemu-devel] [PULL 1/3] ui/cocoa.m: Make scrolling work again in GUI monitor windows Peter Maydell
2017-11-07 10:16 ` Peter Maydell [this message]
2017-11-08 12:04 ` [Qemu-devel] [PULL 2/3] ui/cocoa.m: move ungrab to ctrl-alt-g Programmingkid
2017-11-08 14:27 ` Eric Blake
2017-11-07 10:16 ` [Qemu-devel] [PULL 3/3] ui/cocoa.m: Send ctrl-alt key combos to guest if QEMU isn't using them Peter Maydell
2017-11-07 12:53 ` [Qemu-devel] [PULL 0/3] cocoa queue Peter Maydell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1510049762-4609-3-git-send-email-peter.maydell@linaro.org \
--to=peter.maydell@linaro.org \
--cc=programmingkidx@gmail.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).