qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Gerd Hoffmann <kraxel@redhat.com>
To: qemu-devel@nongnu.org
Cc: Gerd Hoffmann <kraxel@redhat.com>
Subject: [Qemu-devel] [PATCH] vnc: add noledsync option
Date: Tue,  9 Mar 2010 17:09:24 +0100	[thread overview]
Message-ID: <1268150964-20302-1-git-send-email-kraxel@redhat.com> (raw)

Add an option to disable syncing capslock/numlock leds state
with capslock/numlock keyboard state.  Needed for guests which
use the keyboard leds for something else.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 vnc.c |   10 ++++++++--
 vnc.h |    1 +
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/vnc.c b/vnc.c
index 38690e2..007ce31 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->ledsync)
+        qemu_remove_led_event_handler(vs->led);
     qemu_free(vs);
 }
 
@@ -2424,7 +2425,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->ledsync)
+        vs->led = qemu_add_led_event_handler(kbd_leds, vs);
 
     vnc_init_timer(vd);
 
@@ -2545,6 +2547,7 @@ int vnc_display_open(DisplayState *ds, const char *display)
     int saslErr;
 #endif
     int acl = 0;
+    int ledsync = 1;
 
     if (!vnc_display)
         return -1;
@@ -2562,6 +2565,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, "noledsync", 9) == 0) {
+            ledsync = 0;
 #ifdef CONFIG_VNC_SASL
         } else if (strncmp(options, "sasl", 4) == 0) {
             sasl = 1; /* Require SASL auth */
@@ -2707,6 +2712,7 @@ int vnc_display_open(DisplayState *ds, const char *display)
         return -1;
     }
 #endif
+    vs->ledsync = ledsync;
 
     if (reverse) {
         /* connect to viewer */
diff --git a/vnc.h b/vnc.h
index 0fc89bd..bdaea46 100644
--- a/vnc.h
+++ b/vnc.h
@@ -99,6 +99,7 @@ struct VncDisplay
     int lsock;
     DisplayState *ds;
     kbd_layout_t *kbd_layout;
+    int ledsync;
 
     struct VncSurface guest;   /* guest visible surface (aka ds->surface) */
     DisplaySurface *server;  /* vnc server surface */
-- 
1.6.6.1

                 reply	other threads:[~2010-03-09 16:09 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1268150964-20302-1-git-send-email-kraxel@redhat.com \
    --to=kraxel@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).