diff mbox

[1/2] ui/cocoa.m: move ungrab to ctrl-alt-g

Message ID 20170821205225.3401-3-programmingkidx@gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Programmingkid Aug. 21, 2017, 8:52 p.m. UTC
Currently the cocoa user interface relys 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>
---
 ui/cocoa.m | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)
diff mbox

Patch

diff --git a/ui/cocoa.m b/ui/cocoa.m
index 93e56d0518..d3e7907103 100644
--- a/ui/cocoa.m
+++ b/ui/cocoa.m
@@ -609,10 +609,6 @@  - (void) handleEvent:(NSEvent *)event
                 }
             }
 
-            // 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]);
@@ -625,7 +621,7 @@  - (void) handleEvent:(NSEvent *)event
 
             // 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) {
 
@@ -633,6 +629,11 @@  - (void) handleEvent:(NSEvent *)event
                     case Q_KEY_CODE_1 ... Q_KEY_CODE_9: // '1' to '9' keys
                         console_select(keycode - 11);
                         break;
+
+                    // release the mouse grab
+                    case Q_KEY_CODE_G:
+                        [self ungrabMouse];
+                        break;
                 }
 
             // handle keys for graphic console
@@ -806,9 +807,9 @@  - (void) grabMouse
 
     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) {