[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

8.1.1.7 Key Mapping

For keyboard events, Crystal Space's event system expects the platform-specific driver to provide both the raw key code and the cooked character code. For instance, for Alt-p, the raw key code is p and the cooked character code would be whatever that keytroke is mapped to in the current key-mapping (for instance, Greek `pi').

Unfortunately, the AppKit event mechanism in NextStep cooks the raw key code completely out of existence and only makes available the final character code along with the hardware scan code of the depressed key. The `NSEvent' class in Cocoa and OpenStep, on the other hand, make both the raw key code and the cooked character code available.

In order to provide Crystal Space with the raw key code on NextStep, it was necessary to reverse-engineer the format of the raw key-mapping resource (`.keymapping' files). Once accomplished, a special class, `NeXTKeymap', was created to interpret the key-mapping. This class parses the private key-mapping data structure used by the WindowServer and the AppKit and provides a mechanism for translating hardware scan codes to the raw key codes which Crystal Space expects.

`NeXTKeymap' is implemented in `CS/libs/cssys/next/nextstep/NeXTKeymap.m'. It is based upon extracts from the program `dumpkeymap' which is a diagnostic utility for interpreting `.keymapping' files. The source code and full documentation for `dumpkeymap' are available at `CS/libs/cssys/next/support/dumpkeymap'. `dumpkeymap' was written by Eric Sunshine, sunshine@sunshineco.com.



This document was generated using texi2html