Revision 6b132502 vnc.c

b/vnc.c
1377 1377
        }
1378 1378
    }
1379 1379

  
1380
    if ((sym >= 'A' && sym <= 'Z') || (sym >= 'a' && sym <= 'z')) {
1381
        /* If the capslock state needs to change then simulate an additional
1382
           keypress before sending this one.  This will happen if the user
1383
           toggles capslock away from the VNC window.
1384
        */
1385
        int uppercase = !!(sym >= 'A' && sym <= 'Z');
1386
        int shift = !!(vs->modifiers_state[0x2a] | vs->modifiers_state[0x36]);
1387
        int capslock = !!(vs->modifiers_state[0x3a]);
1388
        if (capslock) {
1389
            if (uppercase == shift) {
1390
                vs->modifiers_state[0x3a] = 0;
1391
                press_key(vs, 0xffe5);
1392
            }
1393
        } else {
1394
            if (uppercase != shift) {
1395
                vs->modifiers_state[0x3a] = 1;
1396
                press_key(vs, 0xffe5);
1397
            }
1398
        }
1399
    }
1400

  
1380 1401
    if (is_graphic_console()) {
1381 1402
        if (keycode & 0x80)
1382 1403
            kbd_put_keycode(0xe0);

Also available in: Unified diff