Skip to contentSkip to conversation

AltGr keystrokes

Qemu-devel Edu 3 participants 5 messages Aug 2, 2006 – Aug 8, 2006

lore
Share & tools
lore

Edu

author
#0 lore raw

Hi,

I also have issues with extended characters in my keyboard layout when using VNC. Part of them seem to be caused by sign extension in function read_u32 from vnc.c, which should not be done.

I need to do some more testing, though.

Eduardo Felipe

#1 lore raw

VNC (or RFB), was Re: [Qemu-devel] Re: AltGr keystrokes

Hi,

Quoted 3 lines · Edu

I also have issues with extended characters in my keyboard layout when using VNC. Part of them seem to be caused by sign extension in function read_u32 from vnc.c, which should not be done.

I just _cannot_ resist in pointing out that I never had issues like these with the "old" RFB patch.

AFAICT the only issue the "old" RFB patch had, was that a slow connection could actually slow down QEmu, since the RFB server would block on input.

But I am sure that this can be fixed in LibVNCServer, bringing benefit not only to QEmu, but also to other users of the lib. I cannot help but being sad about the "solution" in QEmu.

Ciao,
Dscho

#2 lore raw
In reply to Edu
Quoted 5 lines · Edu

Hi,

I also have issues with extended characters in my keyboard layout when using VNC. Part of them seem to be caused by sign extension in function read_u32 from vnc.c, which should not be done.

You're right, I'll submit a patch to fix that. Let me know if it helps.

Regards,

Anthony Liguori

Quoted 3 lines

I need to do some more testing, though.

Eduardo Felipe

author
#3 lore raw

2006/8/2, Anthony Liguori <[email protected]>:

Quoted 3 lines

You're right, I'll submit a patch to fix that. Let me know if it helps.

Well, it indeed helps to some extent, but it's not enough.

Tracking down the problem I've found out that modifiers after scancodes in keymap files are completely ignored in function parse_keyboard_layout (keymaps.c).

In "es" keymap we find:

quotedbl 0x03 shift
at 0x03 altgr

Which means
" ==> Shift + 2
@ ==> AltGr + 2

Logging TightVNC client messages:

[ PRESS SHIFT ]
VNC msg: DOWN 0xFFE1 --> OS receives keycode: 0x2A

[ PRESS 2 ]
VNC msg: DOWN 0x22 --> OS receives keycode: 0x03

[ RELEASE 2 ]
VNC msg: UP 0x22 --> OS receives keycode: 0x03

[ RELEASE SHIFT ]
VNC msg: UP 0xFFE1 --> OS receives keycode: 0x2A

This works correctly and double quote is printed, but...

[ PRESS ALTGR ]
VNC msg: DOWN 0xFFE3 --> OS receives keycode: 0x1D VNC msg: DOWN 0xFFEA --> OS receives keycode: 0x38

[ PRESS 2 ]
VNC msg: UP 0xFFE3 --> OS receives keycode: 0x1D
VNC msg: UP 0xFFEA --> OS receives keycode: 0x38
VNC msg: DOWN 0x40 --> OS receives keycode: 0x03
VNC msg: DOWN 0xFFEA --> OS receives keycode: 0x38

 VNC msg: UP   0xFFE3 --> OS receives keycode: 0x1D
 VNC msg: UP   0xFFE3 --> OS receives keycode: 0x1D
 VNC msg: UP   0xFFEA --> OS receives keycode: 0x38
 VNC msg: UP   0x40   --> OS receives keycode: 0x03
 VNC msg: DOWN 0xFFEA --> OS receives keycode: 0x38
 VNC msg: UP   0xFFE3 --> OS receives keycode: 0x1D
 VNC msg: UP   0xFFE3 --> OS receives keycode: 0x1D
 VNC msg: UP   0xFFEA --> OS receives keycode: 0x38

... doesn't work at all.

