From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NrwaP-00005I-6h for qemu-devel@nongnu.org; Wed, 17 Mar 2010 12:59:13 -0400 Received: from [199.232.76.173] (port=35637 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NrwaO-0008WP-CZ for qemu-devel@nongnu.org; Wed, 17 Mar 2010 12:59:12 -0400 Received: from Debian-exim by monty-python.gnu.org with spam-scanned (Exim 4.60) (envelope-from ) id 1NrwaM-0004mL-Mv for qemu-devel@nongnu.org; Wed, 17 Mar 2010 12:59:12 -0400 Received: from mail-pw0-f45.google.com ([209.85.160.45]:49022) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NrwaM-0004mH-Cc for qemu-devel@nongnu.org; Wed, 17 Mar 2010 12:59:10 -0400 Received: by pwi9 with SMTP id 9so889314pwi.4 for ; Wed, 17 Mar 2010 09:59:08 -0700 (PDT) Message-ID: <4BA10A58.3090707@codemonkey.ws> Date: Wed, 17 Mar 2010 11:59:04 -0500 From: Anthony Liguori MIME-Version: 1.0 Subject: Re: [Qemu-devel] [PATCH] vnc: add no-lock-key-sync option References: <1268237522-10603-1-git-send-email-kraxel@redhat.com> In-Reply-To: <1268237522-10603-1-git-send-email-kraxel@redhat.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Gerd Hoffmann Cc: qemu-devel@nongnu.org On 03/10/2010 10:12 AM, Gerd Hoffmann wrote: > Add an option to disable the heuristics which try to keep > capslock and numlock state for guest and host in sync. > > Signed-off-by: Gerd Hoffmann > Applied. Thanks. Regards, Anthony Liguori > --- > vnc.c | 16 ++++++++++++---- > vnc.h | 1 + > 2 files changed, 13 insertions(+), 4 deletions(-) > > diff --git a/vnc.c b/vnc.c > index 38690e2..3cfe2ca 100644 > --- a/vnc.c > +++ b/vnc.c > @@ -1111,7 +1111,8 @@ static void vnc_disconnect_finish(VncState *vs) > } > > vnc_remove_timer(vs->vd); > - qemu_remove_led_event_handler(vs->led); > + if (vs->vd->lock_key_sync) > + qemu_remove_led_event_handler(vs->led); > qemu_free(vs); > } > > @@ -1543,7 +1544,8 @@ static void do_key_event(VncState *vs, int down, int keycode, int sym) > break; > } > > - if (keycode_is_keypad(vs->vd->kbd_layout, keycode)) { > + if (vs->vd->lock_key_sync&& > + keycode_is_keypad(vs->vd->kbd_layout, keycode)) { > /* If the numlock state needs to change then simulate an additional > keypress before sending this one. This will happen if the user > toggles numlock away from the VNC window. > @@ -1561,7 +1563,8 @@ static void do_key_event(VncState *vs, int down, int keycode, int sym) > } > } > > - if ((sym>= 'A'&& sym<= 'Z') || (sym>= 'a'&& sym<= 'z')) { > + if (vs->vd->lock_key_sync&& > + ((sym>= 'A'&& sym<= 'Z') || (sym>= 'a'&& sym<= 'z'))) { > /* If the capslock state needs to change then simulate an additional > keypress before sending this one. This will happen if the user > toggles capslock away from the VNC window. > @@ -2424,7 +2427,8 @@ static void vnc_connect(VncDisplay *vd, int csock) > vnc_flush(vs); > vnc_read_when(vs, protocol_version, 12); > reset_keys(vs); > - vs->led = qemu_add_led_event_handler(kbd_leds, vs); > + if (vs->vd->lock_key_sync) > + vs->led = qemu_add_led_event_handler(kbd_leds, vs); > > vnc_init_timer(vd); > > @@ -2545,6 +2549,7 @@ int vnc_display_open(DisplayState *ds, const char *display) > int saslErr; > #endif > int acl = 0; > + int lock_key_sync = 1; > > if (!vnc_display) > return -1; > @@ -2562,6 +2567,8 @@ int vnc_display_open(DisplayState *ds, const char *display) > password = 1; /* Require password auth */ > } else if (strncmp(options, "reverse", 7) == 0) { > reverse = 1; > + } else if (strncmp(options, "no-lock-key-sync", 9) == 0) { > + lock_key_sync = 0; > #ifdef CONFIG_VNC_SASL > } else if (strncmp(options, "sasl", 4) == 0) { > sasl = 1; /* Require SASL auth */ > @@ -2707,6 +2714,7 @@ int vnc_display_open(DisplayState *ds, const char *display) > return -1; > } > #endif > + vs->lock_key_sync = lock_key_sync; > > if (reverse) { > /* connect to viewer */ > diff --git a/vnc.h b/vnc.h > index 0fc89bd..a4211ae 100644 > --- a/vnc.h > +++ b/vnc.h > @@ -99,6 +99,7 @@ struct VncDisplay > int lsock; > DisplayState *ds; > kbd_layout_t *kbd_layout; > + int lock_key_sync; > > struct VncSurface guest; /* guest visible surface (aka ds->surface) */ > DisplaySurface *server; /* vnc server surface */ >