Skip to contentSkip to conversation

qemu-char: keymap changes for Czech and Unicode support

PATCH Superseded Jan Krupa 2 participants 6 messages Aug 27, 2013 – Sep 1, 2013

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Jan Krupa

author
#0 lore raw

cover qemu-char: keymap changes for Czech and Unicode support

I tried to create keymap for Czech keyboard for QEMU. I found out that some of the keysyms are missing. I added those specific symbols to QEMU VNC header files plus wrote the whole keyboard layout.

Another issue I hit during keyboard layout creation process is that keysym to keycode converter inside QEMU doesn't handle U-prefixed Unicode symbols which are already used for example in Arabic keymap file (pc-bios/keymaps/ar). I implemented support for handling these characters.

Jan Krupa (3):
qemu-char: add Czech characters to VNC keysyms
qemu-char: add Czech keymap file
qemu-char: add support for U-prefixed symbols

 pc-bios/keymaps/cz |   94 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 ui/keymaps.c       |    3 ++
 ui/vnc_keysym.h    |    8 ++++
 3 files changed, 105 insertions(+), 0 deletions(-)
 create mode 100644 pc-bios/keymaps/cz
author
#1 lore raw

PATCH 1/3 qemu-char: add Czech characters to VNC keysyms

This patch adds missing Czech characters to VNC keysym table.

---
 ui/vnc_keysym.h |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)
ui/vnc_keysym.h +8 -0
index 6250bec..72c01d1 100644
@@ -224,6 +224,14 @@ static const name2keysym_t name2keysym[]={
 { "odoubleacute",         0x1f5},
 { "udoubleacute",         0x1fb},
 
+/* Czech national characters */
+{ "ecaron",               0x1ec},
+{ "scaron",               0x1b9},
+{ "ccaron",               0x1e8},
+{ "rcaron",               0x1f8},
+{ "zcaron",               0x1be},
+{ "uring",                0x1f9},
+
     /* modifiers */
 {"ISO_Level3_Shift", 0xfe03}, /* XK_ISO_Level3_Shift */
 {"Control_L", 0xffe3}, /* XK_Control_L */
Signature · 1 line
1.6.0.2
author
#2 lore raw

PATCH 2/3 qemu-char: add Czech keymap file

This patch adds Czech keyboard layout to available keymap files.

---
 pc-bios/keymaps/cz |   94 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 94 insertions(+), 0 deletions(-)
 create mode 100644 pc-bios/keymaps/cz
pc-bios/keymaps/cz new file +94 -0
new file mode 100644
index 0000000..6584bfb
@@ -0,0 +1,94 @@
+include common
+
+# Czech qwertz layout
+# comments are czech descriptions of the characters
+
+# -----------
+#  First row
+# -----------
+
+# strednik, kolecko
+semicolon 0x29
+dead_abovering 0x29 shift
+
+# numbers
+plus 0x2
+1 0x2 shift
+ecaron 0x3
+2 0x3 shift
+scaron 0x4
+3 0x4 shift
+ccaron 0x5
+4 0x5 shift
+rcaron 0x6
+5 0x6 shift
+zcaron 0x7
+6 0x7 shift
+yacute 0x8
+7 0x8 shift
+aacute 0x9
+8 0x9 shift
+iacute 0xa
+9 0xa shift
+eacute 0xb
+0 0xb shift
+
+# rovnitko
+equal 0x0c
+percent 0x0c shift
+
+# carka, hacek
+dead_acute 0x0d
+dead_caron 0x0d shift
+
+# ------------
+#  Second row
+# ------------
+
+z 0x15 addupper
+
+# u s carkou, zpetne lomitko
+uacute 0x1a
+slash 0x1a shift
+
+# prava zavorka, leva zavorka
+parenright 0x1b
+parenleft 0x1b shift
+
+# -----------
+#  Third row
+# -----------
+
+# u s krouzkem, uvozovky
+uring 0x27
+quotedbl 0x27 shift
+
+# paragraf, vykricnik
+section 0x28
+exclam 0x28 shift
+
+# vodorovna dvojtecka, apostrof
+dead_diaeresis 0x2b
+apostrophe 0x2b shift
+
+# ------------
+#  Fourth row
+# ------------
+
+# zpetne lomitko, roura
+backslash 0x2b
+bar 0x2b shift
+
+y 0x2c addupper
+
+# carka, otaznik
+comma 0x33
+question 0x33 shift
+
+# tecka, dvojtecka
+period 0x34
+colon 0x34 shift
+
+# minus, podtrzitko
+minus 0x35
+underscore 0x35 shift
Signature · 1 line
1.6.0.2
author
#3 lore raw

PATCH 3/3 qemu-char: add support for U-prefixed symbols

This patch adds support for Unicode symbols in keymap files. This feature was already used in some keyboard layouts in QEMU generated from XKB (e.g. Arabic) but it wasn't implemented in QEMU source code.

---
 ui/keymaps.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
ui/keymaps.c +3 -0
index f373cc5..426a893 100644
@@ -33,6 +33,9 @@ static int get_keysym(const name2keysym_t *table,
         if (!strcmp(p->name, name))
             return p->keysym;
     }
+    if (strlen(name) == 5 && name[0] == 'U') {
+        return (int)strtol(name + 1, NULL, 16);
+    }
     return 0;
 }
 
Signature · 1 line
1.6.0.2
#4 lore raw

Re: [Qemu-devel] [Qemu-trivial] [PATCH 3/3] qemu-char: add support for U-prefixed symbols

Quoted 14 lines · Jan Krupa

This patch adds support for Unicode symbols in keymap files. This feature was already used in some keyboard layouts in QEMU generated from XKB (e.g. Arabic) but it wasn't implemented in QEMU source code.

---
  ui/keymaps.c |    3 +++
  1 files changed, 3 insertions(+), 0 deletions(-)
ui/keymaps.c +0 -0
index f373cc5..426a893 100644

ui/keymaps.c static int get_keysym(const name2keysym_t *table, · line 38

Quoted 6 lines
ui/keymaps.c +3 -0
@@ -33,6 +33,9 @@ static int get_keysym(const name2keysym_t *table,
          if (!strcmp(p->name, name))
              return p->keysym;
      }
+    if (strlen(name) == 5 && name[0] == 'U') {
+        return (int)strtol(name + 1, NULL, 16);
+    }

How about something like

if (sscanf(name, "U%04x", &temp) == 1)

instead, to ensure it actually is a valid hex number? Because this code will behave in interesting way given, eg, "U" or "UU"... ;) But I don't think this really matters much...

Thanks,

#5 lore raw

Re: [Qemu-devel] [Qemu-trivial] [PATCH 2/3] qemu-char: add Czech keymap file

In reply to Jan Krupa
Quoted 7 lines · Jan Krupa

This patch adds Czech keyboard layout to available keymap files.

---
  pc-bios/keymaps/cz |   94 ++++++++++++++++++++++++++++++++++++++++++++++++++++
  1 files changed, 94 insertions(+), 0 deletions(-)

create mode 100644 pc-bios/keymaps/cz

This file is useles without a corresponding change to Makefile (search for KEYMAPS= there). Please add it there as well (either in a separate patch or include it into this one).

Speaking of the keymap itself, and of the chars added in patch1, I for one can't verify these, so I take it as granted. After all, this appears to be first attempt to implement cz keymap in all these years...

Thanks,

/mjt