ia64/xen-unstable

changeset 12706:582d21e2d3cd

[QEMU] Do shift-key processing in QEMU monitor terminal when connected via VNC.
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
author kfraser@localhost.localdomain
date Thu Nov 30 17:47:50 2006 +0000 (2006-11-30)
parents b7095209e31a
children c7e33053f59b
files tools/ioemu/vnc.c
line diff
     1.1 --- a/tools/ioemu/vnc.c	Thu Nov 30 17:36:03 2006 +0000
     1.2 +++ b/tools/ioemu/vnc.c	Thu Nov 30 17:47:50 2006 +0000
     1.3 @@ -114,6 +114,7 @@ struct VncState
     1.4      int visible_h;
     1.5  
     1.6      int ctl_keys;               /* Ctrl+Alt starts calibration */
     1.7 +    int shift_keys;             /* Shift / CapsLock keys */
     1.8  };
     1.9  
    1.10  #define DIRTY_PIXEL_BITS 64
    1.11 @@ -870,9 +871,12 @@ static void do_key_event(VncState *vs, i
    1.12      } else if (down) {
    1.13  	int qemu_keysym = 0;
    1.14  
    1.15 -	if (sym <= 128) /* normal ascii */
    1.16 +	if (sym <= 128) { /* normal ascii */
    1.17 +	    int shifted = vs->shift_keys == 1 || vs->shift_keys == 2;
    1.18  	    qemu_keysym = sym;
    1.19 -	else {
    1.20 +	    if (sym >= 'a' && sym <= 'z' && shifted)
    1.21 +	        qemu_keysym -= 'a' - 'A';
    1.22 +	} else {
    1.23  	    switch (sym) {
    1.24  	    case XK_Up: qemu_keysym = QEMU_KEY_UP; break;
    1.25  	    case XK_Down: qemu_keysym = QEMU_KEY_DOWN; break;
    1.26 @@ -903,6 +907,10 @@ static void do_key_event(VncState *vs, i
    1.27  	    vs->ctl_keys |= 2;
    1.28  	    break;
    1.29  
    1.30 +	case XK_Shift_L:
    1.31 +	    vs->shift_keys |= 1;
    1.32 +	    break;
    1.33 +
    1.34  	default:
    1.35  	    break;
    1.36  	}
    1.37 @@ -916,6 +924,14 @@ static void do_key_event(VncState *vs, i
    1.38  	    vs->ctl_keys &= ~2;
    1.39  	    break;
    1.40  
    1.41 +	case XK_Shift_L:
    1.42 +	    vs->shift_keys &= ~1;
    1.43 +	    break;
    1.44 +
    1.45 +	case XK_Caps_Lock:
    1.46 +	    vs->shift_keys ^= 2;
    1.47 +	    break;
    1.48 +
    1.49  	case XK_1 ... XK_9:
    1.50  	    if ((vs->ctl_keys & 3) != 3)
    1.51  		break;