qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH] ui/cocoa.m: Allow console selection using keypad nu


From: Programmingkid
Subject: [Qemu-devel] [PATCH] ui/cocoa.m: Allow console selection using keypad number keys
Date: Wed, 2 Mar 2016 22:34:07 -0500

This patch allows for the user to use the keypad number keys to select a
console.

Signed-off-by: John Arbuckle <address@hidden>

---
This patch depends on this patch: http://patchwork.ozlabs.org/patch/591221/

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

diff --git a/ui/cocoa.m b/ui/cocoa.m
index 65301ff..d3310bf 100644
--- a/ui/cocoa.m
+++ b/ui/cocoa.m
@@ -562,13 +562,10 @@ QemuCocoaView *cocoaView;
 
             // handle control + alt Key Combos (ctrl+alt is reserved for QEMU)
             if (([event modifierFlags] & NSControlKeyMask) && ([event 
modifierFlags] & NSAlternateKeyMask)) {
-                switch (keycode) {
-
-                    // enable graphic console
-                    case Q_KEY_CODE_1 ... Q_KEY_CODE_9: // '1' to '9' keys
-                        console_select(keycode - 11);
-                        break;
-                }
+                int selected_console = atoi([[event characters]
+                                           cStringUsingEncoding:
+                                           NSASCIIStringEncoding]);
+                console_select(selected_console - 1);
 
             // handle keys for graphic console
             } else if (qemu_console_is_graphic(NULL)) {
-- 
2.7.2





reply via email to

[Prev in Thread] Current Thread [Next in Thread]