vnc: fix ctrl key in vnc terminal emulation

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>
This commit is contained in:
Gerd Hoffmann 2011-11-08 10:02:16 +01:00
parent ce3e14175e
commit e26437c2d4
1 changed files with 8 additions and 2 deletions

View File

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