]> git.proxmox.com Git - mirror_qemu.git/commitdiff
vnc: fix ctrl key in vnc terminal emulation
authorGerd Hoffmann <kraxel@redhat.com>
Tue, 8 Nov 2011 09:02:16 +0000 (10:02 +0100)
committerGerd Hoffmann <kraxel@redhat.com>
Fri, 10 Feb 2012 08:58:33 +0000 (09:58 +0100)
Make the control keys for terminals on the vnc display
(i.e. qemu -vnc :0 -serial vc) work.  Makes the terminals
alot more usable as typing Ctrl-C in your serial console
actually has the desired effect ;)

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
ui/vnc.c

index 5752bf87405ea286bd0f02d63b95d3dfdcd2bda2..810582b13a5cc28bdda7ebf356b91d31a8b33a5a 100644 (file)
--- a/ui/vnc.c
+++ b/ui/vnc.c
@@ -1552,9 +1552,11 @@ static void do_key_event(VncState *vs, int down, int keycode, int sym)
         else
             kbd_put_keycode(keycode | SCANCODE_UP);
     } else {
+        bool numlock = vs->modifiers_state[0x45];
+        bool control = (vs->modifiers_state[0x1d] ||
+                        vs->modifiers_state[0x9d]);
         /* QEMU console emulation */
         if (down) {
-            int numlock = vs->modifiers_state[0x45];
             switch (keycode) {
             case 0x2a:                          /* Left Shift */
             case 0x36:                          /* Right Shift */
@@ -1642,7 +1644,11 @@ static void do_key_event(VncState *vs, int down, int keycode, int sym)
                 break;
 
             default:
-                kbd_put_keysym(sym);
+                if (control) {
+                    kbd_put_keysym(sym & 0x1f);
+                } else {
+                    kbd_put_keysym(sym);
+                }
                 break;
             }
         }