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