summary refs log tree commit diff stats
path: root/ui/vnc.c
diff options
context:
space:
mode:
authorLei Li <lilei@linux.vnet.ibm.com>2013-05-15 16:20:40 +0800
committerAnthony Liguori <aliguori@us.ibm.com>2013-05-15 08:48:43 -0500
commit1483adcf6ac978656718d4383d909c96dce395a6 (patch)
tree00c0d531145c1a734028501391456952bf105930 /ui/vnc.c
parent800ced8cac361c5d492ac82c4aa344ff769ecf2e (diff)
downloadfocaccia-qemu-1483adcf6ac978656718d4383d909c96dce395a6.tar.gz
focaccia-qemu-1483adcf6ac978656718d4383d909c96dce395a6.zip
vnc: Make ledstate comparison before modifiers updated
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>
Diffstat (limited to 'ui/vnc.c')
-rw-r--r--ui/vnc.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/ui/vnc.c b/ui/vnc.c
index 89108de223..dfc74591f4 100644
--- a/ui/vnc.c
+++ b/ui/vnc.c
@@ -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;
@@ -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);
     }
 }