From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:51923) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UcWxP-0003EF-4Q for qemu-devel@nongnu.org; Wed, 15 May 2013 04:21:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UcWxN-0004an-VQ for qemu-devel@nongnu.org; Wed, 15 May 2013 04:21:07 -0400 Received: from e28smtp03.in.ibm.com ([122.248.162.3]:47041) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UcWxN-0004Zf-Bv for qemu-devel@nongnu.org; Wed, 15 May 2013 04:21:05 -0400 Received: from /spool/local by e28smtp03.in.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 15 May 2013 13:46:10 +0530 Received: from d28relay03.in.ibm.com (d28relay03.in.ibm.com [9.184.220.60]) by d28dlp02.in.ibm.com (Postfix) with ESMTP id 96DB93940053 for ; Wed, 15 May 2013 13:50:59 +0530 (IST) Received: from d28av03.in.ibm.com (d28av03.in.ibm.com [9.184.220.65]) by d28relay03.in.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id r4F8KoAh6750494 for ; Wed, 15 May 2013 13:50:51 +0530 Received: from d28av03.in.ibm.com (loopback [127.0.0.1]) by d28av03.in.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id r4F8Kv9E019691 for ; Wed, 15 May 2013 18:20:58 +1000 From: Lei Li Date: Wed, 15 May 2013 16:20:40 +0800 Message-Id: <1368606040-11950-1-git-send-email-lilei@linux.vnet.ibm.com> Subject: [Qemu-devel] [PATCH] vnc: Make ledstate comparison before modifiers updated List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: aliguori@us.ibm.com, lersek@redhat.com, kraxel@redhat.com, Lei Li The ledstate should be compared before modifiers updated, otherwise the ledstate would be the same as current_led_state. Reported-by: Gerd Hoffmann Signed-off-by: Lei Li --- ui/vnc.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/ui/vnc.c b/ui/vnc.c index 89108de..dfc7459 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); } } -- 1.7.7.6