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