From 5a327955c9287a317e5792e96601375fa5aabced Mon Sep 17 00:00:00 2001 From: Egbert Eich Date: Fri, 3 Jan 2014 11:48:11 +0100 Subject: Detangle inet keys and jp Henkan/ Muhenkan keys When support for inet keys was added to the keyboard driver back in the early 2000 none of the developers thought of Japanese 106 key keybards which have two extra keys generating the scan codes 0x79 and 0x7d. So for keys prefixed with the scan code 0x60 which were not remapped to anything else the line: *scanCode += 0x78; was added. Thus keys generating the scan codes 0xe0 0x01 and 0xe0 0x03 will overlap with the Henkan and Muhenkan keys on Japanese keyboards. A workaround was introduced to xkeyboard-config which makes sure the keycodes 0x79 and 0x7d provide the Henkan and Muhenkan keysyms. As a consequence users might loose some multimedia keys on Japanese keyboards. A different solution would be to either remap keycodes 0x79 and 0x7d or keycodes 0xe0 0x01 and 0xe0 0x03 into the range of unused (X-)keycodes above 0xfb. There are downsides with either solution: the legacy keyboard driver and the xkb files would have to be fixed in sync. Otherwise Japanese users would loose their Henkan and Muhenkan keys (in the first case) or some multimedia keys would get lost. The present patch does the latter which seems to be cleaner codewise. Signed-off-by: Egbert Eich Signed-off-by: Peter Hutterer --- src/atKeynames.h | 2 ++ src/at_scancode.c | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/src/atKeynames.h b/src/atKeynames.h index 85f13ac..d114753 100644 --- a/src/atKeynames.h +++ b/src/atKeynames.h @@ -287,6 +287,8 @@ #define KEY_0x74 0xD3 #define KEY_0x75 0xD4 #define KEY_0x76 0xD5 +#define KEY_R_0xF4 0xF4 +#define KEY_R_0xF5 0xF5 /* These are for "notused" and "unknown" entries in translation maps. */ #define KEY_NOTUSED 0 diff --git a/src/at_scancode.c b/src/at_scancode.c index a519a6c..4893e0d 100644 --- a/src/at_scancode.c +++ b/src/at_scancode.c @@ -108,6 +108,11 @@ ATScancode(InputInfoPtr pInfo, int *scanCode) case KEY_F6: *scanCode = KEY_F16; break; case KEY_F7: *scanCode = KEY_F17; break; case KEY_KP_Plus: *scanCode = KEY_KP_DEC; break; + /* Remap codes 0x09 and 0x11 to avoid overlap with the + Henkan and Muhenkan keys on Japanese pc106 or pc103 + keyboards */ + case 0x01: *scanCode = KEY_R_0xF4; break; + case 0x03: *scanCode = KEY_R_0xF5; break; case 0x2A: case 0x36: return TRUE; -- cgit v1.2.1