qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] vnc: Make ledstate comparison before modifiers updated
@ 2013-05-15  8:20 Lei Li
  2013-05-15  8:31 ` Laszlo Ersek
  2013-05-16 12:50 ` Anthony Liguori
  0 siblings, 2 replies; 3+ messages in thread
From: Lei Li @ 2013-05-15  8:20 UTC (permalink / raw)
  To: qemu-devel; +Cc: aliguori, lersek, kraxel, 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 <kraxel@redhat.com>
Signed-off-by: Lei Li <lilei@linux.vnet.ibm.com>
---
 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

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [PATCH] vnc: Make ledstate comparison before modifiers updated
  2013-05-15  8:20 [Qemu-devel] [PATCH] vnc: Make ledstate comparison before modifiers updated Lei Li
@ 2013-05-15  8:31 ` Laszlo Ersek
  2013-05-16 12:50 ` Anthony Liguori
  1 sibling, 0 replies; 3+ messages in thread
From: Laszlo Ersek @ 2013-05-15  8:31 UTC (permalink / raw)
  To: Lei Li; +Cc: aliguori, qemu-devel, kraxel

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 <kraxel@redhat.com>
> Signed-off-by: Lei Li <lilei@linux.vnet.ibm.com>
> ---
>  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 <lersek@redhat.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [PATCH] vnc: Make ledstate comparison before modifiers updated
  2013-05-15  8:20 [Qemu-devel] [PATCH] vnc: Make ledstate comparison before modifiers updated Lei Li
  2013-05-15  8:31 ` Laszlo Ersek
@ 2013-05-16 12:50 ` Anthony Liguori
  1 sibling, 0 replies; 3+ messages in thread
From: Anthony Liguori @ 2013-05-16 12:50 UTC (permalink / raw)
  To: Lei Li, qemu-devel; +Cc: aliguori, lersek, kraxel

Applied.  Thanks.

Regards,

Anthony Liguori

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-05-16 12:51 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-05-15  8:20 [Qemu-devel] [PATCH] vnc: Make ledstate comparison before modifiers updated Lei Li
2013-05-15  8:31 ` Laszlo Ersek
2013-05-16 12:50 ` Anthony Liguori

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).