[Y-devel] Key mappings

Mark Thomas mark at www.y-windows.org
Wed Feb 25 20:58:07 GMT 2004


I've been thinking about this for a while, and I think I have an idea how
to do it:

The basic problems are:

 1) different devices report different numeric codes for the same key, and
    the same code for different keys.

 2) the mapping from modifier + key -> character is also device dependent
    (in the uk, shift+2 is ", in the us, it is @).

 3) some complex languages (chinese, japanese, ...) require whole IMEs to
    effectively type them in.

 4) different programs require different types of events

Here's my proposal:

Three interfaces for keyboard-based input:

 (a) the Raw interface
     define in a header file an enumerated type of all the possible
     keys on any keyboard ever. A RAW keyboard event corresponds
     with any key press or release.

 (b) the Character interface
     this is the translated character based on the key press and the
     current modifier state.  This would be a unicode codepoint.

 (c) the IME interface
     for complex input methods, to be discussed later

Input modules would be responsible for generating events for both the RAW
and the CHAR interface.  The IME will be built within the server and will
intercept events from the other two and translate them.

For example, if I type a " character on my keyboard, the following
happens:

(I press the left shift key)     RAW LSHIFT DOWN
(I press the 2 key)              RAW 2 DOWN         CHAR " PRESS
                                 RAW 2 UP
(I release the left shift key)   RAW LSHIFT UP

This makes the input module quite a bit more complex, but I think it's the
only way.  It also means the "keymap" is a parameter of the input module,
i.e.:

   LoadModule "driver/input/evdev" keymap=gb

Any thoughts?

Regards,

  Mark.
-- 
|| Mark Thomas
|| efaref.net
||
|| Monday is a hard way to spend one seventh of your life.



More information about the Y-devel mailing list









2026 © www.Y-Windows.Org - All Rights Reserved