General Info | |
Interface: KbdLayout Files: kbdlayout.h Last change: 30/07/2002 Author: Luiz Henrique Shigunov |
Description
Structures |
Functions | |
0x00 - GetMapTables - Get mapping tables |
This page describes the KbdLayout interface which provides access to keyboard layouts.
It's using the tables defined in this interface that a module that implements Keyboard interface maps scancodes to virtual keys and virtual keys to characters.
typedef struct { unsigned short charCode; unsigned short flags; } KbdLayout_VKFlags;
Where charCode is the character and flags must be:
typedef struct { union { struct { unsigned char firstVK; unsigned char firstShift; unsigned char nextVK; unsigned char nextShift; } vks; int all; } key; unsigned short charCode; unsigned short reserved; } KbdLayout_VKDeadKey;
Where firstVK is the first virtual key pressed, firstShift is the shift state for firstVK, nextVK is the second virtual key pressed and nextShift is the shift state for nextVK. charCode is the character generated by the combination.
firstShift and nextShift must be:
typedef struct { unsigned char sc2VK[128]; unsigned char e0sc2VK[128]; KbdLayout_VKFlags vk2CharN[256]; unsigned short *vk2CharS[8]; KbdLayout_VKDeadKey *deadKeys; } KbdLayout_MapTables;
sc2VK is the table that maps scancodes without a prefix to virtual keys. e0sc2VK is the table that maps scancodes with prefix 0xe0 to virtual keys.
vk2CharN is the table that maps virtual keys to characters when there's no shift pressed.
vk2CharS is an array with tables that maps virtual keys to characters. It's indexed by shift state:
If any of this tables doesn't exist, it's pointer must be NULL. For instance, if there's no table for Shift-Ctrl-Alt, vk2CharS[6] must be NULL.
The following special characters can be used in vk2CharN and vk2CharS:
deadKeys is a table that maps deadkeys to characters, NULL if this table doesn't exist. This table must end with an element all 0.
If capslock key is on, vk2CharN table from MapTables structure will be used to know if capslock key affects the virtual key like the shift key. The shift key cancels the behavior of the capslock key, that is, if capslock is on and the shift key is pressed too then is like capslock is off and the shift key is not pressed.
KbdLayout_MapTables *KbdLayout_GetMapTables(void);
This function gets mapping tables for the keyboard layout.
The mapping tables.