]> git.proxmox.com Git - qemu.git/blobdiff - ui/vnc.c
vnc: Make ledstate comparison before modifiers updated
[qemu.git] / ui / vnc.c
index 89108de223003bd291b2c509ebbb91c93c78a83f..dfc74591f4b731e25dddbcd56bc22bf941ceb87b 100644 (file)
--- 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);
     }
 }