[AD] Keyboard mapping fix for Japanese keyboard

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


Hello,

I own a Japanese 109-keys keyboard, and noticed a problem with
Allegro handling. I was not able to produce a KEY_QUOTE scancode
with this keyboard, so ' and " characters were not inputable
anywhere.

I have a fix here to the tables in src/misc/pckeys.c, associating
KEY_COLON2 (which is physically place of KEY_QUOTE on a Japanese
keyboard) to ' and " characters. It was previously non-associated.

It is correct behavior because, pckeys.c handle the default US
keyboard layout, and when I am using the US layout under Windows
with my Japanese keyboard, the colon key generates quote characters.

So this is a fix to make use of a Japanese keyboard in US layout
better. It is not yet perfect (*) but definitively better than
before.

A real Japanese keyboard layout (jp.cfg) would be preferred, but
this wouldn't even be enough: Japanese keyboard should be handled
differently even with a US layout!! See reason below.

(*)
Windows seems to differentiates regular 101/105-keys keyboards
and Japanese 109-keys keyboards, because their layout is different.
When a Japanese 109-keys keyboard is used, scancode->ascii
mapping is slighty different than with a 101/105-keys keyboard.
I don't know how OS other than Windows handle 109-keys keyboards.

This is a bit confusing, and makes things more complicated for
a library such as Allegro.

So there's two things to improve:

1. Provide a real Japanese keyboard JP layout (jp.cfg)
This would be sufficient for 98% Japanese keyboard users.

2. Change the library to handle Japanese 109-keys keyboards
differently, supporting translation of key position, so that
selecting an US (or other non-JP) mapping gets the same
positionning as on a real US (or other non-JP) keyboard.
This is much less important, since you would expect that owners
of Japanese keyboards wants to use a Japanese mapping anyway.

I might submit (1) sometimes in the future.
(2) is definitively too complicated. :(

In the meanwhile,
applying my patch should make things a better and allows
inputting quotes.

Omar Cornut
(Sorry if my explanation are confusing, feel free to ask questions)
--- pckeys.c.old	2003-11-09 19:43:12.000000000 +0000
+++ pckeys.c	2004-02-16 02:47:34.000000000 +0000
@@ -173,7 +173,7 @@
    /* misc chars */  27, '`', '-', '=', 8, 9, '[', ']', 13, ';', '\'', '\\', '\\', ',', '.', '/', ' ',
    /* controls */    0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF,
    /* numpad */      '/', '*', '-', '+', '.', 13,
-   /* others */      0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+    /* others */      0, 0, 0, 0, 0, 0, 0, 0, 0, '\'', 0, 0, 0, 0, 0,
    /* modifiers */   0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
 };
 
@@ -190,7 +190,7 @@
    /* misc chars */  27, '`', '-', '=', 8, 9, '[', ']', 13, ';', '\'', '\\', '\\', ',', '.', '/', ' ',
    /* controls */    0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF,
    /* numpad */      '/', '*', '-', '+', '.', 13,
-   /* others */      0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+   /* others */      0, 0, 0, 0, 0, 0, 0, 0, 0, '\'', 0, 0, 0, 0, 0,
    /* modifiers */   0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
 };
 
@@ -207,7 +207,7 @@
    /* misc chars */  27, '~', '_', '+', 8, 9, '{', '}', 13, ':', '"', '|', '|', '<', '>', '?', ' ',
    /* controls */    0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF,
    /* numpad */      '/', '*', '-', '+', '.', 13,
-   /* others */      0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+   /* others */      0, 0, 0, 0, 0, 0, 0, 0, 0, '"', 0, 0, 0, 0, 0,
    /* modifiers */   0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
 };
 


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/