qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH again] Adds the ability to use the command key in the guest operating system.
@ 2013-08-16 12:04 G 3
  0 siblings, 0 replies; only message in thread
From: G 3 @ 2013-08-16 12:04 UTC (permalink / raw)
  To: qemu-ppc, qemu-devel, afaerber, Peter Maydell

[-- Attachment #1: Type: text/plain, Size: 2654 bytes --]

Resent to fix wrapping that took place.

Signed-off-by: John Arbuckle <programmingkidx@gmail.com>

Deciding when and how to send the command key has not been easy. A simple
protocol that this patch implements is send the command key to the guest
operating system when the mouse is grabbed. Otherwise send the command key
to QEMU.

---
 ui/cocoa.m |   21 ++++++++++++---------
 1 files changed, 12 insertions(+), 9 deletions(-)

diff --git a/ui/cocoa.m b/ui/cocoa.m
index be49179..9a57f57 100644
--- a/ui/cocoa.m
+++ b/ui/cocoa.m
@@ -129,8 +129,8 @@ int keymap[] =
     14, //  51      0x33    0x0e            BKSP    QZ_BACKSPACE
     0,  //  52      0x34    Undefined
     1,  //  53      0x35    0x01            ESC     QZ_ESCAPE
-    0,  //  54      0x36                            QZ_RMETA
-    0,  //  55      0x37                            QZ_LMETA
+    219,//  54      0x36                            QZ_RMETA
+    219,//  55      0x37                            QZ_LMETA
     42, //  56      0x38    0x2a            L SHFT  QZ_LSHIFT
     58, //  57      0x39    0x3a            CAPS    QZ_CAPSLOCK
     56, //  58      0x3A    0x38            L ALT   QZ_LALT
@@ -512,21 +512,24 @@ QemuCocoaView *cocoaView;
             }

             // release Mouse grab when pressing ctrl+alt
-            if (!isFullscreen && ([event modifierFlags] &
NSControlKeyMask) && ([event modifierFlags] & NSAlternateKeyMask)) {
+            if (([event modifierFlags] & NSControlKeyMask) && ([event
modifierFlags] & NSAlternateKeyMask)) {
                 [self ungrabMouse];
             }
             break;
         case NSKeyDown:
+            keycode = cocoa_keycode_to_qemu([event keyCode]);

-            // forward command Key Combos
+            // if command key is down
             if ([event modifierFlags] & NSCommandKeyMask) {
-                [NSApp sendEvent:event];
-                return;
+                if (isMouseGrabed == YES) {    // if sending the command
key to the guest
+                    kbd_put_keycode(219);      // send command key
+                    kbd_put_keycode(keycode);  // send any other key
+                } else {                       // if sending the command
key to QEMU
+                    [NSApp sendEvent:event];
+                    return;
+                }
             }

-            // default
-            keycode = cocoa_keycode_to_qemu([event keyCode]);
-
             // handle control + alt Key Combos (ctrl+alt is reserved for
QEMU)
             if (([event modifierFlags] & NSControlKeyMask) && ([event
modifierFlags] & NSAlternateKeyMask)) {
                 switch (keycode) {
-- 
1.7.5.4

[-- Attachment #2: Type: text/html, Size: 3441 bytes --]

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2013-08-16 12:04 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-08-16 12:04 [Qemu-devel] [PATCH again] Adds the ability to use the command key in the guest operating system G 3

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