gii_key_event - LibGII key events
#include <ggi/events.h>
The gii_key_event structure represents key/button events from keyboards and other devices.
This structure is used for these event types:
The key repeat rate and the delay before repeat is unspecified and depends on the user's environment.
/* key events should be used to report events obtained from keys and ** other switches. */ typedef struct gii_key_event { COMMON_DATA; uint32 modifiers; /* current modifiers in effect */ uint32 sym; /* meaning of key */ uint32 label; /* label on key */ uint32 button; /* button number */ } gii_key_event;
GII_MOD_SHIFT
GII_MOD_CTRL
GII_MOD_ALT
GII_MOD_META
GII_MOD_SUPER
GII_MOD_HYPER
GII_MOD_ALTGR
GII_MOD_CAPS
GII_MOD_NUM
GII_MOD_SCROLL
label can be used as a generalized, portable keycode or scancode of the key.
(That is, if the documentation for an applications says that something is is mapped to key y, it is, even for German keyboard, where y and z are swapped.)
If an application is interested in what physical keys are pressed and released (most games for example), read the label field. Usually the modifiers in effect are irrelevant for these applications
However, for non-alphanumeric symbols like + and -, it is wise to check the sym field instead of label as they are accessed using shifts on some keyboard configurations. . If an application wants a stream of characters (for text input), read the sym field.
In GGI, key values are defined in ggi/keyboard.h. They are basically Unicode characters with some extensions:
Keys which are not represented by codepoints in the Unicode standard (such as the numeric keypad keys) are assigned codepoints in the private range. Applications should use the GIIK_ #defines for representing these keys. These codepoints are used in label, but they can also occur in sym when the symbol is not any character (e.g. arrow keys, function keys).
The GIIUC_ #defines represent normal Unicode characters. The #defines are interchangeable with their corresponding codepoint scalars and their use is optional. However, it is recommended to use them for the symbols GIIUC_BackSpace, GIIUC_Return, GIIUC_Escape and GIIUC_Delete.
Закладки на сайте Проследить за страницей |
Created 1996-2024 by Maxim Chirkov Добавить, Поддержать, Вебмастеру |