1gii_key_event(3) GGI gii_key_event(3)
2
3
4
6 gii_key_event : LibGII key events
7
9 #include <ggi/events.h>
10
11 typedef struct gii_key_event {
12
13 COMMON_DATA;
14
15 uint32_t modifiers;
16 uint32_t sym;
17 uint32_t label;
18 uint32_t button;
19
20 } gii_key_event;
21
22
24 The gii_key_event structure represents key/button events from keyboards
25 and other devices.
26
28 evKeyPress
29 The key specified in the structure is pressed. Not repeatedly
30 produced while holding down the key.
31
32
33 evKeyRelease
34 A key specified in the structure is released.
35
36
37 evKeyRepeat
38 Makes sense when dealing with character input. A key is being
39 held down and the character should be processed at intervals
40 when the key is held down.
41
42 The key repeat rate and the delay before repeat is unspecified
43 and depends on the user's environment.
44
45
47 modifiers
48 Result of bitwise-or of the following flags, indicating certain
49 shift states:
50
51 · GII_MOD_SHIFT
52
53 · GII_MOD_CTRL
54
55 · GII_MOD_ALT
56
57 · GII_MOD_META
58
59 · GII_MOD_SUPER
60
61 · GII_MOD_HYPER
62
63 · GII_MOD_ALTGR
64
65 · GII_MOD_CAPS
66
67 · GII_MOD_NUM
68
69 · GII_MOD_SCROLL
70
71 sym The symbol of the key, which is the resultant character produced
72 by the key. This is roughly a transformation of the label with
73 the current modifiers. It also depends on the user's key config‐
74 uration.
75
76
77 label The actual label visible on the key in question. This is either
78 the symbol produced when there are no modifiers or it is the
79 most prominent symbol on that key. For example:
80
81 · The numeric keys on top of the letter keys on a standard PC
82 keyboard have label values which are the digit characters in
83 ASCII.
84
85 · The English letter keys on a keyboard are represented by A
86 through Z in label. Although in their unshifted state these
87 keys produce lowercase letters, the keycaps are printed with
88 uppercase by convention, so this is what LibGII returns.
89
90 label can be used as a generalized, portable keycode or scancode
91 of the key (That is, if the documentation for an applications
92 says that something is is mapped to key y, it is, even for Ger‐
93 man keyboard, where y and z are swapped)
94
95
96 button The button number distinguishing between the different buttons
97 on the device. For example, on a keyboard it is a number from 0
98 to 127 (i.e. a scancode), on a joystick it might be 1 to 4, and
99 on a spaceorb it will be 1 to 8.
100
101
102 If an application is interested in what physical keys are pressed and
103 released (most games for example), read the label field. Usually the
104 modifiers in effect are irrelevant for these applications (however, for
105 non-alphanumeric symbols like + and -, it is wise to check the sym
106 field instead of label as they are accessed using shifts on some key‐
107 board configurations).
108
109 If an application wants a stream of characters (for text input), it
110 should read the sym field.
111
113 In GGI, key values are defined in ggi/keyboard.h. They are basically
114 Unicode characters with some extensions:
115
116 Keys which are not represented by codepoints in the Unicode standard
117 (such as the numeric keypad keys) are assigned codepoints in the pri‐
118 vate range. Applications should use the GIIK_ #defines for representing
119 these keys. These codepoints are used in label, but they can also
120 occur in sym when the symbol is not any character (e.g. arrow keys,
121 function keys).
122
123 The GIIUC_ #defines represent normal Unicode characters. The #defines
124 are interchangeable with their corresponding codepoint scalars and
125 their use is optional. However, it is recommended to use them for the
126 symbols GIIUC_BackSpace, GIIUC_Return, GIIUC_Escape and GIIUC_Delete.
127 Important: In the LibGII system, no key is guaranteed to exist;
128 the key values are for identification only. Particularly,
129 applications should not rely on their presence. Also, because
130 not all keyboards are configured in the same way, applications
131 are encouraged to allow user configuration of the keys used and
132 not hard-code their values.
133
135 gii_event(3)
136
137
138
139libgii-1.0.x 2006-12-30 gii_key_event(3)