home *** CD-ROM | disk | FTP | other *** search
/ Geek Gadgets 1 / ADE-1.bin / ade-bin / x11r6.1 / include / x11 / extensions / xkb.h < prev    next >
Encoding:
C/C++ Source or Header  |  1996-10-17  |  27.5 KB  |  782 lines

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