Revision 3a0558b5

b/vnc.c
1110 1110
    }
1111 1111

  
1112 1112
    vnc_remove_timer(vs->vd);
1113
    qemu_remove_led_event_handler(vs->led);
1113
    if (vs->vd->lock_key_sync)
1114
        qemu_remove_led_event_handler(vs->led);
1114 1115
    qemu_free(vs);
1115 1116
}
1116 1117

  
......
1549 1550
        break;
1550 1551
    }
1551 1552

  
1552
    if (keycode_is_keypad(vs->vd->kbd_layout, keycode)) {
1553
    if (vs->vd->lock_key_sync &&
1554
        keycode_is_keypad(vs->vd->kbd_layout, keycode)) {
1553 1555
        /* If the numlock state needs to change then simulate an additional
1554 1556
           keypress before sending this one.  This will happen if the user
1555 1557
           toggles numlock away from the VNC window.
......
1567 1569
        }
1568 1570
    }
1569 1571

  
1570
    if ((sym >= 'A' && sym <= 'Z') || (sym >= 'a' && sym <= 'z')) {
1572
    if (vs->vd->lock_key_sync &&
1573
        ((sym >= 'A' && sym <= 'Z') || (sym >= 'a' && sym <= 'z'))) {
1571 1574
        /* If the capslock state needs to change then simulate an additional
1572 1575
           keypress before sending this one.  This will happen if the user
1573 1576
           toggles capslock away from the VNC window.
......
2430 2433
    vnc_flush(vs);
2431 2434
    vnc_read_when(vs, protocol_version, 12);
2432 2435
    reset_keys(vs);
2433
    vs->led = qemu_add_led_event_handler(kbd_leds, vs);
2436
    if (vs->vd->lock_key_sync)
2437
        vs->led = qemu_add_led_event_handler(kbd_leds, vs);
2434 2438

  
2435 2439
    vnc_init_timer(vd);
2436 2440

  
......
2551 2555
    int saslErr;
2552 2556
#endif
2553 2557
    int acl = 0;
2558
    int lock_key_sync = 1;
2554 2559

  
2555 2560
    if (!vnc_display)
2556 2561
        return -1;
......
2568 2573
            password = 1; /* Require password auth */
2569 2574
        } else if (strncmp(options, "reverse", 7) == 0) {
2570 2575
            reverse = 1;
2576
        } else if (strncmp(options, "no-lock-key-sync", 9) == 0) {
2577
            lock_key_sync = 0;
2571 2578
#ifdef CONFIG_VNC_SASL
2572 2579
        } else if (strncmp(options, "sasl", 4) == 0) {
2573 2580
            sasl = 1; /* Require SASL auth */
......
2713 2720
        return -1;
2714 2721
    }
2715 2722
#endif
2723
    vs->lock_key_sync = lock_key_sync;
2716 2724

  
2717 2725
    if (reverse) {
2718 2726
        /* connect to viewer */
b/vnc.h
99 99
    int lsock;
100 100
    DisplayState *ds;
101 101
    kbd_layout_t *kbd_layout;
102
    int lock_key_sync;
102 103

  
103 104
    struct VncSurface guest;   /* guest visible surface (aka ds->surface) */
104 105
    DisplaySurface *server;  /* vnc server surface */

Also available in: Unified diff