Patchwork vnc: improve capslock handling.

login
register
mail settings
Submitter Gerd Hoffmann
Date Dec. 10, 2009, 8:32 p.m.
Message ID <4B215ADC.9050300@redhat.com>
Download mbox | patch
Permalink /patch/40889/
State New
Headers show

Comments

Gerd Hoffmann - Dec. 10, 2009, 8:32 p.m.
On 12/10/09 15:05, Alexander Graf wrote:
> Gerd Hoffmann wrote:
>> When capslock is toggled while the vnc window hasn't the focus qemu
>> will miss the state change.  Add sanity checks for the capslock state
>> and toggle it if needed, so hosts and guests idea of capslock state
>> stay in sync.  Simliar logic for numlock is present in qemu already.
>>
>> Signed-off-by: Gerd Hoffmann<kraxel@redhat.com>
>>
>
> This commit breaks the shift key in VNC for me.

Does the attached patch fix it for you?
Guess you are using vncviewer?

cheers,
   Gerd

Patch

diff --git a/vnc.c b/vnc.c
index 32c4678..2e4fd40 100644
--- a/vnc.c
+++ b/vnc.c
@@ -1506,11 +1506,12 @@  static void do_key_event(VncState *vs, int down, int keycode, int sym)
 static void key_event(VncState *vs, int down, uint32_t sym)
 {
     int keycode;
+    int lsym = sym;
 
-    if (sym >= 'A' && sym <= 'Z' && is_graphic_console())
-        sym = sym - 'A' + 'a';
+    if (lsym >= 'A' && lsym <= 'Z' && is_graphic_console())
+        lsym = lsym - 'A' + 'a';
 
-    keycode = keysym2scancode(vs->vd->kbd_layout, sym & 0xFFFF);
+    keycode = keysym2scancode(vs->vd->kbd_layout, lsym & 0xFFFF);
     do_key_event(vs, down, keycode, sym);
 }