All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] ui/cocoa.m: Allow console selection using keypad number keys
@ 2016-03-03  3:34 Programmingkid
  2016-03-03 16:26 ` Eric Blake
  2016-03-03 16:53 ` Peter Maydell
  0 siblings, 2 replies; 8+ messages in thread
From: Programmingkid @ 2016-03-03  3:34 UTC (permalink / raw)
  To: Peter Maydell; +Cc: qemu-devel qemu-devel

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

Signed-off-by: John Arbuckle <programmingkidx@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

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

end of thread, other threads:[~2016-03-03 16:57 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-03  3:34 [Qemu-devel] [PATCH] ui/cocoa.m: Allow console selection using keypad number keys Programmingkid
2016-03-03 16:26 ` Eric Blake
2016-03-03 16:32   ` Programmingkid
2016-03-03 16:49     ` Peter Maydell
2016-03-03 16:49     ` Eric Blake
2016-03-03 16:53       ` Programmingkid
2016-03-03 16:53 ` Peter Maydell
2016-03-03 16:57   ` Programmingkid

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.