From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:54552) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UcX6T-00009z-Ic for qemu-devel@nongnu.org; Wed, 15 May 2013 04:30:37 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UcX6O-0007ih-G9 for qemu-devel@nongnu.org; Wed, 15 May 2013 04:30:29 -0400 Received: from mx1.redhat.com ([209.132.183.28]:35277) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UcX6O-0007iY-6o for qemu-devel@nongnu.org; Wed, 15 May 2013 04:30:24 -0400 Message-ID: <519347C9.7070309@redhat.com> Date: Wed, 15 May 2013 10:31:05 +0200 From: Laszlo Ersek MIME-Version: 1.0 References: <1368606040-11950-1-git-send-email-lilei@linux.vnet.ibm.com> In-Reply-To: <1368606040-11950-1-git-send-email-lilei@linux.vnet.ibm.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] vnc: Make ledstate comparison before modifiers updated List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Lei Li Cc: aliguori@us.ibm.com, qemu-devel@nongnu.org, kraxel@redhat.com On 05/15/13 10:20, Lei Li wrote: > 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); > } > } > Looks good to me. Reviewed-by: Laszlo Ersek