As you can see, VNC client sends messages to release AltGr modifier before sending 0x40 symbol ( @ ). It relies on the server to know how to get it. As the OS receives a bare 0x03 keycode, the resulting character is 2. Qemu should send to the OS the AltGr keydown event before the 0x03 scancode, as the keymap says. Double quote case shouldn't be affected by the extra Shift keydown event.

Regards,
Eduardo Felipe

author
#4 lore raw
In reply to Anthony Liguori

Hi,

Attached patch, in addition to Anthony's, improves VNC keyboard support for AltGr and extended characters.

I've only modified Spanish "es" keymap, but should be trivial to update other keymaps in a similar manner.

This is my first patch submission, so please be lenient :)

Regards,
Eduardo Felipe

keymaps/es +55 -0
@@ -103,3 +103,58 @@
 underscore 0x35 shift
 dead_belowdot 0x35 altgr
 dead_abovedot 0x35 shift altgr
+
+
+# Dead keys
+aacute 0x1e dead_acute
+Aacute 0x1e dead_acute shift
+eacute 0x12 dead_acute
+Eacute 0x12 dead_acute shift
+iacute 0x17 dead_acute
+Iacute 0x17 dead_acute shift
+oacute 0x18 dead_acute
+Oacute 0x18 dead_acute shift
+uacute 0x16 dead_acute
+Uacute 0x16 dead_acute shift
+yacute 0x15 dead_acute
+Yacute 0x15 dead_acute shift
+
+agrave 0x1e dead_grave
+Agrave 0x1e dead_grave shift
+egrave 0x12 dead_grave
+Egrave 0x12 dead_grave shift
+igrave 0x17 dead_grave
+Igrave 0x17 dead_grave shift
+ograve 0x18 dead_grave
+Ograve 0x18 dead_grave shift
+ugrave 0x16 dead_grave
+Ugrave 0x16 dead_grave shift
+
+adiaeresis 0x1e dead_diaeresis
+Adiaeresis 0x1e dead_diaeresis shift
+ediaeresis 0x12 dead_diaeresis
+Ediaeresis 0x12 dead_diaeresis shift
+idiaeresis 0x17 dead_diaeresis
+Idiaeresis 0x17 dead_diaeresis shift
+odiaeresis 0x18 dead_diaeresis
+Odiaeresis 0x18 dead_diaeresis shift
+udiaeresis 0x16 dead_diaeresis
+Udiaeresis 0x16 dead_diaeresis shift
+ydiaeresis 0x15 dead_diaeresis
+
+acircumflex 0x1e dead_circumflex
+Acircumflex 0x1e dead_circumflex shift
+ecircumflex 0x12 dead_circumflex
+Ecircumflex 0x12 dead_circumflex shift
+icircumflex 0x17 dead_circumflex
+Icircumflex 0x17 dead_circumflex shift
+ocircumflex 0x18 dead_circumflex
+Ocircumflex 0x18 dead_circumflex shift
+ucircumflex 0x16 dead_circumflex
+Ucircumflex 0x16 dead_circumflex shift
+
+acute 0x39 dead_acute
+grave 0x39 dead_grave
+diaeresis 0x39 dead_diaeresis
+asciicircum 0x39 dead_circumflex
+
keymaps.c +76 -12

151 lines not on this page · raw message

sdl.c +5 -1
@@ -104,7 +104,11 @@
     keysym = ev->keysym.sym;
     if (keysym == 0 && ev->keysym.scancode == 113)
         keysym = SDLK_MODE;
-    return keysym2scancode(kbd_layout, keysym);
+    keydata_t *eventdata = find_keysym(kbd_layout, keysym);
+    if (eventdata==NULL)
+        return 0;
+    else
+        return eventdata->keycode;
 }
 
 /* specific keyboard conversions from scan codes */
vnc.c +99 -8

128 lines not on this page · raw message

vnc_keysym.h +49 -7

73 lines not on this page · raw message