Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-30 10:26:33

0001 /************************************************************
0002 Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc.
0003 
0004 Permission to use, copy, modify, and distribute this
0005 software and its documentation for any purpose and without
0006 fee is hereby granted, provided that the above copyright
0007 notice appear in all copies and that both that copyright
0008 notice and this permission notice appear in supporting
0009 documentation, and that the name of Silicon Graphics not be 
0010 used in advertising or publicity pertaining to distribution 
0011 of the software without specific prior written permission.
0012 Silicon Graphics makes no representation about the suitability 
0013 of this software for any purpose. It is provided "as is"
0014 without any express or implied warranty.
0015 
0016 SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS 
0017 SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY 
0018 AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
0019 GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL 
0020 DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, 
0021 DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE 
0022 OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION  WITH
0023 THE USE OR PERFORMANCE OF THIS SOFTWARE.
0024 
0025 ********************************************************/
0026 
0027 #ifndef _XKB_H_
0028 #define _XKB_H_
0029 
0030     /*
0031      * XKB request codes, used in:
0032      *  -  xkbReqType field of all requests
0033      *  -  requestMinor field of some events
0034      */
0035 #define X_kbUseExtension         0
0036 #define X_kbSelectEvents         1
0037 #define X_kbBell             3
0038 #define X_kbGetState             4
0039 #define X_kbLatchLockState       5
0040 #define X_kbGetControls          6
0041 #define X_kbSetControls          7
0042 #define X_kbGetMap           8
0043 #define X_kbSetMap           9
0044 #define X_kbGetCompatMap        10
0045 #define X_kbSetCompatMap        11
0046 #define X_kbGetIndicatorState       12
0047 #define X_kbGetIndicatorMap     13
0048 #define X_kbSetIndicatorMap     14
0049 #define X_kbGetNamedIndicator       15
0050 #define X_kbSetNamedIndicator       16
0051 #define X_kbGetNames            17
0052 #define X_kbSetNames            18
0053 #define X_kbGetGeometry         19
0054 #define X_kbSetGeometry         20
0055 #define X_kbPerClientFlags      21
0056 #define X_kbListComponents      22
0057 #define X_kbGetKbdByName        23
0058 #define X_kbGetDeviceInfo       24
0059 #define X_kbSetDeviceInfo       25
0060 #define X_kbSetDebuggingFlags       101
0061 
0062     /*
0063      * In the X sense, XKB reports only one event.
0064      * The type field of all XKB events is XkbEventCode
0065      */
0066 #define XkbEventCode            0
0067 #define XkbNumberEvents         (XkbEventCode+1)
0068 
0069     /*
0070      * XKB has a minor event code so it can use one X event code for 
0071      * multiple purposes.  
0072      *  - reported in the xkbType field of all XKB events.
0073      *  - XkbSelectEventDetails: Indicates the event for which event details 
0074      *    are being changed
0075      */
0076 #define XkbNewKeyboardNotify        0
0077 #define XkbMapNotify            1
0078 #define XkbStateNotify          2
0079 #define XkbControlsNotify       3
0080 #define XkbIndicatorStateNotify     4
0081 #define XkbIndicatorMapNotify       5
0082 #define XkbNamesNotify          6
0083 #define XkbCompatMapNotify      7
0084 #define XkbBellNotify           8
0085 #define XkbActionMessage        9
0086 #define XkbAccessXNotify        10
0087 #define XkbExtensionDeviceNotify    11
0088 
0089     /*
0090      * Event Mask:
0091      *  - XkbSelectEvents:  Specifies event interest.
0092      */
0093 #define XkbNewKeyboardNotifyMask    (1L << 0)
0094 #define XkbMapNotifyMask        (1L << 1)
0095 #define XkbStateNotifyMask      (1L << 2)
0096 #define XkbControlsNotifyMask       (1L << 3)
0097 #define XkbIndicatorStateNotifyMask (1L << 4)
0098 #define XkbIndicatorMapNotifyMask   (1L << 5)
0099 #define XkbNamesNotifyMask      (1L << 6)
0100 #define XkbCompatMapNotifyMask      (1L << 7)
0101 #define XkbBellNotifyMask       (1L << 8)
0102 #define XkbActionMessageMask        (1L << 9)
0103 #define XkbAccessXNotifyMask        (1L << 10)
0104 #define XkbExtensionDeviceNotifyMask    (1L << 11)
0105 #define XkbAllEventsMask        (0xFFF)
0106 
0107     /*
0108      * NewKeyboardNotify event details:
0109      */
0110 #define XkbNKN_KeycodesMask     (1L << 0)
0111 #define XkbNKN_GeometryMask     (1L << 1)
0112 #define XkbNKN_DeviceIDMask     (1L << 2)
0113 #define XkbAllNewKeyboardEventsMask (0x7)
0114 
0115     /*
0116      * AccessXNotify event types:
0117      *  - The 'what' field of AccessXNotify events reports the
0118      *    reason that the event was generated.
0119      */
0120 #define XkbAXN_SKPress          0
0121 #define XkbAXN_SKAccept         1
0122 #define XkbAXN_SKReject         2
0123 #define XkbAXN_SKRelease        3
0124 #define XkbAXN_BKAccept         4
0125 #define XkbAXN_BKReject         5
0126 #define XkbAXN_AXKWarning       6
0127 
0128     /*
0129      * AccessXNotify details:
0130      * - Used as an event detail mask to limit the conditions under which
0131      *   AccessXNotify events are reported
0132      */
0133 #define XkbAXN_SKPressMask      (1L << 0)
0134 #define XkbAXN_SKAcceptMask     (1L << 1)
0135 #define XkbAXN_SKRejectMask     (1L << 2)
0136 #define XkbAXN_SKReleaseMask        (1L << 3)
0137 #define XkbAXN_BKAcceptMask     (1L << 4)
0138 #define XkbAXN_BKRejectMask     (1L << 5)
0139 #define XkbAXN_AXKWarningMask       (1L << 6)
0140 #define XkbAllAccessXEventsMask     (0x7f)
0141 
0142     /*
0143      * Miscellaneous event details:
0144      * - event detail masks for assorted events that don't reall
0145      *   have any details.
0146      */
0147 #define XkbAllStateEventsMask       XkbAllStateComponentsMask
0148 #define XkbAllMapEventsMask     XkbAllMapComponentsMask
0149 #define XkbAllControlEventsMask     XkbAllControlsMask
0150 #define XkbAllIndicatorEventsMask   XkbAllIndicatorsMask
0151 #define XkbAllNameEventsMask        XkbAllNamesMask
0152 #define XkbAllCompatMapEventsMask   XkbAllCompatMask
0153 #define XkbAllBellEventsMask        (1L << 0)
0154 #define XkbAllActionMessagesMask    (1L << 0)
0155 
0156     /*
0157      * XKB reports one error:  BadKeyboard
0158      * A further reason for the error is encoded into to most significant
0159      * byte of the resourceID for the error:
0160      *    XkbErr_BadDevice - the device in question was not found
0161      *    XkbErr_BadClass  - the device was found but it doesn't belong to 
0162      *                       the appropriate class.
0163      *    XkbErr_BadId     - the device was found and belongs to the right
0164      *                       class, but not feedback with a matching id was
0165      *                       found.
0166      * The low byte of the resourceID for this error contains the device
0167      * id, class specifier or feedback id that failed.
0168      */
0169 #define XkbKeyboard         0
0170 #define XkbNumberErrors         1
0171 
0172 #define XkbErr_BadDevice    0xff
0173 #define XkbErr_BadClass     0xfe
0174 #define XkbErr_BadId        0xfd
0175 
0176     /*
0177      * Keyboard Components Mask:
0178      * - Specifies the components that follow a GetKeyboardByNameReply
0179      */
0180 #define XkbClientMapMask        (1L << 0)
0181 #define XkbServerMapMask        (1L << 1)
0182 #define XkbCompatMapMask        (1L << 2)
0183 #define XkbIndicatorMapMask     (1L << 3)
0184 #define XkbNamesMask            (1L << 4)
0185 #define XkbGeometryMask         (1L << 5)
0186 #define XkbControlsMask         (1L << 6)
0187 #define XkbAllComponentsMask        (0x7f)
0188 
0189     /*
0190      * State detail mask:
0191      *  - The 'changed' field of StateNotify events reports which of
0192      *    the keyboard state components have changed.
0193      *  - Used as an event detail mask to limit the conditions under
0194      *    which StateNotify events are reported.
0195      */
0196 #define XkbModifierStateMask        (1L << 0)
0197 #define XkbModifierBaseMask     (1L << 1)
0198 #define XkbModifierLatchMask        (1L << 2)
0199 #define XkbModifierLockMask     (1L << 3)
0200 #define XkbGroupStateMask       (1L << 4)
0201 #define XkbGroupBaseMask        (1L << 5)
0202 #define XkbGroupLatchMask       (1L << 6)
0203 #define XkbGroupLockMask        (1L << 7)
0204 #define XkbCompatStateMask      (1L << 8)
0205 #define XkbGrabModsMask         (1L << 9)
0206 #define XkbCompatGrabModsMask       (1L << 10)
0207 #define XkbLookupModsMask       (1L << 11)
0208 #define XkbCompatLookupModsMask     (1L << 12)
0209 #define XkbPointerButtonMask        (1L << 13)
0210 #define XkbAllStateComponentsMask   (0x3fff)
0211 
0212     /*
0213      * Controls detail masks:
0214      *  The controls specified in XkbAllControlsMask:
0215      *  - The 'changed' field of ControlsNotify events reports which of 
0216      *    the keyboard controls have changed.
0217      *  - The 'changeControls' field of the SetControls request specifies
0218      *    the controls for which values are to be changed.
0219      *  - Used as an event detail mask to limit the conditions under 
0220      *    which ControlsNotify events are reported.
0221      *
0222      *  The controls specified in the XkbAllBooleanCtrlsMask:
0223      *  - The 'enabledControls' field of ControlsNotify events reports the
0224      *    current status of the boolean controls.
0225      *  - The 'enabledControlsChanges' field of ControlsNotify events reports
0226      *    any boolean controls that have been turned on or off.
0227      *  - The 'affectEnabledControls' and 'enabledControls' fields of the
0228      *    kbSetControls request change the set of enabled controls.
0229      *  - The 'accessXTimeoutMask' and 'accessXTimeoutValues' fields of
0230      *    an XkbControlsRec specify the controls to be changed if the keyboard
0231      *    times out and the values to which they should be changed.
0232      *  - The 'autoCtrls' and 'autoCtrlsValues' fields of the PerClientFlags 
0233      *    request specifies the specify the controls to be reset when the
0234      *    client exits and the values to which they should be reset.
0235      *  - The 'ctrls' field of an indicator map specifies the controls
0236      *    that drive the indicator.
0237      *  - Specifies the boolean controls affected by the SetControls and
0238      *    LockControls key actions.
0239      */
0240 #define XkbRepeatKeysMask    (1L << 0)
0241 #define XkbSlowKeysMask      (1L << 1)
0242 #define XkbBounceKeysMask    (1L << 2)
0243 #define XkbStickyKeysMask    (1L << 3)
0244 #define XkbMouseKeysMask     (1L << 4)
0245 #define XkbMouseKeysAccelMask    (1L << 5)
0246 #define XkbAccessXKeysMask   (1L << 6)
0247 #define XkbAccessXTimeoutMask    (1L << 7)
0248 #define XkbAccessXFeedbackMask   (1L << 8)
0249 #define XkbAudibleBellMask   (1L << 9)
0250 #define XkbOverlay1Mask      (1L << 10)
0251 #define XkbOverlay2Mask      (1L << 11)
0252 #define XkbIgnoreGroupLockMask   (1L << 12)
0253 #define XkbGroupsWrapMask    (1L << 27)
0254 #define XkbInternalModsMask  (1L << 28)
0255 #define XkbIgnoreLockModsMask    (1L << 29)
0256 #define XkbPerKeyRepeatMask  (1L << 30)
0257 #define XkbControlsEnabledMask   (1L << 31)
0258 
0259 #define XkbAccessXOptionsMask    (XkbStickyKeysMask|XkbAccessXFeedbackMask)
0260 
0261 #define XkbAllBooleanCtrlsMask   (0x00001FFF)
0262 #define XkbAllControlsMask   (0xF8001FFF)
0263 #define XkbAllControlEventsMask  XkbAllControlsMask
0264 
0265     /*
0266      * AccessX Options Mask
0267      *  - The 'accessXOptions' field of an XkbControlsRec specifies the
0268      *    AccessX options that are currently in effect.
0269      *  - The 'accessXTimeoutOptionsMask' and 'accessXTimeoutOptionsValues'
0270      *    fields of an XkbControlsRec specify the Access X options to be 
0271      *    changed if the keyboard times out and the values to which they 
0272      *    should be changed.
0273      */
0274 #define XkbAX_SKPressFBMask (1L << 0)
0275 #define XkbAX_SKAcceptFBMask    (1L << 1)
0276 #define XkbAX_FeatureFBMask (1L << 2)
0277 #define XkbAX_SlowWarnFBMask    (1L << 3)
0278 #define XkbAX_IndicatorFBMask   (1L << 4)
0279 #define XkbAX_StickyKeysFBMask  (1L << 5)
0280 #define XkbAX_TwoKeysMask   (1L << 6)
0281 #define XkbAX_LatchToLockMask   (1L << 7)
0282 #define XkbAX_SKReleaseFBMask   (1L << 8)
0283 #define XkbAX_SKRejectFBMask    (1L << 9)
0284 #define XkbAX_BKRejectFBMask    (1L << 10)
0285 #define XkbAX_DumbBellFBMask    (1L << 11)
0286 #define XkbAX_FBOptionsMask (0xF3F)
0287 #define XkbAX_SKOptionsMask (0x0C0)
0288 #define XkbAX_AllOptionsMask    (0xFFF)
0289 
0290     /*
0291      * XkbUseCoreKbd is used to specify the core keyboard without having
0292      *          to look up its X input extension identifier.
0293      * XkbUseCorePtr is used to specify the core pointer without having
0294      *          to look up its X input extension identifier.
0295      * XkbDfltXIClass is used to specify "don't care" any place that the
0296      *          XKB protocol is looking for an X Input Extension 
0297      *          device class.
0298      * XkbDfltXIId is used to specify "don't care" any place that the
0299      *          XKB protocol is looking for an X Input Extension
0300      *          feedback identifier.
0301      * XkbAllXIClasses is used to get information about all device indicators,
0302      *          whether they're part of the indicator feedback class
0303      *          or the keyboard feedback class.
0304      * XkbAllXIIds is used to get information about all device indicator
0305      *          feedbacks without having to list them.
0306      * XkbXINone is used to indicate that no class or id has been specified.
0307      * XkbLegalXILedClass(c)  True if 'c' specifies a legal class with LEDs
0308      * XkbLegalXIBellClass(c) True if 'c' specifies a legal class with bells
0309      * XkbExplicitXIDevice(d) True if 'd' explicitly specifies a device
0310      * XkbExplicitXIClass(c)  True if 'c' explicitly specifies a device class
0311      * XkbExplicitXIId(c)     True if 'i' explicitly specifies a device id
0312      * XkbSingleXIClass(c)    True if 'c' specifies exactly one device class, 
0313      *                        including the default.
0314      * XkbSingleXIId(i)       True if 'i' specifies exactly one device 
0315      *                        identifier, including the default.
0316      */
0317 #define XkbUseCoreKbd       0x0100
0318 #define XkbUseCorePtr       0x0200
0319 #define XkbDfltXIClass      0x0300
0320 #define XkbDfltXIId     0x0400
0321 #define XkbAllXIClasses     0x0500
0322 #define XkbAllXIIds     0x0600
0323 #define XkbXINone       0xff00
0324 
0325 #define XkbLegalXILedClass(c)   (((c)==KbdFeedbackClass)||\
0326                     ((c)==LedFeedbackClass)||\
0327                     ((c)==XkbDfltXIClass)||\
0328                     ((c)==XkbAllXIClasses))
0329 #define XkbLegalXIBellClass(c)  (((c)==KbdFeedbackClass)||\
0330                     ((c)==BellFeedbackClass)||\
0331                     ((c)==XkbDfltXIClass)||\
0332                     ((c)==XkbAllXIClasses))
0333 #define XkbExplicitXIDevice(c)  (((c)&(~0xff))==0)
0334 #define XkbExplicitXIClass(c)   (((c)&(~0xff))==0)
0335 #define XkbExplicitXIId(c)  (((c)&(~0xff))==0)
0336 #define XkbSingleXIClass(c) ((((c)&(~0xff))==0)||((c)==XkbDfltXIClass))
0337 #define XkbSingleXIId(c)    ((((c)&(~0xff))==0)||((c)==XkbDfltXIId))
0338 
0339 #define XkbNoModifier       0xff
0340 #define XkbNoShiftLevel     0xff
0341 #define XkbNoShape      0xff
0342 #define XkbNoIndicator      0xff
0343 
0344 #define XkbNoModifierMask   0
0345 #define XkbAllModifiersMask 0xff
0346 #define XkbAllVirtualModsMask   0xffff
0347 
0348 #define XkbNumKbdGroups     4
0349 #define XkbMaxKbdGroup      (XkbNumKbdGroups-1)
0350 
0351 #define XkbMaxMouseKeysBtn  4
0352 
0353     /*
0354      * Group Index and Mask:
0355      *  - Indices into the kt_index array of a key type.
0356      *  - Mask specifies types to be changed for XkbChangeTypesOfKey
0357      */
0358 #define XkbGroup1Index      0
0359 #define XkbGroup2Index      1
0360 #define XkbGroup3Index      2
0361 #define XkbGroup4Index      3
0362 #define XkbAnyGroup     254
0363 #define XkbAllGroups        255
0364 
0365 #define XkbGroup1Mask       (1<<0)
0366 #define XkbGroup2Mask       (1<<1)
0367 #define XkbGroup3Mask       (1<<2)
0368 #define XkbGroup4Mask       (1<<3)
0369 #define XkbAnyGroupMask     (1<<7)
0370 #define XkbAllGroupsMask    (0xf)
0371 
0372     /*
0373      * BuildCoreState: Given a keyboard group and a modifier state,
0374      *                 construct the value to be reported an event.
0375      * GroupForCoreState:  Given the state reported in an event,
0376      *                 determine the keyboard group.
0377      * IsLegalGroup:   Returns TRUE if 'g' is a valid group index.
0378      */
0379 #define XkbBuildCoreState(m,g)  ((((g)&0x3)<<13)|((m)&0xff))
0380 #define XkbGroupForCoreState(s) (((s)>>13)&0x3)
0381 #define XkbIsLegalGroup(g)  (((g)>=0)&&((g)<XkbNumKbdGroups))
0382 
0383     /*
0384      * GroupsWrap values:
0385      *  - The 'groupsWrap' field of an XkbControlsRec specifies the
0386      *    treatment of out of range groups.
0387      *  - Bits 6 and 7 of the group info field of a key symbol map
0388      *    specify the interpretation of out of range groups for the
0389      *    corresponding key.
0390      */
0391 #define XkbWrapIntoRange    (0x00)
0392 #define XkbClampIntoRange   (0x40)
0393 #define XkbRedirectIntoRange    (0x80)
0394 
0395     /*
0396      * Action flags:  Reported in the 'flags' field of most key actions.
0397      * Interpretation depends on the type of the action; not all actions
0398      * accept all flags.
0399      *
0400      * Option           Used for Actions
0401      * ------           ----------------
0402      * ClearLocks       SetMods, LatchMods, SetGroup, LatchGroup
0403      * LatchToLock      SetMods, LatchMods, SetGroup, LatchGroup
0404      * LockNoLock       LockMods, ISOLock, LockPtrBtn, LockDeviceBtn
0405      * LockNoUnlock     LockMods, ISOLock, LockPtrBtn, LockDeviceBtn
0406      * UseModMapMods        SetMods, LatchMods, LockMods, ISOLock
0407      * GroupAbsolute        SetGroup, LatchGroup, LockGroup, ISOLock
0408      * UseDfltButton        PtrBtn, LockPtrBtn
0409      * NoAcceleration       MovePtr
0410      * MoveAbsoluteX        MovePtr
0411      * MoveAbsoluteY        MovePtr
0412      * ISODfltIsGroup       ISOLock
0413      * ISONoAffectMods      ISOLock
0414      * ISONoAffectGroup     ISOLock
0415      * ISONoAffectPtr       ISOLock
0416      * ISONoAffectCtrls     ISOLock
0417      * MessageOnPress       ActionMessage
0418      * MessageOnRelease     ActionMessage
0419      * MessageGenKeyEvent   ActionMessage
0420      * AffectDfltBtn        SetPtrDflt
0421      * DfltBtnAbsolute      SetPtrDflt
0422      * SwitchApplication    SwitchScreen
0423      * SwitchAbsolute       SwitchScreen
0424      */
0425 
0426 #define XkbSA_ClearLocks    (1L << 0)
0427 #define XkbSA_LatchToLock   (1L << 1)
0428 
0429 #define XkbSA_LockNoLock    (1L << 0)
0430 #define XkbSA_LockNoUnlock  (1L << 1)
0431 
0432 #define XkbSA_UseModMapMods (1L << 2)
0433 
0434 #define XkbSA_GroupAbsolute (1L << 2)
0435 #define XkbSA_UseDfltButton 0
0436 
0437 #define XkbSA_NoAcceleration    (1L << 0)
0438 #define XkbSA_MoveAbsoluteX (1L << 1)
0439 #define XkbSA_MoveAbsoluteY (1L << 2)
0440 
0441 #define XkbSA_ISODfltIsGroup     (1L << 7)
0442 #define XkbSA_ISONoAffectMods    (1L << 6)
0443 #define XkbSA_ISONoAffectGroup   (1L << 5)
0444 #define XkbSA_ISONoAffectPtr     (1L << 4)
0445 #define XkbSA_ISONoAffectCtrls   (1L << 3)
0446 #define XkbSA_ISOAffectMask  (0x78)
0447 
0448 #define XkbSA_MessageOnPress     (1L << 0)
0449 #define XkbSA_MessageOnRelease   (1L << 1)
0450 #define XkbSA_MessageGenKeyEvent (1L << 2)
0451 
0452 #define XkbSA_AffectDfltBtn 1
0453 #define XkbSA_DfltBtnAbsolute   (1L << 2)
0454 
0455 #define XkbSA_SwitchApplication (1L << 0)
0456 #define XkbSA_SwitchAbsolute    (1L << 2)
0457 
0458     /*
0459      * The following values apply to the SA_DeviceValuator 
0460      * action only.  Valuator operations specify the action 
0461      * to be taken.   Values specified in the action are 
0462      * multiplied by 2^scale before they are applied.
0463      */
0464 #define XkbSA_IgnoreVal     (0x00)
0465 #define XkbSA_SetValMin     (0x10)
0466 #define XkbSA_SetValCenter  (0x20)
0467 #define XkbSA_SetValMax     (0x30)
0468 #define XkbSA_SetValRelative    (0x40)
0469 #define XkbSA_SetValAbsolute    (0x50)
0470 #define XkbSA_ValOpMask     (0x70)
0471 #define XkbSA_ValScaleMask  (0x07)
0472 #define XkbSA_ValOp(a)      ((a)&XkbSA_ValOpMask)
0473 #define XkbSA_ValScale(a)   ((a)&XkbSA_ValScaleMask)
0474 
0475     /*
0476      * Action types: specifies the type of a key action.  Reported in the
0477      * type field of all key actions.
0478      */
0479 #define XkbSA_NoAction      0x00
0480 #define XkbSA_SetMods       0x01
0481 #define XkbSA_LatchMods     0x02
0482 #define XkbSA_LockMods      0x03
0483 #define XkbSA_SetGroup      0x04
0484 #define XkbSA_LatchGroup    0x05
0485 #define XkbSA_LockGroup     0x06
0486 #define XkbSA_MovePtr       0x07
0487 #define XkbSA_PtrBtn        0x08
0488 #define XkbSA_LockPtrBtn    0x09
0489 #define XkbSA_SetPtrDflt    0x0a
0490 #define XkbSA_ISOLock       0x0b
0491 #define XkbSA_Terminate     0x0c
0492 #define XkbSA_SwitchScreen  0x0d
0493 #define XkbSA_SetControls   0x0e
0494 #define XkbSA_LockControls  0x0f
0495 #define XkbSA_ActionMessage 0x10
0496 #define XkbSA_RedirectKey   0x11
0497 #define XkbSA_DeviceBtn     0x12
0498 #define XkbSA_LockDeviceBtn 0x13
0499 #define XkbSA_DeviceValuator    0x14
0500 #define XkbSA_LastAction    XkbSA_DeviceValuator
0501 #define XkbSA_NumActions    (XkbSA_LastAction+1)
0502 
0503 #define XkbSA_XFree86Private    0x86
0504 
0505     /*
0506      * Specifies the key actions that clear latched groups or modifiers.
0507      */
0508 #define XkbSA_BreakLatch \
0509     ((1<<XkbSA_NoAction)|(1<<XkbSA_PtrBtn)|(1<<XkbSA_LockPtrBtn)|\
0510     (1<<XkbSA_Terminate)|(1<<XkbSA_SwitchScreen)|(1<<XkbSA_SetControls)|\
0511     (1<<XkbSA_LockControls)|(1<<XkbSA_ActionMessage)|\
0512     (1<<XkbSA_RedirectKey)|(1<<XkbSA_DeviceBtn)|(1<<XkbSA_LockDeviceBtn))
0513      
0514     /*
0515      * Macros to classify key actions
0516      */
0517 #define XkbIsModAction(a)   (((a)->type>=Xkb_SASetMods)&&((a)->type<=XkbSA_LockMods))
0518 #define XkbIsGroupAction(a) (((a)->type>=XkbSA_SetGroup)&&((a)->type<=XkbSA_LockGroup))
0519 #define XkbIsPtrAction(a)   (((a)->type>=XkbSA_MovePtr)&&((a)->type<=XkbSA_SetPtrDflt))
0520 
0521 
0522     /*
0523      * Key Behavior Qualifier:
0524      *    KB_Permanent indicates that the behavior describes an unalterable
0525      *    characteristic of the keyboard, not an XKB software-simulation of
0526      *    the listed behavior.
0527      * Key Behavior Types:  
0528      *    Specifies the behavior of the underlying key.
0529      */
0530 #define XkbKB_Permanent     0x80
0531 #define XkbKB_OpMask        0x7f
0532 
0533 #define XkbKB_Default       0x00
0534 #define XkbKB_Lock      0x01
0535 #define XkbKB_RadioGroup    0x02
0536 #define XkbKB_Overlay1      0x03
0537 #define XkbKB_Overlay2      0x04
0538 
0539 #define XkbKB_RGAllowNone   0x80
0540 
0541     /*
0542      * Various macros which describe the range of legal keycodes.
0543      */
0544 #define XkbMinLegalKeyCode  8
0545 #define XkbMaxLegalKeyCode  255
0546 #define XkbMaxKeyCount      (XkbMaxLegalKeyCode-XkbMinLegalKeyCode+1)
0547 #define XkbPerKeyBitArraySize   ((XkbMaxLegalKeyCode+1)/8)
0548 /* Seems kinda silly to check that an unsigned char is <= 255... */
0549 #define XkbIsLegalKeycode(k)    ((k)>=XkbMinLegalKeyCode)
0550 
0551     /*
0552      * Assorted constants and limits.
0553      */
0554 #define XkbNumModifiers     8
0555 #define XkbNumVirtualMods   16
0556 #define XkbNumIndicators    32
0557 #define XkbAllIndicatorsMask    (0xffffffff)
0558 #define XkbMaxRadioGroups   32
0559 #define XkbAllRadioGroupsMask   (0xffffffff)
0560 #define XkbMaxShiftLevel    63
0561 #define XkbMaxSymsPerKey    (XkbMaxShiftLevel*XkbNumKbdGroups)
0562 #define XkbRGMaxMembers     12
0563 #define XkbActionMessageLength  6
0564 #define XkbKeyNameLength    4
0565 #define XkbMaxRedirectCount 8
0566 
0567 #define XkbGeomPtsPerMM     10
0568 #define XkbGeomMaxColors    32
0569 #define XkbGeomMaxLabelColors   3
0570 #define XkbGeomMaxPriority  255
0571 
0572     /*
0573      * Key Type index and mask for the four standard key types.
0574      */
0575 #define XkbOneLevelIndex    0
0576 #define XkbTwoLevelIndex    1
0577 #define XkbAlphabeticIndex  2
0578 #define XkbKeypadIndex      3
0579 #define XkbLastRequiredType XkbKeypadIndex
0580 #define XkbNumRequiredTypes (XkbLastRequiredType+1)
0581 #define XkbMaxKeyTypes      255
0582 
0583 #define XkbOneLevelMask     (1<<0)
0584 #define XkbTwoLevelMask     (1<<1)
0585 #define XkbAlphabeticMask   (1<<2)
0586 #define XkbKeypadMask       (1<<3)
0587 #define XkbAllRequiredTypes (0xf)
0588 
0589 #define XkbShiftLevel(n)    ((n)-1)
0590 #define XkbShiftLevelMask(n)    (1<<((n)-1))
0591 
0592     /*
0593      * Extension name and version information
0594      */
0595 #define XkbName "XKEYBOARD"
0596 #define XkbMajorVersion 1
0597 #define XkbMinorVersion 0
0598 
0599     /*
0600      * Explicit map components:
0601      *  - Used in the 'explicit' field of an XkbServerMap.  Specifies
0602      *    the keyboard components that should _not_ be updated automatically
0603      *    in response to core protocol keyboard mapping requests.
0604      */
0605 #define XkbExplicitKeyTypesMask   (0x0f)
0606 #define XkbExplicitKeyType1Mask   (1<<0)
0607 #define XkbExplicitKeyType2Mask   (1<<1)
0608 #define XkbExplicitKeyType3Mask   (1<<2)
0609 #define XkbExplicitKeyType4Mask   (1<<3)
0610 #define XkbExplicitInterpretMask  (1<<4)
0611 #define XkbExplicitAutoRepeatMask (1<<5)
0612 #define XkbExplicitBehaviorMask   (1<<6)
0613 #define XkbExplicitVModMapMask    (1<<7)
0614 #define XkbAllExplicitMask    (0xff)
0615 
0616     /*
0617      * Map components masks:
0618      * Those in AllMapComponentsMask:
0619      *  - Specifies the individual fields to be loaded or changed for the
0620      *    GetMap and SetMap requests.
0621      * Those in ClientInfoMask:
0622      *  - Specifies the components to be allocated by XkbAllocClientMap.
0623      * Those in ServerInfoMask:
0624      *  - Specifies the components to be allocated by XkbAllocServerMap.
0625      */
0626 #define XkbKeyTypesMask     (1<<0)
0627 #define XkbKeySymsMask      (1<<1)
0628 #define XkbModifierMapMask  (1<<2)
0629 #define XkbExplicitComponentsMask (1<<3)
0630 #define XkbKeyActionsMask   (1<<4)
0631 #define XkbKeyBehaviorsMask (1<<5)
0632 #define XkbVirtualModsMask  (1<<6)
0633 #define XkbVirtualModMapMask    (1<<7)
0634 
0635 #define XkbAllClientInfoMask    (XkbKeyTypesMask|XkbKeySymsMask|XkbModifierMapMask)
0636 #define XkbAllServerInfoMask    (XkbExplicitComponentsMask|XkbKeyActionsMask|XkbKeyBehaviorsMask|XkbVirtualModsMask|XkbVirtualModMapMask)
0637 #define XkbAllMapComponentsMask (XkbAllClientInfoMask|XkbAllServerInfoMask)
0638 
0639     /*
0640      * Symbol interpretations flags:
0641      *  - Used in the flags field of a symbol interpretation
0642      */
0643 #define XkbSI_AutoRepeat    (1<<0)
0644 #define XkbSI_LockingKey    (1<<1)
0645 
0646     /*
0647      * Symbol interpretations match specification:
0648      *  - Used in the match field of a symbol interpretation to specify 
0649      *    the conditions under which an interpretation is used.
0650      */
0651 #define XkbSI_LevelOneOnly  (0x80)
0652 #define XkbSI_OpMask        (0x7f)
0653 #define XkbSI_NoneOf        (0)
0654 #define XkbSI_AnyOfOrNone   (1)
0655 #define XkbSI_AnyOf     (2)
0656 #define XkbSI_AllOf     (3)
0657 #define XkbSI_Exactly       (4)
0658 
0659     /*
0660      * Indicator map flags:
0661      *  - Used in the flags field of an indicator map to indicate the
0662      *    conditions under which and indicator can be changed and the
0663      *    effects of changing the indicator.
0664      */
0665 #define XkbIM_NoExplicit    (1L << 7)
0666 #define XkbIM_NoAutomatic   (1L << 6)
0667 #define XkbIM_LEDDrivesKB   (1L << 5)
0668 
0669     /*
0670      * Indicator map component specifications:
0671      *  - Used by the 'which_groups' and 'which_mods' fields of an indicator
0672      *    map to specify which keyboard components should be used to drive
0673      *    the indicator.
0674      */
0675 #define XkbIM_UseBase       (1L << 0)
0676 #define XkbIM_UseLatched    (1L << 1)
0677 #define XkbIM_UseLocked     (1L << 2)
0678 #define XkbIM_UseEffective  (1L << 3)
0679 #define XkbIM_UseCompat     (1L << 4)
0680 
0681 #define XkbIM_UseNone     0
0682 #define XkbIM_UseAnyGroup (XkbIM_UseBase|XkbIM_UseLatched|XkbIM_UseLocked\
0683                            |XkbIM_UseEffective)
0684 #define XkbIM_UseAnyMods  (XkbIM_UseAnyGroup|XkbIM_UseCompat)
0685 
0686     /*
0687      * Compatibility Map Compontents:
0688      *  - Specifies the components to be allocated in XkbAllocCompatMap.
0689      */
0690 #define XkbSymInterpMask    (1<<0)
0691 #define XkbGroupCompatMask  (1<<1)
0692 #define XkbAllCompatMask    (0x3)
0693 
0694     /*
0695      * Names component mask:
0696      *  - Specifies the names to be loaded or changed for the GetNames and
0697      *    SetNames requests.
0698      *  - Specifies the names that have changed in a NamesNotify event.
0699      *  - Specifies the names components to be allocated by XkbAllocNames.
0700      */
0701 #define XkbKeycodesNameMask (1<<0)
0702 #define XkbGeometryNameMask (1<<1)
0703 #define XkbSymbolsNameMask  (1<<2)
0704 #define XkbPhysSymbolsNameMask  (1<<3)
0705 #define XkbTypesNameMask    (1<<4)
0706 #define XkbCompatNameMask   (1<<5)
0707 #define XkbKeyTypeNamesMask (1<<6)
0708 #define XkbKTLevelNamesMask (1<<7)
0709 #define XkbIndicatorNamesMask   (1<<8)
0710 #define XkbKeyNamesMask     (1<<9)
0711 #define XkbKeyAliasesMask   (1<<10)
0712 #define XkbVirtualModNamesMask  (1<<11)
0713 #define XkbGroupNamesMask   (1<<12)
0714 #define XkbRGNamesMask      (1<<13)
0715 #define XkbComponentNamesMask   (0x3f)
0716 #define XkbAllNamesMask     (0x3fff)
0717 
0718     /*
0719      * GetByName components:
0720      *  - Specifies desired or necessary components to GetKbdByName request.
0721      *  - Reports the components that were found in a GetKbdByNameReply
0722      */
0723 #define XkbGBN_TypesMask        (1L << 0)
0724 #define XkbGBN_CompatMapMask        (1L << 1)
0725 #define XkbGBN_ClientSymbolsMask    (1L << 2)
0726 #define XkbGBN_ServerSymbolsMask    (1L << 3)
0727 #define XkbGBN_SymbolsMask (XkbGBN_ClientSymbolsMask|XkbGBN_ServerSymbolsMask)
0728 #define XkbGBN_IndicatorMapMask     (1L << 4)
0729 #define XkbGBN_KeyNamesMask     (1L << 5)
0730 #define XkbGBN_GeometryMask     (1L << 6)
0731 #define XkbGBN_OtherNamesMask       (1L << 7)
0732 #define XkbGBN_AllComponentsMask    (0xff)
0733 
0734      /*
0735       * ListComponents flags
0736       */
0737 #define XkbLC_Hidden            (1L <<  0)
0738 #define XkbLC_Default           (1L <<  1)
0739 #define XkbLC_Partial           (1L <<  2)
0740 
0741 #define XkbLC_AlphanumericKeys      (1L <<  8)
0742 #define XkbLC_ModifierKeys      (1L <<  9)
0743 #define XkbLC_KeypadKeys        (1L << 10)
0744 #define XkbLC_FunctionKeys      (1L << 11)
0745 #define XkbLC_AlternateGroup        (1L << 12)
0746 
0747     /*
0748      * X Input Extension Interactions
0749      * - Specifies the possible interactions between XKB and the X input
0750      *   extension
0751      * - Used to request (XkbGetDeviceInfo) or change (XKbSetDeviceInfo)
0752      *   XKB information about an extension device.
0753      * - Reports the list of supported optional features in the reply to
0754      *   XkbGetDeviceInfo or in an XkbExtensionDeviceNotify event.
0755      * XkbXI_UnsupportedFeature is reported in XkbExtensionDeviceNotify
0756      * events to indicate an attempt to use an unsupported feature.
0757      */
0758 #define XkbXI_KeyboardsMask     (1L << 0)
0759 #define XkbXI_ButtonActionsMask     (1L << 1)
0760 #define XkbXI_IndicatorNamesMask    (1L << 2)
0761 #define XkbXI_IndicatorMapsMask     (1L << 3)
0762 #define XkbXI_IndicatorStateMask    (1L << 4)
0763 #define XkbXI_UnsupportedFeatureMask    (1L << 15)
0764 #define XkbXI_AllFeaturesMask       (0x001f)
0765 #define XkbXI_AllDeviceFeaturesMask (0x001e)
0766 
0767 #define XkbXI_IndicatorsMask        (0x001c)
0768 #define XkbAllExtensionDeviceEventsMask (0x801f)
0769 
0770     /*
0771      * Per-Client Flags:
0772      *  - Specifies flags to be changed by the PerClientFlags request.
0773      */
0774 #define XkbPCF_DetectableAutoRepeatMask (1L << 0)
0775 #define XkbPCF_GrabsUseXKBStateMask (1L << 1)
0776 #define XkbPCF_AutoResetControlsMask    (1L << 2)
0777 #define XkbPCF_LookupStateWhenGrabbed   (1L << 3)
0778 #define XkbPCF_SendEventUsesXKBState    (1L << 4)
0779 #define XkbPCF_AllFlagsMask     (0x1F)
0780 
0781     /*
0782      * Debugging flags and controls
0783      */
0784 #define XkbDF_DisableLocks  (1<<0)
0785 
0786 #endif /* _XKB_H_ */