Revision a528b80c vnc.c

b/vnc.c
284 284
	exit(1);
285 285
    }
286 286

  
287
    ds->depth = vs->depth * 8;
287
    if (ds->depth != vs->depth * 8) {
288
        ds->depth = vs->depth * 8;
289
        console_color_init(ds);
290
    }
288 291
    size_changed = ds->width != w || ds->height != h;
289 292
    ds->width = w;
290 293
    ds->height = h;
......
907 910
    }
908 911
}
909 912

  
913
static void press_key(VncState *vs, int keysym)
914
{
915
    kbd_put_keycode(keysym2scancode(vs->kbd_layout, keysym) & 0x7f);
916
    kbd_put_keycode(keysym2scancode(vs->kbd_layout, keysym) | 0x80);
917
}
918

  
910 919
static void do_key_event(VncState *vs, int down, uint32_t sym)
911 920
{
912 921
    int keycode;
......
934 943
            return;
935 944
        }
936 945
        break;
946
    case 0x45:			/* NumLock */
947
        if (!down)
948
            vs->modifiers_state[keycode] ^= 1;
949
        break;
950
    }
951

  
952
    if (keycode_is_keypad(vs->kbd_layout, keycode)) {
953
        /* If the numlock state needs to change then simulate an additional
954
           keypress before sending this one.  This will happen if the user
955
           toggles numlock away from the VNC window.
956
        */
957
        if (keysym_is_numlock(vs->kbd_layout, sym & 0xFFFF)) {
958
            if (!vs->modifiers_state[0x45]) {
959
                vs->modifiers_state[0x45] = 1;
960
                press_key(vs, 0xff7f);
961
            }
962
        } else {
963
            if (vs->modifiers_state[0x45]) {
964
                vs->modifiers_state[0x45] = 0;
965
                press_key(vs, 0xff7f);
966
            }
967
        }
937 968
    }
938 969

  
939 970
    if (is_graphic_console()) {
......
991 1022

  
992 1023
static void key_event(VncState *vs, int down, uint32_t sym)
993 1024
{
994
    if (sym >= 'A' && sym <= 'Z')
1025
    if (sym >= 'A' && sym <= 'Z' && is_graphic_console())
995 1026
	sym = sym - 'A' + 'a';
996 1027
    do_key_event(vs, down, sym);
997 1028
}

Also available in: Unified diff