1 module X11.XKBlib;
2 
3 import X11.Xlib;
4 
5 import core.stdc.config;
6 
7     /*
8      * XKB request codes, used in:
9      *  -  xkbReqType field of all requests
10      *  -  requestMinor field of some events
11      */
12 enum	X_kbUseExtension		 = 0;
13 enum	X_kbSelectEvents	 	 = 1;
14 enum	X_kbBell			 = 3;
15 enum	X_kbGetState			 = 4;
16 enum	X_kbLatchLockState		 = 5;
17 enum	X_kbGetControls			 = 6;
18 enum	X_kbSetControls			 = 7;
19 enum	X_kbGetMap			 = 8;
20 enum	X_kbSetMap			 = 9;
21 enum	X_kbGetCompatMap		= 10;
22 enum	X_kbSetCompatMap		= 11;
23 enum	X_kbGetIndicatorState		= 12;
24 enum	X_kbGetIndicatorMap		= 13;
25 enum	X_kbSetIndicatorMap		= 14;
26 enum	X_kbGetNamedIndicator		= 15;
27 enum	X_kbSetNamedIndicator		= 16;
28 enum	X_kbGetNames			= 17;
29 enum	X_kbSetNames			= 18;
30 enum	X_kbGetGeometry			= 19;
31 enum	X_kbSetGeometry			= 20;
32 enum	X_kbPerClientFlags		= 21;
33 enum	X_kbListComponents		= 22;
34 enum	X_kbGetKbdByName		= 23;
35 enum	X_kbGetDeviceInfo		= 24;
36 enum	X_kbSetDeviceInfo		= 25;
37 enum	X_kbSetDebuggingFlags		= 101;
38 
39     /*
40      * In the X sense, XKB reports only one event.
41      * The type field of all XKB events is XkbEventCode
42      */
43 enum	XkbEventCode			= 0;
44 enum	XkbNumberEvents			= (XkbEventCode+1);
45 
46     /*
47      * XKB has a minor event code so it can use one X event code for
48      * multiple purposes.
49      *  - reported in the xkbType field of all XKB events.
50      *  - XkbSelectEventDetails: Indicates the event for which event details
51      *    are being changed
52      */
53 enum	XkbNewKeyboardNotify		= 0;
54 enum XkbMapNotify			= 1;
55 enum	XkbStateNotify			= 2;
56 enum XkbControlsNotify		= 3;
57 enum	XkbIndicatorStateNotify		= 4;
58 enum	XkbIndicatorMapNotify		= 5;
59 enum	XkbNamesNotify			= 6;
60 enum XkbCompatMapNotify		= 7;
61 enum	XkbBellNotify			= 8;
62 enum	XkbActionMessage		= 9;
63 enum	XkbAccessXNotify		= 10;
64 enum	XkbExtensionDeviceNotify	= 11;
65 
66     /*
67      * Event Mask:
68      *  - XkbSelectEvents:  Specifies event interest.
69      */
70 enum	XkbNewKeyboardNotifyMask	= (1L << 0);
71 enum XkbMapNotifyMask		= (1L << 1);
72 enum	XkbStateNotifyMask		= (1L << 2);
73 enum XkbControlsNotifyMask		= (1L << 3);
74 enum	XkbIndicatorStateNotifyMask	= (1L << 4);
75 enum	XkbIndicatorMapNotifyMask	= (1L << 5);
76 enum	XkbNamesNotifyMask		= (1L << 6);
77 enum XkbCompatMapNotifyMask		= (1L << 7);
78 enum	XkbBellNotifyMask		= (1L << 8);
79 enum	XkbActionMessageMask		= (1L << 9);
80 enum	XkbAccessXNotifyMask		= (1L << 10);
81 enum	XkbExtensionDeviceNotifyMask	= (1L << 11);
82 enum	XkbAllEventsMask		= (0xFFF);
83 
84     /*
85      * NewKeyboardNotify event details:
86      */
87 enum	XkbNKN_KeycodesMask		= (1L << 0);
88 enum	XkbNKN_GeometryMask		= (1L << 1);
89 enum	XkbNKN_DeviceIDMask		= (1L << 2);
90 enum	XkbAllNewKeyboardEventsMask	= (0x7);
91 
92     /*
93      * AccessXNotify event types:
94      *  - The 'what' field of AccessXNotify events reports the
95      *    reason that the event was generated.
96      */
97 enum	XkbAXN_SKPress			= 0;
98 enum	XkbAXN_SKAccept			= 1;
99 enum	XkbAXN_SKReject			= 2;
100 enum	XkbAXN_SKRelease		= 3;
101 enum	XkbAXN_BKAccept			= 4;
102 enum	XkbAXN_BKReject			= 5;
103 enum	XkbAXN_AXKWarning		= 6;
104 
105     /*
106      * AccessXNotify details:
107      * - Used as an event detail mask to limit the conditions under which
108      *   AccessXNotify events are reported
109      */
110 enum	XkbAXN_SKPressMask		= (1L << 0);
111 enum	XkbAXN_SKAcceptMask		= (1L << 1);
112 enum	XkbAXN_SKRejectMask		= (1L << 2);
113 enum	XkbAXN_SKReleaseMask		= (1L << 3);
114 enum	XkbAXN_BKAcceptMask		= (1L << 4);
115 enum	XkbAXN_BKRejectMask		= (1L << 5);
116 enum	XkbAXN_AXKWarningMask		= (1L << 6);
117 enum	XkbAllAccessXEventsMask		= (0x7f);
118 
119     /*
120      * Miscellaneous event details:
121      * - event detail masks for assorted events that don't reall
122      *   have any details.
123      */
124 enum	XkbAllStateEventsMask		= XkbAllStateComponentsMask;
125 enum	XkbAllMapEventsMask		= XkbAllMapComponentsMask;
126 enum	XkbAllControlEventsMask		= XkbAllControlsMask;
127 enum	XkbAllIndicatorEventsMask	= XkbAllIndicatorsMask;
128 enum	XkbAllNameEventsMask		= XkbAllNamesMask;
129 enum	XkbAllCompatMapEventsMask	= XkbAllCompatMask;
130 enum	XkbAllBellEventsMask		= (1L << 0);
131 enum	XkbAllActionMessagesMask	= (1L << 0);
132 
133     /*
134      * XKB reports one error:  BadKeyboard
135      * A further reason for the error is encoded into to most significant
136      * byte of the resourceID for the error:
137      *    XkbErr_BadDevice - the device in question was not found
138      *    XkbErr_BadClass  - the device was found but it doesn't bec_long to
139      *                       the appropriate class.
140      *    XkbErr_BadId     - the device was found and bec_longs to the right
141      *                       class, but not feedback with a matching id was
142      *                       found.
143      * The low byte of the resourceID for this error contains the device
144      * id, class specifier or feedback id that failed.
145      */
146 enum	XkbKeyboard			= 0;
147 enum	XkbNumberErrors			= 1;
148 
149 enum	XkbErr_BadDevice	= 0xff;
150 enum	XkbErr_BadClass		= 0xfe;
151 enum	XkbErr_BadId		= 0xfd;
152 
153     /*
154      * Keyboard Components Mask:
155      * - Specifies the components that follow a GetKeyboardByNameReply
156      */
157 enum	XkbClientMapMask		= (1L << 0);
158 enum	XkbServerMapMask		= (1L << 1);
159 enum	XkbCompatMapMask		= (1L << 2);
160 enum	XkbIndicatorMapMask		= (1L << 3);
161 enum	XkbNamesMask			= (1L << 4);
162 enum	XkbGeometryMask			= (1L << 5);
163 enum	XkbControlsMask			= (1L << 6);
164 enum	XkbAllComponentsMask		= (0x7f);
165 
166     /*
167      * State detail mask:
168      *  - The 'changed' field of StateNotify events reports which of
169      *    the keyboard state components have changed.
170      *  - Used as an event detail mask to limit the conditions under
171      *    which StateNotify events are reported.
172      */
173 enum	XkbModifierStateMask		= (1L << 0);
174 enum	XkbModifierBaseMask		= (1L << 1);
175 enum	XkbModifierLatchMask		= (1L << 2);
176 enum	XkbModifierLockMask		= (1L << 3);
177 enum	XkbGroupStateMask		= (1L << 4);
178 enum	XkbGroupBaseMask		= (1L << 5);
179 enum	XkbGroupLatchMask		= (1L << 6);
180 enum XkbGroupLockMask		= (1L << 7);
181 enum	XkbCompatStateMask		= (1L << 8);
182 enum	XkbGrabModsMask			= (1L << 9);
183 enum	XkbCompatGrabModsMask		= (1L << 10);
184 enum	XkbLookupModsMask		= (1L << 11);
185 enum	XkbCompatLookupModsMask		= (1L << 12);
186 enum	XkbPointerButtonMask		= (1L << 13);
187 enum	XkbAllStateComponentsMask	= (0x3fff);
188 
189     /*
190      * Controls detail masks:
191      *  The controls specified in XkbAllControlsMask:
192      *  - The 'changed' field of ControlsNotify events reports which of
193      *    the keyboard controls have changed.
194      *  - The 'changeControls' field of the SetControls request specifies
195      *    the controls for which values are to be changed.
196      *  - Used as an event detail mask to limit the conditions under
197      *    which ControlsNotify events are reported.
198      *
199      *  The controls specified in the XkbAllBooleanCtrlsMask:
200      *  - The 'enabledControls' field of ControlsNotify events reports the
201      *    current status of the boolean controls.
202      *  - The 'enabledControlsChanges' field of ControlsNotify events reports
203      *    any boolean controls that have been turned on or off.
204      *  - The 'affectEnabledControls' and 'enabledControls' fields of the
205      *    kbSetControls request change the set of enabled controls.
206      *  - The 'accessXTimeoutMask' and 'accessXTimeoutValues' fields of
207      *    an XkbControlsRec specify the controls to be changed if the keyboard
208      *    times out and the values to which they should be changed.
209      *  - The 'autoCtrls' and 'autoCtrlsValues' fields of the PerClientFlags
210      *    request specifies the specify the controls to be reset when the
211      *    client exits and the values to which they should be reset.
212      *  - The 'ctrls' field of an indicator map specifies the controls
213      *    that drive the indicator.
214      *  - Specifies the boolean controls affected by the SetControls and
215      *    LockControls key actions.
216      */
217 enum	XkbRepeatKeysMask	 = (1L << 0);
218 enum	XkbSlowKeysMask		 = (1L << 1);
219 enum	XkbBounceKeysMask	 = (1L << 2);
220 enum	XkbStickyKeysMask	 = (1L << 3);
221 enum	XkbMouseKeysMask	 = (1L << 4);
222 enum	XkbMouseKeysAccelMask	 = (1L << 5);
223 enum	XkbAccessXKeysMask	 = (1L << 6);
224 enum	XkbAccessXTimeoutMask	 = (1L << 7);
225 enum	XkbAccessXFeedbackMask	 = (1L << 8);
226 enum	XkbAudibleBellMask	 = (1L << 9);
227 enum	XkbOverlay1Mask		 = (1L << 10);
228 enum	XkbOverlay2Mask		 = (1L << 11);
229 enum	XkbIgnoreGroupLockMask	 = (1L << 12);
230 enum	XkbGroupsWrapMask	 = (1L << 27);
231 enum	XkbInternalModsMask	 = (1L << 28);
232 enum	XkbIgnoreLockModsMask	 = (1L << 29);
233 enum	XkbPerKeyRepeatMask	 = (1L << 30);
234 enum	XkbControlsEnabledMask	 = (1L << 31);
235 
236 enum	XkbAccessXOptionsMask    = (XkbStickyKeysMask|XkbAccessXFeedbackMask);
237 
238 enum	XkbAllBooleanCtrlsMask	 = (0x00001FFF);
239 enum	XkbAllControlsMask	 = (0xF8001FFF);
240 //enum	XkbAllControlEventsMask	 = XkbAllControlsMask;
241 
242     /*
243      * AccessX Options Mask
244      *  - The 'accessXOptions' field of an XkbControlsRec specifies the
245      *    AccessX options that are currently in effect.
246      *  - The 'accessXTimeoutOptionsMask' and 'accessXTimeoutOptionsValues'
247      *    fields of an XkbControlsRec specify the Access X options to be
248      *    changed if the keyboard times out and the values to which they
249      *    should be changed.
250      */
251 enum	XkbAX_SKPressFBMask	= (1L << 0);
252 enum	XkbAX_SKAcceptFBMask	= (1L << 1);
253 enum	XkbAX_FeatureFBMask	= (1L << 2);
254 enum	XkbAX_SlowWarnFBMask	= (1L << 3);
255 enum	XkbAX_IndicatorFBMask	= (1L << 4);
256 enum	XkbAX_StickyKeysFBMask	= (1L << 5);
257 enum	XkbAX_TwoKeysMask	= (1L << 6);
258 enum	XkbAX_LatchToLockMask	= (1L << 7);
259 enum	XkbAX_SKReleaseFBMask	= (1L << 8);
260 enum	XkbAX_SKRejectFBMask	= (1L << 9);
261 enum	XkbAX_BKRejectFBMask	= (1L << 10);
262 enum	XkbAX_DumbBellFBMask	= (1L << 11);
263 enum	XkbAX_FBOptionsMask	= (0xF3F);
264 enum	XkbAX_SKOptionsMask	= (0x0C0);
265 enum	XkbAX_AllOptionsMask	= (0xFFF);
266 
267     /*
268      * XkbUseCoreKbd is used to specify the core keyboard without having
269      * 			to look up its X input extension identifier.
270      * XkbUseCorePtr is used to specify the core pointer without having
271      *			to look up its X input extension identifier.
272      * XkbDfltXIClass is used to specify "don't care" any place that the
273      *			XKB protocol is looking for an X Input Extension
274      *			device class.
275      * XkbDfltXIId is used to specify "don't care" any place that the
276      *			XKB protocol is looking for an X Input Extension
277      *			feedback identifier.
278      * XkbAllXIClasses is used to get information about all device indicators,
279      *			whether they're part of the indicator feedback class
280      *			or the keyboard feedback class.
281      * XkbAllXIIds is used to get information about all device indicator
282      *			feedbacks without having to list them.
283      * XkbXINone is used to indicate that no class or id has been specified.
284      * XkbLegalXILedClass(c)  True if 'c' specifies a legal class with LEDs
285      * XkbLegalXIBellClass(c) True if 'c' specifies a legal class with bells
286      * XkbExplicitXIDevice(d) True if 'd' explicitly specifies a device
287      * XkbExplicitXIClass(c)  True if 'c' explicitly specifies a device class
288      * XkbExplicitXIId(c)     True if 'i' explicitly specifies a device id
289      * XkbSingleXIClass(c)    True if 'c' specifies exactly one device class,
290      *                        including the default.
291      * XkbSingleXIId(i)       True if 'i' specifies exactly one device
292      *	                      identifier, including the default.
293      */
294 enum	XkbUseCoreKbd		= 0x0100;
295 enum	XkbUseCorePtr		= 0x0200;
296 enum	XkbDfltXIClass		= 0x0300;
297 enum	XkbDfltXIId		= 0x0400;
298 enum	XkbAllXIClasses		= 0x0500;
299 enum	XkbAllXIIds		= 0x0600;
300 enum	XkbXINone		= 0xff00;
301 
302 
303 auto XkbLegalXILedClassc(C)(C c) {
304     return (c==KbdFeedbackClass)||
305 					(c==LedFeedbackClass)||
306 					(c==XkbDfltXIClass)||
307 					(c==XkbAllXIClasses);
308 }
309 
310 auto XkbLegalXIBellClassc(C)(C c) {
311     return (c==KbdFeedbackClass)||
312 					(c==BellFeedbackClass)||
313 					(c==XkbDfltXIClass)||
314 					(c==XkbAllXIClasses);
315 }
316 
317 auto XkbExplicitXIDevicec(C)(C c) {
318     return (c & (~0xff)) == 0;
319 }
320 
321 auto XkbExplicitXIDevicec(C)(C c) {
322     return ((c&(~0xff))==0);
323 }
324 
325 auto XkbExplicitXIClassc(C)(C c) {
326     return ((c&(~0xff))==0);
327 }
328 
329 auto XkbExplicitXIIdc(C)(C c) {
330     return ((c&(~0xff))==0);
331 }
332 
333 auto XkbSingleXIClassc(C)(C c) {
334     return (((c&(~0xff))==0)||(c==XkbDfltXIClass));
335 }
336 
337 auto XkbSingleXIIdc(C)(C c) {
338     return (((c&(~0xff))==0)||(c==XkbDfltXIId));
339 }
340 
341 enum	XkbNoModifier		= 0xff;
342 enum	XkbNoShiftLevel		= 0xff;
343 enum	XkbNoShape		= 0xff;
344 enum	XkbNoIndicator		= 0xff;
345 
346 enum	XkbNoModifierMask	= 0;
347 enum	XkbAllModifiersMask	= 0xff;
348 enum	XkbAllVirtualModsMask	= 0xffff;
349 
350 enum	XkbNumKbdGroups		= 4;
351 enum	XkbMaxKbdGroup		= (XkbNumKbdGroups-1);
352 
353 enum	XkbMaxMouseKeysBtn	= 4;
354 
355     /*
356      * Group Index and Mask:
357      *  - Indices into the kt_index array of a key type.
358      *  - Mask specifies types to be changed for XkbChangeTypesOfKey
359      */
360 enum	XkbGroup1Index		= 0;
361 enum	XkbGroup2Index		= 1;
362 enum	XkbGroup3Index		= 2;
363 enum	XkbGroup4Index		= 3;
364 enum	XkbAnyGroup		= 254;
365 enum	XkbAllGroups		= 255;
366 
367 enum	XkbGroup1Mask		= (1<<0);
368 enum	XkbGroup2Mask		= (1<<1);
369 enum	XkbGroup3Mask		= (1<<2);
370 enum	XkbGroup4Mask		= (1<<3);
371 enum	XkbAnyGroupMask		= (1<<7);
372 enum	XkbAllGroupsMask	= (0xf);
373 
374     /*
375      * BuildCoreState: Given a keyboard group and a modifier state,
376      *                 construct the value to be reported an event.
377      * GroupForCoreState:  Given the state reported in an event,
378      *                 determine the keyboard group.
379      * IsLegalGroup:   Returns TRUE if 'g' is a valid group index.
380      */
381 auto XkbBuildCoreState(M, G)(M m, G g) {
382     return (((g&0x3)<<13)|(m&0xff));
383 }
384 auto XkbGroupForCoreState(S)(S s) {
385     return ((s>>13)&0x3);
386 }
387 auto XkbIsLegalGroupg(G)(G g) {
388     return ((g>=0)&&(g<XkbNumKbdGroups));
389 }
390 
391     /*
392      * GroupsWrap values:
393      *  - The 'groupsWrap' field of an XkbControlsRec specifies the
394      *    treatment of out of range groups.
395      *  - Bits 6 and 7 of the group info field of a key symbol map
396      *    specify the interpretation of out of range groups for the
397      *    corresponding key.
398      */
399 enum	XkbWrapIntoRange	= (0x00);
400 enum	XkbClampIntoRange	= (0x40);
401 enum	XkbRedirectIntoRange	= (0x80);
402 
403     /*
404      * Action flags:  Reported in the 'flags' field of most key actions.
405      * Interpretation depends on the type of the action; not all actions
406      * accept all flags.
407      *
408      * Option			Used for Actions
409      * ------			----------------
410      * ClearLocks		SetMods, LatchMods, SetGroup, LatchGroup
411      * LatchToLock		SetMods, LatchMods, SetGroup, LatchGroup
412      * LockNoLock		LockMods, ISOLock, LockPtrBtn, LockDeviceBtn
413      * LockNoUnlock		LockMods, ISOLock, LockPtrBtn, LockDeviceBtn
414      * UseModMapMods		SetMods, LatchMods, LockMods, ISOLock
415      * GroupAbsolute		SetGroup, LatchGroup, LockGroup, ISOLock
416      * UseDfltButton		PtrBtn, LockPtrBtn
417      * NoAcceleration		MovePtr
418      * MoveAbsoluteX		MovePtr
419      * MoveAbsoluteY		MovePtr
420      * ISODfltIsGroup		ISOLock
421      * ISONoAffectMods		ISOLock
422      * ISONoAffectGroup		ISOLock
423      * ISONoAffectPtr		ISOLock
424      * ISONoAffectCtrls		ISOLock
425      * MessageOnPress		ActionMessage
426      * MessageOnRelease		ActionMessage
427      * MessageGenKeyEvent	ActionMessage
428      * AffectDfltBtn		SetPtrDflt
429      * DfltBtnAbsolute		SetPtrDflt
430      * SwitchApplication	SwitchScreen
431      * SwitchAbsolute		SwitchScreen
432      */
433 
434 enum	XkbSA_ClearLocks	= (1L << 0);
435 enum	XkbSA_LatchToLock	= (1L << 1);
436 
437 enum	XkbSA_LockNoLock	= (1L << 0);
438 enum	XkbSA_LockNoUnlock	= (1L << 1);
439 
440 enum	XkbSA_UseModMapMods	= (1L << 2);
441 
442 enum	XkbSA_GroupAbsolute	= (1L << 2);
443 enum	XkbSA_UseDfltButton	= 0;
444 
445 enum	XkbSA_NoAcceleration	= (1L << 0);
446 enum	XkbSA_MoveAbsoluteX	= (1L << 1);
447 enum	XkbSA_MoveAbsoluteY	= (1L << 2);
448 
449 enum	XkbSA_ISODfltIsGroup 	 = (1L << 7);
450 enum	XkbSA_ISONoAffectMods	 = (1L << 6);
451 enum	XkbSA_ISONoAffectGroup	 = (1L << 5);
452 enum	XkbSA_ISONoAffectPtr	 = (1L << 4);
453 enum	XkbSA_ISONoAffectCtrls	 = (1L << 3);
454 enum	XkbSA_ISOAffectMask	 = (0x78);
455 
456 enum	XkbSA_MessageOnPress	 = (1L << 0);
457 enum	XkbSA_MessageOnRelease	 = (1L << 1);
458 enum	XkbSA_MessageGenKeyEvent = (1L << 2);
459 
460 enum	XkbSA_AffectDfltBtn	= 1;
461 enum	XkbSA_DfltBtnAbsolute	= (1L << 2);
462 
463 enum	XkbSA_SwitchApplication	= (1L << 0);
464 enum	XkbSA_SwitchAbsolute	= (1L << 2);
465 
466     /*
467      * The following values apply to the SA_DeviceValuator
468      * action only.  Valuator operations specify the action
469      * to be taken.   Values specified in the action are
470      * multiplied by 2^scale before they are applied.
471      */
472 enum	XkbSA_IgnoreVal		= (0x00);
473 enum	XkbSA_SetValMin		= (0x10);
474 enum	XkbSA_SetValCenter	= (0x20);
475 enum	XkbSA_SetValMax		= (0x30);
476 enum	XkbSA_SetValRelative	= (0x40);
477 enum	XkbSA_SetValAbsolute	= (0x50);
478 enum	XkbSA_ValOpMask		= (0x70);
479 enum	XkbSA_ValScaleMask	= (0x07);
480 
481 auto XkbSA_ValOp(A)(A a) {
482     return ((a)&XkbSA_ValOpMask);
483 }
484 auto XkbSA_ValScale(A)(A a) {
485     return ((a)&XkbSA_ValScaleMask);
486 }
487 
488     /*
489      * Action types: specifies the type of a key action.  Reported in the
490      * type field of all key actions.
491      */
492 enum	XkbSA_NoAction		= 0x00;
493 enum	XkbSA_SetMods		= 0x01;
494 enum	XkbSA_LatchMods		= 0x02;
495 enum	XkbSA_LockMods		= 0x03;
496 enum	XkbSA_SetGroup		= 0x04;
497 enum	XkbSA_LatchGroup	= 0x05;
498 enum	XkbSA_LockGroup		= 0x06;
499 enum	XkbSA_MovePtr		= 0x07;
500 enum	XkbSA_PtrBtn		= 0x08;
501 enum	XkbSA_LockPtrBtn	= 0x09;
502 enum	XkbSA_SetPtrDflt	= 0x0a;
503 enum	XkbSA_ISOLock		= 0x0b;
504 enum	XkbSA_Terminate		= 0x0c;
505 enum	XkbSA_SwitchScreen	= 0x0d;
506 enum	XkbSA_SetControls	= 0x0e;
507 enum	XkbSA_LockControls	= 0x0f;
508 enum	XkbSA_ActionMessage	= 0x10;
509 enum	XkbSA_RedirectKey	= 0x11;
510 enum	XkbSA_DeviceBtn		= 0x12;
511 enum	XkbSA_LockDeviceBtn	= 0x13;
512 enum	XkbSA_DeviceValuator	= 0x14;
513 enum	XkbSA_LastAction	= XkbSA_DeviceValuator;
514 enum	XkbSA_NumActions	= (XkbSA_LastAction+1);
515 
516 enum	XkbSA_XFree86Private	= 0x86;
517 
518     /*
519      * Specifies the key actions that clear latched groups or modifiers.
520      */
521 enum XkbSA_BreakLatch =
522 	((1<<XkbSA_NoAction)|(1<<XkbSA_PtrBtn)|(1<<XkbSA_LockPtrBtn)|
523 	(1<<XkbSA_Terminate)|(1<<XkbSA_SwitchScreen)|(1<<XkbSA_SetControls)|
524 	(1<<XkbSA_LockControls)|(1<<XkbSA_ActionMessage)|
525 	(1<<XkbSA_RedirectKey)|(1<<XkbSA_DeviceBtn)|(1<<XkbSA_LockDeviceBtn));
526 
527     /*
528      * Macros to classify key actions
529      */
530 enum XkbIsModAction(A)(A a) {
531     return (((a).type>=Xkb_SASetMods)&&((a).type<=XkbSA_LockMods));
532 }
533 enum XkbIsGroupAction(A)(A a) {
534     return (((a).type>=XkbSA_SetGroup)&&((a).type<=XkbSA_LockGroup));
535 }
536 enum XkbIsPtrAction(A)(A a) {
537     return (((a).type>=XkbSA_MovePtr)&&((a).type<=XkbSA_SetPtrDflt));
538 }
539 
540 
541     /*
542      * Key Behavior Qualifier:
543      *    KB_Permanent indicates that the behavior describes an unalterable
544      *    characteristic of the keyboard, not an XKB software-simulation of
545      *    the listed behavior.
546      * Key Behavior Types:
547      *    Specifies the behavior of the underlying key.
548      */
549 enum	XkbKB_Permanent		= 0x80;
550 enum	XkbKB_OpMask		= 0x7f;
551 
552 enum	XkbKB_Default		= 0x00;
553 enum	XkbKB_Lock		= 0x01;
554 enum	XkbKB_RadioGroup	= 0x02;
555 enum	XkbKB_Overlay1		= 0x03;
556 enum	XkbKB_Overlay2		= 0x04;
557 
558 enum	XkbKB_RGAllowNone	= 0x80;
559 
560     /*
561      * Various macros which describe the range of legal keycodes.
562      */
563 enum	XkbMinLegalKeyCode	= 8;
564 enum	XkbMaxLegalKeyCode	= 255;
565 enum	XkbMaxKeyCount		= (XkbMaxLegalKeyCode-XkbMinLegalKeyCode+1);
566 enum	XkbPerKeyBitArraySize	= ((XkbMaxLegalKeyCode+1)/8);
567 /* Seems kinda silly to check that an ubyte is <= 255... */
568 enum XkbIsLegalKeycode(A)(A k) {
569     return ((k)>=XkbMinLegalKeyCode);
570 }
571 
572     /*
573      * Assorted constants and limits.
574      */
575 enum	XkbNumModifiers		= 8;
576 enum	XkbNumVirtualMods	= 16;
577 enum	XkbNumIndicators	= 32;
578 enum	XkbAllIndicatorsMask	= (0xffffffff);
579 enum	XkbMaxRadioGroups	= 32;
580 enum	XkbAllRadioGroupsMask	= (0xffffffff);
581 enum	XkbMaxShiftLevel	= 63;
582 enum	XkbMaxSymsPerKey	= (XkbMaxShiftLevel*XkbNumKbdGroups);
583 enum	XkbRGMaxMembers		= 12;
584 enum	XkbActionMessageLength	= 6;
585 enum	XkbKeyNameLength	= 4;
586 enum	XkbMaxRedirectCount	= 8;
587 
588 enum	XkbGeomPtsPerMM		= 10;
589 enum	XkbGeomMaxColors	= 32;
590 enum	XkbGeomMaxLabelColors	= 3;
591 enum	XkbGeomMaxPriority	= 255;
592 
593     /*
594      * Key Type index and mask for the four standard key types.
595      */
596 enum	XkbOneLevelIndex	= 0;
597 enum	XkbTwoLevelIndex	= 1;
598 enum	XkbAlphabeticIndex	= 2;
599 enum	XkbKeypadIndex		= 3;
600 enum	XkbLastRequiredType	= XkbKeypadIndex;
601 enum	XkbNumRequiredTypes	= (XkbLastRequiredType+1);
602 enum	XkbMaxKeyTypes		= 255;
603 
604 enum	XkbOneLevelMask		= (1<<0);
605 enum	XkbTwoLevelMask		= (1<<1);
606 enum	XkbAlphabeticMask	= (1<<2);
607 enum	XkbKeypadMask		= (1<<3);
608 enum	XkbAllRequiredTypes	= (0xf);
609 
610 enum XkbShiftLevel(A)(A n) {
611     return ((n)-1);
612 }
613 enum XkbShiftLevelMask(A)(A n) {
614     return (1<<((n)-1));
615 }
616 
617     /*
618      * Extension name and version information
619      */
620 enum	XkbName = "XKEYBOARD";
621 enum	XkbMajorVersion	= 1;
622 enum	XkbMinorVersion	= 0;
623 
624     /*
625      * Explicit map components:
626      *  - Used in the 'explicit' field of an XkbServerMap.  Specifies
627      *    the keyboard components that should _not_ be updated automatically
628      *    in response to core protocol keyboard mapping requests.
629      */
630 enum	XkbExplicitKeyTypesMask	  = (0x0f);
631 enum	XkbExplicitKeyType1Mask	  = (1<<0);
632 enum	XkbExplicitKeyType2Mask	  = (1<<1);
633 enum	XkbExplicitKeyType3Mask	  = (1<<2);
634 enum	XkbExplicitKeyType4Mask	  = (1<<3);
635 enum	XkbExplicitInterpretMask  = (1<<4);
636 enum	XkbExplicitAutoRepeatMask = (1<<5);
637 enum	XkbExplicitBehaviorMask	  = (1<<6);
638 enum	XkbExplicitVModMapMask	  = (1<<7);
639 enum	XkbAllExplicitMask	  = (0xff);
640 
641     /*
642      * Map components masks:
643      * Those in AllMapComponentsMask:
644      *  - Specifies the individual fields to be loaded or changed for the
645      *    GetMap and SetMap requests.
646      * Those in ClientInfoMask:
647      *  - Specifies the components to be allocated by XkbAllocClientMap.
648      * Those in ServerInfoMask:
649      *  - Specifies the components to be allocated by XkbAllocServerMap.
650      */
651 enum	XkbKeyTypesMask		= (1<<0);
652 enum	XkbKeySymsMask		= (1<<1);
653 enum	XkbModifierMapMask	= (1<<2);
654 enum	XkbExplicitComponentsMask = (1<<3);
655 enum XkbKeyActionsMask	= (1<<4);
656 enum	XkbKeyBehaviorsMask	= (1<<5);
657 enum	XkbVirtualModsMask	= (1<<6);
658 enum	XkbVirtualModMapMask	= (1<<7);
659 
660 enum	XkbAllClientInfoMask	= (XkbKeyTypesMask|XkbKeySymsMask|XkbModifierMapMask);
661 enum	XkbAllServerInfoMask	= (XkbExplicitComponentsMask|XkbKeyActionsMask|XkbKeyBehaviorsMask|XkbVirtualModsMask|XkbVirtualModMapMask);
662 enum	XkbAllMapComponentsMask	= (XkbAllClientInfoMask|XkbAllServerInfoMask);
663 
664     /*
665      * Symbol interpretations flags:
666      *  - Used in the flags field of a symbol interpretation
667      */
668 enum	XkbSI_AutoRepeat	= (1<<0);
669 enum	XkbSI_LockingKey	= (1<<1);
670 
671     /*
672      * Symbol interpretations match specification:
673      *  - Used in the match field of a symbol interpretation to specify
674      *    the conditions under which an interpretation is used.
675      */
676 enum	XkbSI_LevelOneOnly	= (0x80);
677 enum	XkbSI_OpMask		= (0x7f);
678 enum	XkbSI_NoneOf		= (0);
679 enum	XkbSI_AnyOfOrNone	= (1);
680 enum	XkbSI_AnyOf		= (2);
681 enum	XkbSI_AllOf		= (3);
682 enum	XkbSI_Exactly		= (4);
683 
684     /*
685      * Indicator map flags:
686      *  - Used in the flags field of an indicator map to indicate the
687      *    conditions under which and indicator can be changed and the
688      *    effects of changing the indicator.
689      */
690 enum	XkbIM_NoExplicit	= (1L << 7);
691 enum	XkbIM_NoAutomatic	= (1L << 6);
692 enum	XkbIM_LEDDrivesKB	= (1L << 5);
693 
694     /*
695      * Indicator map component specifications:
696      *  - Used by the 'which_groups' and 'which_mods' fields of an indicator
697      *    map to specify which keyboard components should be used to drive
698      *    the indicator.
699      */
700 enum	XkbIM_UseBase		= (1L << 0);
701 enum	XkbIM_UseLatched	= (1L << 1);
702 enum	XkbIM_UseLocked		= (1L << 2);
703 enum	XkbIM_UseEffective	= (1L << 3);
704 enum	XkbIM_UseCompat		= (1L << 4);
705 
706 enum	XkbIM_UseNone	  = 0;
707 enum	XkbIM_UseAnyGroup = (XkbIM_UseBase|XkbIM_UseLatched|XkbIM_UseLocked
708                            |XkbIM_UseEffective);
709 enum	XkbIM_UseAnyMods  = (XkbIM_UseAnyGroup|XkbIM_UseCompat);
710 
711     /*
712      * Compatibility Map Compontents:
713      *  - Specifies the components to be allocated in XkbAllocCompatMap.
714      */
715 enum	XkbSymInterpMask	= (1<<0);
716 enum	XkbGroupCompatMask	= (1<<1);
717 enum	XkbAllCompatMask	= (0x3);
718 
719     /*
720      * Names component mask:
721      *  - Specifies the names to be loaded or changed for the GetNames and
722      *    SetNames requests.
723      *  - Specifies the names that have changed in a NamesNotify event.
724      *  - Specifies the names components to be allocated by XkbAllocNames.
725      */
726 enum	XkbKeycodesNameMask	= (1<<0);
727 enum	XkbGeometryNameMask	= (1<<1);
728 enum	XkbSymbolsNameMask	= (1<<2);
729 enum	XkbPhysSymbolsNameMask	= (1<<3);
730 enum	XkbTypesNameMask	= (1<<4);
731 enum	XkbCompatNameMask 	= (1<<5);
732 enum	XkbKeyTypeNamesMask	= (1<<6);
733 enum	XkbKTLevelNamesMask	= (1<<7);
734 enum	XkbIndicatorNamesMask	= (1<<8);
735 enum	XkbKeyNamesMask		= (1<<9);
736 enum	XkbKeyAliasesMask	= (1<<10);
737 enum	XkbVirtualModNamesMask	= (1<<11);
738 enum	XkbGroupNamesMask	= (1<<12);
739 enum	XkbRGNamesMask		= (1<<13);
740 enum	XkbComponentNamesMask	= (0x3f);
741 enum	XkbAllNamesMask		= (0x3fff);
742 
743     /*
744      * GetByName components:
745      *  - Specifies desired or necessary components to GetKbdByName request.
746      *  - Reports the components that were found in a GetKbdByNameReply
747      */
748 enum	XkbGBN_TypesMask		= (1L << 0);
749 enum	XkbGBN_CompatMapMask		= (1L << 1);
750 enum	XkbGBN_ClientSymbolsMask	= (1L << 2);
751 enum	XkbGBN_ServerSymbolsMask	= (1L << 3);
752 enum	XkbGBN_SymbolsMask = (XkbGBN_ClientSymbolsMask|XkbGBN_ServerSymbolsMask);
753 enum	XkbGBN_IndicatorMapMask		= (1L << 4);
754 enum	XkbGBN_KeyNamesMask		= (1L << 5);
755 enum	XkbGBN_GeometryMask		= (1L << 6);
756 enum	XkbGBN_OtherNamesMask		= (1L << 7);
757 enum	XkbGBN_AllComponentsMask	= (0xff);
758 
759      /*
760       * ListComponents flags
761       */
762 enum	XkbLC_Hidden			= (1L <<  0);
763 enum	XkbLC_Default			= (1L <<  1);
764 enum	XkbLC_Partial			= (1L <<  2);
765 
766 enum	XkbLC_AlphanumericKeys		= (1L <<  8);
767 enum	XkbLC_ModifierKeys		= (1L <<  9);
768 enum	XkbLC_KeypadKeys		= (1L << 10);
769 enum	XkbLC_FunctionKeys		= (1L << 11);
770 enum	XkbLC_AlternateGroup		= (1L << 12);
771 
772     /*
773      * X Input Extension Interactions
774      * - Specifies the possible interactions between XKB and the X input
775      *   extension
776      * - Used to request (XkbGetDeviceInfo) or change (XKbSetDeviceInfo)
777      *   XKB information about an extension device.
778      * - Reports the list of supported optional features in the reply to
779      *   XkbGetDeviceInfo or in an XkbExtensionDeviceNotify event.
780      * XkbXI_UnsupportedFeature is reported in XkbExtensionDeviceNotify
781      * events to indicate an attempt to use an unsupported feature.
782      */
783 enum	XkbXI_KeyboardsMask		= (1L << 0);
784 enum	XkbXI_ButtonActionsMask		= (1L << 1);
785 enum	XkbXI_IndicatorNamesMask	= (1L << 2);
786 enum	XkbXI_IndicatorMapsMask		= (1L << 3);
787 enum	XkbXI_IndicatorStateMask	= (1L << 4);
788 enum	XkbXI_UnsupportedFeatureMask	= (1L << 15);
789 enum	XkbXI_AllFeaturesMask		= (0x001f);
790 enum	XkbXI_AllDeviceFeaturesMask	= (0x001e);
791 
792 enum	XkbXI_IndicatorsMask		= (0x001c);
793 enum	XkbAllExtensionDeviceEventsMask = (0x801f);
794 
795     /*
796      * Per-Client Flags:
797      *  - Specifies flags to be changed by the PerClientFlags request.
798      */
799 enum	XkbPCF_DetectableAutoRepeatMask	= (1L << 0);
800 enum	XkbPCF_GrabsUseXKBStateMask	= (1L << 1);
801 enum	XkbPCF_AutoResetControlsMask	= (1L << 2);
802 enum	XkbPCF_LookupStateWhenGrabbed	= (1L << 3);
803 enum	XkbPCF_SendEventUsesXKBState	= (1L << 4);
804 enum	XkbPCF_AllFlagsMask		= (0x1F);
805 
806     /*
807      * Debugging flags and controls
808      */
809 enum	XkbDF_DisableLocks	= (1<<0);
810 
811 extern(C) {
812 
813 
814     struct XkbDescRec;
815     struct XkbMapChangesRec;
816     struct XkbIndicatorMapRec;
817     struct XkbKeyTypeRec;
818     struct XkbSymInterpretRec;
819     struct XkbChangesRec;
820     struct XkbStateRec;
821     struct XkbComponentListRec;
822     struct XkbComponentNamesRec;
823     struct XkbDeviceLedInfoRec;
824     struct XkbDeviceInfoRec;
825     struct XkbNameChangesRec;
826     struct XkbControlsChangesRec;
827     struct XkbDeviceChangesRec;
828     struct XkbAction;
829 
830     alias XkbDescPtr = XkbDescRec*;
831     alias XkbMapChangesPtr = XkbMapChangesRec*;
832     alias XkbIndicatorMapPtr = XkbIndicatorMapRec*;
833     alias XkbKeyTypePtr = XkbKeyTypeRec*;
834     alias XkbSymInterpretPtr = XkbSymInterpretRec*;
835     alias XkbChangesPtr = XkbChangesRec*;
836     alias XkbStatePtr = XkbStateRec*;
837     alias XkbComponentListPtr = XkbComponentListRec*;
838     alias XkbComponentNamesPtr = XkbComponentNamesRec*;
839     alias XkbDeviceLedInfoPtr = XkbDeviceLedInfoRec*;
840     alias XkbDeviceInfoPtr = XkbDeviceInfoRec*;
841     alias XkbNameChangesPtr = XkbNameChangesRec*;
842     alias XkbControlsChangesPtr = XkbControlsChangesRec*;
843     alias XkbDeviceChangesPtr = XkbDeviceChangesRec*;
844 
845 
846     struct XkbAnyEvent {
847         int 		type;		/* XkbAnyEvent */
848         c_ulong 	serial;		/* # of last req processed by server */
849         Bool 		send_event;	/* is this from a SendEvent request? */
850         Display *	display;	/* Display the event was read from */
851         Time 		time;		/* milliseconds */
852         int 		xkb_type;	/* XKB event minor code */
853         uint 	device;		/* device ID */
854     }
855 
856     struct XkbNewKeyboardNotifyEvent {
857         int 		type;		/* XkbAnyEvent */
858         c_ulong 	serial;		/* of last req processed by server */
859         Bool 		send_event;	/* is this from a SendEvent request? */
860         Display *	display;	/* Display the event was read from */
861         Time 		time;		/* milliseconds */
862         int 		xkb_type;	/* XkbNewKeyboardNotify */
863         int	 	device;		/* device ID */
864         int	 	old_device;	/* device ID of previous keyboard */
865         int	 	min_key_code;	/* minimum key code */
866         int		max_key_code;	/* maximum key code */
867         int	 	old_min_key_code;/* min key code of previous kbd */
868         int		old_max_key_code;/* max key code of previous kbd */
869         uint	changed;	/* changed aspects of the keyboard */
870         char	 	req_major;	/* major and minor opcode of req */
871         char	 	req_minor;	/* that caused change, if applicable */
872     }
873 
874     struct XkbMapNotifyEvent {
875         int 		type;		/* XkbAnyEvent */
876         c_ulong 	serial;		/* of last req processed by server */
877         Bool 		send_event;	/* is this from a SendEvent request */
878         Display *	display;	/* Display the event was read from */
879         Time 		time;		/* milliseconds */
880         int 		xkb_type;	/* XkbMapNotify */
881         int 		device;		/* device ID */
882         uint 	changed;	/* fields which have been changed */
883         uint 	flags;		/* reserved */
884         int 		first_type;	/* first changed key type */
885         int 		num_types;	/* number of changed key types */
886         KeyCode		min_key_code;
887         KeyCode		max_key_code;
888         KeyCode		first_key_sym;
889         KeyCode		first_key_act;
890         KeyCode		first_key_behavior;
891         KeyCode		first_key_explicit;
892         KeyCode		first_modmap_key;
893         KeyCode		first_vmodmap_key;
894         int		num_key_syms;
895         int		num_key_acts;
896         int		num_key_behaviors;
897         int		num_key_explicit;
898         int 		num_modmap_keys;
899         int 		num_vmodmap_keys;
900         uint 	vmods;		/* mask of changed virtual mods */
901     }
902 
903     struct XkbStateNotifyEvent {
904         int 		type;		/* XkbAnyEvent */
905         c_ulong 	serial;		/* # of last req processed by server */
906         Bool 		send_event;	/* is this from a SendEvent request? */
907         Display *	display;	/* Display the event was read from */
908         Time 		time;		/* milliseconds */
909         int 		xkb_type;	/* XkbStateNotify */
910         int 		device;		/* device ID */
911         uint 	changed;	/* mask of changed state components */
912         int 		group;		/* keyboard group */
913         int 		base_group;	/* base keyboard group */
914         int 		latched_group;	/* latched keyboard group */
915         int 		locked_group;	/* locked keyboard group */
916         uint	mods;		/* modifier state */
917         uint 	base_mods;	/* base modifier state */
918         uint	latched_mods;	/* latched modifiers */
919         uint	locked_mods;	/* locked modifiers */
920         int 		compat_state;	/* compatibility state */
921         ubyte	grab_mods;	/* mods used for grabs */
922         ubyte	compat_grab_mods;/* grab mods for non-XKB clients */
923         ubyte	lookup_mods;	/* mods sent to clients */
924         ubyte	compat_lookup_mods; /* mods sent to non-XKB clients */
925         int 		ptr_buttons;	/* pointer button state */
926         KeyCode		keycode;	/* keycode that caused the change */
927         char 		event_type;	/* KeyPress or KeyRelease */
928         char 		req_major;	/* Major opcode of request */
929         char 		req_minor;	/* Minor opcode of request */
930     }
931 
932     struct XkbControlsNotifyEvent {
933         int 		type;		/* XkbAnyEvent */
934         c_ulong 	serial;		/* of last req processed by server */
935         Bool 		send_event;	/* is this from a SendEvent request? */
936         Display *	display;	/* Display the event was read from */
937         Time 		time;		/* milliseconds */
938         int 		xkb_type;	/* XkbControlsNotify */
939         int 		device;		/* device ID */
940         uint	changed_ctrls;	/* controls with changed sub-values */
941         uint 	enabled_ctrls;	/* controls currently enabled */
942         uint	enabled_ctrl_changes;/* controls just {en,dis}abled */
943         int 		num_groups;	/* total groups on keyboard */
944         KeyCode		keycode;	/* key that caused change or 0 */
945         char 		event_type;	/* type of event that caused change */
946         char 		req_major;	/* if keycode==0, major and minor */
947         char 		req_minor;	/* opcode of req that caused change */
948     }
949 
950     struct XkbIndicatorNotifyEvent {
951         int 		type;		/* XkbAnyEvent */
952         c_ulong 	serial;		/* of last req processed by server */
953         Bool 		send_event;	/* is this from a SendEvent request? */
954         Display *	display;	/* Display the event was read from */
955         Time 		time;		/* milliseconds */
956         int 		xkb_type;	/* XkbIndicatorNotify */
957         int 		device;		/* device ID */
958         uint	changed;	/* indicators with new state or map */
959         uint	state;	 	/* current state of all indicators */
960     }
961 
962     struct XkbNamesNotifyEvent {
963         int 		type;		/* XkbAnyEvent */
964         c_ulong 	serial;		/* of last req processed by server */
965         Bool 		send_event;	/* is this from a SendEvent request? */
966         Display *	display;	/* Display the event was read from */
967         Time 		time;		/* milliseconds */
968         int 		xkb_type;	/* XkbNamesNotify */
969         int	 	device;		/* device ID */
970         uint 	changed;	/* names that have changed */
971         int	 	first_type;	/* first key type with new name */
972         int	 	num_types;	/* number of key types with new names */
973         int	 	first_lvl;	/* first key type new new level names */
974         int	 	num_lvls;	/* # of key types w/new level names */
975         int	 	num_aliases;	/* total number of key aliases*/
976         int	 	num_radio_groups;/* total number of radio groups */
977         uint 	changed_vmods;	/* virtual modifiers with new names */
978         uint 	changed_groups;	/* groups with new names */
979         uint 	changed_indicators;/* indicators with new names */
980         int		first_key;	/* first key with new name */
981         int		num_keys;	/* number of keys with new names */
982     }
983 
984     struct XkbCompatMapNotifyEvent {
985         int 		type;		/* XkbAnyEvent */
986         c_ulong 	serial;		/* of last req processed by server */
987         Bool 		send_event;	/* is this from a SendEvent request? */
988         Display *	display;	/* Display the event was read from */
989         Time 		time;		/* milliseconds */
990         int 		xkb_type;	/* XkbCompatMapNotify */
991         int	 	device;		/* device ID */
992         uint 	changed_groups; /* groups with new compat maps */
993         int	 	first_si;	/* first new symbol interp */
994         int	 	num_si;		/* number of new symbol interps */
995         int	 	num_total_si;	/* total # of symbol interps */
996     }
997 
998     struct XkbBellNotifyEvent {
999         int 		type;		/* XkbAnyEvent */
1000         c_ulong 	serial;		/* of last req processed by server */
1001         Bool 		send_event;	/* is this from a SendEvent request? */
1002         Display *	display;	/* Display the event was read from */
1003         Time 		time;		/* milliseconds */
1004         int 		xkb_type;	/* XkbBellNotify */
1005         int	 	device;		/* device ID */
1006         int	 	percent;	/* requested volume as a % of maximum */
1007         int	 	pitch;		/* requested pitch in Hz */
1008         int	 	duration;	/* requested duration in useconds */
1009         int	 	bell_class;	/* (input extension) feedback class */
1010         int	 	bell_id;	/* (input extension) ID of feedback */
1011         Atom 		name;		/* "name" of requested bell */
1012         Window 		window;		/* window associated with event */
1013         Bool		event_only;	/* "event only" requested */
1014     }
1015 
1016     struct XkbActionMessageEvent {
1017         int 		type;		/* XkbAnyEvent */
1018         c_ulong 	serial;		/* of last req processed by server */
1019         Bool 		send_event;	/* is this from a SendEvent request? */
1020         Display *	display;	/* Display the event was read from */
1021         Time 		time;		/* milliseconds */
1022         int 		xkb_type;	/* XkbActionMessage */
1023         int	 	device;		/* device ID */
1024         KeyCode		keycode;	/* key that generated the event */
1025         Bool 		press;		/* true if act caused by key press */
1026         Bool 		key_event_follows;/* true if key event also generated */
1027         int		group;		/* effective group */
1028         uint	mods;		/* effective mods */
1029         char[XkbActionMessageLength+1] message;
1030                         /* message -- leave space for NUL */
1031     }
1032 
1033     struct XkbAccessXNotifyEvent {
1034         int 		type;		/* XkbAnyEvent */
1035         c_ulong 	serial;		/* of last req processed by server */
1036         Bool 		send_event;	/* is this from a SendEvent request? */
1037         Display *	display;	/* Display the event was read from */
1038         Time 		time;		/* milliseconds */
1039         int 		xkb_type;	/* XkbAccessXNotify */
1040         int	 	device;		/* device ID */
1041         int	 	detail;		/* XkbAXN_* */
1042         int	 	keycode;	/* key of event */
1043         int	 	sk_delay;	/* current slow keys delay */
1044         int		debounce_delay;	/* current debounce delay */
1045     }
1046 
1047     struct XkbExtensionDeviceNotifyEvent {
1048         int 		type;		/* XkbAnyEvent */
1049         c_ulong 	serial;		/* of last req processed by server */
1050         Bool 		send_event;	/* is this from a SendEvent request? */
1051         Display *	display;	/* Display the event was read from */
1052         Time 		time;		/* milliseconds */
1053         int 		xkb_type;	/* XkbExtensionDeviceNotify */
1054         int	 	device;		/* device ID */
1055         uint	reason;		/* reason for the event */
1056         uint	supported;	/* mask of supported features */
1057         uint	unsupported;	/* mask of unsupported features */
1058                         /* that some app tried to use */
1059         int	 	first_btn;	/* first button that changed */
1060         int	 	num_btns;	/* range of buttons changed */
1061         uint	leds_defined;   /* indicators with names or maps */
1062         uint	led_state;	/* current state of the indicators */
1063         int		led_class;	/* feedback class for led changes */
1064         int		led_id;   	/* feedback id for led changes */
1065     }
1066 
1067     union XkbEvent {
1068         int				type;
1069         XkbAnyEvent			any;
1070         XkbNewKeyboardNotifyEvent	new_kbd;
1071         XkbMapNotifyEvent		map;
1072         XkbStateNotifyEvent		state;
1073         XkbControlsNotifyEvent		ctrls;
1074         XkbIndicatorNotifyEvent 	indicators;
1075         XkbNamesNotifyEvent		names;
1076         XkbCompatMapNotifyEvent		compat;
1077         XkbBellNotifyEvent		bell;
1078         XkbActionMessageEvent		message;
1079         XkbAccessXNotifyEvent		accessx;
1080         XkbExtensionDeviceNotifyEvent 	device;
1081         XEvent				core;
1082     }
1083 
1084     struct	_XkbKbdDpyState;
1085 
1086     alias XkbKbdDpyStateRec = _XkbKbdDpyState;
1087     alias XkbKbdDpyStatePtr = _XkbKbdDpyState*;
1088 
1089         /* XkbOpenDisplay error codes */
1090     enum	XkbOD_Success =		0;
1091     enum	XkbOD_BadLibraryVersion =	1;
1092     enum	XkbOD_ConnectionRefused =	2;
1093     enum	XkbOD_NonXkbServer =	3;
1094     enum	XkbOD_BadServerVersion =	4;
1095 
1096         /*; Values for XlibFlags */
1097     enum	XkbLC_ForceLatin1Lookup =		(1<<0);
1098     enum	XkbLC_ConsumeLookupMods =		(1<<1);
1099     enum	XkbLC_AlwaysConsumeShiftAndLock = (1<<2);
1100     enum	XkbLC_IgnoreNewKeyboards =	(1<<3);
1101     enum	XkbLC_ControlFallback =		(1<<4);
1102     enum	XkbLC_ConsumeKeysOnComposeFail =	(1<<29);
1103     enum	XkbLC_ComposeLED =		(1<<30);
1104     enum	XkbLC_BeepOnComposeFail =		(1<<31);
1105 
1106     enum	XkbLC_AllComposeControls =	(0xc0000000);
1107     enum	XkbLC_AllControls =		(0xc000001f);
1108 
1109     Bool	XkbIgnoreExtension(
1110         Bool			/* ignore */
1111     );
1112 
1113     Display *XkbOpenDisplay(
1114         char *			/* name */,
1115         int *			/* ev_rtrn */,
1116         int *			/* err_rtrn */,
1117         int *			/* major_rtrn */,
1118         int *			/* minor_rtrn */,
1119         int *			/* reason */
1120     );
1121 
1122     Bool	XkbQueryExtension(
1123         Display *		/* dpy */,
1124         int *			/* opcodeReturn */,
1125         int *			/* eventBaseReturn */,
1126         int *			/* errorBaseReturn */,
1127         int *			/* majorRtrn */,
1128         int *			/* minorRtrn */
1129     );
1130 
1131     Bool	XkbUseExtension(
1132         Display *		/* dpy */,
1133         int *			/* major_rtrn */,
1134         int *			/* minor_rtrn */
1135     );
1136 
1137     Bool	XkbLibraryVersion(
1138         int *			/* libMajorRtrn */,
1139         int *			/* libMinorRtrn */
1140     );
1141 
1142     uint	XkbSetXlibControls(
1143         Display*		/* dpy */,
1144         uint		/* affect */,
1145         uint		/* values */
1146     );
1147 
1148     uint	XkbGetXlibControls(
1149         Display*		/* dpy */
1150     );
1151 
1152     uint	XkbXlibControlsImplemented();
1153 
1154     alias XkbInternAtomFunc = Atom function(
1155         Display *		/* dpy */,
1156         const(char) *		/* name */,
1157         Bool			/* only_if_exists */
1158     );
1159 
1160     alias XkbGetAtomNameFunc = char* function (
1161         Display *		/* dpy */,
1162         Atom			/* atom */
1163     );
1164 
1165     void		XkbSetAtomFuncs(
1166         XkbInternAtomFunc	/* getAtom */,
1167         XkbGetAtomNameFunc	/* getName */
1168     );
1169 
1170 version(XlibWidePrototypes) {
1171     KeySym XkbKeycodeToKeysym(
1172         Display *	/* dpy */,
1173         uint	/* kc */,
1174         int 		/* group */,
1175         int		/* level */
1176     );
1177 }
1178 else {
1179     KeySym XkbKeycodeToKeysym(
1180         Display *	/* dpy */,
1181         KeyCode		/* kc */,
1182         int 		/* group */,
1183         int		/* level */
1184     );
1185 }
1186 
1187     uint	XkbKeysymToModifiers(
1188         Display *			/* dpy */,
1189         KeySym 			/* ks */
1190     );
1191 
1192     Bool		XkbLookupKeySym(
1193         Display *			/* dpy */,
1194         KeyCode 			/* keycode */,
1195         uint 		/* modifiers */,
1196         uint *		/* modifiers_return */,
1197         KeySym *			/* keysym_return */
1198     );
1199 
1200     int		XkbLookupKeyBinding(
1201         Display *			/* dpy */,
1202         KeySym 			/* sym_rtrn */,
1203         uint 		/* mods */,
1204         char *			/* buffer */,
1205         int 			/* nbytes */,
1206         int * 			/* extra_rtrn */
1207     );
1208 
1209     Bool		XkbTranslateKeyCode(
1210         XkbDescPtr			/* xkb */,
1211         KeyCode 			/* keycode */,
1212         uint 		/* modifiers */,
1213         uint *		/* modifiers_return */,
1214         KeySym *			/* keysym_return */
1215     );
1216 
1217     /* FIXME: does register keyword affect binary compatibility ?? */
1218     int		XkbTranslateKeySym(
1219         Display *			/* dpy */,
1220         /*register*/ KeySym *		/* sym_return */,
1221         uint 		/* modifiers */,
1222         char *			/* buffer */,
1223         int 			/* nbytes */,
1224         int *			/* extra_rtrn */
1225     );
1226 
1227     Bool	XkbSetAutoRepeatRate(
1228         Display *		/* dpy */,
1229         uint		/* deviceSpec */,
1230         uint		/* delay */,
1231         uint		/* interval */
1232     );
1233 
1234     Bool	XkbGetAutoRepeatRate(
1235         Display *		/* dpy */,
1236         uint		/* deviceSpec */,
1237         uint *		/* delayRtrn */,
1238         uint *		/* intervalRtrn */
1239     );
1240 
1241     Bool	XkbChangeEnabledControls(
1242         Display *		/* dpy */,
1243         uint		/* deviceSpec */,
1244         uint		/* affect */,
1245         uint		/* values */
1246     );
1247 
1248     Bool	XkbDeviceBell(
1249         Display *		/* dpy */,
1250         Window			/* win */,
1251         int			/* deviceSpec */,
1252         int			/* bellClass */,
1253         int			/* bellID */,
1254         int			/* percent */,
1255         Atom			/* name */
1256     );
1257 
1258     Bool	XkbForceDeviceBell(
1259         Display *		/* dpy */,
1260         int			/* deviceSpec */,
1261         int			/* bellClass */,
1262         int			/* bellID */,
1263         int			/* percent */
1264     );
1265 
1266     Bool	XkbDeviceBellEvent(
1267         Display *		/* dpy */,
1268         Window			/* win */,
1269         int			/* deviceSpec */,
1270         int			/* bellClass */,
1271         int			/* bellID */,
1272         int			/* percent */,
1273         Atom			/* name */
1274     );
1275 
1276     Bool	XkbBell(
1277         Display *		/* dpy */,
1278         Window			/* win */,
1279         int			/* percent */,
1280         Atom			/* name */
1281     );
1282 
1283     Bool	XkbForceBell(
1284         Display *		/* dpy */,
1285         int			/* percent */
1286     );
1287 
1288     Bool	XkbBellEvent(
1289         Display *		/* dpy */,
1290         Window			/* win */,
1291         int			/* percent */,
1292         Atom			/* name */
1293     );
1294 
1295     Bool	XkbSelectEvents(
1296         Display *		/* dpy */,
1297         uint		/* deviceID */,
1298         uint 		/* affect */,
1299         uint 		/* values */
1300     );
1301 
1302     Bool	XkbSelectEventDetails(
1303         Display *		/* dpy */,
1304         uint 		/* deviceID */,
1305         uint 		/* eventType */,
1306         c_ulong 		/* affect */,
1307         c_ulong 		/* details */
1308     );
1309 
1310     void	XkbNoteMapChanges(
1311         XkbMapChangesPtr		/* old */,
1312         XkbMapNotifyEvent	*	/* new */,
1313         uint	 	/* wanted */
1314     );
1315 
1316     void	XkbNoteNameChanges(
1317         XkbNameChangesPtr		/* old */,
1318         XkbNamesNotifyEvent	*	/* new */,
1319         uint	 	/* wanted */
1320     );
1321 
1322     Status	XkbGetIndicatorState(
1323         Display *		/* dpy */,
1324         uint		/* deviceSpec */,
1325         uint *		/* pStateRtrn */
1326     );
1327 
1328     Status	XkbGetDeviceIndicatorState(
1329         Display *		/* dpy */,
1330         uint		/* deviceSpec */,
1331         uint		/* ledClass */,
1332         uint		/* ledID */,
1333         uint *		/* pStateRtrn */
1334     );
1335 
1336     Status	 XkbGetIndicatorMap(
1337         Display *		/* dpy */,
1338         c_ulong		/* which */,
1339         XkbDescPtr		/* desc */
1340     );
1341 
1342     Bool	 XkbSetIndicatorMap(
1343         Display *		/* dpy */,
1344         c_ulong 		/* which */,
1345         XkbDescPtr		/* desc */
1346     );
1347 
1348 
1349     enum XkbNoteIndicatorMapChanges(O, N, W)(O o, N n, W w) {
1350         return ((o).map_changes|=((n).map_changes&(w)));
1351     }
1352     auto XkbNoteIndicatorStateChanges(O, N, W)(O o, N n, W w) {
1353         ((o).state_changes|=((n).state_changes&(w)));
1354     }
1355     auto XkbGetIndicatorMapChanges(D, X, C)(D d, X x, C c) {
1356         return (XkbGetIndicatorMap((d),(c).map_changes,x));
1357     }
1358     auto XkbChangeIndicatorMaps(D, X, C)(D d, X x, C c) {
1359         return (XkbSetIndicatorMap((d),(c).map_changes,x));
1360     }
1361 
1362     Bool	XkbGetNamedIndicator(
1363         Display *		/* dpy */,
1364         Atom			/* name */,
1365         int *			/* pNdxRtrn */,
1366         Bool *			/* pStateRtrn */,
1367         XkbIndicatorMapPtr	/* pMapRtrn */,
1368         Bool *			/* pRealRtrn */
1369     );
1370 
1371     Bool	XkbGetNamedDeviceIndicator(
1372         Display *		/* dpy */,
1373         uint		/* deviceSpec */,
1374         uint		/* ledClass */,
1375         uint		/* ledID */,
1376         Atom			/* name */,
1377         int *			/* pNdxRtrn */,
1378         Bool *			/* pStateRtrn */,
1379         XkbIndicatorMapPtr	/* pMapRtrn */,
1380         Bool *			/* pRealRtrn */
1381     );
1382 
1383     Bool	XkbSetNamedIndicator(
1384         Display *		/* dpy */,
1385         Atom			/* name */,
1386         Bool			/* changeState */,
1387         Bool 			/* state */,
1388         Bool			/* createNewMap */,
1389         XkbIndicatorMapPtr	/* pMap */
1390     );
1391 
1392     Bool	XkbSetNamedDeviceIndicator(
1393         Display *		/* dpy */,
1394         uint		/* deviceSpec */,
1395         uint		/* ledClass */,
1396         uint		/* ledID */,
1397         Atom			/* name */,
1398         Bool			/* changeState */,
1399         Bool 			/* state */,
1400         Bool			/* createNewMap */,
1401         XkbIndicatorMapPtr	/* pMap */
1402     );
1403 
1404     Bool	XkbLockModifiers(
1405         Display *		/* dpy */,
1406         uint 		/* deviceSpec */,
1407         uint 		/* affect */,
1408         uint 		/* values */
1409     );
1410 
1411     Bool	XkbLatchModifiers(
1412         Display *		/* dpy */,
1413         uint 		/* deviceSpec */,
1414         uint 		/* affect */,
1415         uint 		/* values */
1416     );
1417 
1418     Bool	XkbLockGroup(
1419         Display *		/* dpy */,
1420         uint 		/* deviceSpec */,
1421         uint 		/* group */
1422     );
1423 
1424     Bool	XkbLatchGroup(
1425         Display *		/* dpy */,
1426         uint 		/* deviceSpec */,
1427         uint 		/* group */
1428     );
1429 
1430     Bool	XkbSetServerInternalMods(
1431         Display *		/* dpy */,
1432         uint 		/* deviceSpec */,
1433         uint 		/* affectReal */,
1434         uint 		/* realValues */,
1435         uint		/* affectVirtual */,
1436         uint		/* virtualValues */
1437     );
1438 
1439     Bool	XkbSetIgnoreLockMods(
1440         Display *		/* dpy */,
1441         uint 		/* deviceSpec */,
1442         uint 		/* affectReal */,
1443         uint 		/* realValues */,
1444         uint		/* affectVirtual */,
1445         uint		/* virtualValues */
1446     );
1447 
1448 
1449     Bool	XkbVirtualModsToReal(
1450         XkbDescPtr		/* xkb */,
1451         uint		/* virtual_mask */,
1452         uint *		/* mask_rtrn */
1453     );
1454 
1455     Bool	XkbComputeEffectiveMap(
1456         XkbDescPtr 		/* xkb */,
1457         XkbKeyTypePtr		/* type */,
1458         ubyte *		/* map_rtrn */
1459     );
1460 
1461     Status XkbInitCanonicalKeyTypes(
1462         XkbDescPtr			/* xkb */,
1463         uint		/* which */,
1464         int				/* keypadVMod */
1465     );
1466 
1467     XkbDescPtr XkbAllocKeyboard();
1468 
1469     void	XkbFreeKeyboard(
1470         XkbDescPtr		/* xkb */,
1471         uint		/* which */,
1472         Bool			/* freeDesc */
1473     );
1474 
1475     Status XkbAllocClientMap(
1476         XkbDescPtr		/* xkb */,
1477         uint		/* which */,
1478         uint		/* nTypes */
1479     );
1480 
1481     Status XkbAllocServerMap(
1482         XkbDescPtr		/* xkb */,
1483         uint		/* which */,
1484         uint		/* nActions */
1485     );
1486 
1487     void	XkbFreeClientMap(
1488         XkbDescPtr			/* xkb */,
1489         uint		/* what */,
1490         Bool			/* freeMap */
1491     );
1492 
1493     void	XkbFreeServerMap(
1494         XkbDescPtr			/* xkb */,
1495         uint		/* what */,
1496         Bool			/* freeMap */
1497     );
1498 
1499     XkbKeyTypePtr	XkbAddKeyType(
1500         XkbDescPtr			/* xkb */,
1501         Atom			/* name */,
1502         int				/* map_count */,
1503         Bool			/* want_preserve */,
1504         int				/* num_lvls */
1505     );
1506 
1507     Status XkbAllocIndicatorMaps(
1508         XkbDescPtr		/* xkb */
1509     );
1510 
1511     void XkbFreeIndicatorMaps(
1512         XkbDescPtr			/* xkb */
1513     );
1514 
1515     XkbDescPtr XkbGetMap(
1516         Display *		/* dpy */,
1517         uint 		/* which */,
1518         uint 		/* deviceSpec */
1519     );
1520 
1521     Status	XkbGetUpdatedMap(
1522         Display *		/* dpy */,
1523         uint 		/* which */,
1524         XkbDescPtr		/* desc */
1525     );
1526 
1527     Status	XkbGetMapChanges(
1528         Display *			/* dpy */,
1529         XkbDescPtr			/* xkb */,
1530         XkbMapChangesPtr		/* changes */
1531     );
1532 
1533 
1534     Status	XkbRefreshKeyboardMapping(
1535         XkbMapNotifyEvent *		/* event */
1536     );
1537 
1538     Status	XkbGetKeyTypes(
1539         Display *			/* dpy */,
1540         uint		/* first */,
1541         uint 		/* num */,
1542         XkbDescPtr			/* xkb */
1543     );
1544 
1545     Status	XkbGetKeySyms(
1546         Display *			/* dpy */,
1547         uint		/* first */,
1548         uint		/* num */,
1549         XkbDescPtr			/* xkb */
1550     );
1551 
1552     Status	XkbGetKeyActions(
1553         Display *			/* dpy */,
1554         uint 		/* first */,
1555         uint 		/* num */,
1556         XkbDescPtr			/* xkb */
1557     );
1558 
1559     Status	XkbGetKeyBehaviors(
1560         Display *		/* dpy */,
1561         uint 		/* firstKey */,
1562         uint		/* nKeys */,
1563         XkbDescPtr		/* desc */
1564     );
1565 
1566     Status	XkbGetVirtualMods(
1567         Display *		/* dpy */,
1568         uint 		/* which */,
1569         XkbDescPtr		/* desc */
1570     );
1571 
1572     Status	XkbGetKeyExplicitComponents(
1573         Display *		/* dpy */,
1574         uint 		/* firstKey */,
1575         uint		/* nKeys */,
1576         XkbDescPtr		/* desc */
1577     );
1578 
1579     Status	XkbGetKeyModifierMap(
1580         Display *		/* dpy */,
1581         uint 		/* firstKey */,
1582         uint		/* nKeys */,
1583         XkbDescPtr		/* desc */
1584     );
1585 
1586     Status	XkbGetKeyVirtualModMap(
1587         Display *		/* dpy */,
1588         uint		/* first */,
1589         uint		/* num */,
1590         XkbDescPtr		/* xkb */
1591     );
1592 
1593     Status	XkbAllocControls(
1594         XkbDescPtr		/* xkb */,
1595         uint		/* which*/
1596     );
1597 
1598     void	XkbFreeControls(
1599         XkbDescPtr		/* xkb */,
1600         uint		/* which */,
1601         Bool			/* freeMap */
1602     );
1603 
1604     Status	XkbGetControls(
1605         Display *		/* dpy */,
1606         c_ulong		/* which */,
1607         XkbDescPtr		/* desc */
1608     );
1609 
1610     Bool	XkbSetControls(
1611         Display *		/* dpy */,
1612         c_ulong		/* which */,
1613         XkbDescPtr		/* desc */
1614     );
1615 
1616     void	XkbNoteControlsChanges(
1617         XkbControlsChangesPtr	/* old */,
1618         XkbControlsNotifyEvent *	/* new */,
1619         uint	 	/* wanted */
1620     );
1621 
1622     auto XkbGetControlsChanges(D, X, C)(D d, X x, C c) {
1623         return XkbGetControls(d,(c).changed_ctrls,x);
1624     }
1625     auto XkbChangeControls(D, X, C)(D d, X x, C c) {
1626         return XkbSetControls(d,(c).changed_ctrls,x);
1627     }
1628 
1629     Status	XkbAllocCompatMap(
1630         XkbDescPtr			/* xkb */,
1631         uint		/* which */,
1632         uint		/* nInterpret */
1633     );
1634 
1635     void	XkbFreeCompatMap(
1636         XkbDescPtr			/* xkb */,
1637         uint		/* which */,
1638         Bool			/* freeMap */
1639     );
1640 
1641     Status XkbGetCompatMap(
1642         Display *		/* dpy */,
1643         uint 		/* which */,
1644         XkbDescPtr 		/* xkb */
1645     );
1646 
1647     Bool XkbSetCompatMap(
1648         Display *		/* dpy */,
1649         uint 		/* which */,
1650         XkbDescPtr 		/* xkb */,
1651         Bool			/* updateActions */
1652     );
1653 
1654     XkbSymInterpretPtr XkbAddSymInterpret(
1655         XkbDescPtr		/* xkb */,
1656         XkbSymInterpretPtr	/* si */,
1657         Bool			/* updateMap */,
1658         XkbChangesPtr		/* changes */
1659     );
1660 
1661     Status XkbAllocNames(
1662         XkbDescPtr		/* xkb */,
1663         uint		/* which */,
1664         int			/* nTotalRG */,
1665         int			/* nTotalAliases */
1666     );
1667 
1668     Status	XkbGetNames(
1669         Display *		/* dpy */,
1670         uint		/* which */,
1671         XkbDescPtr		/* desc */
1672     );
1673 
1674     Bool	XkbSetNames(
1675         Display *		/* dpy */,
1676         uint		/* which */,
1677         uint		/* firstType */,
1678         uint		/* nTypes */,
1679         XkbDescPtr		/* desc */
1680     );
1681 
1682     Bool	XkbChangeNames(
1683         Display *		/* dpy */,
1684         XkbDescPtr		/* xkb */,
1685         XkbNameChangesPtr	/* changes */
1686     );
1687 
1688     void XkbFreeNames(
1689         XkbDescPtr		/* xkb */,
1690         uint		/* which */,
1691         Bool			/* freeMap */
1692     );
1693 
1694 
1695     Status	XkbGetState(
1696         Display *		/* dpy */,
1697         uint 		/* deviceSpec */,
1698         XkbStatePtr		/* rtrnState */
1699     );
1700 
1701     Bool	XkbSetMap(
1702         Display *		/* dpy */,
1703         uint		/* which */,
1704         XkbDescPtr		/* desc */
1705     );
1706 
1707     Bool	XkbChangeMap(
1708         Display*		/* dpy */,
1709         XkbDescPtr		/* desc */,
1710         XkbMapChangesPtr	/* changes */
1711     );
1712 
1713     Bool	XkbSetDetectableAutoRepeat(
1714         Display *		/* dpy */,
1715         Bool			/* detectable */,
1716         Bool *			/* supported */
1717     );
1718 
1719     Bool	XkbGetDetectableAutoRepeat(
1720         Display *		/* dpy */,
1721         Bool *			/* supported */
1722     );
1723 
1724     Bool	XkbSetAutoResetControls(
1725         Display *			/* dpy */,
1726         uint 		/* changes */,
1727         uint *		/* auto_ctrls */,
1728         uint *		/* auto_values */
1729     );
1730 
1731     Bool	XkbGetAutoResetControls(
1732         Display *			/* dpy */,
1733         uint *		/* auto_ctrls */,
1734         uint *		/* auto_ctrl_values */
1735     );
1736 
1737     Bool	XkbSetPerClientControls(
1738         Display *			/* dpy */,
1739         uint		/* change */,
1740         uint *		/* values */
1741     );
1742 
1743     Bool	XkbGetPerClientControls(
1744         Display *			/* dpy */,
1745         uint *		/* ctrls */
1746     );
1747 
1748     Status XkbCopyKeyType(
1749         XkbKeyTypePtr	/* from */,
1750         XkbKeyTypePtr	/* into */
1751     );
1752 
1753     Status XkbCopyKeyTypes(
1754         XkbKeyTypePtr	/* from */,
1755         XkbKeyTypePtr	/* into */,
1756         int			/* num_types */
1757     );
1758 
1759     Status	XkbResizeKeyType(
1760         XkbDescPtr		/* xkb */,
1761         int			/* type_ndx */,
1762         int			/* map_count */,
1763         Bool		/* want_preserve */,
1764         int			/* new_num_lvls */
1765     );
1766 
1767     KeySym *XkbResizeKeySyms(
1768         XkbDescPtr		/* desc */,
1769         int 			/* forKey */,
1770         int 			/* symsNeeded */
1771     );
1772 
1773     XkbAction *XkbResizeKeyActions(
1774         XkbDescPtr		/* desc */,
1775         int 			/* forKey */,
1776         int 			/* actsNeeded */
1777     );
1778 
1779     Status XkbChangeTypesOfKey(
1780         XkbDescPtr		/* xkb */,
1781         int 			/* key */,
1782         int			/* num_groups */,
1783         uint		/* groups */,
1784         int *			/* newTypes */,
1785         XkbMapChangesPtr	/* pChanges */
1786     );
1787 
1788     Status   XkbChangeKeycodeRange(
1789         XkbDescPtr		/* xkb */,
1790         int			/* minKC */,
1791         int			/* maxKC */,
1792         XkbChangesPtr		/* changes */
1793     );
1794 
1795     /***====================================================================***/
1796 
1797     XkbComponentListPtr	XkbListComponents(
1798         Display *		/* dpy */,
1799         uint		/* deviceSpec */,
1800         XkbComponentNamesPtr	/* ptrns */,
1801         int *			/* max_inout */
1802     );
1803 
1804     void XkbFreeComponentList(
1805         XkbComponentListPtr	/* list */
1806     );
1807 
1808     XkbDescPtr XkbGetKeyboard(
1809         Display *		/* dpy */,
1810         uint 		/* which */,
1811         uint 		/* deviceSpec */
1812     );
1813 
1814     XkbDescPtr XkbGetKeyboardByName(
1815         Display *			/* dpy */,
1816         uint		/* deviceSpec */,
1817         XkbComponentNamesPtr	/* names */,
1818         uint 		/* want */,
1819         uint 		/* need */,
1820         Bool			/* load */
1821     );
1822 
1823     /***====================================================================***/
1824 
1825     int	XkbKeyTypesForCoreSymbols(	/* returns # of groups */
1826         XkbDescPtr	/* xkb */,			/* keyboard device */
1827         int		/* map_width */,		/* width of core KeySym array */
1828         KeySym *	/* core_syms */,		/* always mapWidth symbols */
1829         uint	/* protected */,	/* explicit key types */
1830         int *	/* types_inout */,		/* always four type indices */
1831         KeySym * 	/* xkb_syms_rtrn */		/* must have enough space */
1832     );
1833 
1834     Bool	XkbApplyCompatMapToKey(	/* False only on error */
1835         XkbDescPtr		/* xkb */,		/* keymap to be edited */
1836         KeyCode		/* key */,		/* key to be updated */
1837         XkbChangesPtr	/* changes */		/* resulting changes to map */
1838     );
1839 
1840     Bool	XkbUpdateMapFromCore( /* False only on error */
1841         XkbDescPtr		/* xkb */,		/* XKB keyboard to be edited */
1842         KeyCode		/* first_key */,	/* first changed key */
1843         int			/* num_keys */, 	/* number of changed keys */
1844         int			/* map_width */,	/* width of core keymap */
1845         KeySym *		/* core_keysyms */,	/* symbols from core keymap */
1846         XkbChangesPtr	/* changes */		/* resulting changes */
1847     );
1848 
1849     /***====================================================================***/
1850 
1851     XkbDeviceLedInfoPtr	XkbAddDeviceLedInfo(
1852         XkbDeviceInfoPtr	/* devi */,
1853         uint		/* ledClass */,
1854         uint		/* ledId */
1855     );
1856 
1857     Status			XkbResizeDeviceButtonActions(
1858         XkbDeviceInfoPtr	/* devi */,
1859         uint		/* newTotal */
1860     );
1861 
1862     XkbDeviceInfoPtr	XkbAllocDeviceInfo(
1863         uint		/* deviceSpec */,
1864         uint		/* nButtons */,
1865         uint		/* szLeds */
1866     );
1867 
1868     void XkbFreeDeviceInfo(
1869         XkbDeviceInfoPtr	/* devi */,
1870         uint		/* which */,
1871         Bool			/* freeDevI */
1872     );
1873 
1874     void	XkbNoteDeviceChanges(
1875         XkbDeviceChangesPtr			/* old */,
1876         XkbExtensionDeviceNotifyEvent *	/* new */,
1877         uint	 		/* wanted */
1878     );
1879 
1880     XkbDeviceInfoPtr XkbGetDeviceInfo(
1881         Display *		/* dpy */,
1882         uint 		/* which */,
1883         uint		/* deviceSpec */,
1884         uint		/* ledClass */,
1885         uint		/* ledID */
1886     );
1887 
1888     Status	XkbGetDeviceInfoChanges(
1889         Display *		/* dpy */,
1890         XkbDeviceInfoPtr	/* devi */,
1891         XkbDeviceChangesPtr 	/* changes */
1892     );
1893 
1894     Status	XkbGetDeviceButtonActions(
1895         Display *		/* dpy */,
1896         XkbDeviceInfoPtr	/* devi */,
1897         Bool			/* all */,
1898         uint		/* first */,
1899         uint		/* nBtns */
1900     );
1901 
1902     Status	XkbGetDeviceLedInfo(
1903         Display *		/* dpy */,
1904         XkbDeviceInfoPtr	/* devi */,
1905         uint		/* ledClass (class, XIDflt, XIAll) */,
1906         uint		/* ledId (id, XIDflt, XIAll) */,
1907         uint		/* which (XkbXI_Indicator{Names,Map}Mask */
1908     );
1909 
1910     Bool	XkbSetDeviceInfo(
1911         Display *		/* dpy */,
1912         uint		/* which */,
1913         XkbDeviceInfoPtr	/* devi */
1914     );
1915 
1916     Bool	XkbChangeDeviceInfo(
1917         Display*		/* dpy */,
1918         XkbDeviceInfoPtr	/* desc */,
1919         XkbDeviceChangesPtr	/* changes */
1920     );
1921 
1922     Bool XkbSetDeviceLedInfo(
1923         Display *		/* dpy */,
1924         XkbDeviceInfoPtr	/* devi */,
1925         uint 		/* ledClass */,
1926         uint		/* ledID */,
1927         uint		/* which */
1928     );
1929 
1930     Bool XkbSetDeviceButtonActions(
1931         Display *		/* dpy */,
1932         XkbDeviceInfoPtr	/* devi */,
1933         uint		/* first */,
1934         uint		/* nBtns */
1935     );
1936 
1937     /***====================================================================***/
1938 
1939     char	XkbToControl(
1940         char		/* c */
1941     );
1942 
1943     /***====================================================================***/
1944 
1945     Bool XkbSetDebuggingFlags(
1946         Display *		/* dpy */,
1947         uint	/* mask */,
1948         uint	/* flags */,
1949         char *		/* msg */,
1950         uint	/* ctrls_mask */,
1951         uint	/* ctrls */,
1952         uint *	/* rtrn_flags */,
1953         uint *	/* rtrn_ctrls */
1954     );
1955 
1956     Bool XkbApplyVirtualModChanges(
1957        XkbDescPtr		/* xkb */,
1958        uint		/* changed */,
1959        XkbChangesPtr	/* changes */
1960     );
1961 
1962     Bool XkbUpdateActionVirtualMods(
1963         XkbDescPtr		/* xkb */,
1964         XkbAction *		/* act */,
1965         uint		/* changed */
1966     );
1967 
1968     void XkbUpdateKeyTypeVirtualMods(
1969         XkbDescPtr		/* xkb */,
1970         XkbKeyTypePtr		/* type */,
1971         uint		/* changed */,
1972         XkbChangesPtr		/* changes */
1973     );
1974 
1975 }