1 | /************************************************************
|
---|
2 | Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc.
|
---|
3 |
|
---|
4 | Permission to use, copy, modify, and distribute this
|
---|
5 | software and its documentation for any purpose and without
|
---|
6 | fee is hereby granted, provided that the above copyright
|
---|
7 | notice appear in all copies and that both that copyright
|
---|
8 | notice and this permission notice appear in supporting
|
---|
9 | documentation, and that the name of Silicon Graphics not be
|
---|
10 | used in advertising or publicity pertaining to distribution
|
---|
11 | of the software without specific prior written permission.
|
---|
12 | Silicon Graphics makes no representation about the suitability
|
---|
13 | of this software for any purpose. It is provided "as is"
|
---|
14 | without any express or implied warranty.
|
---|
15 |
|
---|
16 | SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
|
---|
17 | SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
---|
18 | AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
|
---|
19 | GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
|
---|
20 | DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
---|
21 | DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
|
---|
22 | OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
|
---|
23 | THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
---|
24 |
|
---|
25 | ********************************************************/
|
---|
26 |
|
---|
27 | #ifndef _XKBSTR_H_
|
---|
28 | #define _XKBSTR_H_
|
---|
29 |
|
---|
30 | #include <X11/extensions/XKB.h>
|
---|
31 |
|
---|
32 | #define XkbCharToInt(v) ((int) ((v) & 0x80 ? ((v) | (~0xff)) : ((v) & 0x7f)))
|
---|
33 | #define XkbIntTo2Chars(i, h, l) ((h) = (i >> 8) & 0xff, (l) = (i) & 0xff)
|
---|
34 |
|
---|
35 | #if defined(WORD64) && defined(UNSIGNEDBITFIELDS)
|
---|
36 | #define Xkb2CharsToInt(h, l) ((int) ((h) & 0x80 ? \
|
---|
37 | (((h) << 8) | (l) | (~0xffff)) : \
|
---|
38 | (((h) << 8) | (l) & 0x7fff))
|
---|
39 | #else
|
---|
40 | #define Xkb2CharsToInt(h,l) ((short)(((h)<<8)|(l)))
|
---|
41 | #endif
|
---|
42 |
|
---|
43 | /*
|
---|
44 | * Common data structures and access macros
|
---|
45 | */
|
---|
46 |
|
---|
47 | typedef struct _XkbStateRec {
|
---|
48 | unsigned char group; /* base + latched + locked */
|
---|
49 | /* FIXME: Why are base + latched short and not char?? */
|
---|
50 | unsigned short base_group; /* physically ... down? */
|
---|
51 | unsigned short latched_group;
|
---|
52 | unsigned char locked_group;
|
---|
53 |
|
---|
54 | unsigned char mods; /* base + latched + locked */
|
---|
55 | unsigned char base_mods; /* physically down */
|
---|
56 | unsigned char latched_mods;
|
---|
57 | unsigned char locked_mods;
|
---|
58 |
|
---|
59 | unsigned char compat_state; /* mods + group for core state */
|
---|
60 |
|
---|
61 | /* grab mods = all depressed and latched mods, _not_ locked mods */
|
---|
62 | unsigned char grab_mods; /* grab mods minus internal mods */
|
---|
63 | unsigned char compat_grab_mods; /* grab mods + group for core state,
|
---|
64 | but not locked groups if
|
---|
65 | IgnoreGroupLocks set */
|
---|
66 |
|
---|
67 | /* effective mods = all mods (depressed, latched, locked) */
|
---|
68 | unsigned char lookup_mods; /* effective mods minus internal mods */
|
---|
69 | unsigned char compat_lookup_mods; /* effective mods + group */
|
---|
70 |
|
---|
71 | unsigned short ptr_buttons; /* core pointer buttons */
|
---|
72 | } XkbStateRec,*XkbStatePtr;
|
---|
73 | #define XkbStateFieldFromRec(s) XkbBuildCoreState((s)->lookup_mods,(s)->group)
|
---|
74 | #define XkbGrabStateFromRec(s) XkbBuildCoreState((s)->grab_mods,(s)->group)
|
---|
75 |
|
---|
76 | typedef struct _XkbMods {
|
---|
77 | unsigned char mask; /* effective mods */
|
---|
78 | unsigned char real_mods;
|
---|
79 | unsigned short vmods;
|
---|
80 | } XkbModsRec,*XkbModsPtr;
|
---|
81 |
|
---|
82 | typedef struct _XkbKTMapEntry {
|
---|
83 | Bool active;
|
---|
84 | unsigned char level;
|
---|
85 | XkbModsRec mods;
|
---|
86 | } XkbKTMapEntryRec,*XkbKTMapEntryPtr;
|
---|
87 |
|
---|
88 | typedef struct _XkbKeyType {
|
---|
89 | XkbModsRec mods;
|
---|
90 | unsigned char num_levels;
|
---|
91 | unsigned char map_count;
|
---|
92 | XkbKTMapEntryPtr map;
|
---|
93 | XkbModsPtr preserve;
|
---|
94 | Atom name;
|
---|
95 | Atom * level_names;
|
---|
96 | } XkbKeyTypeRec, *XkbKeyTypePtr;
|
---|
97 |
|
---|
98 | #define XkbNumGroups(g) ((g)&0x0f)
|
---|
99 | #define XkbOutOfRangeGroupInfo(g) ((g)&0xf0)
|
---|
100 | #define XkbOutOfRangeGroupAction(g) ((g)&0xc0)
|
---|
101 | #define XkbOutOfRangeGroupNumber(g) (((g)&0x30)>>4)
|
---|
102 | #define XkbSetGroupInfo(g, w, n) (((w) & 0xc0) | (((n) & 3) << 4) | \
|
---|
103 | ((g) & 0x0f))
|
---|
104 | #define XkbSetNumGroups(g,n) (((g)&0xf0)|((n)&0x0f))
|
---|
105 |
|
---|
106 | /*
|
---|
107 | * Structures and access macros used primarily by the server
|
---|
108 | */
|
---|
109 |
|
---|
110 | typedef struct _XkbBehavior {
|
---|
111 | unsigned char type;
|
---|
112 | unsigned char data;
|
---|
113 | } XkbBehavior;
|
---|
114 |
|
---|
115 | #define XkbAnyActionDataSize 7
|
---|
116 | typedef struct _XkbAnyAction {
|
---|
117 | unsigned char type;
|
---|
118 | unsigned char data[XkbAnyActionDataSize];
|
---|
119 | } XkbAnyAction;
|
---|
120 |
|
---|
121 | typedef struct _XkbModAction {
|
---|
122 | unsigned char type;
|
---|
123 | unsigned char flags;
|
---|
124 | unsigned char mask;
|
---|
125 | unsigned char real_mods;
|
---|
126 | /* FIXME: Make this an int. */
|
---|
127 | unsigned char vmods1;
|
---|
128 | unsigned char vmods2;
|
---|
129 | } XkbModAction;
|
---|
130 | #define XkbModActionVMods(a) ((short) (((a)->vmods1 << 8) | (a)->vmods2))
|
---|
131 | #define XkbSetModActionVMods(a,v) \
|
---|
132 | ((a)->vmods1 = (((v) >> 8) & 0xff), \
|
---|
133 | (a)->vmods2 = (v) & 0xff)
|
---|
134 |
|
---|
135 | typedef struct _XkbGroupAction {
|
---|
136 | unsigned char type;
|
---|
137 | unsigned char flags;
|
---|
138 | /* FIXME: Make this an int. */
|
---|
139 | char group_XXX;
|
---|
140 | } XkbGroupAction;
|
---|
141 | #define XkbSAGroup(a) (XkbCharToInt((a)->group_XXX))
|
---|
142 | #define XkbSASetGroup(a,g) ((a)->group_XXX=(g))
|
---|
143 |
|
---|
144 | typedef struct _XkbISOAction {
|
---|
145 | unsigned char type;
|
---|
146 | unsigned char flags;
|
---|
147 | unsigned char mask;
|
---|
148 | unsigned char real_mods;
|
---|
149 | /* FIXME: Make this an int. */
|
---|
150 | char group_XXX;
|
---|
151 | unsigned char affect;
|
---|
152 | unsigned char vmods1;
|
---|
153 | unsigned char vmods2;
|
---|
154 | } XkbISOAction;
|
---|
155 |
|
---|
156 | typedef struct _XkbPtrAction {
|
---|
157 | unsigned char type;
|
---|
158 | unsigned char flags;
|
---|
159 | /* FIXME: Make this an int. */
|
---|
160 | unsigned char high_XXX;
|
---|
161 | unsigned char low_XXX;
|
---|
162 | unsigned char high_YYY;
|
---|
163 | unsigned char low_YYY;
|
---|
164 | } XkbPtrAction;
|
---|
165 | #define XkbPtrActionX(a) (Xkb2CharsToInt((a)->high_XXX,(a)->low_XXX))
|
---|
166 | #define XkbPtrActionY(a) (Xkb2CharsToInt((a)->high_YYY,(a)->low_YYY))
|
---|
167 | #define XkbSetPtrActionX(a,x) (XkbIntTo2Chars(x,(a)->high_XXX,(a)->low_XXX))
|
---|
168 | #define XkbSetPtrActionY(a,y) (XkbIntTo2Chars(y,(a)->high_YYY,(a)->low_YYY))
|
---|
169 |
|
---|
170 | typedef struct _XkbPtrBtnAction {
|
---|
171 | unsigned char type;
|
---|
172 | unsigned char flags;
|
---|
173 | unsigned char count;
|
---|
174 | unsigned char button;
|
---|
175 | } XkbPtrBtnAction;
|
---|
176 |
|
---|
177 | typedef struct _XkbPtrDfltAction {
|
---|
178 | unsigned char type;
|
---|
179 | unsigned char flags;
|
---|
180 | unsigned char affect;
|
---|
181 | char valueXXX;
|
---|
182 | } XkbPtrDfltAction;
|
---|
183 | #define XkbSAPtrDfltValue(a) (XkbCharToInt((a)->valueXXX))
|
---|
184 | #define XkbSASetPtrDfltValue(a, c) ((a)->valueXXX = (c) & 0xff)
|
---|
185 |
|
---|
186 | typedef struct _XkbSwitchScreenAction {
|
---|
187 | unsigned char type;
|
---|
188 | unsigned char flags;
|
---|
189 | char screenXXX;
|
---|
190 | } XkbSwitchScreenAction;
|
---|
191 | #define XkbSAScreen(a) (XkbCharToInt((a)->screenXXX))
|
---|
192 | #define XkbSASetScreen(a, s) ((a)->screenXXX = (s) & 0xff)
|
---|
193 |
|
---|
194 | typedef struct _XkbCtrlsAction {
|
---|
195 | unsigned char type;
|
---|
196 | unsigned char flags;
|
---|
197 | /* FIXME: Make this an int. */
|
---|
198 | unsigned char ctrls3;
|
---|
199 | unsigned char ctrls2;
|
---|
200 | unsigned char ctrls1;
|
---|
201 | unsigned char ctrls0;
|
---|
202 | } XkbCtrlsAction;
|
---|
203 | #define XkbActionSetCtrls(a, c) ((a)->ctrls3 = ((c) >> 24) & 0xff, \
|
---|
204 | (a)->ctrls2 = ((c) >> 16) & 0xff, \
|
---|
205 | (a)->ctrls1 = ((c) >> 8) & 0xff, \
|
---|
206 | (a)->ctrls0 = (c) & 0xff)
|
---|
207 | #define XkbActionCtrls(a) ((((unsigned int)(a)->ctrls3)<<24)|\
|
---|
208 | (((unsigned int)(a)->ctrls2)<<16)|\
|
---|
209 | (((unsigned int)(a)->ctrls1)<<8)|\
|
---|
210 | ((unsigned int) (a)->ctrls0))
|
---|
211 |
|
---|
212 | typedef struct _XkbMessageAction {
|
---|
213 | unsigned char type;
|
---|
214 | unsigned char flags;
|
---|
215 | unsigned char message[6];
|
---|
216 | } XkbMessageAction;
|
---|
217 |
|
---|
218 | typedef struct _XkbRedirectKeyAction {
|
---|
219 | unsigned char type;
|
---|
220 | unsigned char new_key;
|
---|
221 | unsigned char mods_mask;
|
---|
222 | unsigned char mods;
|
---|
223 | /* FIXME: Make this an int. */
|
---|
224 | unsigned char vmods_mask0;
|
---|
225 | unsigned char vmods_mask1;
|
---|
226 | unsigned char vmods0;
|
---|
227 | unsigned char vmods1;
|
---|
228 | } XkbRedirectKeyAction;
|
---|
229 |
|
---|
230 | #define XkbSARedirectVMods(a) ((((unsigned int)(a)->vmods1)<<8)|\
|
---|
231 | ((unsigned int)(a)->vmods0))
|
---|
232 | /* FIXME: This is blatantly not setting vmods. Yeesh. */
|
---|
233 | #define XkbSARedirectSetVMods(a,m) (((a)->vmods_mask1=(((m)>>8)&0xff)),\
|
---|
234 | ((a)->vmods_mask0=((m)&0xff)))
|
---|
235 | #define XkbSARedirectVModsMask(a) ((((unsigned int)(a)->vmods_mask1)<<8)|\
|
---|
236 | ((unsigned int)(a)->vmods_mask0))
|
---|
237 | #define XkbSARedirectSetVModsMask(a,m) (((a)->vmods_mask1=(((m)>>8)&0xff)),\
|
---|
238 | ((a)->vmods_mask0=((m)&0xff)))
|
---|
239 |
|
---|
240 | typedef struct _XkbDeviceBtnAction {
|
---|
241 | unsigned char type;
|
---|
242 | unsigned char flags;
|
---|
243 | unsigned char count;
|
---|
244 | unsigned char button;
|
---|
245 | unsigned char device;
|
---|
246 | } XkbDeviceBtnAction;
|
---|
247 |
|
---|
248 | typedef struct _XkbDeviceValuatorAction {
|
---|
249 | unsigned char type;
|
---|
250 | unsigned char device;
|
---|
251 | unsigned char v1_what;
|
---|
252 | unsigned char v1_ndx;
|
---|
253 | unsigned char v1_value;
|
---|
254 | unsigned char v2_what;
|
---|
255 | unsigned char v2_ndx;
|
---|
256 | unsigned char v2_value;
|
---|
257 | } XkbDeviceValuatorAction;
|
---|
258 |
|
---|
259 | typedef union _XkbAction {
|
---|
260 | XkbAnyAction any;
|
---|
261 | XkbModAction mods;
|
---|
262 | XkbGroupAction group;
|
---|
263 | XkbISOAction iso;
|
---|
264 | XkbPtrAction ptr;
|
---|
265 | XkbPtrBtnAction btn;
|
---|
266 | XkbPtrDfltAction dflt;
|
---|
267 | XkbSwitchScreenAction screen;
|
---|
268 | XkbCtrlsAction ctrls;
|
---|
269 | XkbMessageAction msg;
|
---|
270 | XkbRedirectKeyAction redirect;
|
---|
271 | XkbDeviceBtnAction devbtn;
|
---|
272 | XkbDeviceValuatorAction devval;
|
---|
273 | unsigned char type;
|
---|
274 | } XkbAction;
|
---|
275 |
|
---|
276 | typedef struct _XkbControls {
|
---|
277 | unsigned char mk_dflt_btn;
|
---|
278 | unsigned char num_groups;
|
---|
279 | unsigned char groups_wrap;
|
---|
280 | XkbModsRec internal;
|
---|
281 | XkbModsRec ignore_lock;
|
---|
282 | unsigned int enabled_ctrls;
|
---|
283 | unsigned short repeat_delay;
|
---|
284 | unsigned short repeat_interval;
|
---|
285 | unsigned short slow_keys_delay;
|
---|
286 | unsigned short debounce_delay;
|
---|
287 | unsigned short mk_delay;
|
---|
288 | unsigned short mk_interval;
|
---|
289 | unsigned short mk_time_to_max;
|
---|
290 | unsigned short mk_max_speed;
|
---|
291 | short mk_curve;
|
---|
292 | unsigned short ax_options;
|
---|
293 | unsigned short ax_timeout;
|
---|
294 | unsigned short axt_opts_mask;
|
---|
295 | unsigned short axt_opts_values;
|
---|
296 | unsigned int axt_ctrls_mask;
|
---|
297 | unsigned int axt_ctrls_values;
|
---|
298 | unsigned char per_key_repeat[XkbPerKeyBitArraySize];
|
---|
299 | } XkbControlsRec, *XkbControlsPtr;
|
---|
300 |
|
---|
301 | #define XkbAX_AnyFeedback(c) ((c)->enabled_ctrls&XkbAccessXFeedbackMask)
|
---|
302 | #define XkbAX_NeedOption(c,w) ((c)->ax_options&(w))
|
---|
303 | #define XkbAX_NeedFeedback(c, w) (XkbAX_AnyFeedback((c)) && \
|
---|
304 | XkbAX_NeedOption((c), (w)))
|
---|
305 |
|
---|
306 | typedef struct _XkbServerMapRec {
|
---|
307 | unsigned short num_acts;
|
---|
308 | unsigned short size_acts;
|
---|
309 | XkbAction *acts;
|
---|
310 |
|
---|
311 | XkbBehavior *behaviors;
|
---|
312 | unsigned short *key_acts;
|
---|
313 | #if defined(__cplusplus) || defined(c_plusplus)
|
---|
314 | /* explicit is a C++ reserved word */
|
---|
315 | unsigned char *c_explicit;
|
---|
316 | #else
|
---|
317 | unsigned char *explicit;
|
---|
318 | #endif
|
---|
319 | unsigned char vmods[XkbNumVirtualMods];
|
---|
320 | unsigned short *vmodmap;
|
---|
321 | } XkbServerMapRec, *XkbServerMapPtr;
|
---|
322 |
|
---|
323 | #define XkbSMKeyActionsPtr(m, k) (&(m)->acts[(m)->key_acts[(k)]])
|
---|
324 |
|
---|
325 | /*
|
---|
326 | * Structures and access macros used primarily by clients
|
---|
327 | */
|
---|
328 |
|
---|
329 | typedef struct _XkbSymMapRec {
|
---|
330 | unsigned char kt_index[XkbNumKbdGroups];
|
---|
331 | unsigned char group_info;
|
---|
332 | unsigned char width;
|
---|
333 | unsigned short offset;
|
---|
334 | } XkbSymMapRec, *XkbSymMapPtr;
|
---|
335 |
|
---|
336 | typedef struct _XkbClientMapRec {
|
---|
337 | unsigned char size_types;
|
---|
338 | unsigned char num_types;
|
---|
339 | XkbKeyTypePtr types;
|
---|
340 |
|
---|
341 | unsigned short size_syms;
|
---|
342 | unsigned short num_syms;
|
---|
343 | KeySym *syms;
|
---|
344 | XkbSymMapPtr key_sym_map;
|
---|
345 |
|
---|
346 | unsigned char *modmap;
|
---|
347 | } XkbClientMapRec, *XkbClientMapPtr;
|
---|
348 |
|
---|
349 | #define XkbCMKeyGroupInfo(m, k) ((m)->key_sym_map[(k)].group_info)
|
---|
350 | #define XkbCMKeyNumGroups(m, k) (XkbNumGroups((m)->key_sym_map[(k)].group_info))
|
---|
351 | #define XkbCMKeyGroupWidth(m, k, g) (XkbCMKeyType((m), (k), (g))->num_levels)
|
---|
352 | #define XkbCMKeyGroupsWidth(m, k) ((m)->key_sym_map[(k)].width)
|
---|
353 | #define XkbCMKeyTypeIndex(m, k, g) ((m)->key_sym_map[(k)].kt_index[(g) & 0x3])
|
---|
354 | #define XkbCMKeyType(m, k, g) (&(m)->types[XkbCMKeyTypeIndex((m), (k), (g))])
|
---|
355 | #define XkbCMKeyNumSyms(m, k) (XkbCMKeyGroupsWidth((m), (k)) * \
|
---|
356 | XkbCMKeyNumGroups((m), (k)))
|
---|
357 | #define XkbCMKeySymsOffset(m, k) ((m)->key_sym_map[(k)].offset)
|
---|
358 | #define XkbCMKeySymsPtr(m, k) (&(m)->syms[XkbCMKeySymsOffset((m), (k))])
|
---|
359 |
|
---|
360 | /*
|
---|
361 | * Compatibility structures and access macros
|
---|
362 | */
|
---|
363 |
|
---|
364 | typedef struct _XkbSymInterpretRec {
|
---|
365 | KeySym sym;
|
---|
366 | unsigned char flags;
|
---|
367 | unsigned char match;
|
---|
368 | unsigned char mods;
|
---|
369 | unsigned char virtual_mod;
|
---|
370 | XkbAnyAction act;
|
---|
371 | } XkbSymInterpretRec,*XkbSymInterpretPtr;
|
---|
372 |
|
---|
373 | typedef struct _XkbCompatMapRec {
|
---|
374 | XkbSymInterpretPtr sym_interpret;
|
---|
375 | XkbModsRec groups[XkbNumKbdGroups];
|
---|
376 | unsigned short num_si;
|
---|
377 | unsigned short size_si;
|
---|
378 | } XkbCompatMapRec, *XkbCompatMapPtr;
|
---|
379 |
|
---|
380 | typedef struct _XkbIndicatorMapRec {
|
---|
381 | unsigned char flags;
|
---|
382 | /* FIXME: For some reason, interepretation of groups is wildly
|
---|
383 | * different between which being base/latched/locked. */
|
---|
384 | unsigned char which_groups;
|
---|
385 | unsigned char groups;
|
---|
386 | unsigned char which_mods;
|
---|
387 | XkbModsRec mods;
|
---|
388 | unsigned int ctrls;
|
---|
389 | } XkbIndicatorMapRec, *XkbIndicatorMapPtr;
|
---|
390 |
|
---|
391 | #define XkbIM_IsAuto(i) (!((i)->flags & XkbIM_NoAutomatic) && \
|
---|
392 | (((i)->which_groups&&(i)->groups)||\
|
---|
393 | ((i)->which_mods&&(i)->mods.mask)||\
|
---|
394 | (i)->ctrls))
|
---|
395 | #define XkbIM_InUse(i) ((i)->flags || (i)->which_groups || (i)->which_mods || \
|
---|
396 | (i)->ctrls)
|
---|
397 |
|
---|
398 |
|
---|
399 | typedef struct _XkbIndicatorRec {
|
---|
400 | unsigned long phys_indicators;
|
---|
401 | XkbIndicatorMapRec maps[XkbNumIndicators];
|
---|
402 | } XkbIndicatorRec,*XkbIndicatorPtr;
|
---|
403 |
|
---|
404 | typedef struct _XkbKeyNameRec {
|
---|
405 | char name[XkbKeyNameLength];
|
---|
406 | } XkbKeyNameRec,*XkbKeyNamePtr;
|
---|
407 |
|
---|
408 | typedef struct _XkbKeyAliasRec {
|
---|
409 | char real[XkbKeyNameLength];
|
---|
410 | char alias[XkbKeyNameLength];
|
---|
411 | } XkbKeyAliasRec,*XkbKeyAliasPtr;
|
---|
412 |
|
---|
413 | /*
|
---|
414 | * Names for everything
|
---|
415 | */
|
---|
416 | typedef struct _XkbNamesRec {
|
---|
417 | Atom keycodes;
|
---|
418 | Atom geometry;
|
---|
419 | Atom symbols;
|
---|
420 | Atom types;
|
---|
421 | Atom compat;
|
---|
422 | Atom vmods[XkbNumVirtualMods];
|
---|
423 | Atom indicators[XkbNumIndicators];
|
---|
424 | Atom groups[XkbNumKbdGroups];
|
---|
425 | XkbKeyNamePtr keys;
|
---|
426 | XkbKeyAliasPtr key_aliases;
|
---|
427 | Atom *radio_groups;
|
---|
428 | Atom phys_symbols;
|
---|
429 |
|
---|
430 | unsigned char num_keys;
|
---|
431 | unsigned char num_key_aliases;
|
---|
432 | unsigned short num_rg;
|
---|
433 | } XkbNamesRec,*XkbNamesPtr;
|
---|
434 |
|
---|
435 | typedef struct _XkbGeometry *XkbGeometryPtr;
|
---|
436 | /*
|
---|
437 | * Tie it all together into one big keyboard description
|
---|
438 | */
|
---|
439 | typedef struct _XkbDesc {
|
---|
440 | unsigned int defined;
|
---|
441 | unsigned short flags;
|
---|
442 | unsigned short device_spec;
|
---|
443 | KeyCode min_key_code;
|
---|
444 | KeyCode max_key_code;
|
---|
445 |
|
---|
446 | XkbControlsPtr ctrls;
|
---|
447 | XkbServerMapPtr server;
|
---|
448 | XkbClientMapPtr map;
|
---|
449 | XkbIndicatorPtr indicators;
|
---|
450 | XkbNamesPtr names;
|
---|
451 | XkbCompatMapPtr compat;
|
---|
452 | XkbGeometryPtr geom;
|
---|
453 | } XkbDescRec, *XkbDescPtr;
|
---|
454 | #define XkbKeyKeyTypeIndex(d, k, g) (XkbCMKeyTypeIndex((d)->map, (k), (g)))
|
---|
455 | #define XkbKeyKeyType(d, k, g) (XkbCMKeyType((d)->map, (k), (g)))
|
---|
456 | #define XkbKeyGroupWidth(d, k, g) (XkbCMKeyGroupWidth((d)->map, (k), (g)))
|
---|
457 | #define XkbKeyGroupsWidth(d, k) (XkbCMKeyGroupsWidth((d)->map, (k)))
|
---|
458 | #define XkbKeyGroupInfo(d,k) (XkbCMKeyGroupInfo((d)->map,(k)))
|
---|
459 | #define XkbKeyNumGroups(d,k) (XkbCMKeyNumGroups((d)->map,(k)))
|
---|
460 | #define XkbKeyNumSyms(d,k) (XkbCMKeyNumSyms((d)->map,(k)))
|
---|
461 | #define XkbKeySymsPtr(d,k) (XkbCMKeySymsPtr((d)->map,(k)))
|
---|
462 | #define XkbKeySym(d, k, n) (XkbKeySymsPtr((d), (k))[(n)])
|
---|
463 | #define XkbKeySymEntry(d,k,sl,g) \
|
---|
464 | (XkbKeySym((d), (k), (XkbKeyGroupsWidth((d), (k)) * (g)) + (sl)))
|
---|
465 | #define XkbKeyAction(d,k,n) \
|
---|
466 | (XkbKeyHasActions((d), (k)) ? & XkbKeyActionsPtr((d), (k))[(n)] : NULL)
|
---|
467 | #define XkbKeyActionEntry(d,k,sl,g) \
|
---|
468 | (XkbKeyHasActions((d), (k)) ? \
|
---|
469 | XkbKeyAction((d), (k), ((XkbKeyGroupsWidth((d), (k)) * (g)) + (sl))) : \
|
---|
470 | NULL)
|
---|
471 |
|
---|
472 | #define XkbKeyHasActions(d, k) (!!(d)->server->key_acts[(k)])
|
---|
473 | #define XkbKeyNumActions(d, k) (XkbKeyHasActions((d), (k)) ? \
|
---|
474 | XkbKeyNumSyms((d), (k)) : 1)
|
---|
475 | #define XkbKeyActionsPtr(d, k) (XkbSMKeyActionsPtr((d)->server, (k)))
|
---|
476 | #define XkbKeycodeInRange(d, k) ((k) >= (d)->min_key_code && \
|
---|
477 | (k) <= (d)->max_key_code)
|
---|
478 | #define XkbNumKeys(d) ((d)->max_key_code-(d)->min_key_code+1)
|
---|
479 |
|
---|
480 |
|
---|
481 | /*
|
---|
482 | * The following structures can be used to track changes
|
---|
483 | * to a keyboard device
|
---|
484 | */
|
---|
485 | typedef struct _XkbMapChanges {
|
---|
486 | unsigned short changed;
|
---|
487 | KeyCode min_key_code;
|
---|
488 | KeyCode max_key_code;
|
---|
489 | unsigned char first_type;
|
---|
490 | unsigned char num_types;
|
---|
491 | KeyCode first_key_sym;
|
---|
492 | unsigned char num_key_syms;
|
---|
493 | KeyCode first_key_act;
|
---|
494 | unsigned char num_key_acts;
|
---|
495 | KeyCode first_key_behavior;
|
---|
496 | unsigned char num_key_behaviors;
|
---|
497 | KeyCode first_key_explicit;
|
---|
498 | unsigned char num_key_explicit;
|
---|
499 | KeyCode first_modmap_key;
|
---|
500 | unsigned char num_modmap_keys;
|
---|
501 | KeyCode first_vmodmap_key;
|
---|
502 | unsigned char num_vmodmap_keys;
|
---|
503 | unsigned char pad;
|
---|
504 | unsigned short vmods;
|
---|
505 | } XkbMapChangesRec,*XkbMapChangesPtr;
|
---|
506 |
|
---|
507 | typedef struct _XkbControlsChanges {
|
---|
508 | unsigned int changed_ctrls;
|
---|
509 | unsigned int enabled_ctrls_changes;
|
---|
510 | Bool num_groups_changed;
|
---|
511 | } XkbControlsChangesRec,*XkbControlsChangesPtr;
|
---|
512 |
|
---|
513 | typedef struct _XkbIndicatorChanges {
|
---|
514 | unsigned int state_changes;
|
---|
515 | unsigned int map_changes;
|
---|
516 | } XkbIndicatorChangesRec,*XkbIndicatorChangesPtr;
|
---|
517 |
|
---|
518 | typedef struct _XkbNameChanges {
|
---|
519 | unsigned int changed;
|
---|
520 | unsigned char first_type;
|
---|
521 | unsigned char num_types;
|
---|
522 | unsigned char first_lvl;
|
---|
523 | unsigned char num_lvls;
|
---|
524 | unsigned char num_aliases;
|
---|
525 | unsigned char num_rg;
|
---|
526 | unsigned char first_key;
|
---|
527 | unsigned char num_keys;
|
---|
528 | unsigned short changed_vmods;
|
---|
529 | unsigned long changed_indicators;
|
---|
530 | unsigned char changed_groups;
|
---|
531 | } XkbNameChangesRec,*XkbNameChangesPtr;
|
---|
532 |
|
---|
533 | typedef struct _XkbCompatChanges {
|
---|
534 | unsigned char changed_groups;
|
---|
535 | unsigned short first_si;
|
---|
536 | unsigned short num_si;
|
---|
537 | } XkbCompatChangesRec,*XkbCompatChangesPtr;
|
---|
538 |
|
---|
539 | typedef struct _XkbChanges {
|
---|
540 | unsigned short device_spec;
|
---|
541 | unsigned short state_changes;
|
---|
542 | XkbMapChangesRec map;
|
---|
543 | XkbControlsChangesRec ctrls;
|
---|
544 | XkbIndicatorChangesRec indicators;
|
---|
545 | XkbNameChangesRec names;
|
---|
546 | XkbCompatChangesRec compat;
|
---|
547 | } XkbChangesRec, *XkbChangesPtr;
|
---|
548 |
|
---|
549 | /*
|
---|
550 | * These data structures are used to construct a keymap from
|
---|
551 | * a set of components or to list components in the server
|
---|
552 | * database.
|
---|
553 | */
|
---|
554 | typedef struct _XkbComponentNames {
|
---|
555 | char * keycodes;
|
---|
556 | char * types;
|
---|
557 | char * compat;
|
---|
558 | char * symbols;
|
---|
559 | char * geometry;
|
---|
560 | } XkbComponentNamesRec, *XkbComponentNamesPtr;
|
---|
561 |
|
---|
562 | typedef struct _XkbComponentName {
|
---|
563 | unsigned short flags;
|
---|
564 | char * name;
|
---|
565 | } XkbComponentNameRec,*XkbComponentNamePtr;
|
---|
566 |
|
---|
567 | typedef struct _XkbComponentList {
|
---|
568 | int num_keymaps;
|
---|
569 | int num_keycodes;
|
---|
570 | int num_types;
|
---|
571 | int num_compat;
|
---|
572 | int num_symbols;
|
---|
573 | int num_geometry;
|
---|
574 | XkbComponentNamePtr keymaps;
|
---|
575 | XkbComponentNamePtr keycodes;
|
---|
576 | XkbComponentNamePtr types;
|
---|
577 | XkbComponentNamePtr compat;
|
---|
578 | XkbComponentNamePtr symbols;
|
---|
579 | XkbComponentNamePtr geometry;
|
---|
580 | } XkbComponentListRec, *XkbComponentListPtr;
|
---|
581 |
|
---|
582 | /*
|
---|
583 | * The following data structures describe and track changes to a
|
---|
584 | * non-keyboard extension device
|
---|
585 | */
|
---|
586 | typedef struct _XkbDeviceLedInfo {
|
---|
587 | unsigned short led_class;
|
---|
588 | unsigned short led_id;
|
---|
589 | unsigned int phys_indicators;
|
---|
590 | unsigned int maps_present;
|
---|
591 | unsigned int names_present;
|
---|
592 | unsigned int state;
|
---|
593 | Atom names[XkbNumIndicators];
|
---|
594 | XkbIndicatorMapRec maps[XkbNumIndicators];
|
---|
595 | } XkbDeviceLedInfoRec,*XkbDeviceLedInfoPtr;
|
---|
596 |
|
---|
597 | typedef struct _XkbDeviceInfo {
|
---|
598 | char * name;
|
---|
599 | Atom type;
|
---|
600 | unsigned short device_spec;
|
---|
601 | Bool has_own_state;
|
---|
602 | unsigned short supported;
|
---|
603 | unsigned short unsupported;
|
---|
604 |
|
---|
605 | unsigned short num_btns;
|
---|
606 | XkbAction * btn_acts;
|
---|
607 |
|
---|
608 | unsigned short sz_leds;
|
---|
609 | unsigned short num_leds;
|
---|
610 | unsigned short dflt_kbd_fb;
|
---|
611 | unsigned short dflt_led_fb;
|
---|
612 | XkbDeviceLedInfoPtr leds;
|
---|
613 | } XkbDeviceInfoRec,*XkbDeviceInfoPtr;
|
---|
614 |
|
---|
615 | #define XkbXI_DevHasBtnActs(d) ((d)->num_btns > 0 && (d)->btn_acts)
|
---|
616 | #define XkbXI_LegalDevBtn(d,b) (XkbXI_DevHasBtnActs(d) && (b) < (d)->num_btns)
|
---|
617 | #define XkbXI_DevHasLeds(d) ((d)->num_leds > 0 && (d)->leds)
|
---|
618 |
|
---|
619 | typedef struct _XkbDeviceLedChanges {
|
---|
620 | unsigned short led_class;
|
---|
621 | unsigned short led_id;
|
---|
622 | unsigned int defined; /* names or maps changed */
|
---|
623 | struct _XkbDeviceLedChanges *next;
|
---|
624 | } XkbDeviceLedChangesRec,*XkbDeviceLedChangesPtr;
|
---|
625 |
|
---|
626 | typedef struct _XkbDeviceChanges {
|
---|
627 | unsigned int changed;
|
---|
628 | unsigned short first_btn;
|
---|
629 | unsigned short num_btns;
|
---|
630 | XkbDeviceLedChangesRec leds;
|
---|
631 | } XkbDeviceChangesRec,*XkbDeviceChangesPtr;
|
---|
632 |
|
---|
633 | #endif /* _XKBSTR_H_ */
|
---|