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

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

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