resend: [PATCH] x11drv/keyboard.c: jp106 keyboard map fix

Aric Cyr <[email protected]> Wed, 25 May 2005 12:14:36 +0900
Newsgroups gmane.comp.emulators.winex.devel
Message-ID <[email protected]>
(Sorry, resending this due to mime restrictions on list)

Here is a patch to fix a real annoying problem with World of Warcraft
in Cedega.  It fixes the mapping for Japanese 106 keyboards so that
the keycodes are correctly mapped.  Japanese keyboards have a '1' as
the leftmost key.  I have submitted this patch to the Wine developers
as well back in March and figured it'd be nice to have in Cedega as
well.

For more details see:
  http://www.winehq.org/hypermail/wine-patches/2005/03/0718.html

I reworked the Wine patch so that it cleanly applies to the latest
Cedega CVS.  The Cedega version is attached.

Regards,
  Aric

-- 
Aric Cyr <acyr at alumni dot uwaterloo dot ca>    (http://acyr.net)
gpg fingerprint: 943A 1549 47AC D766 B7F8  D551 6703 7142 C282 D542
winex-jp106.patch (text/plain, 2.8 KB)
Index: windows/x11drv/keyboard.c
===================================================================
RCS file: /cvsroot/winex/windows/x11drv/keyboard.c,v
retrieving revision 1.19
diff -u -r1.19 keyboard.c
--- windows/x11drv/keyboard.c	14 Mar 2005 18:55:03 -0000	1.19
+++ windows/x11drv/keyboard.c	25 May 2005 01:54:32 -0000
@@ -77,6 +77,21 @@
    0x56 /* the 102nd key (actually to the right of l-shift) */
 };
 
+static const WORD main_key_scan_qwerty_jp106[MAIN_LEN] =
+{
+/* this is my (106-key) keyboard layout, sorry if it doesn't quite match yours */
+/* 1    2    3    4    5    6    7    8    9    0    -    ^    \ */
+0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x29,
+/* q    w    e    r    t    y    u    i    o    p    @    [ */
+0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,0x1B,
+/* a    s    d    f    g    h    j    k    l    ;    :    ] */
+0x1E,0x1F,0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x2B,
+/* z    x    c    v    b    n    m    ,    .    / */
+0x2C,0x2D,0x2E,0x2F,0x30,0x31,0x32,0x33,0x34,0x35,
+0x56 /* the 102nd key (actually to the right of l-shift) */
+};
+
+
 static const WORD main_key_vkey_qwerty[MAIN_LEN] =
 {
 /* NOTE: this layout must concur with the scan codes layout above */
@@ -87,6 +102,16 @@
    VK_OEM_102 /* the 102nd key (actually to the right of l-shift) */
 };
 
+static const WORD main_key_vkey_qwerty_jp106[MAIN_LEN] =
+{
+/* NOTE: this layout must concur with the scan codes layout above */
+'1','2','3','4','5','6','7','8','9','0',VK_OEM_MINUS,VK_OEM_PLUS,VK_OEM_3,
+'Q','W','E','R','T','Y','U','I','O','P',VK_OEM_4,VK_OEM_6,
+'A','S','D','F','G','H','J','K','L',VK_OEM_1,VK_OEM_7,VK_OEM_5,
+'Z','X','C','V','B','N','M',VK_OEM_COMMA,VK_OEM_PERIOD,VK_OEM_2,
+VK_OEM_102 /* the 102nd key (actually to the right of l-shift) */
+};
+
 static const WORD main_key_vkey_azerty[MAIN_LEN] =
 {
 /* NOTE: this layout must concur with the scan codes layout above */
@@ -546,7 +571,7 @@
  {"Polish (programmer's) keyboard layout", 28592, &main_key_PL, &main_key_scan_qwerty, &main_key_vkey_qwerty},
  {"Croatian keyboard layout", 28592, &main_key_HR, &main_key_scan_qwerty, &main_key_vkey_qwerty},
  {"Croatian keyboard layout (specific)", 28592, &main_key_HR_jelly, &main_key_scan_qwerty, &main_key_vkey_qwerty},
- {"Japanese 106 keyboard layout", 932, &main_key_JA_jp106, &main_key_scan_qwerty, &main_key_vkey_qwerty},
+ {"Japanese 106 keyboard layout", 932, &main_key_JA_jp106, &main_key_scan_qwerty_jp106, &main_key_vkey_qwerty_jp106},
  {"Japanese pc98x1 keyboard layout", 932, &main_key_JA_pc98x1, &main_key_scan_qwerty, &main_key_vkey_qwerty},
  {"Slovak keyboard layout", 28592, &main_key_SK, &main_key_scan_qwerty, &main_key_vkey_qwerty},
  {"Slovak and Czech keyboard layout without dead keys", 28592, &main_key_SK_prog, &main_key_scan_qwerty, &main_key_vkey_qwerty},