Skip to content

Commit

Permalink
vnc: Make ledstate comparison before modifiers updated
Browse files Browse the repository at this point in the history
The ledstate should be compared before modifiers updated,
otherwise the ledstate would be the same as current_led_state.

Reported-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Lei Li <lilei@linux.vnet.ibm.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Message-id: 1368606040-11950-1-git-send-email-lilei@linux.vnet.ibm.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
  • Loading branch information
leilihh authored and Anthony Liguori committed May 15, 2013
1 parent 800ced8 commit 1483adc
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion ui/vnc.c
Expand Up @@ -1601,6 +1601,7 @@ static void kbd_leds(void *opaque, int ledstate)
{
VncState *vs = opaque;
int caps, num, scr;
bool has_changed = (ledstate != current_led_state(vs));

caps = ledstate & QEMU_CAPS_LOCK_LED ? 1 : 0;
num = ledstate & QEMU_NUM_LOCK_LED ? 1 : 0;
Expand All @@ -1617,7 +1618,7 @@ static void kbd_leds(void *opaque, int ledstate)
}

/* Sending the current led state message to the client */
if (ledstate != current_led_state(vs)) {
if (has_changed) {
vnc_led_state_change(vs);
}
}
Expand Down

0 comments on commit 1483adc

Please sign in to comment.