qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH 2/2] ui/cocoa.m: send ctrl-alt key combinations to guest if not used by QEMU
@ 2017-08-21 20:52 John Arbuckle
  2017-08-21 20:52 ` [Qemu-devel] [PATCH 0/2] ui/cocoa.m: enable guest to see control-alt key combinations John Arbuckle
  2017-08-21 20:52 ` [Qemu-devel] [PATCH 1/2] ui/cocoa.m: move ungrab to ctrl-alt-g John Arbuckle
  0 siblings, 2 replies; 3+ messages in thread
From: John Arbuckle @ 2017-08-21 20:52 UTC (permalink / raw)
  To: qemu-devel@nongnu.org qemu-devel peter . maydell @ linaro . org
  Cc: John Arbuckle

Send control-alt key combinations to the guest if not used by the user interface.

Signed-off-by: John Arbuckle <programmingkidx@gmail.com>
---
 ui/cocoa.m | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/ui/cocoa.m b/ui/cocoa.m
index d3e7907103..6920ea38aa 100644
--- a/ui/cocoa.m
+++ b/ui/cocoa.m
@@ -634,6 +634,14 @@ - (void) handleEvent:(NSEvent *)event
                     case Q_KEY_CODE_G:
                         [self ungrabMouse];
                         break;
+
+                    // send to the guest
+                    default:
+                        if (qemu_console_is_graphic(NULL)) {
+                            qemu_input_event_send_key_qcode(dcl->con, keycode,
+                                                            true);
+                        }
+                    break;
                 }
 
             // handle keys for graphic console
-- 
2.11.0 (Apple Git-81)

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [Qemu-devel] [PATCH 0/2] ui/cocoa.m: enable guest to see control-alt key combinations
  2017-08-21 20:52 [Qemu-devel] [PATCH 2/2] ui/cocoa.m: send ctrl-alt key combinations to guest if not used by QEMU John Arbuckle
@ 2017-08-21 20:52 ` John Arbuckle
  2017-08-21 20:52 ` [Qemu-devel] [PATCH 1/2] ui/cocoa.m: move ungrab to ctrl-alt-g John Arbuckle
  1 sibling, 0 replies; 3+ messages in thread
From: John Arbuckle @ 2017-08-21 20:52 UTC (permalink / raw)
  To: qemu-devel@nongnu.org qemu-devel peter . maydell @ linaro . org
  Cc: John Arbuckle

Currently if the user needs to send a control-alt key combination, he or she was either out of luck or had to rely on the monitor's sendkey command to do so. With this patch the user can now directly send control-alt key combinations. This is great for Windows guest that may need the control-alt-delete key combination. 

John Arbuckle (2):
  move ungrab to ctrl-alt-g
  send ctrl-alt key combinations to guest if not used by QEMU

 ui/cocoa.m | 23 ++++++++++++++++-------
 1 file changed, 16 insertions(+), 7 deletions(-)

-- 
2.11.0 (Apple Git-81)

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Qemu-devel] [PATCH 1/2] ui/cocoa.m: move ungrab to ctrl-alt-g
  2017-08-21 20:52 [Qemu-devel] [PATCH 2/2] ui/cocoa.m: send ctrl-alt key combinations to guest if not used by QEMU John Arbuckle
  2017-08-21 20:52 ` [Qemu-devel] [PATCH 0/2] ui/cocoa.m: enable guest to see control-alt key combinations John Arbuckle
@ 2017-08-21 20:52 ` John Arbuckle
  1 sibling, 0 replies; 3+ messages in thread
From: John Arbuckle @ 2017-08-21 20:52 UTC (permalink / raw)
  To: qemu-devel@nongnu.org qemu-devel peter . maydell @ linaro . org
  Cc: John Arbuckle

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 --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) {
-- 
2.11.0 (Apple Git-81)

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-08-21 20:52 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-08-21 20:52 [Qemu-devel] [PATCH 2/2] ui/cocoa.m: send ctrl-alt key combinations to guest if not used by QEMU John Arbuckle
2017-08-21 20:52 ` [Qemu-devel] [PATCH 0/2] ui/cocoa.m: enable guest to see control-alt key combinations John Arbuckle
2017-08-21 20:52 ` [Qemu-devel] [PATCH 1/2] ui/cocoa.m: move ungrab to ctrl-alt-g John Arbuckle

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).