[Spice-devel] kbd_push_scan does not take effect for modifier key

bigclouds bigclouds at 163.com
Mon Aug 12 21:52:23 PDT 2013


hi, sometime  modifier key state is not right.

 

Spice-Warning **: inputs_channel.c:442:inputs_channel_handle_parsed: YYYYYY 0 leds=0, modifiers=6
Spice-Warning **: inputs_channel.c:442:inputs_channel_handle_parsed: YYYYYY 1 leds=0, modifiers=6
Spice-Warning **: inputs_channel.c:442:inputs_channel_handle_parsed: YYYYYY 2 leds=0, modifiers=6

 

 

that is my modified code:inputs_channel.c

case SPICE_MSGC_INPUTS_KEY_MODIFIERS: {
        SpiceMsgcKeyModifiers *modifiers = (SpiceMsgcKeyModifiers *)buf;
        uint8_t leds;
        int i = 0;

        if (!keyboard) {
            break;
        }

        for(i=0; i<3; i++){
                leds = kbd_get_leds(keyboard);
                spice_warning("YYYYYY %d leds=%d, modifiers=%d", i, leds, modifiers->modifiers);
                if (leds == modifiers->modifiers)
                        break;
                if ((modifiers->modifiers & SPICE_KEYBOARD_MODIFIER_FLAGS_SCROLL_LOCK) !=
                    (leds & SPICE_KEYBOARD_MODIFIER_FLAGS_SCROLL_LOCK)) {
                    kbd_push_scan(keyboard, SCROLL_LOCK_SCAN_CODE);
                    kbd_push_scan(keyboard, SCROLL_LOCK_SCAN_CODE | 0x80);
                }
                if ((modifiers->modifiers & SPICE_KEYBOARD_MODIFIER_FLAGS_NUM_LOCK) !=
                    (leds & SPICE_KEYBOARD_MODIFIER_FLAGS_NUM_LOCK)) {
                    kbd_push_scan(keyboard, NUM_LOCK_SCAN_CODE);
                    kbd_push_scan(keyboard, NUM_LOCK_SCAN_CODE | 0x80);
                }
                if ((modifiers->modifiers & SPICE_KEYBOARD_MODIFIER_FLAGS_CAPS_LOCK) !=
                    (leds & SPICE_KEYBOARD_MODIFIER_FLAGS_CAPS_LOCK)) {
                    kbd_push_scan(keyboard, CAPS_LOCK_SCAN_CODE);
                    kbd_push_scan(keyboard, CAPS_LOCK_SCAN_CODE | 0x80);
                }
        }
        activate_modifiers_watch();
        break;
    }
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/spice-devel/attachments/20130813/c23e98d0/attachment.html>


More information about the Spice-devel mailing list