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