Skip to contentSkip to conversation

vnc with german keymap

Qemu-devel Juergen Lock 2 participants 5 messages Jul 4, 2007 – Jul 7, 2007 2 messages not in the archive

lore
Share & tools
lore
#0 lore raw

Hi!

I got a report yesterday of -vnc not working right with german
keymaps (I hadn't really played with -vnc yet so I hadn't noticed), and came up with the following hack: (which still needs -k de, that just wasn't enough)

Index: qemu/vnc.c
@@ -763,7 +763,31 @@

 {
     int keycode;

+#if 1
+ /* XXX fixup some de keysyms (use with -k de) */
+ if ((sym & 0xffff) == 0xfe03) /* Alt_Gr -> Alt_R */
+ sym = 0xffea;
+ if ((sym & 0xffff) == 0xfe50) /* grave */
+ sym = '`';
+#if 0
+ if ((sym & 0xffff) == 0xfe51) /* '/acute (gets mixed up with #) */
+ sym = '\'';
+#endif
+ if ((sym & 0xffff) == 0xfe52) /* asciicircum */
+ sym = '^';
+ if ((sym & 0xffff) == 0xfe53) /* asciitilde */
+ sym = '~';
+#endif

     keycode = keysym2scancode(vs->kbd_layout, sym & 0xFFFF);

+#if 1
+ /* '/acute key needs special treatment */
+ if (!keycode && (sym & 0xffff) == 0xfe51) /* acute */
+ keycode = 0xd;
+#endif
+#ifdef VNCDEBUGKEYS
+ printf("do_key_event down %d, sym 0x%x, keycode 0x%x\n",
+ down, (int) sym, keycode);
+#endif

     /* QEMU console switch */
     switch(keycode) {

I wasn't able to fix this by editing vnc_keysym.h and/or keymaps
because those dont take duplicate definitions, but this is certainly `somewhat' ugly; anyone care to fix it for real? :)

Thanx,
Juergen

#1 lore raw

Hi,

Some time ago I made a patch to handle keyboard localization for vnc:

http://lists.gnu.org/archive/html/qemu-devel/2006-08/msg00129.html

It is outdated and most probably won't apply to current CVS, but with some tweaking it can improve things a bit.

Regads,
Eduardo Felipe

2007/7/4, Juergen Lock <[email protected]>:

Quoted 51 lines

Hi!

I got a report yesterday of -vnc not working right with german keymaps (I hadn't really played with -vnc yet so I hadn't noticed), and came up with the following hack: (which still needs -k de, that just wasn't enough)

Index: qemu/vnc.c

(quoted diff) +24 -0
@@ -763,7 +763,31 @@
 {
     int keycode;
 
+#if 1
+    /* XXX fixup some de keysyms (use with -k de) */
+    if ((sym & 0xffff) == 0xfe03)    /* Alt_Gr -> Alt_R */
+       sym = 0xffea;
+    if ((sym & 0xffff) == 0xfe50)    /* grave */
+       sym = '`';
+#if 0
+    if ((sym & 0xffff) == 0xfe51)    /* '/acute (gets mixed up with #) */
+       sym = '\'';
+#endif
+    if ((sym & 0xffff) == 0xfe52)    /* asciicircum */
+       sym = '^';
+    if ((sym & 0xffff) == 0xfe53)    /* asciitilde */
+       sym = '~';
+#endif
     keycode = keysym2scancode(vs->kbd_layout, sym & 0xFFFF);
+#if 1
+    /* '/acute key needs special treatment */
+    if (!keycode && (sym & 0xffff) == 0xfe51)    /* acute */
+       keycode = 0xd;
+#endif
+#ifdef VNCDEBUGKEYS
+    printf("do_key_event down %d, sym 0x%x, keycode 0x%x\n",
+       down, (int) sym, keycode);
+#endif
 
     /* QEMU console switch */
     switch(keycode) {

I wasn't able to fix this by editing vnc_keysym.h and/or keymaps because those dont take duplicate definitions, but this is certainly `somewhat' ugly; anyone care to fix it for real? :)

Thanx,
Juergen

#2 lore raw

In article <[email protected]> you write:

Quoted 10 lines

-=-=-=-=-=-

Hi,

Some time ago I made a patch to handle keyboard localization for vnc:

http://lists.gnu.org/archive/html/qemu-devel/2006-08/msg00129.html

It is outdated and most probably won't apply to current CVS, but with some tweaking it can improve things a bit.

Ah, thanx, I didnt see that one! :)

I have a qeuestion tho: does this patch do deadkey handling on the host?
Because I didn't have to do anything like that for the de patch, the guest could do that itself just fine. (tested with a linux livecd guest with (under X) and without deadkeys (console).)

bye,
Juergen

#3 lore raw

2007/7/4, Juergen Lock <[email protected]>:

Quoted 5 lines

Ah, thanx, I didnt see that one! :)

I have a qeuestion tho: does this patch do deadkey handling on the host?

Yes. IIRC I needed that because some VNC clients I tested didn't send dead keys to the server. They just waited for a full character to be available in its buffer to send the KeyEvent message, as they assume the server will know how to represent it. That is, if I press ´ and o in some VNC clients, only an ó (0x00f3) message is sent after pressing the last key, not the 0xfe51 / 0x006f combination. The server (qemu) has to know how to build the character for its guest.

Because I didn't have to do anything like that for the de patch, the

Quoted 4 lines

guest could do that itself just fine. (tested with a linux livecd guest with (under X) and without deadkeys (console).)

Your VNC client probably sends deadkey messages... or maybe I have a complicated way to handle simple things :)

Regards,
Edu

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

#6 lore raw

2007/7/6, Juergen Lock <[email protected]>:

Quoted 7 lines · Eduardo Felipe
Quoted 3 lines

Your VNC client probably sends deadkey messages... or maybe I have a complicated way to handle simple things :)

Yup, I tested with tightvnc-1.3.8.

I've tried tightvnc and it does send deadkey messages. By contrast, RealVNC is an example of client that sends extended Latin-1 (or similar) characters.

(You might want to explain this fact on the list tho, it may have been

Quoted 5 lines

the reason your patch wasn't committed...)

Bye,
Juergen

Agreed, cc'ing. I just forgot to "Reply-to-all" last time...

Regards,
Edu