• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 _XKB_H_
28 #define	_XKB_H_
29 
30     /*
31      * XKB request codes, used in:
32      *  -  xkbReqType field of all requests
33      *  -  requestMinor field of some events
34      */
35 #define	X_kbUseExtension		 0
36 #define	X_kbSelectEvents	 	 1
37 #define	X_kbBell			 3
38 #define	X_kbGetState			 4
39 #define	X_kbLatchLockState		 5
40 #define	X_kbGetControls			 6
41 #define	X_kbSetControls			 7
42 #define	X_kbGetMap			 8
43 #define	X_kbSetMap			 9
44 #define	X_kbGetCompatMap		10
45 #define	X_kbSetCompatMap		11
46 #define	X_kbGetIndicatorState		12
47 #define	X_kbGetIndicatorMap		13
48 #define	X_kbSetIndicatorMap		14
49 #define	X_kbGetNamedIndicator		15
50 #define	X_kbSetNamedIndicator		16
51 #define	X_kbGetNames			17
52 #define	X_kbSetNames			18
53 #define	X_kbGetGeometry			19
54 #define	X_kbSetGeometry			20
55 #define	X_kbPerClientFlags		21
56 #define	X_kbListComponents		22
57 #define	X_kbGetKbdByName		23
58 #define	X_kbGetDeviceInfo		24
59 #define	X_kbSetDeviceInfo		25
60 #define	X_kbSetDebuggingFlags		101
61 
62     /*
63      * In the X sense, XKB reports only one event.
64      * The type field of all XKB events is XkbEventCode
65      */
66 #define	XkbEventCode			0
67 #define	XkbNumberEvents			(XkbEventCode+1)
68 
69     /*
70      * XKB has a minor event code so it can use one X event code for
71      * multiple purposes.
72      *  - reported in the xkbType field of all XKB events.
73      *  - XkbSelectEventDetails: Indicates the event for which event details
74      *    are being changed
75      */
76 #define	XkbNewKeyboardNotify		0
77 #define XkbMapNotify			1
78 #define	XkbStateNotify			2
79 #define XkbControlsNotify		3
80 #define	XkbIndicatorStateNotify		4
81 #define	XkbIndicatorMapNotify		5
82 #define	XkbNamesNotify			6
83 #define XkbCompatMapNotify		7
84 #define	XkbBellNotify			8
85 #define	XkbActionMessage		9
86 #define	XkbAccessXNotify		10
87 #define	XkbExtensionDeviceNotify	11
88 
89     /*
90      * Event Mask:
91      *  - XkbSelectEvents:  Specifies event interest.
92      */
93 #define	XkbNewKeyboardNotifyMask	(1L << 0)
94 #define XkbMapNotifyMask		(1L << 1)
95 #define	XkbStateNotifyMask		(1L << 2)
96 #define XkbControlsNotifyMask		(1L << 3)
97 #define	XkbIndicatorStateNotifyMask	(1L << 4)
98 #define	XkbIndicatorMapNotifyMask	(1L << 5)
99 #define	XkbNamesNotifyMask		(1L << 6)
100 #define XkbCompatMapNotifyMask		(1L << 7)
101 #define	XkbBellNotifyMask		(1L << 8)
102 #define	XkbActionMessageMask		(1L << 9)
103 #define	XkbAccessXNotifyMask		(1L << 10)
104 #define	XkbExtensionDeviceNotifyMask	(1L << 11)
105 #define	XkbAllEventsMask		(0xFFF)
106 
107     /*
108      * NewKeyboardNotify event details:
109      */
110 #define	XkbNKN_KeycodesMask		(1L << 0)
111 #define	XkbNKN_GeometryMask		(1L << 1)
112 #define	XkbNKN_DeviceIDMask		(1L << 2)
113 #define	XkbAllNewKeyboardEventsMask	(0x7)
114 
115     /*
116      * AccessXNotify event types:
117      *  - The 'what' field of AccessXNotify events reports the
118      *    reason that the event was generated.
119      */
120 #define	XkbAXN_SKPress			0
121 #define	XkbAXN_SKAccept			1
122 #define	XkbAXN_SKReject			2
123 #define	XkbAXN_SKRelease		3
124 #define	XkbAXN_BKAccept			4
125 #define	XkbAXN_BKReject			5
126 #define	XkbAXN_AXKWarning		6
127 
128     /*
129      * AccessXNotify details:
130      * - Used as an event detail mask to limit the conditions under which
131      *   AccessXNotify events are reported
132      */
133 #define	XkbAXN_SKPressMask		(1L << 0)
134 #define	XkbAXN_SKAcceptMask		(1L << 1)
135 #define	XkbAXN_SKRejectMask		(1L << 2)
136 #define	XkbAXN_SKReleaseMask		(1L << 3)
137 #define	XkbAXN_BKAcceptMask		(1L << 4)
138 #define	XkbAXN_BKRejectMask		(1L << 5)
139 #define	XkbAXN_AXKWarningMask		(1L << 6)
140 #define	XkbAllAccessXEventsMask		(0x7f)
141 
142     /*
143      * Miscellaneous event details:
144      * - event detail masks for assorted events that don't reall
145      *   have any details.
146      */
147 #define	XkbAllStateEventsMask		XkbAllStateComponentsMask
148 #define	XkbAllMapEventsMask		XkbAllMapComponentsMask
149 #define	XkbAllControlEventsMask		XkbAllControlsMask
150 #define	XkbAllIndicatorEventsMask	XkbAllIndicatorsMask
151 #define	XkbAllNameEventsMask		XkbAllNamesMask
152 #define	XkbAllCompatMapEventsMask	XkbAllCompatMask
153 #define	XkbAllBellEventsMask		(1L << 0)
154 #define	XkbAllActionMessagesMask	(1L << 0)
155 
156     /*
157      * XKB reports one error:  BadKeyboard
158      * A further reason for the error is encoded into to most significant
159      * byte of the resourceID for the error:
160      *    XkbErr_BadDevice - the device in question was not found
161      *    XkbErr_BadClass  - the device was found but it doesn't belong to
162      *                       the appropriate class.
163      *    XkbErr_BadId     - the device was found and belongs to the right
164      *                       class, but not feedback with a matching id was
165      *                       found.
166      * The low byte of the resourceID for this error contains the device
167      * id, class specifier or feedback id that failed.
168      */
169 #define	XkbKeyboard			0
170 #define	XkbNumberErrors			1
171 
172 #define	XkbErr_BadDevice	0xff
173 #define	XkbErr_BadClass		0xfe
174 #define	XkbErr_BadId		0xfd
175 
176     /*
177      * Keyboard Components Mask:
178      * - Specifies the components that follow a GetKeyboardByNameReply
179      */
180 #define	XkbClientMapMask		(1L << 0)
181 #define	XkbServerMapMask		(1L << 1)
182 #define	XkbCompatMapMask		(1L << 2)
183 #define	XkbIndicatorMapMask		(1L << 3)
184 #define	XkbNamesMask			(1L << 4)
185 #define	XkbGeometryMask			(1L << 5)
186 #define	XkbControlsMask			(1L << 6)
187 #define	XkbAllComponentsMask		(0x7f)
188 
189     /*
190      * State detail mask:
191      *  - The 'changed' field of StateNotify events reports which of
192      *    the keyboard state components have changed.
193      *  - Used as an event detail mask to limit the conditions under
194      *    which StateNotify events are reported.
195      */
196 #define	XkbModifierStateMask		(1L << 0)
197 #define	XkbModifierBaseMask		(1L << 1)
198 #define	XkbModifierLatchMask		(1L << 2)
199 #define	XkbModifierLockMask		(1L << 3)
200 #define	XkbGroupStateMask		(1L << 4)
201 #define	XkbGroupBaseMask		(1L << 5)
202 #define	XkbGroupLatchMask		(1L << 6)
203 #define XkbGroupLockMask		(1L << 7)
204 #define	XkbCompatStateMask		(1L << 8)
205 #define	XkbGrabModsMask			(1L << 9)
206 #define	XkbCompatGrabModsMask		(1L << 10)
207 #define	XkbLookupModsMask		(1L << 11)
208 #define	XkbCompatLookupModsMask		(1L << 12)
209 #define	XkbPointerButtonMask		(1L << 13)
210 #define	XkbAllStateComponentsMask	(0x3fff)
211 
212     /*
213      * Controls detail masks:
214      *  The controls specified in XkbAllControlsMask:
215      *  - The 'changed' field of ControlsNotify events reports which of
216      *    the keyboard controls have changed.
217      *  - The 'changeControls' field of the SetControls request specifies
218      *    the controls for which values are to be changed.
219      *  - Used as an event detail mask to limit the conditions under
220      *    which ControlsNotify events are reported.
221      *
222      *  The controls specified in the XkbAllBooleanCtrlsMask:
223      *  - The 'enabledControls' field of ControlsNotify events reports the
224      *    current status of the boolean controls.
225      *  - The 'enabledControlsChanges' field of ControlsNotify events reports
226      *    any boolean controls that have been turned on or off.
227      *  - The 'affectEnabledControls' and 'enabledControls' fields of the
228      *    kbSetControls request change the set of enabled controls.
229      *  - The 'accessXTimeoutMask' and 'accessXTimeoutValues' fields of
230      *    an XkbControlsRec specify the controls to be changed if the keyboard
231      *    times out and the values to which they should be changed.
232      *  - The 'autoCtrls' and 'autoCtrlsValues' fields of the PerClientFlags
233      *    request specifies the specify the controls to be reset when the
234      *    client exits and the values to which they should be reset.
235      *  - The 'ctrls' field of an indicator map specifies the controls
236      *    that drive the indicator.
237      *  - Specifies the boolean controls affected by the SetControls and
238      *    LockControls key actions.
239      */
240 #define	XkbRepeatKeysMask	 (1L << 0)
241 #define	XkbSlowKeysMask		 (1L << 1)
242 #define	XkbBounceKeysMask	 (1L << 2)
243 #define	XkbStickyKeysMask	 (1L << 3)
244 #define	XkbMouseKeysMask	 (1L << 4)
245 #define	XkbMouseKeysAccelMask	 (1L << 5)
246 #define	XkbAccessXKeysMask	 (1L << 6)
247 #define	XkbAccessXTimeoutMask	 (1L << 7)
248 #define	XkbAccessXFeedbackMask	 (1L << 8)
249 #define	XkbAudibleBellMask	 (1L << 9)
250 #define	XkbOverlay1Mask		 (1L << 10)
251 #define	XkbOverlay2Mask		 (1L << 11)
252 #define	XkbIgnoreGroupLockMask	 (1L << 12)
253 #define	XkbGroupsWrapMask	 (1L << 27)
254 #define	XkbInternalModsMask	 (1L << 28)
255 #define	XkbIgnoreLockModsMask	 (1L << 29)
256 #define	XkbPerKeyRepeatMask	 (1L << 30)
257 #define	XkbControlsEnabledMask	 (1L << 31)
258 
259 #define	XkbAccessXOptionsMask    (XkbStickyKeysMask|XkbAccessXFeedbackMask)
260 
261 #define	XkbAllBooleanCtrlsMask	 (0x00001FFF)
262 #define	XkbAllControlsMask	 (0xF8001FFF)
263 #define	XkbAllControlEventsMask	 XkbAllControlsMask
264 
265     /*
266      * AccessX Options Mask
267      *  - The 'accessXOptions' field of an XkbControlsRec specifies the
268      *    AccessX options that are currently in effect.
269      *  - The 'accessXTimeoutOptionsMask' and 'accessXTimeoutOptionsValues'
270      *    fields of an XkbControlsRec specify the Access X options to be
271      *    changed if the keyboard times out and the values to which they
272      *    should be changed.
273      */
274 #define	XkbAX_SKPressFBMask	(1L << 0)
275 #define	XkbAX_SKAcceptFBMask	(1L << 1)
276 #define	XkbAX_FeatureFBMask	(1L << 2)
277 #define	XkbAX_SlowWarnFBMask	(1L << 3)
278 #define	XkbAX_IndicatorFBMask	(1L << 4)
279 #define	XkbAX_StickyKeysFBMask	(1L << 5)
280 #define	XkbAX_TwoKeysMask	(1L << 6)
281 #define	XkbAX_LatchToLockMask	(1L << 7)
282 #define	XkbAX_SKReleaseFBMask	(1L << 8)
283 #define	XkbAX_SKRejectFBMask	(1L << 9)
284 #define	XkbAX_BKRejectFBMask	(1L << 10)
285 #define	XkbAX_DumbBellFBMask	(1L << 11)
286 #define	XkbAX_FBOptionsMask	(0xF3F)
287 #define	XkbAX_SKOptionsMask	(0x0C0)
288 #define	XkbAX_AllOptionsMask	(0xFFF)
289 
290     /*
291      * XkbUseCoreKbd is used to specify the core keyboard without having
292      * 			to look up its X input extension identifier.
293      * XkbUseCorePtr is used to specify the core pointer without having
294      *			to look up its X input extension identifier.
295      * XkbDfltXIClass is used to specify "don't care" any place that the
296      *			XKB protocol is looking for an X Input Extension
297      *			device class.
298      * XkbDfltXIId is used to specify "don't care" any place that the
299      *			XKB protocol is looking for an X Input Extension
300      *			feedback identifier.
301      * XkbAllXIClasses is used to get information about all device indicators,
302      *			whether they're part of the indicator feedback class
303      *			or the keyboard feedback class.
304      * XkbAllXIIds is used to get information about all device indicator
305      *			feedbacks without having to list them.
306      * XkbXINone is used to indicate that no class or id has been specified.
307      * XkbLegalXILedClass(c)  True if 'c' specifies a legal class with LEDs
308      * XkbLegalXIBellClass(c) True if 'c' specifies a legal class with bells
309      * XkbExplicitXIDevice(d) True if 'd' explicitly specifies a device
310      * XkbExplicitXIClass(c)  True if 'c' explicitly specifies a device class
311      * XkbExplicitXIId(c)     True if 'i' explicitly specifies a device id
312      * XkbSingleXIClass(c)    True if 'c' specifies exactly one device class,
313      *                        including the default.
314      * XkbSingleXIId(i)       True if 'i' specifies exactly one device
315      *	                      identifier, including the default.
316      */
317 #define	XkbUseCoreKbd		0x0100
318 #define	XkbUseCorePtr		0x0200
319 #define	XkbDfltXIClass		0x0300
320 #define	XkbDfltXIId		0x0400
321 #define	XkbAllXIClasses		0x0500
322 #define	XkbAllXIIds		0x0600
323 #define	XkbXINone		0xff00
324 
325 #define	XkbLegalXILedClass(c)	(((c)==KbdFeedbackClass)||\
326 					((c)==LedFeedbackClass)||\
327 					((c)==XkbDfltXIClass)||\
328 					((c)==XkbAllXIClasses))
329 #define	XkbLegalXIBellClass(c)	(((c)==KbdFeedbackClass)||\
330 					((c)==BellFeedbackClass)||\
331 					((c)==XkbDfltXIClass)||\
332 					((c)==XkbAllXIClasses))
333 #define	XkbExplicitXIDevice(c)	(((c)&(~0xff))==0)
334 #define	XkbExplicitXIClass(c)	(((c)&(~0xff))==0)
335 #define	XkbExplicitXIId(c)	(((c)&(~0xff))==0)
336 #define	XkbSingleXIClass(c)	((((c)&(~0xff))==0)||((c)==XkbDfltXIClass))
337 #define	XkbSingleXIId(c)	((((c)&(~0xff))==0)||((c)==XkbDfltXIId))
338 
339 #define	XkbNoModifier		0xff
340 #define	XkbNoShiftLevel		0xff
341 #define	XkbNoShape		0xff
342 #define	XkbNoIndicator		0xff
343 
344 #define	XkbNoModifierMask	0
345 #define	XkbAllModifiersMask	0xff
346 #define	XkbAllVirtualModsMask	0xffff
347 
348 #define	XkbNumKbdGroups		4
349 #define	XkbMaxKbdGroup		(XkbNumKbdGroups-1)
350 
351 #define	XkbMaxMouseKeysBtn	4
352 
353     /*
354      * Group Index and Mask:
355      *  - Indices into the kt_index array of a key type.
356      *  - Mask specifies types to be changed for XkbChangeTypesOfKey
357      */
358 #define	XkbGroup1Index		0
359 #define	XkbGroup2Index		1
360 #define	XkbGroup3Index		2
361 #define	XkbGroup4Index		3
362 #define	XkbAnyGroup		254
363 #define	XkbAllGroups		255
364 
365 #define	XkbGroup1Mask		(1<<0)
366 #define	XkbGroup2Mask		(1<<1)
367 #define	XkbGroup3Mask		(1<<2)
368 #define	XkbGroup4Mask		(1<<3)
369 #define	XkbAnyGroupMask		(1<<7)
370 #define	XkbAllGroupsMask	(0xf)
371 
372     /*
373      * BuildCoreState: Given a keyboard group and a modifier state,
374      *                 construct the value to be reported an event.
375      * GroupForCoreState:  Given the state reported in an event,
376      *                 determine the keyboard group.
377      * IsLegalGroup:   Returns TRUE if 'g' is a valid group index.
378      */
379 #define	XkbBuildCoreState(m,g)	((((g)&0x3)<<13)|((m)&0xff))
380 #define XkbGroupForCoreState(s)	(((s)>>13)&0x3)
381 #define	XkbIsLegalGroup(g)	(((g)>=0)&&((g)<XkbNumKbdGroups))
382 
383     /*
384      * GroupsWrap values:
385      *  - The 'groupsWrap' field of an XkbControlsRec specifies the
386      *    treatment of out of range groups.
387      *  - Bits 6 and 7 of the group info field of a key symbol map
388      *    specify the interpretation of out of range groups for the
389      *    corresponding key.
390      */
391 #define	XkbWrapIntoRange	(0x00)
392 #define	XkbClampIntoRange	(0x40)
393 #define	XkbRedirectIntoRange	(0x80)
394 
395     /*
396      * Action flags:  Reported in the 'flags' field of most key actions.
397      * Interpretation depends on the type of the action; not all actions
398      * accept all flags.
399      *
400      * Option			Used for Actions
401      * ------			----------------
402      * ClearLocks		SetMods, LatchMods, SetGroup, LatchGroup
403      * LatchToLock		SetMods, LatchMods, SetGroup, LatchGroup
404      * LockNoLock		LockMods, ISOLock, LockPtrBtn, LockDeviceBtn
405      * LockNoUnlock		LockMods, ISOLock, LockPtrBtn, LockDeviceBtn
406      * UseModMapMods		SetMods, LatchMods, LockMods, ISOLock
407      * GroupAbsolute		SetGroup, LatchGroup, LockGroup, ISOLock
408      * UseDfltButton		PtrBtn, LockPtrBtn
409      * NoAcceleration		MovePtr
410      * MoveAbsoluteX		MovePtr
411      * MoveAbsoluteY		MovePtr
412      * ISODfltIsGroup		ISOLock
413      * ISONoAffectMods		ISOLock
414      * ISONoAffectGroup		ISOLock
415      * ISONoAffectPtr		ISOLock
416      * ISONoAffectCtrls		ISOLock
417      * MessageOnPress		ActionMessage
418      * MessageOnRelease		ActionMessage
419      * MessageGenKeyEvent	ActionMessage
420      * AffectDfltBtn		SetPtrDflt
421      * DfltBtnAbsolute		SetPtrDflt
422      * SwitchApplication	SwitchScreen
423      * SwitchAbsolute		SwitchScreen
424      */
425 
426 #define	XkbSA_ClearLocks	(1L << 0)
427 #define	XkbSA_LatchToLock	(1L << 1)
428 
429 #define	XkbSA_LockNoLock	(1L << 0)
430 #define	XkbSA_LockNoUnlock	(1L << 1)
431 
432 #define	XkbSA_UseModMapMods	(1L << 2)
433 
434 #define	XkbSA_GroupAbsolute	(1L << 2)
435 #define	XkbSA_UseDfltButton	0
436 
437 #define	XkbSA_NoAcceleration	(1L << 0)
438 #define	XkbSA_MoveAbsoluteX	(1L << 1)
439 #define	XkbSA_MoveAbsoluteY	(1L << 2)
440 
441 #define	XkbSA_ISODfltIsGroup 	 (1L << 7)
442 #define	XkbSA_ISONoAffectMods	 (1L << 6)
443 #define	XkbSA_ISONoAffectGroup	 (1L << 5)
444 #define	XkbSA_ISONoAffectPtr	 (1L << 4)
445 #define	XkbSA_ISONoAffectCtrls	 (1L << 3)
446 #define	XkbSA_ISOAffectMask	 (0x78)
447 
448 #define	XkbSA_MessageOnPress	 (1L << 0)
449 #define	XkbSA_MessageOnRelease	 (1L << 1)
450 #define	XkbSA_MessageGenKeyEvent (1L << 2)
451 
452 #define	XkbSA_AffectDfltBtn	1
453 #define	XkbSA_DfltBtnAbsolute	(1L << 2)
454 
455 #define	XkbSA_SwitchApplication	(1L << 0)
456 #define	XkbSA_SwitchAbsolute	(1L << 2)
457 
458     /*
459      * The following values apply to the SA_DeviceValuator
460      * action only.  Valuator operations specify the action
461      * to be taken.   Values specified in the action are
462      * multiplied by 2^scale before they are applied.
463      */
464 #define	XkbSA_IgnoreVal		(0x00)
465 #define	XkbSA_SetValMin		(0x10)
466 #define	XkbSA_SetValCenter	(0x20)
467 #define	XkbSA_SetValMax		(0x30)
468 #define	XkbSA_SetValRelative	(0x40)
469 #define	XkbSA_SetValAbsolute	(0x50)
470 #define	XkbSA_ValOpMask		(0x70)
471 #define	XkbSA_ValScaleMask	(0x07)
472 #define	XkbSA_ValOp(a)		((a)&XkbSA_ValOpMask)
473 #define	XkbSA_ValScale(a)	((a)&XkbSA_ValScaleMask)
474 
475     /*
476      * Action types: specifies the type of a key action.  Reported in the
477      * type field of all key actions.
478      */
479 #define	XkbSA_NoAction		0x00
480 #define	XkbSA_SetMods		0x01
481 #define	XkbSA_LatchMods		0x02
482 #define	XkbSA_LockMods		0x03
483 #define	XkbSA_SetGroup		0x04
484 #define	XkbSA_LatchGroup	0x05
485 #define	XkbSA_LockGroup		0x06
486 #define	XkbSA_MovePtr		0x07
487 #define	XkbSA_PtrBtn		0x08
488 #define	XkbSA_LockPtrBtn	0x09
489 #define	XkbSA_SetPtrDflt	0x0a
490 #define	XkbSA_ISOLock		0x0b
491 #define	XkbSA_Terminate		0x0c
492 #define	XkbSA_SwitchScreen	0x0d
493 #define	XkbSA_SetControls	0x0e
494 #define	XkbSA_LockControls	0x0f
495 #define	XkbSA_ActionMessage	0x10
496 #define	XkbSA_RedirectKey	0x11
497 #define	XkbSA_DeviceBtn		0x12
498 #define	XkbSA_LockDeviceBtn	0x13
499 #define	XkbSA_DeviceValuator	0x14
500 #define	XkbSA_LastAction	XkbSA_DeviceValuator
501 #define	XkbSA_NumActions	(XkbSA_LastAction+1)
502 
503 #define	XkbSA_XFree86Private	0x86
504 
505     /*
506      * Specifies the key actions that clear latched groups or modifiers.
507      */
508 #define	XkbSA_BreakLatch \
509 	((1<<XkbSA_NoAction)|(1<<XkbSA_PtrBtn)|(1<<XkbSA_LockPtrBtn)|\
510 	(1<<XkbSA_Terminate)|(1<<XkbSA_SwitchScreen)|(1<<XkbSA_SetControls)|\
511 	(1<<XkbSA_LockControls)|(1<<XkbSA_ActionMessage)|\
512 	(1<<XkbSA_RedirectKey)|(1<<XkbSA_DeviceBtn)|(1<<XkbSA_LockDeviceBtn))
513 
514     /*
515      * Macros to classify key actions
516      */
517 #define	XkbIsModAction(a)	(((a)->type>=Xkb_SASetMods)&&((a)->type<=XkbSA_LockMods))
518 #define	XkbIsGroupAction(a)	(((a)->type>=XkbSA_SetGroup)&&((a)->type<=XkbSA_LockGroup))
519 #define	XkbIsPtrAction(a)	(((a)->type>=XkbSA_MovePtr)&&((a)->type<=XkbSA_SetPtrDflt))
520 
521 
522     /*
523      * Key Behavior Qualifier:
524      *    KB_Permanent indicates that the behavior describes an unalterable
525      *    characteristic of the keyboard, not an XKB software-simulation of
526      *    the listed behavior.
527      * Key Behavior Types:
528      *    Specifies the behavior of the underlying key.
529      */
530 #define	XkbKB_Permanent		0x80
531 #define	XkbKB_OpMask		0x7f
532 
533 #define	XkbKB_Default		0x00
534 #define	XkbKB_Lock		0x01
535 #define	XkbKB_RadioGroup	0x02
536 #define	XkbKB_Overlay1		0x03
537 #define	XkbKB_Overlay2		0x04
538 
539 #define	XkbKB_RGAllowNone	0x80
540 
541     /*
542      * Various macros which describe the range of legal keycodes.
543      */
544 #define	XkbMinLegalKeyCode	8
545 #define	XkbMaxLegalKeyCode	255
546 #define	XkbMaxKeyCount		(XkbMaxLegalKeyCode-XkbMinLegalKeyCode+1)
547 #define	XkbPerKeyBitArraySize	((XkbMaxLegalKeyCode+1)/8)
548 /* Seems kinda silly to check that an unsigned char is <= 255... */
549 #define	XkbIsLegalKeycode(k)	((k)>=XkbMinLegalKeyCode)
550 
551     /*
552      * Assorted constants and limits.
553      */
554 #define	XkbNumModifiers		8
555 #define	XkbNumVirtualMods	16
556 #define	XkbNumIndicators	32
557 #define	XkbAllIndicatorsMask	(0xffffffff)
558 #define	XkbMaxRadioGroups	32
559 #define	XkbAllRadioGroupsMask	(0xffffffff)
560 #define	XkbMaxShiftLevel	63
561 #define	XkbMaxSymsPerKey	(XkbMaxShiftLevel*XkbNumKbdGroups)
562 #define	XkbRGMaxMembers		12
563 #define	XkbActionMessageLength	6
564 #define	XkbKeyNameLength	4
565 #define	XkbMaxRedirectCount	8
566 
567 #define	XkbGeomPtsPerMM		10
568 #define	XkbGeomMaxColors	32
569 #define	XkbGeomMaxLabelColors	3
570 #define	XkbGeomMaxPriority	255
571 
572     /*
573      * Key Type index and mask for the four standard key types.
574      */
575 #define	XkbOneLevelIndex	0
576 #define	XkbTwoLevelIndex	1
577 #define	XkbAlphabeticIndex	2
578 #define	XkbKeypadIndex		3
579 #define	XkbLastRequiredType	XkbKeypadIndex
580 #define	XkbNumRequiredTypes	(XkbLastRequiredType+1)
581 #define	XkbMaxKeyTypes		255
582 
583 #define	XkbOneLevelMask		(1<<0)
584 #define	XkbTwoLevelMask		(1<<1)
585 #define	XkbAlphabeticMask	(1<<2)
586 #define	XkbKeypadMask		(1<<3)
587 #define	XkbAllRequiredTypes	(0xf)
588 
589 #define	XkbShiftLevel(n)	((n)-1)
590 #define	XkbShiftLevelMask(n)	(1<<((n)-1))
591 
592     /*
593      * Extension name and version information
594      */
595 #define	XkbName "XKEYBOARD"
596 #define	XkbMajorVersion	1
597 #define	XkbMinorVersion	0
598 
599     /*
600      * Explicit map components:
601      *  - Used in the 'explicit' field of an XkbServerMap.  Specifies
602      *    the keyboard components that should _not_ be updated automatically
603      *    in response to core protocol keyboard mapping requests.
604      */
605 #define	XkbExplicitKeyTypesMask	  (0x0f)
606 #define	XkbExplicitKeyType1Mask	  (1<<0)
607 #define	XkbExplicitKeyType2Mask	  (1<<1)
608 #define	XkbExplicitKeyType3Mask	  (1<<2)
609 #define	XkbExplicitKeyType4Mask	  (1<<3)
610 #define	XkbExplicitInterpretMask  (1<<4)
611 #define	XkbExplicitAutoRepeatMask (1<<5)
612 #define	XkbExplicitBehaviorMask	  (1<<6)
613 #define	XkbExplicitVModMapMask	  (1<<7)
614 #define	XkbAllExplicitMask	  (0xff)
615 
616     /*
617      * Map components masks:
618      * Those in AllMapComponentsMask:
619      *  - Specifies the individual fields to be loaded or changed for the
620      *    GetMap and SetMap requests.
621      * Those in ClientInfoMask:
622      *  - Specifies the components to be allocated by XkbAllocClientMap.
623      * Those in ServerInfoMask:
624      *  - Specifies the components to be allocated by XkbAllocServerMap.
625      */
626 #define	XkbKeyTypesMask		(1<<0)
627 #define	XkbKeySymsMask		(1<<1)
628 #define	XkbModifierMapMask	(1<<2)
629 #define	XkbExplicitComponentsMask (1<<3)
630 #define XkbKeyActionsMask	(1<<4)
631 #define	XkbKeyBehaviorsMask	(1<<5)
632 #define	XkbVirtualModsMask	(1<<6)
633 #define	XkbVirtualModMapMask	(1<<7)
634 
635 #define	XkbAllClientInfoMask	(XkbKeyTypesMask|XkbKeySymsMask|XkbModifierMapMask)
636 #define	XkbAllServerInfoMask	(XkbExplicitComponentsMask|XkbKeyActionsMask|XkbKeyBehaviorsMask|XkbVirtualModsMask|XkbVirtualModMapMask)
637 #define	XkbAllMapComponentsMask	(XkbAllClientInfoMask|XkbAllServerInfoMask)
638 
639     /*
640      * Symbol interpretations flags:
641      *  - Used in the flags field of a symbol interpretation
642      */
643 #define	XkbSI_AutoRepeat	(1<<0)
644 #define	XkbSI_LockingKey	(1<<1)
645 
646     /*
647      * Symbol interpretations match specification:
648      *  - Used in the match field of a symbol interpretation to specify
649      *    the conditions under which an interpretation is used.
650      */
651 #define	XkbSI_LevelOneOnly	(0x80)
652 #define	XkbSI_OpMask		(0x7f)
653 #define	XkbSI_NoneOf		(0)
654 #define	XkbSI_AnyOfOrNone	(1)
655 #define	XkbSI_AnyOf		(2)
656 #define	XkbSI_AllOf		(3)
657 #define	XkbSI_Exactly		(4)
658 
659     /*
660      * Indicator map flags:
661      *  - Used in the flags field of an indicator map to indicate the
662      *    conditions under which and indicator can be changed and the
663      *    effects of changing the indicator.
664      */
665 #define	XkbIM_NoExplicit	(1L << 7)
666 #define	XkbIM_NoAutomatic	(1L << 6)
667 #define	XkbIM_LEDDrivesKB	(1L << 5)
668 
669     /*
670      * Indicator map component specifications:
671      *  - Used by the 'which_groups' and 'which_mods' fields of an indicator
672      *    map to specify which keyboard components should be used to drive
673      *    the indicator.
674      */
675 #define	XkbIM_UseBase		(1L << 0)
676 #define	XkbIM_UseLatched	(1L << 1)
677 #define	XkbIM_UseLocked		(1L << 2)
678 #define	XkbIM_UseEffective	(1L << 3)
679 #define	XkbIM_UseCompat		(1L << 4)
680 
681 #define	XkbIM_UseNone	  0
682 #define	XkbIM_UseAnyGroup (XkbIM_UseBase|XkbIM_UseLatched|XkbIM_UseLocked\
683                            |XkbIM_UseEffective)
684 #define	XkbIM_UseAnyMods  (XkbIM_UseAnyGroup|XkbIM_UseCompat)
685 
686     /*
687      * Compatibility Map Compontents:
688      *  - Specifies the components to be allocated in XkbAllocCompatMap.
689      */
690 #define	XkbSymInterpMask	(1<<0)
691 #define	XkbGroupCompatMask	(1<<1)
692 #define	XkbAllCompatMask	(0x3)
693 
694     /*
695      * Names component mask:
696      *  - Specifies the names to be loaded or changed for the GetNames and
697      *    SetNames requests.
698      *  - Specifies the names that have changed in a NamesNotify event.
699      *  - Specifies the names components to be allocated by XkbAllocNames.
700      */
701 #define	XkbKeycodesNameMask	(1<<0)
702 #define	XkbGeometryNameMask	(1<<1)
703 #define	XkbSymbolsNameMask	(1<<2)
704 #define	XkbPhysSymbolsNameMask	(1<<3)
705 #define	XkbTypesNameMask	(1<<4)
706 #define	XkbCompatNameMask 	(1<<5)
707 #define	XkbKeyTypeNamesMask	(1<<6)
708 #define	XkbKTLevelNamesMask	(1<<7)
709 #define	XkbIndicatorNamesMask	(1<<8)
710 #define	XkbKeyNamesMask		(1<<9)
711 #define	XkbKeyAliasesMask	(1<<10)
712 #define	XkbVirtualModNamesMask	(1<<11)
713 #define	XkbGroupNamesMask	(1<<12)
714 #define	XkbRGNamesMask		(1<<13)
715 #define	XkbComponentNamesMask	(0x3f)
716 #define	XkbAllNamesMask		(0x3fff)
717 
718     /*
719      * GetByName components:
720      *  - Specifies desired or necessary components to GetKbdByName request.
721      *  - Reports the components that were found in a GetKbdByNameReply
722      */
723 #define	XkbGBN_TypesMask		(1L << 0)
724 #define	XkbGBN_CompatMapMask		(1L << 1)
725 #define	XkbGBN_ClientSymbolsMask	(1L << 2)
726 #define	XkbGBN_ServerSymbolsMask	(1L << 3)
727 #define	XkbGBN_SymbolsMask (XkbGBN_ClientSymbolsMask|XkbGBN_ServerSymbolsMask)
728 #define	XkbGBN_IndicatorMapMask		(1L << 4)
729 #define	XkbGBN_KeyNamesMask		(1L << 5)
730 #define	XkbGBN_GeometryMask		(1L << 6)
731 #define	XkbGBN_OtherNamesMask		(1L << 7)
732 #define	XkbGBN_AllComponentsMask	(0xff)
733 
734      /*
735       * ListComponents flags
736       */
737 #define	XkbLC_Hidden			(1L <<  0)
738 #define	XkbLC_Default			(1L <<  1)
739 #define	XkbLC_Partial			(1L <<  2)
740 
741 #define	XkbLC_AlphanumericKeys		(1L <<  8)
742 #define	XkbLC_ModifierKeys		(1L <<  9)
743 #define	XkbLC_KeypadKeys		(1L << 10)
744 #define	XkbLC_FunctionKeys		(1L << 11)
745 #define	XkbLC_AlternateGroup		(1L << 12)
746 
747     /*
748      * X Input Extension Interactions
749      * - Specifies the possible interactions between XKB and the X input
750      *   extension
751      * - Used to request (XkbGetDeviceInfo) or change (XKbSetDeviceInfo)
752      *   XKB information about an extension device.
753      * - Reports the list of supported optional features in the reply to
754      *   XkbGetDeviceInfo or in an XkbExtensionDeviceNotify event.
755      * XkbXI_UnsupportedFeature is reported in XkbExtensionDeviceNotify
756      * events to indicate an attempt to use an unsupported feature.
757      */
758 #define	XkbXI_KeyboardsMask		(1L << 0)
759 #define	XkbXI_ButtonActionsMask		(1L << 1)
760 #define	XkbXI_IndicatorNamesMask	(1L << 2)
761 #define	XkbXI_IndicatorMapsMask		(1L << 3)
762 #define	XkbXI_IndicatorStateMask	(1L << 4)
763 #define	XkbXI_UnsupportedFeatureMask	(1L << 15)
764 #define	XkbXI_AllFeaturesMask		(0x001f)
765 #define	XkbXI_AllDeviceFeaturesMask	(0x001e)
766 
767 #define	XkbXI_IndicatorsMask		(0x001c)
768 #define	XkbAllExtensionDeviceEventsMask (0x801f)
769 
770     /*
771      * Per-Client Flags:
772      *  - Specifies flags to be changed by the PerClientFlags request.
773      */
774 #define	XkbPCF_DetectableAutoRepeatMask	(1L << 0)
775 #define	XkbPCF_GrabsUseXKBStateMask	(1L << 1)
776 #define	XkbPCF_AutoResetControlsMask	(1L << 2)
777 #define	XkbPCF_LookupStateWhenGrabbed	(1L << 3)
778 #define	XkbPCF_SendEventUsesXKBState	(1L << 4)
779 #define	XkbPCF_AllFlagsMask		(0x1F)
780 
781     /*
782      * Debugging flags and controls
783      */
784 #define	XkbDF_DisableLocks	(1<<0)
785 
786 #endif /* _XKB_H_ */
787