From 209ae2d4c9cd739e91f8c00184dc6f2f48e21100 Mon Sep 17 00:00:00 2001 From: Kaleb Keithley Date: Fri, 14 Nov 2003 15:54:35 +0000 Subject: R6.6 is the Xorg base-line --- XKB.h | 781 ++++++++++++++++++++++++++++++++++++ XKBgeom.h | 745 +++++++++++++++++++++++++++++++++++ XKBproto.h | 1282 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ XKBsrv.h | 1285 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ XKBstr.h | 614 +++++++++++++++++++++++++++++ 5 files changed, 4707 insertions(+) create mode 100644 XKB.h create mode 100644 XKBgeom.h create mode 100644 XKBproto.h create mode 100644 XKBsrv.h create mode 100644 XKBstr.h diff --git a/XKB.h b/XKB.h new file mode 100644 index 0000000..da7c374 --- /dev/null +++ b/XKB.h @@ -0,0 +1,781 @@ +/* $Xorg: XKB.h,v 1.3 2000/08/18 04:05:45 coskrey Exp $ */ +/************************************************************ +Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc. + +Permission to use, copy, modify, and distribute this +software and its documentation for any purpose and without +fee is hereby granted, provided that the above copyright +notice appear in all copies and that both that copyright +notice and this permission notice appear in supporting +documentation, and that the name of Silicon Graphics not be +used in advertising or publicity pertaining to distribution +of the software without specific prior written permission. +Silicon Graphics makes no representation about the suitability +of this software for any purpose. It is provided "as is" +without any express or implied warranty. + +SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS +SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON +GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL +DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, +DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE +OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH +THE USE OR PERFORMANCE OF THIS SOFTWARE. + +********************************************************/ + +#ifndef _XKB_H_ +#define _XKB_H_ + + /* + * XKB request codes, used in: + * - xkbReqType field of all requests + * - requestMinor field of some events + */ +#define X_kbUseExtension 0 +#define X_kbSelectEvents 1 +#define X_kbBell 3 +#define X_kbGetState 4 +#define X_kbLatchLockState 5 +#define X_kbGetControls 6 +#define X_kbSetControls 7 +#define X_kbGetMap 8 +#define X_kbSetMap 9 +#define X_kbGetCompatMap 10 +#define X_kbSetCompatMap 11 +#define X_kbGetIndicatorState 12 +#define X_kbGetIndicatorMap 13 +#define X_kbSetIndicatorMap 14 +#define X_kbGetNamedIndicator 15 +#define X_kbSetNamedIndicator 16 +#define X_kbGetNames 17 +#define X_kbSetNames 18 +#define X_kbGetGeometry 19 +#define X_kbSetGeometry 20 +#define X_kbPerClientFlags 21 +#define X_kbListComponents 22 +#define X_kbGetKbdByName 23 +#define X_kbGetDeviceInfo 24 +#define X_kbSetDeviceInfo 25 +#define X_kbSetDebuggingFlags 101 + + /* + * In the X sense, XKB reports only one event. + * The type field of all XKB events is XkbEventCode + */ +#define XkbEventCode 0 +#define XkbNumberEvents (XkbEventCode+1) + + /* + * XKB has a minor event code so it can use one X event code for + * multiple purposes. + * - reported in the xkbType field of all XKB events. + * - XkbSelectEventDetails: Indicates the event for which event details + * are being changed + */ +#define XkbNewKeyboardNotify 0 +#define XkbMapNotify 1 +#define XkbStateNotify 2 +#define XkbControlsNotify 3 +#define XkbIndicatorStateNotify 4 +#define XkbIndicatorMapNotify 5 +#define XkbNamesNotify 6 +#define XkbCompatMapNotify 7 +#define XkbBellNotify 8 +#define XkbActionMessage 9 +#define XkbAccessXNotify 10 +#define XkbExtensionDeviceNotify 11 + + /* + * Event Mask: + * - XkbSelectEvents: Specifies event interest. + */ +#define XkbNewKeyboardNotifyMask (1L << 0) +#define XkbMapNotifyMask (1L << 1) +#define XkbStateNotifyMask (1L << 2) +#define XkbControlsNotifyMask (1L << 3) +#define XkbIndicatorStateNotifyMask (1L << 4) +#define XkbIndicatorMapNotifyMask (1L << 5) +#define XkbNamesNotifyMask (1L << 6) +#define XkbCompatMapNotifyMask (1L << 7) +#define XkbBellNotifyMask (1L << 8) +#define XkbActionMessageMask (1L << 9) +#define XkbAccessXNotifyMask (1L << 10) +#define XkbExtensionDeviceNotifyMask (1L << 11) +#define XkbAllEventsMask (0xFFF) + + /* + * NewKeyboardNotify event details: + */ +#define XkbNKN_KeycodesMask (1L << 0) +#define XkbNKN_GeometryMask (1L << 1) +#define XkbNKN_DeviceIDMask (1L << 2) +#define XkbAllNewKeyboardEventsMask (0x7) + + /* + * AccessXNotify event types: + * - The 'what' field of AccessXNotify events reports the + * reason that the event was generated. + */ +#define XkbAXN_SKPress 0 +#define XkbAXN_SKAccept 1 +#define XkbAXN_SKReject 2 +#define XkbAXN_SKRelease 3 +#define XkbAXN_BKAccept 4 +#define XkbAXN_BKReject 5 +#define XkbAXN_AXKWarning 6 + + /* + * AccessXNotify details: + * - Used as an event detail mask to limit the conditions under which + * AccessXNotify events are reported + */ +#define XkbAXN_SKPressMask (1L << 0) +#define XkbAXN_SKAcceptMask (1L << 1) +#define XkbAXN_SKRejectMask (1L << 2) +#define XkbAXN_SKReleaseMask (1L << 3) +#define XkbAXN_BKAcceptMask (1L << 4) +#define XkbAXN_BKRejectMask (1L << 5) +#define XkbAXN_AXKWarningMask (1L << 6) +#define XkbAllAccessXEventsMask (0xf) + + /* + * Miscellaneous event details: + * - event detail masks for assorted events that don't reall + * have any details. + */ +#define XkbAllStateEventsMask XkbAllStateComponentsMask +#define XkbAllMapEventsMask XkbAllMapComponentsMask +#define XkbAllControlEventsMask XkbAllControlsMask +#define XkbAllIndicatorEventsMask XkbAllIndicatorsMask +#define XkbAllNameEventsMask XkbAllNamesMask +#define XkbAllCompatMapEventsMask XkbAllCompatMask +#define XkbAllBellEventsMask (1L << 0) +#define XkbAllActionMessagesMask (1L << 0) + + /* + * XKB reports one error: BadKeyboard + * A further reason for the error is encoded into to most significant + * byte of the resourceID for the error: + * XkbErr_BadDevice - the device in question was not found + * XkbErr_BadClass - the device was found but it doesn't belong to + * the appropriate class. + * XkbErr_BadId - the device was found and belongs to the right + * class, but not feedback with a matching id was + * found. + * The low byte of the resourceID for this error contains the device + * id, class specifier or feedback id that failed. + */ +#define XkbKeyboard 0 +#define XkbNumberErrors 1 + +#define XkbErr_BadDevice 0xff +#define XkbErr_BadClass 0xfe +#define XkbErr_BadId 0xfd + + /* + * Keyboard Components Mask: + * - Specifies the components that follow a GetKeyboardByNameReply + */ +#define XkbClientMapMask (1L << 0) +#define XkbServerMapMask (1L << 1) +#define XkbCompatMapMask (1L << 2) +#define XkbIndicatorMapMask (1L << 3) +#define XkbNamesMask (1L << 4) +#define XkbGeometryMask (1L << 5) +#define XkbControlsMask (1L << 6) +#define XkbAllComponentsMask (0x7f) + + /* + * State detail mask: + * - The 'changed' field of StateNotify events reports which of + * the keyboard state components have changed. + * - Used as an event detail mask to limit the conditions under + * which StateNotify events are reported. + */ +#define XkbModifierStateMask (1L << 0) +#define XkbModifierBaseMask (1L << 1) +#define XkbModifierLatchMask (1L << 2) +#define XkbModifierLockMask (1L << 3) +#define XkbGroupStateMask (1L << 4) +#define XkbGroupBaseMask (1L << 5) +#define XkbGroupLatchMask (1L << 6) +#define XkbGroupLockMask (1L << 7) +#define XkbCompatStateMask (1L << 8) +#define XkbGrabModsMask (1L << 9) +#define XkbCompatGrabModsMask (1L << 10) +#define XkbLookupModsMask (1L << 11) +#define XkbCompatLookupModsMask (1L << 12) +#define XkbPointerButtonMask (1L << 13) +#define XkbAllStateComponentsMask (0x3fff) + + /* + * Controls detail masks: + * The controls specified in XkbAllControlsMask: + * - The 'changed' field of ControlsNotify events reports which of + * the keyboard controls have changed. + * - The 'changeControls' field of the SetControls request specifies + * the controls for which values are to be changed. + * - Used as an event detail mask to limit the conditions under + * which ControlsNotify events are reported. + * + * The controls specified in the XkbAllBooleanCtrlsMask: + * - The 'enabledControls' field of ControlsNotify events reports the + * current status of the boolean controls. + * - The 'enabledControlsChanges' field of ControlsNotify events reports + * any boolean controls that have been turned on or off. + * - The 'affectEnabledControls' and 'enabledControls' fields of the + * kbSetControls request change the set of enabled controls. + * - The 'accessXTimeoutMask' and 'accessXTimeoutValues' fields of + * an XkbControlsRec specify the controls to be changed if the keyboard + * times out and the values to which they should be changed. + * - The 'autoCtrls' and 'autoCtrlsValues' fields of the PerClientFlags + * request specifies the specify the controls to be reset when the + * client exits and the values to which they should be reset. + * - The 'ctrls' field of an indicator map specifies the controls + * that drive the indicator. + * - Specifies the boolean controls affected by the SetControls and + * LockControls key actions. + */ +#define XkbRepeatKeysMask (1L << 0) +#define XkbSlowKeysMask (1L << 1) +#define XkbBounceKeysMask (1L << 2) +#define XkbStickyKeysMask (1L << 3) +#define XkbMouseKeysMask (1L << 4) +#define XkbMouseKeysAccelMask (1L << 5) +#define XkbAccessXKeysMask (1L << 6) +#define XkbAccessXTimeoutMask (1L << 7) +#define XkbAccessXFeedbackMask (1L << 8) +#define XkbAudibleBellMask (1L << 9) +#define XkbOverlay1Mask (1L << 10) +#define XkbOverlay2Mask (1L << 11) +#define XkbIgnoreGroupLockMask (1L << 12) +#define XkbGroupsWrapMask (1L << 27) +#define XkbInternalModsMask (1L << 28) +#define XkbIgnoreLockModsMask (1L << 29) +#define XkbPerKeyRepeatMask (1L << 30) +#define XkbControlsEnabledMask (1L << 31) + +#define XkbAllBooleanCtrlsMask (0x00001FFF) +#define XkbAllControlsMask (0xF8001FFF) +#define XkbAllControlEventsMask XkbAllControlsMask + + /* + * AccessX Options Mask + * - The 'accessXOptions' field of an XkbControlsRec specifies the + * AccessX options that are currently in effect. + * - The 'accessXTimeoutOptionsMask' and 'accessXTimeoutOptionsValues' + * fields of an XkbControlsRec specify the Access X options to be + * changed if the keyboard times out and the values to which they + * should be changed. + */ +#define XkbAX_SKPressFBMask (1L << 0) +#define XkbAX_SKAcceptFBMask (1L << 1) +#define XkbAX_FeatureFBMask (1L << 2) +#define XkbAX_SlowWarnFBMask (1L << 3) +#define XkbAX_IndicatorFBMask (1L << 4) +#define XkbAX_StickyKeysFBMask (1L << 5) +#define XkbAX_TwoKeysMask (1L << 6) +#define XkbAX_LatchToLockMask (1L << 7) +#define XkbAX_SKReleaseFBMask (1L << 8) +#define XkbAX_SKRejectFBMask (1L << 9) +#define XkbAX_BKRejectFBMask (1L << 10) +#define XkbAX_DumbBellFBMask (1L << 11) +#define XkbAX_FBOptionsMask (0xF3F) +#define XkbAX_SKOptionsMask (0x0C0) +#define XkbAX_AllOptionsMask (0xFFF) + + /* + * XkbUseCoreKbd is used to specify the core keyboard without having + * to look up its X input extension identifier. + * XkbUseCorePtr is used to specify the core pointer without having + * to look up its X input extension identifier. + * XkbDfltXIClass is used to specify "don't care" any place that the + * XKB protocol is looking for an X Input Extension + * device class. + * XkbDfltXIId is used to specify "don't care" any place that the + * XKB protocol is looking for an X Input Extension + * feedback identifier. + * XkbAllXIClasses is used to get information about all device indicators, + * whether they're part of the indicator feedback class + * or the keyboard feedback class. + * XkbAllXIIds is used to get information about all device indicator + * feedbacks without having to list them. + * XkbXINone is used to indicate that no class or id has been specified. + * XkbLegalXILedClass(c) True if 'c' specifies a legal class with LEDs + * XkbLegalXIBellClass(c) True if 'c' specifies a legal class with bells + * XkbExplicitXIDevice(d) True if 'd' explicitly specifies a device + * XkbExplicitXIClass(c) True if 'c' explicitly specifies a device class + * XkbExplicitXIId(c) True if 'i' explicitly specifies a device id + * XkbSingleXIClass(c) True if 'c' specifies exactly one device class, + * including the default. + * XkbSingleXIId(i) True if 'i' specifies exactly one device + * identifier, including the default. + */ +#define XkbUseCoreKbd 0x0100 +#define XkbUseCorePtr 0x0200 +#define XkbDfltXIClass 0x0300 +#define XkbDfltXIId 0x0400 +#define XkbAllXIClasses 0x0500 +#define XkbAllXIIds 0x0600 +#define XkbXINone 0xff00 + +#define XkbLegalXILedClass(c) (((c)==KbdFeedbackClass)||\ + ((c)==LedFeedbackClass)||\ + ((c)==XkbDfltXIClass)||\ + ((c)==XkbAllXIClasses)) +#define XkbLegalXIBellClass(c) (((c)==KbdFeedbackClass)||\ + ((c)==BellFeedbackClass)||\ + ((c)==XkbDfltXIClass)||\ + ((c)==XkbAllXIClasses)) +#define XkbExplicitXIDevice(c) (((c)&(~0xff))==0) +#define XkbExplicitXIClass(c) (((c)&(~0xff))==0) +#define XkbExplicitXIId(c) (((c)&(~0xff))==0) +#define XkbSingleXIClass(c) ((((c)&(~0xff))==0)||((c)==XkbDfltXIClass)) +#define XkbSingleXIId(c) ((((c)&(~0xff))==0)||((c)==XkbDfltXIId)) + +#define XkbNoModifier 0xff +#define XkbNoShiftLevel 0xff +#define XkbNoShape 0xff +#define XkbNoIndicator 0xff + +#define XkbNoModifierMask 0 +#define XkbAllModifiersMask 0xff +#define XkbAllVirtualModsMask 0xffff + +#define XkbNumKbdGroups 4 +#define XkbMaxKbdGroup (XkbNumKbdGroups-1) + +#define XkbMaxMouseKeysBtn 4 + + /* + * Group Index and Mask: + * - Indices into the kt_index array of a key type. + * - Mask specifies types to be changed for XkbChangeTypesOfKey + */ +#define XkbGroup1Index 0 +#define XkbGroup2Index 1 +#define XkbGroup3Index 2 +#define XkbGroup4Index 3 +#define XkbAnyGroup 254 +#define XkbAllGroups 255 + +#define XkbGroup1Mask (1<<0) +#define XkbGroup2Mask (1<<1) +#define XkbGroup3Mask (1<<2) +#define XkbGroup4Mask (1<<3) +#define XkbAnyGroupMask (1<<7) +#define XkbAllGroupsMask (0xf) + + /* + * BuildCoreState: Given a keyboard group and a modifier state, + * construct the value to be reported an event. + * GroupForCoreState: Given the state reported in an event, + * determine the keyboard group. + * IsLegalGroup: Returns TRUE if 'g' is a valid group index. + */ +#define XkbBuildCoreState(m,g) ((((g)&0x3)<<13)|((m)&0xff)) +#define XkbGroupForCoreState(s) (((s)>>13)&0x3) +#define XkbIsLegalGroup(g) (((g)>=0)&&((g)type>=Xkb_SASetMods)&&((a)->type<=XkbSA_LockMods)) +#define XkbIsGroupAction(a) (((a)->type>=XkbSA_SetGroup)&&((a)->type<=XkbSA_LockGroup)) +#define XkbIsPtrAction(a) (((a)->type>=XkbSA_MovePtr)&&((a)->type<=XkbSA_SetPtrDflt)) + + + /* + * Key Behavior Qualifier: + * KB_Permanent indicates that the behavior describes an unalterable + * characteristic of the keyboard, not an XKB software-simulation of + * the listed behavior. + * Key Behavior Types: + * Specifies the behavior of the underlying key. + */ +#define XkbKB_Permanent 0x80 +#define XkbKB_OpMask 0x7f + +#define XkbKB_Default 0x00 +#define XkbKB_Lock 0x01 +#define XkbKB_RadioGroup 0x02 +#define XkbKB_Overlay1 0x03 +#define XkbKB_Overlay2 0x04 + +#define XkbKB_RGAllowNone 0x80 + + /* + * Various macros which describe the range of legal keycodes. + */ +#define XkbMinLegalKeyCode 8 +#define XkbMaxLegalKeyCode 255 +#define XkbMaxKeyCount (XkbMaxLegalKeyCode-XkbMinLegalKeyCode+1) +#define XkbPerKeyBitArraySize ((XkbMaxLegalKeyCode+1)/8) +#define XkbIsLegalKeycode(k) (((k)>=XkbMinLegalKeyCode)&&((k)<=XkbMaxLegalKeyCode)) + + /* + * Assorted constants and limits. + */ +#define XkbNumModifiers 8 +#define XkbNumVirtualMods 16 +#define XkbNumIndicators 32 +#define XkbAllIndicatorsMask (0xffffffff) +#define XkbMaxRadioGroups 32 +#define XkbAllRadioGroupsMask (0xffffffff) +#define XkbMaxShiftLevel 63 +#define XkbMaxSymsPerKey (XkbMaxShiftLevel*XkbNumKbdGroups) +#define XkbRGMaxMembers 12 +#define XkbActionMessageLength 6 +#define XkbKeyNameLength 4 +#define XkbMaxRedirectCount 8 + +#define XkbGeomPtsPerMM 10 +#define XkbGeomMaxColors 32 +#define XkbGeomMaxLabelColors 3 +#define XkbGeomMaxPriority 255 + + /* + * Key Type index and mask for the four standard key types. + */ +#define XkbOneLevelIndex 0 +#define XkbTwoLevelIndex 1 +#define XkbAlphabeticIndex 2 +#define XkbKeypadIndex 3 +#define XkbLastRequiredType XkbKeypadIndex +#define XkbNumRequiredTypes (XkbLastRequiredType+1) +#define XkbMaxKeyTypes 255 + +#define XkbOneLevelMask (1<<0) +#define XkbTwoLevelMask (1<<1) +#define XkbAlphabeticMask (1<<2) +#define XkbKeypadMask (1<<3) +#define XkbAllRequiredTypes (0xf) + +#define XkbShiftLevel(n) ((n)-1) +#define XkbShiftLevelMask(n) (1<<((n)-1)) + + /* + * Extension name and version information + */ +#define XkbName "XKEYBOARD" +#define XkbMajorVersion 1 +#define XkbMinorVersion 0 + + /* + * Explicit map components: + * - Used in the 'explicit' field of an XkbServerMap. Specifies + * the keyboard components that should _not_ be updated automatically + * in response to core protocol keyboard mapping requests. + */ +#define XkbExplicitKeyTypesMask (0x0f) +#define XkbExplicitKeyType1Mask (1<<0) +#define XkbExplicitKeyType2Mask (1<<1) +#define XkbExplicitKeyType3Mask (1<<2) +#define XkbExplicitKeyType4Mask (1<<3) +#define XkbExplicitInterpretMask (1<<4) +#define XkbExplicitAutoRepeatMask (1<<5) +#define XkbExplicitBehaviorMask (1<<6) +#define XkbExplicitVModMapMask (1<<7) +#define XkbAllExplicitMask (0xff) + + /* + * Map components masks: + * Those in AllMapComponentsMask: + * - Specifies the individual fields to be loaded or changed for the + * GetMap and SetMap requests. + * Those in ClientInfoMask: + * - Specifies the components to be allocated by XkbAllocClientMap. + * Those in ServerInfoMask: + * - Specifies the components to be allocated by XkbAllocServerMap. + */ +#define XkbKeyTypesMask (1<<0) +#define XkbKeySymsMask (1<<1) +#define XkbModifierMapMask (1<<2) +#define XkbExplicitComponentsMask (1<<3) +#define XkbKeyActionsMask (1<<4) +#define XkbKeyBehaviorsMask (1<<5) +#define XkbVirtualModsMask (1<<6) +#define XkbVirtualModMapMask (1<<7) + +#define XkbAllClientInfoMask (XkbKeyTypesMask|XkbKeySymsMask|XkbModifierMapMask) +#define XkbAllServerInfoMask (XkbExplicitComponentsMask|XkbKeyActionsMask|XkbKeyBehaviorsMask|XkbVirtualModsMask|XkbVirtualModMapMask) +#define XkbAllMapComponentsMask (XkbAllClientInfoMask|XkbAllServerInfoMask) + + /* + * Symbol interpretations flags: + * - Used in the flags field of a symbol interpretation + */ +#define XkbSI_AutoRepeat (1<<0) +#define XkbSI_LockingKey (1<<1) + + /* + * Symbol interpretations match specification: + * - Used in the match field of a symbol interpretation to specify + * the conditions under which an interpretation is used. + */ +#define XkbSI_LevelOneOnly (0x80) +#define XkbSI_OpMask (0x7f) +#define XkbSI_NoneOf (0) +#define XkbSI_AnyOfOrNone (1) +#define XkbSI_AnyOf (2) +#define XkbSI_AllOf (3) +#define XkbSI_Exactly (4) + + /* + * Indicator map flags: + * - Used in the flags field of an indicator map to indicate the + * conditions under which and indicator can be changed and the + * effects of changing the indicator. + */ +#define XkbIM_NoExplicit (1L << 7) +#define XkbIM_NoAutomatic (1L << 6) +#define XkbIM_LEDDrivesKB (1L << 5) + + /* + * Indicator map component specifications: + * - Used by the 'which_groups' and 'which_mods' fields of an indicator + * map to specify which keyboard components should be used to drive + * the indicator. + */ +#define XkbIM_UseBase (1L << 0) +#define XkbIM_UseLatched (1L << 1) +#define XkbIM_UseLocked (1L << 2) +#define XkbIM_UseEffective (1L << 3) +#define XkbIM_UseCompat (1L << 4) + +#define XkbIM_UseNone 0 +#define XkbIM_UseAnyGroup (XkbIM_UseLatched|XkbIM_UseLocked|XkbIM_UseEffective) +#define XkbIM_UseAnyMods (XkbIM_UseAnyGroup|XkbIM_UseCompat|XkbIM_UseBase) + + /* + * Compatibility Map Compontents: + * - Specifies the components to be allocated in XkbAllocCompatMap. + */ +#define XkbSymInterpMask (1<<0) +#define XkbGroupCompatMask (1<<1) +#define XkbAllCompatMask (0x3) + + /* + * Names component mask: + * - Specifies the names to be loaded or changed for the GetNames and + * SetNames requests. + * - Specifies the names that have changed in a NamesNotify event. + * - Specifies the names components to be allocated by XkbAllocNames. + */ +#define XkbKeycodesNameMask (1<<0) +#define XkbGeometryNameMask (1<<1) +#define XkbSymbolsNameMask (1<<2) +#define XkbPhysSymbolsNameMask (1<<3) +#define XkbTypesNameMask (1<<4) +#define XkbCompatNameMask (1<<5) +#define XkbKeyTypeNamesMask (1<<6) +#define XkbKTLevelNamesMask (1<<7) +#define XkbIndicatorNamesMask (1<<8) +#define XkbKeyNamesMask (1<<9) +#define XkbKeyAliasesMask (1<<10) +#define XkbVirtualModNamesMask (1<<11) +#define XkbGroupNamesMask (1<<12) +#define XkbRGNamesMask (1<<13) +#define XkbComponentNamesMask (0x3f) +#define XkbAllNamesMask (0x3fff) + + /* + * GetByName components: + * - Specifies desired or necessary components to GetKbdByName request. + * - Reports the components that were found in a GetKbdByNameReply + */ +#define XkbGBN_TypesMask (1L << 0) +#define XkbGBN_CompatMapMask (1L << 1) +#define XkbGBN_ClientSymbolsMask (1L << 2) +#define XkbGBN_ServerSymbolsMask (1L << 3) +#define XkbGBN_SymbolsMask (XkbGBN_ClientSymbolsMask|XkbGBN_ServerSymbolsMask) +#define XkbGBN_IndicatorMapMask (1L << 4) +#define XkbGBN_KeyNamesMask (1L << 5) +#define XkbGBN_GeometryMask (1L << 6) +#define XkbGBN_OtherNamesMask (1L << 7) +#define XkbGBN_AllComponentsMask (0xff) + + /* + * ListComponents flags + */ +#define XkbLC_Hidden (1L << 0) +#define XkbLC_Default (1L << 1) +#define XkbLC_Partial (1L << 2) + +#define XkbLC_AlphanumericKeys (1L << 8) +#define XkbLC_ModifierKeys (1L << 9) +#define XkbLC_KeypadKeys (1L << 10) +#define XkbLC_FunctionKeys (1L << 11) +#define XkbLC_AlternateGroup (1L << 12) + + /* + * X Input Extension Interactions + * - Specifies the possible interactions between XKB and the X input + * extension + * - Used to request (XkbGetDeviceInfo) or change (XKbSetDeviceInfo) + * XKB information about an extension device. + * - Reports the list of supported optional features in the reply to + * XkbGetDeviceInfo or in an XkbExtensionDeviceNotify event. + * XkbXI_UnsupportedFeature is reported in XkbExtensionDeviceNotify + * events to indicate an attempt to use an unsupported feature. + */ +#define XkbXI_KeyboardsMask (1L << 0) +#define XkbXI_ButtonActionsMask (1L << 1) +#define XkbXI_IndicatorNamesMask (1L << 2) +#define XkbXI_IndicatorMapsMask (1L << 3) +#define XkbXI_IndicatorStateMask (1L << 4) +#define XkbXI_UnsupportedFeatureMask (1L << 15) +#define XkbXI_AllFeaturesMask (0x001f) +#define XkbXI_AllDeviceFeaturesMask (0x001e) + +#define XkbXI_IndicatorsMask (0x001c) +#define XkbAllExtensionDeviceEventsMask (0x801f) + + /* + * Per-Client Flags: + * - Specifies flags to be changed by the PerClientFlags request. + */ +#define XkbPCF_DetectableAutoRepeatMask (1L << 0) +#define XkbPCF_GrabsUseXKBStateMask (1L << 1) +#define XkbPCF_AutoResetControlsMask (1L << 2) +#define XkbPCF_LookupStateWhenGrabbed (1L << 3) +#define XkbPCF_SendEventUsesXKBState (1L << 4) +#define XkbPCF_AllFlagsMask (0x1F) + + /* + * Debugging flags and controls + */ +#define XkbDF_DisableLocks (1<<0) + +#endif /* _XKB_H_ */ diff --git a/XKBgeom.h b/XKBgeom.h new file mode 100644 index 0000000..6538e9e --- /dev/null +++ b/XKBgeom.h @@ -0,0 +1,745 @@ +/* $Xorg: XKBgeom.h,v 1.3 2000/08/18 04:05:45 coskrey Exp $ */ +/************************************************************ +Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc. + +Permission to use, copy, modify, and distribute this +software and its documentation for any purpose and without +fee is hereby granted, provided that the above copyright +notice appear in all copies and that both that copyright +notice and this permission notice appear in supporting +documentation, and that the name of Silicon Graphics not be +used in advertising or publicity pertaining to distribution +of the software without specific prior written permission. +Silicon Graphics makes no representation about the suitability +of this software for any purpose. It is provided "as is" +without any express or implied warranty. + +SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS +SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON +GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL +DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, +DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE +OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH +THE USE OR PERFORMANCE OF THIS SOFTWARE. + +********************************************************/ + +#ifndef _XKBGEOM_H_ +#define _XKBGEOM_H_ + +#ifdef XKB_IN_SERVER +#define XkbAddGeomKeyAlias SrvXkbAddGeomKeyAlias +#define XkbAddGeomColor SrvXkbAddGeomColor +#define XkbAddGeomDoodad SrvXkbAddGeomDoodad +#define XkbAddGeomKey SrvXkbAddGeomKey +#define XkbAddGeomOutline SrvXkbAddGeomOutline +#define XkbAddGeomOverlay SrvXkbAddGeomOverlay +#define XkbAddGeomOverlayRow SrvXkbAddGeomOverlayRow +#define XkbAddGeomOverlayKey SrvXkbAddGeomOverlayKey +#define XkbAddGeomProperty SrvXkbAddGeomProperty +#define XkbAddGeomRow SrvXkbAddGeomRow +#define XkbAddGeomSection SrvXkbAddGeomSection +#define XkbAddGeomShape SrvXkbAddGeomShape +#define XkbAllocGeomKeyAliases SrvXkbAllocGeomKeyAliases +#define XkbAllocGeomColors SrvXkbAllocGeomColors +#define XkbAllocGeomDoodads SrvXkbAllocGeomDoodads +#define XkbAllocGeomKeys SrvXkbAllocGeomKeys +#define XkbAllocGeomOutlines SrvXkbAllocGeomOutlines +#define XkbAllocGeomPoints SrvXkbAllocGeomPoints +#define XkbAllocGeomProps SrvXkbAllocGeomProps +#define XkbAllocGeomRows SrvXkbAllocGeomRows +#define XkbAllocGeomSectionDoodads SrvXkbAllocGeomSectionDoodads +#define XkbAllocGeomSections SrvXkbAllocGeomSections +#define XkbAllocGeomOverlays SrvXkbAllocGeomOverlays +#define XkbAllocGeomOverlayRows SrvXkbAllocGeomOverlayRows +#define XkbAllocGeomOverlayKeys SrvXkbAllocGeomOverlayKeys +#define XkbAllocGeomShapes SrvXkbAllocGeomShapes +#define XkbAllocGeometry SrvXkbAllocGeometry +#define XkbFreeGeomKeyAliases SrvXkbFreeGeomKeyAliases +#define XkbFreeGeomColors SrvXkbFreeGeomColors +#define XkbFreeGeomDoodads SrvXkbFreeGeomDoodads +#define XkbFreeGeomProperties SrvXkbFreeGeomProperties +#define XkbFreeGeomOverlayKeys SrvXkbFreeGeomOverlayKeys +#define XkbFreeGeomOverlayRows SrvXkbFreeGeomOverlayRows +#define XkbFreeGeomOverlays SrvXkbFreeGeomOverlays +#define XkbFreeGeomKeys SrvXKbFreeGeomKeys +#define XkbFreeGeomRows SrvXKbFreeGeomRows +#define XkbFreeGeomSections SrvXkbFreeGeomSections +#define XkbFreeGeomPoints SrvXkbFreeGeomPoints +#define XkbFreeGeomOutlines SrvXkbFreeGeomOutlines +#define XkbFreeGeomShapes SrvXkbFreeGeomShapes +#define XkbFreeGeometry SrvXkbFreeGeometry +#endif + +typedef struct _XkbProperty { + char *name; + char *value; +} XkbPropertyRec,*XkbPropertyPtr; + +typedef struct _XkbColor { + unsigned int pixel; + char * spec; +} XkbColorRec,*XkbColorPtr; + +typedef struct _XkbPoint { + short x; + short y; +} XkbPointRec, *XkbPointPtr; + +typedef struct _XkbBounds { + short x1,y1; + short x2,y2; +} XkbBoundsRec, *XkbBoundsPtr; +#define XkbBoundsWidth(b) (((b)->x2)-((b)->x1)) +#define XkbBoundsHeight(b) (((b)->y2)-((b)->y1)) + +typedef struct _XkbOutline { + unsigned short num_points; + unsigned short sz_points; + unsigned short corner_radius; + XkbPointPtr points; +} XkbOutlineRec, *XkbOutlinePtr; + +typedef struct _XkbShape { + Atom name; + unsigned short num_outlines; + unsigned short sz_outlines; + XkbOutlinePtr outlines; + XkbOutlinePtr approx; + XkbOutlinePtr primary; + XkbBoundsRec bounds; +} XkbShapeRec, *XkbShapePtr; +#define XkbOutlineIndex(s,o) ((o)-&(s)->outlines[0]) + +typedef struct _XkbShapeDoodad { + Atom name; + unsigned char type; + unsigned char priority; + short top; + short left; + short angle; + unsigned short color_ndx; + unsigned short shape_ndx; +} XkbShapeDoodadRec, *XkbShapeDoodadPtr; +#define XkbShapeDoodadColor(g,d) (&(g)->colors[(d)->color_ndx]) +#define XkbShapeDoodadShape(g,d) (&(g)->shapes[(d)->shape_ndx]) +#define XkbSetShapeDoodadColor(g,d,c) ((d)->color_ndx= (c)-&(g)->colors[0]) +#define XkbSetShapeDoodadShape(g,d,s) ((d)->shape_ndx= (s)-&(g)->shapes[0]) + +typedef struct _XkbTextDoodad { + Atom name; + unsigned char type; + unsigned char priority; + short top; + short left; + short angle; + short width; + short height; + unsigned short color_ndx; + char * text; + char * font; +} XkbTextDoodadRec, *XkbTextDoodadPtr; +#define XkbTextDoodadColor(g,d) (&(g)->colors[(d)->color_ndx]) +#define XkbSetTextDoodadColor(g,d,c) ((d)->color_ndx= (c)-&(g)->colors[0]) + +typedef struct _XkbIndicatorDoodad { + Atom name; + unsigned char type; + unsigned char priority; + short top; + short left; + short angle; + unsigned short shape_ndx; + unsigned short on_color_ndx; + unsigned short off_color_ndx; +} XkbIndicatorDoodadRec, *XkbIndicatorDoodadPtr; +#define XkbIndicatorDoodadShape(g,d) (&(g)->shapes[(d)->shape_ndx]) +#define XkbIndicatorDoodadOnColor(g,d) (&(g)->colors[(d)->on_color_ndx]) +#define XkbIndicatorDoodadOffColor(g,d) (&(g)->colors[(d)->off_color_ndx]) +#define XkbSetIndicatorDoodadOnColor(g,d,c) \ + ((d)->on_color_ndx= (c)-&(g)->colors[0]) +#define XkbSetIndicatorDoodadOffColor(g,d,c) \ + ((d)->off_color_ndx= (c)-&(g)->colors[0]) +#define XkbSetIndicatorDoodadShape(g,d,s) \ + ((d)->shape_ndx= (s)-&(g)->shapes[0]) + +typedef struct _XkbLogoDoodad { + Atom name; + unsigned char type; + unsigned char priority; + short top; + short left; + short angle; + unsigned short color_ndx; + unsigned short shape_ndx; + char * logo_name; +} XkbLogoDoodadRec, *XkbLogoDoodadPtr; +#define XkbLogoDoodadColor(g,d) (&(g)->colors[(d)->color_ndx]) +#define XkbLogoDoodadShape(g,d) (&(g)->shapes[(d)->shape_ndx]) +#define XkbSetLogoDoodadColor(g,d,c) ((d)->color_ndx= (c)-&(g)->colors[0]) +#define XkbSetLogoDoodadShape(g,d,s) ((d)->shape_ndx= (s)-&(g)->shapes[0]) + +typedef struct _XkbAnyDoodad { + Atom name; + unsigned char type; + unsigned char priority; + short top; + short left; + short angle; +} XkbAnyDoodadRec, *XkbAnyDoodadPtr; + +typedef union _XkbDoodad { + XkbAnyDoodadRec any; + XkbShapeDoodadRec shape; + XkbTextDoodadRec text; + XkbIndicatorDoodadRec indicator; + XkbLogoDoodadRec logo; +} XkbDoodadRec, *XkbDoodadPtr; + +#define XkbUnknownDoodad 0 +#define XkbOutlineDoodad 1 +#define XkbSolidDoodad 2 +#define XkbTextDoodad 3 +#define XkbIndicatorDoodad 4 +#define XkbLogoDoodad 5 + +typedef struct _XkbKey { + XkbKeyNameRec name; + short gap; + unsigned char shape_ndx; + unsigned char color_ndx; +} XkbKeyRec, *XkbKeyPtr; +#define XkbKeyShape(g,k) (&(g)->shapes[(k)->shape_ndx]) +#define XkbKeyColor(g,k) (&(g)->colors[(k)->color_ndx]) +#define XkbSetKeyShape(g,k,s) ((k)->shape_ndx= (s)-&(g)->shapes[0]) +#define XkbSetKeyColor(g,k,c) ((k)->color_ndx= (c)-&(g)->colors[0]) + +typedef struct _XkbRow { + short top; + short left; + unsigned short num_keys; + unsigned short sz_keys; + int vertical; + XkbKeyPtr keys; + XkbBoundsRec bounds; +} XkbRowRec, *XkbRowPtr; + +typedef struct _XkbSection { + Atom name; + unsigned char priority; + short top; + short left; + unsigned short width; + unsigned short height; + short angle; + unsigned short num_rows; + unsigned short num_doodads; + unsigned short num_overlays; + unsigned short sz_rows; + unsigned short sz_doodads; + unsigned short sz_overlays; + XkbRowPtr rows; + XkbDoodadPtr doodads; + XkbBoundsRec bounds; + struct _XkbOverlay *overlays; +} XkbSectionRec, *XkbSectionPtr; + +typedef struct _XkbOverlayKey { + XkbKeyNameRec over; + XkbKeyNameRec under; +} XkbOverlayKeyRec,*XkbOverlayKeyPtr; + +typedef struct _XkbOverlayRow { + unsigned short row_under; + unsigned short num_keys; + unsigned short sz_keys; + XkbOverlayKeyPtr keys; +} XkbOverlayRowRec,*XkbOverlayRowPtr; + +typedef struct _XkbOverlay { + Atom name; + XkbSectionPtr section_under; + unsigned short num_rows; + unsigned short sz_rows; + XkbOverlayRowPtr rows; + XkbBoundsPtr bounds; +} XkbOverlayRec,*XkbOverlayPtr; + +typedef struct _XkbGeometry { + Atom name; + unsigned short width_mm; + unsigned short height_mm; + char * label_font; + XkbColorPtr label_color; + XkbColorPtr base_color; + unsigned short sz_properties; + unsigned short sz_colors; + unsigned short sz_shapes; + unsigned short sz_sections; + unsigned short sz_doodads; + unsigned short sz_key_aliases; + unsigned short num_properties; + unsigned short num_colors; + unsigned short num_shapes; + unsigned short num_sections; + unsigned short num_doodads; + unsigned short num_key_aliases; + XkbPropertyPtr properties; + XkbColorPtr colors; + XkbShapePtr shapes; + XkbSectionPtr sections; + XkbDoodadPtr doodads; + XkbKeyAliasPtr key_aliases; +} XkbGeometryRec; +#define XkbGeomColorIndex(g,c) ((c)-&(g)->colors[0]) + +#define XkbGeomPropertiesMask (1<<0) +#define XkbGeomColorsMask (1<<1) +#define XkbGeomShapesMask (1<<2) +#define XkbGeomSectionsMask (1<<3) +#define XkbGeomDoodadsMask (1<<4) +#define XkbGeomKeyAliasesMask (1<<5) +#define XkbGeomAllMask (0x3f) + +typedef struct _XkbGeometrySizes { + unsigned int which; + unsigned short num_properties; + unsigned short num_colors; + unsigned short num_shapes; + unsigned short num_sections; + unsigned short num_doodads; + unsigned short num_key_aliases; +} XkbGeometrySizesRec,*XkbGeometrySizesPtr; + +_XFUNCPROTOBEGIN + +extern XkbPropertyPtr +XkbAddGeomProperty( +#if NeedFunctionPrototypes + XkbGeometryPtr /* geom */, + char * /* name */, + char * /* value */ +#endif +); + +extern XkbKeyAliasPtr +XkbAddGeomKeyAlias( +#if NeedFunctionPrototypes + XkbGeometryPtr /* geom */, + char * /* alias */, + char * /* real */ +#endif +); + +extern XkbColorPtr +XkbAddGeomColor( +#if NeedFunctionPrototypes + XkbGeometryPtr /* geom */, + char * /* spec */, + unsigned int /* pixel */ +#endif +); + +extern XkbOutlinePtr +XkbAddGeomOutline( +#if NeedFunctionPrototypes + XkbShapePtr /* shape */, + int /* sz_points */ +#endif +); + +extern XkbShapePtr +XkbAddGeomShape( +#if NeedFunctionPrototypes + XkbGeometryPtr /* geom */, + Atom /* name */, + int /* sz_outlines */ +#endif +); + +extern XkbKeyPtr +XkbAddGeomKey( +#if NeedFunctionPrototypes + XkbRowPtr /* row */ +#endif +); + +extern XkbRowPtr +XkbAddGeomRow( +#if NeedFunctionPrototypes + XkbSectionPtr /* section */, + int /* sz_keys */ +#endif +); + +extern XkbSectionPtr +XkbAddGeomSection( +#if NeedFunctionPrototypes + XkbGeometryPtr /* geom */, + Atom /* name */, + int /* sz_rows */, + int /* sz_doodads */, + int /* sz_overlays */ +#endif +); + +extern XkbOverlayPtr +XkbAddGeomOverlay( +#if NeedFunctionPrototypes + XkbSectionPtr /* section */, + Atom /* name */, + int /* sz_rows */ +#endif +); + +extern XkbOverlayRowPtr +XkbAddGeomOverlayRow( +#if NeedFunctionPrototypes + XkbOverlayPtr /* overlay */, + int /* row_under */, + int /* sz_keys */ +#endif +); + +extern XkbOverlayKeyPtr +XkbAddGeomOverlayKey( +#if NeedFunctionPrototypes + XkbOverlayPtr /* overlay */, + XkbOverlayRowPtr /* row */, + char * /* over */, + char * /* under */ +#endif +); + +extern XkbDoodadPtr +XkbAddGeomDoodad( +#if NeedFunctionPrototypes + XkbGeometryPtr /* geom */, + XkbSectionPtr /* section */, + Atom /* name */ +#endif +); + + +extern void +XkbFreeGeomKeyAliases( +#if NeedFunctionPrototypes + XkbGeometryPtr /* geom */, + int /* first */, + int /* count */, + Bool /* freeAll */ +#endif +); + +extern void +XkbFreeGeomColors( +#if NeedFunctionPrototypes + XkbGeometryPtr /* geom */, + int /* first */, + int /* count */, + Bool /* freeAll */ +#endif +); + +extern void +XkbFreeGeomDoodads( +#if NeedFunctionPrototypes + XkbDoodadPtr /* doodads */, + int /* nDoodads */, + Bool /* freeAll */ +#endif +); + + +extern void +XkbFreeGeomProperties( +#if NeedFunctionPrototypes + XkbGeometryPtr /* geom */, + int /* first */, + int /* count */, + Bool /* freeAll */ +#endif +); + +extern void +XkbFreeGeomOverlayKeys( +#if NeedFunctionPrototypes + XkbOverlayRowPtr /* row */, + int /* first */, + int /* count */, + Bool /* freeAll */ +#endif +); + +extern void +XkbFreeGeomOverlayRows( +#if NeedFunctionPrototypes + XkbOverlayPtr /* overlay */, + int /* first */, + int /* count */, + Bool /* freeAll */ +#endif +); + +extern void +XkbFreeGeomOverlays( +#if NeedFunctionPrototypes + XkbSectionPtr /* section */, + int /* first */, + int /* count */, + Bool /* freeAll */ +#endif +); + +extern void +XkbFreeGeomKeys( +#if NeedFunctionPrototypes + XkbRowPtr /* row */, + int /* first */, + int /* count */, + Bool /* freeAll */ +#endif +); + +extern void +XkbFreeGeomRows( +#if NeedFunctionPrototypes + XkbSectionPtr /* section */, + int /* first */, + int /* count */, + Bool /* freeAll */ +#endif +); + +extern void +XkbFreeGeomSections( +#if NeedFunctionPrototypes + XkbGeometryPtr /* geom */, + int /* first */, + int /* count */, + Bool /* freeAll */ +#endif +); + + +extern void +XkbFreeGeomPoints( +#if NeedFunctionPrototypes + XkbOutlinePtr /* outline */, + int /* first */, + int /* count */, + Bool /* freeAll */ +#endif +); + +extern void +XkbFreeGeomOutlines( +#if NeedFunctionPrototypes + XkbShapePtr /* shape */, + int /* first */, + int /* count */, + Bool /* freeAll */ +#endif +); + +extern void +XkbFreeGeomShapes( +#if NeedFunctionPrototypes + XkbGeometryPtr /* geom */, + int /* first */, + int /* count */, + Bool /* freeAll */ +#endif +); + +extern void +XkbFreeGeometry( +#if NeedFunctionPrototypes + XkbGeometryPtr /* geom */, + unsigned int /* which */, + Bool /* freeMap */ +#endif +); + +extern Status +XkbAllocGeomProps( +#if NeedFunctionPrototypes + XkbGeometryPtr /* geom */, + int /* nProps */ +#endif +); + +extern Status +XkbAllocGeomKeyAliases( +#if NeedFunctionPrototypes + XkbGeometryPtr /* geom */, + int /* nAliases */ +#endif +); + +extern Status +XkbAllocGeomColors( +#if NeedFunctionPrototypes + XkbGeometryPtr /* geom */, + int /* nColors */ +#endif +); + +extern Status +XkbAllocGeomShapes( +#if NeedFunctionPrototypes + XkbGeometryPtr /* geom */, + int /* nShapes */ +#endif +); + +extern Status +XkbAllocGeomSections( +#if NeedFunctionPrototypes + XkbGeometryPtr /* geom */, + int /* nSections */ +#endif +); + +extern Status +XkbAllocGeomOverlays( +#if NeedFunctionPrototypes + XkbSectionPtr /* section */, + int /* num_needed */ +#endif +); + +extern Status +XkbAllocGeomOverlayRows( +#if NeedFunctionPrototypes + XkbOverlayPtr /* overlay */, + int /* num_needed */ +#endif +); + +extern Status +XkbAllocGeomOverlayKeys( +#if NeedFunctionPrototypes + XkbOverlayRowPtr /* row */, + int /* num_needed */ +#endif +); + +extern Status +XkbAllocGeomDoodads( +#if NeedFunctionPrototypes + XkbGeometryPtr /* geom */, + int /* nDoodads */ +#endif +); + +extern Status +XkbAllocGeomSectionDoodads( +#if NeedFunctionPrototypes + XkbSectionPtr /* section */, + int /* nDoodads */ +#endif +); + +extern Status +XkbAllocGeomOutlines( +#if NeedFunctionPrototypes + XkbShapePtr /* shape */, + int /* nOL */ +#endif +); + +extern Status +XkbAllocGeomRows( +#if NeedFunctionPrototypes + XkbSectionPtr /* section */, + int /* nRows */ +#endif +); + +extern Status +XkbAllocGeomPoints( +#if NeedFunctionPrototypes + XkbOutlinePtr /* ol */, + int /* nPts */ +#endif +); + +extern Status +XkbAllocGeomKeys( +#if NeedFunctionPrototypes + XkbRowPtr /* row */, + int /* nKeys */ +#endif +); + +extern Status +XkbAllocGeometry( +#if NeedFunctionPrototypes + XkbDescPtr /* xkb */, + XkbGeometrySizesPtr /* sizes */ +#endif +); + +extern Bool +XkbComputeShapeTop( +#if NeedFunctionPrototypes + XkbShapePtr /* shape */, + XkbBoundsPtr /* bounds */ +#endif +); + +extern Bool +XkbComputeShapeBounds( +#if NeedFunctionPrototypes + XkbShapePtr /* shape */ +#endif +); + +extern Bool +XkbComputeRowBounds( +#if NeedFunctionPrototypes + XkbGeometryPtr /* geom */, + XkbSectionPtr /* section */, + XkbRowPtr /* row */ +#endif +); + +extern Bool +XkbComputeSectionBounds( +#if NeedFunctionPrototypes + XkbGeometryPtr /* geom */, + XkbSectionPtr /* section */ +#endif +); + +extern char * +XkbFindOverlayForKey( +#if NeedFunctionPrototypes + XkbGeometryPtr /* geom */, + XkbSectionPtr /* wanted */, + char * /* under */ +#endif +); + +extern Status +XkbGetGeometry( +#if NeedFunctionPrototypes + Display * /* dpy */, + XkbDescPtr /* xkb */ +#endif +); + +extern Status +XkbGetNamedGeometry( +#if NeedFunctionPrototypes + Display * /* dpy */, + XkbDescPtr /* xkb */, + Atom /* name */ +#endif +); + +_XFUNCPROTOEND + +#endif /* _XKBSTR_H_ */ diff --git a/XKBproto.h b/XKBproto.h new file mode 100644 index 0000000..97dd4d2 --- /dev/null +++ b/XKBproto.h @@ -0,0 +1,1282 @@ +/* $Xorg: XKBproto.h,v 1.3 2000/08/18 04:05:45 coskrey Exp $ */ +/************************************************************ +Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc. + +Permission to use, copy, modify, and distribute this +software and its documentation for any purpose and without +fee is hereby granted, provided that the above copyright +notice appear in all copies and that both that copyright +notice and this permission notice appear in supporting +documentation, and that the name of Silicon Graphics not be +used in advertising or publicity pertaining to distribution +of the software without specific prior written permission. +Silicon Graphics makes no representation about the suitability +of this software for any purpose. It is provided "as is" +without any express or implied warranty. + +SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS +SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON +GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL +DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, +DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE +OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH +THE USE OR PERFORMANCE OF THIS SOFTWARE. + +********************************************************/ + +#ifndef _XKBPROTO_H_ +#define _XKBPROTO_H_ + +#include +#include + +#define Window CARD32 +#define Atom CARD32 +#define Time CARD32 +#define KeyCode CARD8 +#define KeySym CARD32 + +#define XkbPaddedSize(n) ((((unsigned int)(n)+3) >> 2) << 2) + +typedef struct _xkbUseExtension { + CARD8 reqType; + CARD8 xkbReqType; /* always X_KBUseExtension */ + CARD16 length B16; + CARD16 wantedMajor B16; + CARD16 wantedMinor B16; +} xkbUseExtensionReq; +#define sz_xkbUseExtensionReq 8 + +typedef struct _xkbUseExtensionReply { + BYTE type; /* X_Reply */ + BOOL supported; + CARD16 sequenceNumber B16; + CARD32 length B32; + CARD16 serverMajor B16; + CARD16 serverMinor B16; + CARD32 pad1 B32; + CARD32 pad2 B32; + CARD32 pad3 B32; + CARD32 pad4 B32; + CARD32 pad5 B32; +} xkbUseExtensionReply; +#define sz_xkbUseExtensionReply 32 + +typedef struct _xkbSelectEvents { + CARD8 reqType; + CARD8 xkbReqType; /* X_KBSelectEvents */ + CARD16 length B16; + CARD16 deviceSpec B16; + CARD16 affectWhich B16; + CARD16 clear B16; + CARD16 selectAll B16; + CARD16 affectMap B16; + CARD16 map B16; +} xkbSelectEventsReq; +#define sz_xkbSelectEventsReq 16 + +typedef struct _xkbBell { + CARD8 reqType; + CARD8 xkbReqType; /* X_KBBell */ + CARD16 length B16; + CARD16 deviceSpec B16; + CARD16 bellClass B16; + CARD16 bellID B16; + INT8 percent; + BOOL forceSound; + BOOL eventOnly; + CARD8 pad1; + INT16 pitch B16; + INT16 duration B16; + CARD16 pad2 B16; + Atom name B32; + Window window B32; +} xkbBellReq; +#define sz_xkbBellReq 28 + +typedef struct _xkbGetState { + CARD8 reqType; + CARD8 xkbReqType; /* always X_KBGetState */ + CARD16 length B16; + CARD16 deviceSpec B16; + CARD16 pad B16; +} xkbGetStateReq; +#define sz_xkbGetStateReq 8 + +typedef struct _xkbGetStateReply { + BYTE type; + BYTE deviceID; + CARD16 sequenceNumber B16; + CARD32 length B32; + CARD8 mods; + CARD8 baseMods; + CARD8 latchedMods; + CARD8 lockedMods; + CARD8 group; + CARD8 lockedGroup; + INT16 baseGroup B16; + INT16 latchedGroup B16; + CARD8 compatState; + CARD8 grabMods; + CARD8 compatGrabMods; + CARD8 lookupMods; + CARD8 compatLookupMods; + CARD8 pad1; + CARD16 ptrBtnState B16; + CARD16 pad2 B16; + CARD32 pad3 B32; +} xkbGetStateReply; +#define sz_xkbGetStateReply 32 + +typedef struct _xkbLatchLockState { + CARD8 reqType; + CARD8 xkbReqType; /* always X_KBLatchLockState */ + CARD16 length B16; + CARD16 deviceSpec B16; + CARD8 affectModLocks; + CARD8 modLocks; + BOOL lockGroup; + CARD8 groupLock; + CARD8 affectModLatches; + CARD8 modLatches; + CARD8 pad; + BOOL latchGroup; + INT16 groupLatch B16; +} xkbLatchLockStateReq; +#define sz_xkbLatchLockStateReq 16 + +typedef struct _xkbGetControls { + CARD8 reqType; + CARD8 xkbReqType; /* always X_KBGetControls */ + CARD16 length B16; + CARD16 deviceSpec B16; + CARD16 pad B16; +} xkbGetControlsReq; +#define sz_xkbGetControlsReq 8 + +typedef struct _xkbGetControlsReply { + BYTE type; /* X_Reply */ + CARD8 deviceID; + CARD16 sequenceNumber B16; + CARD32 length B32; + CARD8 mkDfltBtn; + CARD8 numGroups; + CARD8 groupsWrap; + CARD8 internalMods; + CARD8 ignoreLockMods; + CARD8 internalRealMods; + CARD8 ignoreLockRealMods; + CARD8 pad1; + CARD16 internalVMods B16; + CARD16 ignoreLockVMods B16; + CARD16 repeatDelay B16; + CARD16 repeatInterval B16; + CARD16 slowKeysDelay B16; + CARD16 debounceDelay B16; + CARD16 mkDelay B16; + CARD16 mkInterval B16; + CARD16 mkTimeToMax B16; + CARD16 mkMaxSpeed B16; + INT16 mkCurve B16; + CARD16 axOptions B16; + CARD16 axTimeout B16; + CARD16 axtOptsMask B16; + CARD16 axtOptsValues B16; + CARD16 pad2 B16; + CARD32 axtCtrlsMask B32; + CARD32 axtCtrlsValues B32; + CARD32 enabledCtrls B32; + BYTE perKeyRepeat[XkbPerKeyBitArraySize]; +} xkbGetControlsReply; +#define sz_xkbGetControlsReply 92 + +typedef struct _xkbSetControls { + CARD8 reqType; + CARD8 xkbReqType; /* always X_KBSetControls */ + CARD16 length B16; + CARD16 deviceSpec B16; + CARD8 affectInternalMods; + CARD8 internalMods; + CARD8 affectIgnoreLockMods; + CARD8 ignoreLockMods; + CARD16 affectInternalVMods B16; + CARD16 internalVMods B16; + CARD16 affectIgnoreLockVMods B16; + CARD16 ignoreLockVMods B16; + CARD8 mkDfltBtn; + CARD8 groupsWrap; + CARD16 axOptions B16; + CARD16 pad1 B16; + CARD32 affectEnabledCtrls B32; + CARD32 enabledCtrls B32; + CARD32 changeCtrls B32; + CARD16 repeatDelay B16; + CARD16 repeatInterval B16; + CARD16 slowKeysDelay B16; + CARD16 debounceDelay B16; + CARD16 mkDelay B16; + CARD16 mkInterval B16; + CARD16 mkTimeToMax B16; + CARD16 mkMaxSpeed B16; + INT16 mkCurve B16; + CARD16 axTimeout B16; + CARD32 axtCtrlsMask B32; + CARD32 axtCtrlsValues B32; + CARD16 axtOptsMask B16; + CARD16 axtOptsValues B16; + BYTE perKeyRepeat[XkbPerKeyBitArraySize]; +} xkbSetControlsReq; +#define sz_xkbSetControlsReq 100 + +typedef struct _xkbKTMapEntryWireDesc { + BOOL active; + CARD8 mask; + CARD8 level; + CARD8 realMods; + CARD16 virtualMods B16; + CARD16 pad B16; +} xkbKTMapEntryWireDesc; +#define sz_xkbKTMapEntryWireDesc 8 + +typedef struct _xkbKTSetMapEntryWireDesc { + CARD8 level; + CARD8 realMods; + CARD16 virtualMods B16; +} xkbKTSetMapEntryWireDesc; +#define sz_xkbKTSetMapEntryWireDesc 4 + +typedef struct _xkbModsWireDesc { + CARD8 mask; /* GetMap only */ + CARD8 realMods; + CARD16 virtualMods B16; +} xkbModsWireDesc; +#define sz_xkbModsWireDesc 4 + +typedef struct _xkbKeyTypeWireDesc { + CARD8 mask; + CARD8 realMods; + CARD16 virtualMods B16; + CARD8 numLevels; + CARD8 nMapEntries; + BOOL preserve; + CARD8 pad; +} xkbKeyTypeWireDesc; +#define sz_xkbKeyTypeWireDesc 8 + +typedef struct _xkbSymMapWireDesc { + CARD8 ktIndex[XkbNumKbdGroups]; + CARD8 groupInfo; + CARD8 width; + CARD16 nSyms B16; +} xkbSymMapWireDesc; +#define sz_xkbSymMapWireDesc 8 + +typedef struct _xkbVModMapWireDesc { + KeyCode key; + CARD8 pad; + CARD16 vmods B16; +} xkbVModMapWireDesc; +#define sz_xkbVModMapWireDesc 4 + +typedef struct _xkbBehaviorWireDesc { + CARD8 key; + CARD8 type; + CARD8 data; + CARD8 pad; +} xkbBehaviorWireDesc; +#define sz_xkbBehaviorWireDesc 4 + +typedef struct _xkbActionWireDesc { + CARD8 type; + CARD8 data[7]; +} xkbActionWireDesc; +#define sz_xkbActionWireDesc 8 + +typedef struct _xkbGetMap { + CARD8 reqType; + CARD8 xkbReqType; /* always X_KBGetMap */ + CARD16 length B16; + CARD16 deviceSpec B16; + CARD16 full B16; + CARD16 partial B16; + CARD8 firstType; + CARD8 nTypes; + KeyCode firstKeySym; + CARD8 nKeySyms; + KeyCode firstKeyAct; + CARD8 nKeyActs; + KeyCode firstKeyBehavior; + CARD8 nKeyBehaviors; + CARD16 virtualMods B16; + KeyCode firstKeyExplicit; + CARD8 nKeyExplicit; + KeyCode firstModMapKey; + CARD8 nModMapKeys; + KeyCode firstVModMapKey; + CARD8 nVModMapKeys; + CARD16 pad1 B16; +} xkbGetMapReq; +#define sz_xkbGetMapReq 28 + +typedef struct _xkbGetMapReply { + CARD8 type; /* always X_Reply */ + CARD8 deviceID; + CARD16 sequenceNumber B16; + CARD32 length B32; + CARD16 pad1 B16; + KeyCode minKeyCode; + KeyCode maxKeyCode; + CARD16 present B16; + CARD8 firstType; + CARD8 nTypes; + CARD8 totalTypes; + KeyCode firstKeySym; + CARD16 totalSyms B16; + CARD8 nKeySyms; + KeyCode firstKeyAct; + CARD16 totalActs B16; + CARD8 nKeyActs; + KeyCode firstKeyBehavior; + CARD8 nKeyBehaviors; + CARD8 totalKeyBehaviors; + KeyCode firstKeyExplicit; + CARD8 nKeyExplicit; + CARD8 totalKeyExplicit; + KeyCode firstModMapKey; + CARD8 nModMapKeys; + CARD8 totalModMapKeys; + KeyCode firstVModMapKey; + CARD8 nVModMapKeys; + CARD8 totalVModMapKeys; + CARD8 pad2; + CARD16 virtualMods B16; +} xkbGetMapReply; +#define sz_xkbGetMapReply 40 + +#define XkbSetMapResizeTypes (1L<<0) +#define XkbSetMapRecomputeActions (1L<<1) +#define XkbSetMapAllFlags (0x3) + +typedef struct _xkbSetMap { + CARD8 reqType; + CARD8 xkbReqType; /* always X_KBSetMap */ + CARD16 length B16; + CARD16 deviceSpec B16; + CARD16 present B16; + CARD16 flags B16; + KeyCode minKeyCode; + KeyCode maxKeyCode; + CARD8 firstType; + CARD8 nTypes; + KeyCode firstKeySym; + CARD8 nKeySyms; + CARD16 totalSyms B16; + KeyCode firstKeyAct; + CARD8 nKeyActs; + CARD16 totalActs B16; + KeyCode firstKeyBehavior; + CARD8 nKeyBehaviors; + CARD8 totalKeyBehaviors; + KeyCode firstKeyExplicit; + CARD8 nKeyExplicit; + CARD8 totalKeyExplicit; + KeyCode firstModMapKey; + CARD8 nModMapKeys; + CARD8 totalModMapKeys; + KeyCode firstVModMapKey; + CARD8 nVModMapKeys; + CARD8 totalVModMapKeys; + CARD16 virtualMods B16; +} xkbSetMapReq; +#define sz_xkbSetMapReq 36 + +typedef struct _xkbSymInterpretWireDesc { + CARD32 sym B32; + CARD8 mods; + CARD8 match; + CARD8 virtualMod; + CARD8 flags; + xkbActionWireDesc act; +} xkbSymInterpretWireDesc; +#define sz_xkbSymInterpretWireDesc 16 + +typedef struct _xkbGetCompatMap { + CARD8 reqType; + CARD8 xkbReqType; /* always X_KBGetCompatMap */ + CARD16 length B16; + CARD16 deviceSpec B16; + CARD8 groups; + BOOL getAllSI; + CARD16 firstSI B16; + CARD16 nSI B16; +} xkbGetCompatMapReq; +#define sz_xkbGetCompatMapReq 12 + +typedef struct _xkbGetCompatMapReply { + CARD8 type; /* always X_Reply */ + CARD8 deviceID; + CARD16 sequenceNumber B16; + CARD32 length B32; + CARD8 groups; + CARD8 pad1; + CARD16 firstSI B16; + CARD16 nSI B16; + CARD16 nTotalSI B16; + CARD32 pad2 B32; + CARD32 pad3 B32; + CARD32 pad4 B32; + CARD32 pad5 B32; +} xkbGetCompatMapReply; +#define sz_xkbGetCompatMapReply 32 + +typedef struct _xkbSetCompatMap { + CARD8 reqType; + CARD8 xkbReqType; /* always X_KBSetCompatMap */ + CARD16 length B16; + CARD16 deviceSpec B16; + CARD8 pad1; + BOOL recomputeActions; + BOOL truncateSI; + CARD8 groups; + CARD16 firstSI B16; + CARD16 nSI B16; + CARD16 pad2 B16; +} xkbSetCompatMapReq; +#define sz_xkbSetCompatMapReq 16 + +typedef struct _xkbGetIndicatorState { + CARD8 reqType; + CARD8 xkbReqType; /* always X_KBGetIndicatorState */ + CARD16 length B16; + CARD16 deviceSpec B16; + CARD16 pad1 B16; +} xkbGetIndicatorStateReq; +#define sz_xkbGetIndicatorStateReq 8 + +typedef struct _xkbGetIndicatorStateReply { + CARD8 type; /* always X_Reply */ + CARD8 deviceID; + CARD16 sequenceNumber B16; + CARD32 length B32; + CARD32 state B32; + CARD32 pad1 B32; + CARD32 pad2 B32; + CARD32 pad3 B32; + CARD32 pad4 B32; + CARD32 pad5 B32; +} xkbGetIndicatorStateReply; +#define sz_xkbGetIndicatorStateReply 32 + +typedef struct _xkbGetIndicatorMap { + CARD8 reqType; + CARD8 xkbReqType; /* always X_KBGetIndicatorMap */ + CARD16 length B16; + CARD16 deviceSpec B16; + CARD16 pad B16; + CARD32 which B32; +} xkbGetIndicatorMapReq; +#define sz_xkbGetIndicatorMapReq 12 + +typedef struct _xkbGetIndicatorMapReply { + CARD8 type; /* always X_Reply */ + CARD8 deviceID; + CARD16 sequenceNumber B16; + CARD32 length B32; + CARD32 which B32; + CARD32 realIndicators B32; + CARD8 nIndicators; + CARD8 pad1; + CARD16 pad2 B16; + CARD32 pad3 B32; + CARD32 pad4 B32; + CARD32 pad5 B32; +} xkbGetIndicatorMapReply; +#define sz_xkbGetIndicatorMapReply 32 + +typedef struct _xkbIndicatorMapWireDesc { + CARD8 flags; + CARD8 whichGroups; + CARD8 groups; + CARD8 whichMods; + CARD8 mods; + CARD8 realMods; + CARD16 virtualMods B16; + CARD32 ctrls B32; +} xkbIndicatorMapWireDesc; +#define sz_xkbIndicatorMapWireDesc 12 + +typedef struct _xkbSetIndicatorMap { + CARD8 reqType; + CARD8 xkbReqType; /* always X_KBSetIndicatorMap */ + CARD16 length B16; + CARD16 deviceSpec B16; + CARD16 pad1 B16; + CARD32 which B32; +} xkbSetIndicatorMapReq; +#define sz_xkbSetIndicatorMapReq 12 + +typedef struct _xkbGetNamedIndicator { + CARD8 reqType; + CARD8 xkbReqType; /* X_KBGetNamedIndicator */ + CARD16 length B16; + CARD16 deviceSpec B16; + CARD16 ledClass B16; + CARD16 ledID B16; + CARD16 pad1 B16; + Atom indicator B32; +} xkbGetNamedIndicatorReq; +#define sz_xkbGetNamedIndicatorReq 16 + +typedef struct _xkbGetNamedIndicatorReply { + BYTE type; + BYTE deviceID; + CARD16 sequenceNumber B16; + CARD32 length B32; + Atom indicator B32; + BOOL found; + BOOL on; + BOOL realIndicator; + CARD8 ndx; + CARD8 flags; + CARD8 whichGroups; + CARD8 groups; + CARD8 whichMods; + CARD8 mods; + CARD8 realMods; + CARD16 virtualMods B16; + CARD32 ctrls B32; + BOOL supported; + CARD8 pad1; + CARD16 pad2 B16; +} xkbGetNamedIndicatorReply; +#define sz_xkbGetNamedIndicatorReply 32 + +typedef struct _xkbSetNamedIndicator { + CARD8 reqType; + CARD8 xkbReqType; /* X_KBSetNamedIndicator */ + CARD16 length B16; + CARD16 deviceSpec B16; + CARD16 ledClass B16; + CARD16 ledID B16; + CARD16 pad1 B16; + Atom indicator B32; + BOOL setState; + BOOL on; + BOOL setMap; + BOOL createMap; + CARD8 pad2; + CARD8 flags; + CARD8 whichGroups; + CARD8 groups; + CARD8 whichMods; + CARD8 realMods; + CARD16 virtualMods B16; + CARD32 ctrls B32; +} xkbSetNamedIndicatorReq; +#define sz_xkbSetNamedIndicatorReq 32 + +typedef struct _xkbGetNames { + CARD8 reqType; + CARD8 xkbReqType; /* always X_KBGetNames */ + CARD16 length B16; + CARD16 deviceSpec B16; + CARD16 pad B16; + CARD32 which B32; +} xkbGetNamesReq; +#define sz_xkbGetNamesReq 12 + +typedef struct _xkbGetNamesReply { + BYTE type; + BYTE deviceID; + CARD16 sequenceNumber B16; + CARD32 length B32; + CARD32 which B32; + KeyCode minKeyCode; + KeyCode maxKeyCode; + CARD8 nTypes; + CARD8 groupNames; + CARD16 virtualMods B16; + KeyCode firstKey; + CARD8 nKeys; + CARD32 indicators B32; + CARD8 nRadioGroups; + CARD8 nKeyAliases; + CARD16 nKTLevels B16; + CARD32 pad3 B32; +} xkbGetNamesReply; +#define sz_xkbGetNamesReply 32 + +typedef struct _xkbSetNames { + CARD8 reqType; + CARD8 xkbReqType; /* always X_KBSetNames */ + CARD16 length B16; + CARD16 deviceSpec B16; + CARD16 virtualMods B16; + CARD32 which B32; + CARD8 firstType; + CARD8 nTypes; + CARD8 firstKTLevel; + CARD8 nKTLevels; + CARD32 indicators B32; + CARD8 groupNames; + CARD8 nRadioGroups; + KeyCode firstKey; + CARD8 nKeys; + CARD8 nKeyAliases; + CARD8 pad1; + CARD16 totalKTLevelNames B16; +} xkbSetNamesReq; +#define sz_xkbSetNamesReq 28 + +typedef struct _xkbPointWireDesc { + INT16 x B16; + INT16 y B16; +} xkbPointWireDesc; +#define sz_xkbPointWireDesc 4 + +typedef struct _xkbOutlineWireDesc { + CARD8 nPoints; + CARD8 cornerRadius; + CARD16 pad B16; +} xkbOutlineWireDesc; +#define sz_xkbOutlineWireDesc 4 + +typedef struct _xkbShapeWireDesc { + Atom name B32; + CARD8 nOutlines; + CARD8 primaryNdx; + CARD8 approxNdx; + CARD8 pad; +} xkbShapeWireDesc; +#define sz_xkbShapeWireDesc 8 + +typedef struct _xkbSectionWireDesc { + Atom name B32; + INT16 top B16; + INT16 left B16; + CARD16 width B16; + CARD16 height B16; + INT16 angle B16; + CARD8 priority; + CARD8 nRows; + CARD8 nDoodads; + CARD8 nOverlays; + CARD16 pad B16; +} xkbSectionWireDesc; +#define sz_xkbSectionWireDesc 20 + +typedef struct _xkbRowWireDesc { + INT16 top B16; + INT16 left B16; + CARD8 nKeys; + BOOL vertical; + CARD16 pad B16; +} xkbRowWireDesc; +#define sz_xkbRowWireDesc 8 + +typedef struct _xkbKeyWireDesc { + CARD8 name[XkbKeyNameLength]; + INT16 gap B16; + CARD8 shapeNdx; + CARD8 colorNdx; +} xkbKeyWireDesc; +#define sz_xkbKeyWireDesc 8 + +typedef struct _xkbOverlayWireDesc { + Atom name B32; + CARD8 nRows; + CARD8 pad1; + CARD16 pad2 B16; +} xkbOverlayWireDesc; +#define sz_xkbOverlayWireDesc 8 + +typedef struct _xkbOverlayRowWireDesc { + CARD8 rowUnder; + CARD8 nKeys; + CARD16 pad1 B16; +} xkbOverlayRowWireDesc; +#define sz_xkbOverlayRowWireDesc 4 + +typedef struct _xkbOverlayKeyWireDesc { + CARD8 over[XkbKeyNameLength]; + CARD8 under[XkbKeyNameLength]; +} xkbOverlayKeyWireDesc; +#define sz_xkbOverlayKeyWireDesc 8 + +typedef struct _xkbShapeDoodadWireDesc { + Atom name B32; + CARD8 type; + CARD8 priority; + INT16 top B16; + INT16 left B16; + INT16 angle B16; + CARD8 colorNdx; + CARD8 shapeNdx; + CARD16 pad1 B16; + CARD32 pad2 B32; +} xkbShapeDoodadWireDesc; +#define sz_xkbShapeDoodadWireDesc 20 + +typedef struct _xkbTextDoodadWireDesc { + Atom name B32; + CARD8 type; + CARD8 priority; + INT16 top B16; + INT16 left B16; + INT16 angle B16; + CARD16 width B16; + CARD16 height B16; + CARD8 colorNdx; + CARD8 pad1; + CARD16 pad2 B16; +} xkbTextDoodadWireDesc; +#define sz_xkbTextDoodadWireDesc 20 + +typedef struct _xkbIndicatorDoodadWireDesc { + Atom name B32; + CARD8 type; + CARD8 priority; + INT16 top B16; + INT16 left B16; + INT16 angle B16; + CARD8 shapeNdx; + CARD8 onColorNdx; + CARD8 offColorNdx; + CARD8 pad1; + CARD32 pad2 B32; +} xkbIndicatorDoodadWireDesc; +#define sz_xkbIndicatorDoodadWireDesc 20 + +typedef struct _xkbLogoDoodadWireDesc { + Atom name B32; + CARD8 type; + CARD8 priority; + INT16 top B16; + INT16 left B16; + INT16 angle B16; + CARD8 colorNdx; + CARD8 shapeNdx; + CARD16 pad1 B16; + CARD32 pad2 B32; +} xkbLogoDoodadWireDesc; +#define sz_xkbLogoDoodadWireDesc 20 + +typedef struct _xkbAnyDoodadWireDesc { + Atom name B32; + CARD8 type; + CARD8 priority; + INT16 top B16; + INT16 left B16; + INT16 angle B16; + CARD32 pad2 B32; + CARD32 pad3 B32; +} xkbAnyDoodadWireDesc; +#define sz_xkbAnyDoodadWireDesc 20 + +typedef union _xkbDoodadWireDesc { + xkbAnyDoodadWireDesc any; + xkbShapeDoodadWireDesc shape; + xkbTextDoodadWireDesc text; + xkbIndicatorDoodadWireDesc indicator; + xkbLogoDoodadWireDesc logo; +} xkbDoodadWireDesc; +#define sz_xkbDoodadWireDesc 20 + +typedef struct _xkbGetGeometry { + CARD8 reqType; + CARD8 xkbReqType; /* always X_KBGetGeometry */ + CARD16 length B16; + CARD16 deviceSpec B16; + CARD16 pad B16; + Atom name B32; +} xkbGetGeometryReq; +#define sz_xkbGetGeometryReq 12 + +typedef struct _xkbGetGeometryReply { + CARD8 type; /* always X_Reply */ + CARD8 deviceID; + CARD16 sequenceNumber B16; + CARD32 length B32; + Atom name B32; + BOOL found; + CARD8 pad; + CARD16 widthMM B16; + CARD16 heightMM B16; + CARD16 nProperties B16; + CARD16 nColors B16; + CARD16 nShapes B16; + CARD16 nSections B16; + CARD16 nDoodads B16; + CARD16 nKeyAliases B16; + CARD8 baseColorNdx; + CARD8 labelColorNdx; +} xkbGetGeometryReply; +#define sz_xkbGetGeometryReply 32 + +typedef struct _xkbSetGeometry { + CARD8 reqType; + CARD8 xkbReqType; /* always X_KBSetGeometry */ + CARD16 length B16; + CARD16 deviceSpec B16; + CARD8 nShapes; + CARD8 nSections; + Atom name B32; + CARD16 widthMM B16; + CARD16 heightMM B16; + CARD16 nProperties B16; + CARD16 nColors B16; + CARD16 nDoodads B16; + CARD16 nKeyAliases B16; + CARD8 baseColorNdx; + CARD8 labelColorNdx; + CARD16 pad B16; +} xkbSetGeometryReq; +#define sz_xkbSetGeometryReq 28 + +typedef struct _xkbPerClientFlags { + CARD8 reqType; + CARD8 xkbReqType;/* always X_KBPerClientFlags */ + CARD16 length B16; + CARD16 deviceSpec B16; + CARD16 pad1 B16; + CARD32 change B32; + CARD32 value B32; + CARD32 ctrlsToChange B32; + CARD32 autoCtrls B32; + CARD32 autoCtrlValues B32; +} xkbPerClientFlagsReq; +#define sz_xkbPerClientFlagsReq 28 + +typedef struct _xkbPerClientFlagsReply { + CARD8 type; /* always X_Reply */ + CARD8 deviceID; + CARD16 sequenceNumber B16; + CARD32 length B32; + CARD32 supported B32; + CARD32 value B32; + CARD32 autoCtrls B32; + CARD32 autoCtrlValues B32; + CARD32 pad1 B32; + CARD32 pad2 B32; +} xkbPerClientFlagsReply; +#define sz_xkbPerClientFlagsReply 32 + +typedef struct _xkbListComponents { + CARD8 reqType; + CARD8 xkbReqType; /* always X_KBListComponents */ + CARD16 length B16; + CARD16 deviceSpec B16; + CARD16 maxNames B16; +} xkbListComponentsReq; +#define sz_xkbListComponentsReq 8 + +typedef struct _xkbListComponentsReply { + CARD8 type; /* always X_Reply */ + CARD8 deviceID; + CARD16 sequenceNumber B16; + CARD32 length B32; + CARD16 nKeymaps B16; + CARD16 nKeycodes B16; + CARD16 nTypes B16; + CARD16 nCompatMaps B16; + CARD16 nSymbols B16; + CARD16 nGeometries B16; + CARD16 extra B16; + CARD16 pad1 B16; + CARD32 pad2 B32; + CARD32 pad3 B32; +} xkbListComponentsReply; +#define sz_xkbListComponentsReply 32 + +typedef struct _xkbGetKbdByName { + CARD8 reqType; + CARD8 xkbReqType; /* always X_KBGetKbdByName */ + CARD16 length B16; + CARD16 deviceSpec B16; + CARD16 need B16; /* combination of XkbGBN_* */ + CARD16 want B16; /* combination of XkbGBN_* */ + BOOL load; + CARD8 pad; +} xkbGetKbdByNameReq; +#define sz_xkbGetKbdByNameReq 12 + +typedef struct _xkbGetKbdByNameReply { + CARD8 type; /* always X_Reply */ + CARD8 deviceID; + CARD16 sequenceNumber B16; + CARD32 length B32; + KeyCode minKeyCode; + KeyCode maxKeyCode; + BOOL loaded; + BOOL newKeyboard; + CARD16 found B16; /* combination of XkbGBN_* */ + CARD16 reported B16; /* combination of XkbAllComponents */ + CARD32 pad1 B32; + CARD32 pad2 B32; + CARD32 pad3 B32; + CARD32 pad4 B32; +} xkbGetKbdByNameReply; +#define sz_xkbGetKbdByNameReply 32 + +typedef struct _xkbDeviceLedsWireDesc { + CARD16 ledClass B16; + CARD16 ledID B16; + CARD32 namesPresent B32; + CARD32 mapsPresent B32; + CARD32 physIndicators B32; + CARD32 state B32; +} xkbDeviceLedsWireDesc; +#define sz_xkbDeviceLedsWireDesc 20 + +typedef struct _xkbGetDeviceInfo { + CARD8 reqType; + CARD8 xkbReqType; /* always X_KBGetDeviceInfo */ + CARD16 length B16; + CARD16 deviceSpec B16; + CARD16 wanted B16; + BOOL allBtns; + CARD8 firstBtn; + CARD8 nBtns; + CARD8 pad; + CARD16 ledClass B16; + CARD16 ledID B16; +} xkbGetDeviceInfoReq; +#define sz_xkbGetDeviceInfoReq 16 + +typedef struct _xkbGetDeviceInfoReply { + CARD8 type; /* always X_Reply */ + CARD8 deviceID; + CARD16 sequenceNumber B16; + CARD32 length B32; + CARD16 present B16; + CARD16 supported B16; + CARD16 unsupported B16; + CARD16 nDeviceLedFBs B16; + CARD8 firstBtnWanted; + CARD8 nBtnsWanted; + CARD8 firstBtnRtrn; + CARD8 nBtnsRtrn; + CARD8 totalBtns; + BOOL hasOwnState; + CARD16 dfltKbdFB B16; + CARD16 dfltLedFB B16; + CARD16 pad B16; + Atom devType B32; +} xkbGetDeviceInfoReply; +#define sz_xkbGetDeviceInfoReply 32 + +typedef struct _xkbSetDeviceInfo { + CARD8 reqType; + CARD8 xkbReqType; /* always X_KBSetDeviceInfo */ + CARD16 length B16; + CARD16 deviceSpec B16; + CARD8 firstBtn; + CARD8 nBtns; + CARD16 change B16; + CARD16 nDeviceLedFBs B16; +} xkbSetDeviceInfoReq; +#define sz_xkbSetDeviceInfoReq 12 + +typedef struct _xkbSetDebuggingFlags { + CARD8 reqType; + CARD8 xkbReqType; /* always X_KBSetDebuggingFlags */ + CARD16 length B16; + CARD16 msgLength B16; + CARD16 pad B16; + CARD32 affectFlags B32; + CARD32 flags B32; + CARD32 affectCtrls B32; + CARD32 ctrls B32; +} xkbSetDebuggingFlagsReq; +#define sz_xkbSetDebuggingFlagsReq 24 + +typedef struct _xkbSetDebuggingFlagsReply { + BYTE type; /* X_Reply */ + CARD8 pad0; + CARD16 sequenceNumber B16; + CARD32 length B32; + CARD32 currentFlags B32; + CARD32 currentCtrls B32; + CARD32 supportedFlags B32; + CARD32 supportedCtrls B32; + CARD32 pad1 B32; + CARD32 pad2 B32; +} xkbSetDebuggingFlagsReply; +#define sz_xkbSetDebuggingFlagsReply 32 + + /* + * X KEYBOARD EXTENSION EVENT STRUCTURES + */ + +typedef struct _xkbAnyEvent { + BYTE type; + BYTE xkbType; + CARD16 sequenceNumber B16; + Time time B32; + CARD8 deviceID; + CARD8 pad1; + CARD16 pad2 B16; + CARD32 pad3 B32; + CARD32 pad4 B32; + CARD32 pad5 B32; + CARD32 pad6 B32; + CARD32 pad7 B32; +} xkbAnyEvent; +#define sz_xkbAnyEvent 32 + +typedef struct _xkbNewKeyboardNotify { + BYTE type; + BYTE xkbType; + CARD16 sequenceNumber B16; + Time time B32; + CARD8 deviceID; + CARD8 oldDeviceID; + KeyCode minKeyCode; + KeyCode maxKeyCode; + KeyCode oldMinKeyCode; + KeyCode oldMaxKeyCode; + CARD8 requestMajor; + CARD8 requestMinor; + CARD16 changed B16; + CARD8 detail; + CARD8 pad1; + CARD32 pad2 B32; + CARD32 pad3 B32; + CARD32 pad4 B32; +} xkbNewKeyboardNotify; +#define sz_xkbNewKeyboardNotify 32 + +typedef struct _xkbMapNotify { + BYTE type; + BYTE xkbType; + CARD16 sequenceNumber B16; + Time time B32; + CARD8 deviceID; + CARD8 ptrBtnActions; + CARD16 changed B16; + KeyCode minKeyCode; + KeyCode maxKeyCode; + CARD8 firstType; + CARD8 nTypes; + KeyCode firstKeySym; + CARD8 nKeySyms; + KeyCode firstKeyAct; + CARD8 nKeyActs; + KeyCode firstKeyBehavior; + CARD8 nKeyBehaviors; + KeyCode firstKeyExplicit; + CARD8 nKeyExplicit; + KeyCode firstModMapKey; + CARD8 nModMapKeys; + KeyCode firstVModMapKey; + CARD8 nVModMapKeys; + CARD16 virtualMods B16; + CARD16 pad1 B16; +} xkbMapNotify; +#define sz_xkbMapNotify 32 + +typedef struct _xkbStateNotify { + BYTE type; + BYTE xkbType; + CARD16 sequenceNumber B16; + Time time B32; + CARD8 deviceID; + CARD8 mods; + CARD8 baseMods; + CARD8 latchedMods; + CARD8 lockedMods; + CARD8 group; + INT16 baseGroup B16; + INT16 latchedGroup B16; + CARD8 lockedGroup; + CARD8 compatState; + CARD8 grabMods; + CARD8 compatGrabMods; + CARD8 lookupMods; + CARD8 compatLookupMods; + CARD16 ptrBtnState B16; + CARD16 changed B16; + KeyCode keycode; + CARD8 eventType; + CARD8 requestMajor; + CARD8 requestMinor; +} xkbStateNotify; +#define sz_xkbStateNotify 32 + +typedef struct _xkbControlsNotify { + BYTE type; + BYTE xkbType; + CARD16 sequenceNumber B16; + Time time B32; + CARD8 deviceID; + CARD8 numGroups; + CARD16 pad1 B16; + CARD32 changedControls B32; + CARD32 enabledControls B32; + CARD32 enabledControlChanges B32; + KeyCode keycode; + CARD8 eventType; + CARD8 requestMajor; + CARD8 requestMinor; + CARD32 pad2 B32; +} xkbControlsNotify; +#define sz_xkbControlsNotify 32 + +typedef struct _xkbIndicatorNotify { + BYTE type; + BYTE xkbType; + CARD16 sequenceNumber B16; + Time time B32; + CARD8 deviceID; + CARD8 pad1; + CARD16 pad2 B16; + CARD32 state B32; + CARD32 changed B32; + CARD32 pad3 B32; + CARD32 pad4 B32; + CARD32 pad5 B32; +} xkbIndicatorNotify; +#define sz_xkbIndicatorNotify 32 + +typedef struct _xkbNamesNotify { + BYTE type; + BYTE xkbType; + CARD16 sequenceNumber B16; + Time time B32; + CARD8 deviceID; + CARD8 pad1; + CARD16 changed B16; + CARD8 firstType; + CARD8 nTypes; + CARD8 firstLevelName; + CARD8 nLevelNames; + CARD8 pad2; + CARD8 nRadioGroups; + CARD8 nAliases; + CARD8 changedGroupNames; + CARD16 changedVirtualMods B16; + CARD8 firstKey; + CARD8 nKeys; + CARD32 changedIndicators B32; + CARD32 pad3 B32; +} xkbNamesNotify; +#define sz_xkbNamesNotify 32 + +typedef struct _xkbCompatMapNotify { + BYTE type; + BYTE xkbType; + CARD16 sequenceNumber B16; + Time time B32; + CARD8 deviceID; + CARD8 changedGroups; + CARD16 firstSI B16; + CARD16 nSI B16; + CARD16 nTotalSI B16; + CARD32 pad1 B32; + CARD32 pad2 B32; + CARD32 pad3 B32; + CARD32 pad4 B32; +} xkbCompatMapNotify; +#define sz_xkbCompatMapNotify 32 + +typedef struct _xkbBellNotify { + BYTE type; + BYTE xkbType; + CARD16 sequenceNumber B16; + Time time B32; + CARD8 deviceID; + CARD8 bellClass; + CARD8 bellID; + CARD8 percent; + CARD16 pitch B16; + CARD16 duration B16; + Atom name B32; + Window window B32; + BOOL eventOnly; + CARD8 pad1; + CARD16 pad2 B16; + CARD32 pad3 B32; +} xkbBellNotify; +#define sz_xkbBellNotify 32 + +typedef struct _xkbActionMessage { + BYTE type; + BYTE xkbType; + CARD16 sequenceNumber B16; + Time time B32; + CARD8 deviceID; + KeyCode keycode; + BOOL press; + BOOL keyEventFollows; + CARD8 mods; + CARD8 group; + CARD8 message[8]; + CARD16 pad1 B16; + CARD32 pad2 B32; + CARD32 pad3 B32; +} xkbActionMessage; +#define sz_xkbActionMessage 32 + +typedef struct _xkbAccessXNotify { + BYTE type; + BYTE xkbType; + CARD16 sequenceNumber B16; + Time time B32; + CARD8 deviceID; + KeyCode keycode; + CARD16 detail B16; + CARD16 slowKeysDelay B16; + CARD16 debounceDelay B16; + CARD32 pad1 B32; + CARD32 pad2 B32; + CARD32 pad3 B32; + CARD32 pad4 B32; +} xkbAccessXNotify; +#define sz_xkbAccessXNotify 32 + +typedef struct _xkbExtensionDeviceNotify { + BYTE type; + BYTE xkbType; + CARD16 sequenceNumber B16; + Time time B32; + CARD8 deviceID; + CARD8 pad1; + CARD16 reason B16; + CARD16 ledClass B16; + CARD16 ledID B16; + CARD32 ledsDefined B32; + CARD32 ledState B32; + CARD8 firstBtn; + CARD8 nBtns; + CARD16 supported B16; + CARD16 unsupported B16; + CARD16 pad3 B16; +} xkbExtensionDeviceNotify; +#define sz_xkbExtensionDeviceNotify 32 + +typedef struct _xkbEvent { + union { + xkbAnyEvent any; + xkbNewKeyboardNotify new_kbd; + xkbMapNotify map; + xkbStateNotify state; + xkbControlsNotify ctrls; + xkbIndicatorNotify indicators; + xkbNamesNotify names; + xkbCompatMapNotify compat; + xkbBellNotify bell; + xkbActionMessage message; + xkbAccessXNotify accessx; + xkbExtensionDeviceNotify device; + } u; +} xkbEvent; +#define sz_xkbEvent 32 + +#undef Window +#undef Atom +#undef Time +#undef KeyCode +#undef KeySym + +#endif /* _XKBPROTO_H_ */ diff --git a/XKBsrv.h b/XKBsrv.h new file mode 100644 index 0000000..16c04ed --- /dev/null +++ b/XKBsrv.h @@ -0,0 +1,1285 @@ +/* $Xorg: XKBsrv.h,v 1.3 2000/08/18 04:05:45 coskrey Exp $ */ +/************************************************************ +Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc. + +Permission to use, copy, modify, and distribute this +software and its documentation for any purpose and without +fee is hereby granted, provided that the above copyright +notice appear in all copies and that both that copyright +notice and this permission notice appear in supporting +documentation, and that the name of Silicon Graphics not be +used in advertising or publicity pertaining to distribution +of the software without specific prior written permission. +Silicon Graphics makes no representation about the suitability +of this software for any purpose. It is provided "as is" +without any express or implied warranty. + +SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS +SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON +GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL +DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, +DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE +OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH +THE USE OR PERFORMANCE OF THIS SOFTWARE. + +********************************************************/ + +#ifndef _XKBSRV_H_ +#define _XKBSRV_H_ + +#ifdef XKB_IN_SERVER +#define XkbAllocClientMap SrvXkbAllocClientMap +#define XkbAllocServerMap SrvXkbAllocServerMap +#define XkbChangeTypesOfKey SrvXkbChangeTypesOfKey +#define XkbAddKeyType SrvXkbAddKeyType +#define XkbCopyKeyType SrvXkbCopyKeyType +#define XkbCopyKeyTypes SrvXkbCopyKeyTypes +#define XkbFreeClientMap SrvXkbFreeClientMap +#define XkbFreeServerMap SrvXkbFreeServerMap +#define XkbInitCanonicalKeyTypes SrvXkbInitCanonicalKeyTypes +#define XkbKeyTypesForCoreSymbols SrvXkbKeyTypesForCoreSymbols +#define XkbApplyCompatMapToKey SrvXkbApplyCompatMapToKey +#define XkbUpdateMapFromCore SrvXkbUpdateMapFromCore +#define XkbResizeKeyActions SrvXkbResizeKeyActions +#define XkbResizeKeySyms SrvXkbResizeKeySyms +#define XkbResizeKeyType SrvXkbResizeKeyType +#define XkbAllocCompatMap SrvXkbAllocCompatMap +#define XkbAllocControls SrvXkbAllocControls +#define XkbAllocIndicatorMaps SrvXkbAllocIndicatorMaps +#define XkbAllocKeyboard SrvXkbAllocKeyboard +#define XkbAllocNames SrvXkbAllocNames +#define XkbFreeCompatMap SrvXkbFreeCompatMap +#define XkbFreeControls SrvXkbFreeControls +#define XkbFreeIndicatorMaps SrvXkbFreeIndicatorMaps +#define XkbFreeKeyboard SrvXkbFreeKeyboard +#define XkbFreeNames SrvXkbFreeNames +#define XkbAddDeviceLedInfo SrvXkbAddDeviceLedInfo +#define XkbAllocDeviceInfo SrvXkbAllocDeviceInfo +#define XkbFreeDeviceInfo SrvXkbFreeDeviceInfo +#define XkbResizeDeviceButtonActions SrvXkbResizeDeviceButtonActions +#define XkbLatchModifiers SrvXkbLatchModifiers +#define XkbLatchGroup SrvXkbLatchGroup +#define XkbVirtualModsToReal SrvXkbVirtualModsToReal +#define XkbChangeKeycodeRange SrvXkbChangeKeycodeRange +#define XkbApplyVirtualModChanges SrvXkbApplyVirtualModChanges +#define XkbUpdateActionVirtualMods SrvXkbUpdateActionVirtualMods +#define XkbUpdateKeyTypeVirtualMods SrvXkbUpdateKeyTypeVirtualMods +#endif + +#include +#include + +typedef struct _XkbInterest { + DeviceIntPtr dev; + ClientPtr client; + XID resource; + struct _XkbInterest * next; + CARD16 extDevNotifyMask; + CARD16 stateNotifyMask; + CARD16 namesNotifyMask; + CARD32 ctrlsNotifyMask; + CARD8 compatNotifyMask; + BOOL bellNotifyMask; + BOOL actionMessageMask; + CARD16 accessXNotifyMask; + CARD32 iStateNotifyMask; + CARD32 iMapNotifyMask; + CARD16 altSymsNotifyMask; + CARD32 autoCtrls; + CARD32 autoCtrlValues; +} XkbInterestRec,*XkbInterestPtr; + +typedef struct _XkbRadioGroup { + CARD8 flags; + CARD8 nMembers; + CARD8 dfltDown; + CARD8 currentDown; + CARD8 members[XkbRGMaxMembers]; +} XkbRadioGroupRec, *XkbRadioGroupPtr; + +typedef struct _XkbEventCause { + CARD8 kc; + CARD8 event; + CARD8 mjr; + CARD8 mnr; + ClientPtr client; +} XkbEventCauseRec,*XkbEventCausePtr; +#define XkbSetCauseKey(c,k,e) { (c)->kc= (k),(c)->event= (e),\ + (c)->mjr= (c)->mnr= 0; \ + (c)->client= NULL; } +#define XkbSetCauseReq(c,j,n,cl) { (c)->kc= (c)->event= 0,\ + (c)->mjr= (j),(c)->mnr= (n);\ + (c)->client= (cl); } +#define XkbSetCauseCoreReq(c,e,cl) XkbSetCauseReq(c,e,0,cl) +#define XkbSetCauseXkbReq(c,e,cl) XkbSetCauseReq(c,XkbReqCode,e,cl) +#define XkbSetCauseUnknown(c) XkbSetCauseKey(c,0,0) + +#define _OFF_TIMER 0 +#define _KRG_WARN_TIMER 1 +#define _KRG_TIMER 2 +#define _SK_TIMEOUT_TIMER 3 +#define _ALL_TIMEOUT_TIMER 4 + +#define _BEEP_NONE 0 +#define _BEEP_FEATURE_ON 1 +#define _BEEP_FEATURE_OFF 2 +#define _BEEP_FEATURE_CHANGE 3 +#define _BEEP_SLOW_WARN 4 +#define _BEEP_SLOW_PRESS 5 +#define _BEEP_SLOW_ACCEPT 6 +#define _BEEP_SLOW_REJECT 7 +#define _BEEP_SLOW_RELEASE 8 +#define _BEEP_STICKY_LATCH 9 +#define _BEEP_STICKY_LOCK 10 +#define _BEEP_STICKY_UNLOCK 11 +#define _BEEP_LED_ON 12 +#define _BEEP_LED_OFF 13 +#define _BEEP_LED_CHANGE 14 +#define _BEEP_BOUNCE_REJECT 15 + +typedef struct _XkbSrvInfo { + XkbStateRec prev_state; + XkbStateRec state; + XkbDescPtr desc; + + DeviceIntPtr device; + KbdCtrlProcPtr kbdProc; + + XkbRadioGroupPtr radioGroups; + CARD8 nRadioGroups; + CARD8 clearMods; + CARD8 setMods; + INT16 groupChange; + + CARD16 dfltPtrDelta; + + double mouseKeysCurve; + double mouseKeysCurveFactor; + INT16 mouseKeysDX; + INT16 mouseKeysDY; + CARD8 mouseKeysFlags; + Bool mouseKeysAccel; + CARD8 mouseKeysCounter; + + CARD8 lockedPtrButtons; + CARD8 shiftKeyCount; + KeyCode mouseKey; + KeyCode inactiveKey; + KeyCode slowKey; + KeyCode repeatKey; + CARD8 krgTimerActive; + CARD8 beepType; + CARD8 beepCount; + + CARD32 flags; + CARD32 lastPtrEventTime; + CARD32 lastShiftEventTime; + OsTimerPtr beepTimer; + OsTimerPtr mouseKeyTimer; + OsTimerPtr slowKeysTimer; + OsTimerPtr bounceKeysTimer; + OsTimerPtr repeatKeyTimer; + OsTimerPtr krgTimer; +} XkbSrvInfoRec, *XkbSrvInfoPtr; + +#define XkbSLI_IsDefault (1L<<0) +#define XkbSLI_HasOwnState (1L<<1) + +typedef struct _XkbSrvLedInfo { + CARD16 flags; + CARD16 class; + CARD16 id; + union { + KbdFeedbackPtr kf; + LedFeedbackPtr lf; + } fb; + + CARD32 physIndicators; + CARD32 autoState; + CARD32 explicitState; + CARD32 effectiveState; + + CARD32 mapsPresent; + CARD32 namesPresent; + XkbIndicatorMapPtr maps; + Atom * names; + + CARD32 usesBase; + CARD32 usesLatched; + CARD32 usesLocked; + CARD32 usesEffective; + CARD32 usesCompat; + CARD32 usesControls; + + CARD32 usedComponents; +} XkbSrvLedInfoRec, *XkbSrvLedInfoPtr; + +/* + * Settings for xkbClientFlags field (used by DIX) + * These flags _must_ not overlap with XkbPCF_* + */ +#define _XkbClientInitialized (1<<15) + +#define _XkbWantsDetectableAutoRepeat(c)\ + ((c)->xkbClientFlags&XkbPCF_DetectableAutoRepeatMask) + +/* + * Settings for flags field + */ +#define _XkbStateNotifyInProgress (1<<0) + +/***====================================================================***/ + +#define XkbAX_KRGMask (XkbSlowKeysMask|XkbBounceKeysMask) +#define XkbAllFilteredEventsMask \ + (XkbAccessXKeysMask|XkbRepeatKeysMask|XkbAX_KRGMask) + +/***====================================================================***/ + +extern int XkbReqCode; +extern int XkbEventBase; +extern int XkbKeyboardErrorCode; +extern int XkbDisableLockActions; +extern char * XkbBaseDirectory; +extern char * XkbInitialMap; +extern int _XkbClientMajor; +extern int _XkbClientMinor; +extern unsigned int XkbXIUnsupported; + +extern char * XkbModelUsed,*XkbLayoutUsed,*XkbVariantUsed,*XkbOptionsUsed; +extern Bool noXkbExtension; +extern Bool XkbWantRulesProp; + +extern pointer XkbLastRepeatEvent; + +extern CARD32 xkbDebugFlags; +extern CARD32 xkbDebugCtrls; + +#define _XkbAlloc(s) xalloc((s)) +#define _XkbCalloc(n,s) Xcalloc((n)*(s)) +#define _XkbRealloc(o,s) Xrealloc((o),(s)) +#define _XkbTypedAlloc(t) ((t *)xalloc(sizeof(t))) +#define _XkbTypedCalloc(n,t) ((t *)Xcalloc((n)*sizeof(t))) +#define _XkbTypedRealloc(o,n,t) \ + ((o)?(t *)Xrealloc((o),(n)*sizeof(t)):_XkbTypedCalloc(n,t)) +#define _XkbClearElems(a,f,l,t) bzero(&(a)[f],((l)-(f)+1)*sizeof(t)) +#define _XkbFree(p) Xfree(p) + +#define _XkbLibError(c,l,d) \ + { _XkbErrCode= (c); _XkbErrLocation= (l); _XkbErrData= (d); } +#define _XkbErrCode2(a,b) ((XID)((((unsigned int)(a))<<24)|((b)&0xffffff))) +#define _XkbErrCode3(a,b,c) _XkbErrCode2(a,(((unsigned int)(b))<<16)|(c)) +#define _XkbErrCode4(a,b,c,d) _XkbErrCode3(a,b,((((unsigned int)(c))<<8)|(d))) + +extern int DeviceKeyPress,DeviceKeyRelease; +extern int DeviceButtonPress,DeviceButtonRelease; + +#ifdef XINPUT +#define _XkbIsPressEvent(t) (((t)==KeyPress)||((t)==DeviceKeyPress)) +#define _XkbIsReleaseEvent(t) (((t)==KeyRelease)||((t)==DeviceKeyRelease)) +#else +#define _XkbIsPressEvent(t) ((t)==KeyPress) +#define _XkbIsReleaseEvent(t) ((t)==KeyRelease) +#endif + +#define _XkbCoreKeycodeInRange(c,k) (((k)>=(c)->curKeySyms.minKeyCode)&&\ + ((k)<=(c)->curKeySyms.maxKeyCode)) +#define _XkbCoreNumKeys(c) ((c)->curKeySyms.maxKeyCode-\ + (c)->curKeySyms.minKeyCode+1) + +#define XConvertCase(s,l,u) XkbConvertCase(s,l,u) +#define IsKeypadKey(s) XkbKSIsKeypad(s) + +#define Status int +#define XPointer pointer +#define Display struct _XDisplay + +#ifndef True +#define True 1 +#define False 0 +#endif + +#ifndef PATH_MAX +#ifdef MAXPATHLEN +#define PATH_MAX MAXPATHLEN +#else +#define PATH_MAX 1024 +#endif +#endif + +_XFUNCPROTOBEGIN + +extern void XkbFreeCompatMap( +#if NeedFunctionPrototypes + XkbDescPtr /* xkb */, + unsigned int /* which */, + Bool /* freeMap */ +#endif +); + +extern void XkbFreeNames( +#if NeedFunctionPrototypes + XkbDescPtr /* xkb */, + unsigned int /* which */, + Bool /* freeMap */ +#endif +); + +extern DeviceIntPtr _XkbLookupAnyDevice( +#if NeedFunctionPrototypes + int /* id */, + int * /* why_rtrn */ +#endif +); + +extern DeviceIntPtr _XkbLookupKeyboard( +#if NeedFunctionPrototypes + int /* id */, + int * /* why_rtrn */ +#endif +); + +extern DeviceIntPtr _XkbLookupBellDevice( +#if NeedFunctionPrototypes + int /* id */, + int * /* why_rtrn */ +#endif +); + +extern DeviceIntPtr _XkbLookupLedDevice( +#if NeedFunctionPrototypes + int /* id */, + int * /* why_rtrn */ +#endif +); + +extern DeviceIntPtr _XkbLookupButtonDevice( +#if NeedFunctionPrototypes + int /* id */, + int * /* why_rtrn */ +#endif +); + +extern XkbDescPtr XkbAllocKeyboard( +#if NeedFunctionPrototypes + void +#endif +); + +extern Status XkbAllocClientMap( +#if NeedFunctionPrototypes + XkbDescPtr /* xkb */, + unsigned int /* which */, + unsigned int /* nTypes */ +#endif +); + +extern Status XkbAllocServerMap( +#if NeedFunctionPrototypes + XkbDescPtr /* xkb */, + unsigned int /* which */, + unsigned int /* nNewActions */ +#endif +); + +extern void XkbFreeClientMap( +#if NeedFunctionPrototypes + XkbDescPtr /* xkb */, + unsigned int /* what */, + Bool /* freeMap */ +#endif +); + +extern void XkbFreeServerMap( +#if NeedFunctionPrototypes + XkbDescPtr /* xkb */, + unsigned int /* what */, + Bool /* freeMap */ +#endif +); + +extern Status XkbAllocIndicatorMaps( +#if NeedFunctionPrototypes + XkbDescPtr /* xkb */ +#endif +); + +extern Status XkbAllocCompatMap( +#if NeedFunctionPrototypes + XkbDescPtr /* xkb */, + unsigned int /* which */, + unsigned int /* nInterpret */ +#endif +); + +extern Status XkbAllocNames( +#if NeedFunctionPrototypes + XkbDescPtr /* xkb */, + unsigned int /* which */, + int /* nTotalRG */, + int /* nTotalAliases */ +#endif +); + +extern Status XkbAllocControls( +#if NeedFunctionPrototypes + XkbDescPtr /* xkb */, + unsigned int /* which*/ +#endif +); + +extern Status XkbCopyKeyType( +#if NeedFunctionPrototypes + XkbKeyTypePtr /* from */, + XkbKeyTypePtr /* into */ +#endif +); + +extern Status XkbCopyKeyTypes( +#if NeedFunctionPrototypes + XkbKeyTypePtr /* from */, + XkbKeyTypePtr /* into */, + int /* num_types */ +#endif +); + +extern Status XkbResizeKeyType( +#if NeedFunctionPrototypes + XkbDescPtr /* xkb */, + int /* type_ndx */, + int /* map_count */, + Bool /* want_preserve */, + int /* new_num_lvls */ +#endif +); + +extern void XkbFreeKeyboard( +#if NeedFunctionPrototypes + XkbDescPtr /* xkb */, + unsigned int /* which */, + Bool /* freeDesc */ +#endif +); + +extern void XkbSetActionKeyMods( +#if NeedFunctionPrototypes + XkbDescPtr /* xkb */, + XkbAction * /* act */, + unsigned int /* mods */ +#endif +); + +extern Bool XkbCheckActionVMods( +#if NeedFunctionPrototypes + XkbDescPtr /* xkb */, + XkbAction * /* act */, + unsigned int /* changed */ +#endif +); + +extern Bool XkbApplyVModChanges( +#if NeedFunctionPrototypes + XkbSrvInfoPtr /* xkbi */, + unsigned int /* changed */, + XkbChangesPtr /* pChanges */, + unsigned int * /* needChecksRtrn */, + XkbEventCausePtr /* cause */ +#endif +); + +extern void XkbApplyVModChangesToAllDevices( +#if NeedFunctionPrototypes + DeviceIntPtr /* dev */, + XkbDescPtr /* xkb */, + unsigned int /* changed */, + XkbEventCausePtr /* cause */ +#endif +); + +extern unsigned int XkbMaskForVMask( +#if NeedFunctionPrototypes + XkbDescPtr /* xkb */, + unsigned int /* vmask */ +#endif +); + +extern Bool XkbVirtualModsToReal( +#if NeedFunctionPrototypes + XkbDescPtr /* xkb */, + unsigned int /* virtua_mask */, + unsigned int * /* mask_rtrn */ +#endif +); + +extern unsigned int XkbAdjustGroup( +#if NeedFunctionPrototypes + int /* group */, + XkbControlsPtr /* ctrls */ +#endif +); + +extern KeySym *XkbResizeKeySyms( +#if NeedFunctionPrototypes + XkbDescPtr /* xkb */, + int /* key */, + int /* needed */ +#endif +); + +extern XkbAction *XkbResizeKeyActions( +#if NeedFunctionPrototypes + XkbDescPtr /* xkb */, + int /* key */, + int /* needed */ +#endif +); + +extern void XkbUpdateKeyTypesFromCore( +#if NeedFunctionPrototypes + DeviceIntPtr /* pXDev */, + KeyCode /* first */, + CARD8 /* num */, + XkbChangesPtr /* pChanges */ +#endif +); + +extern void XkbUpdateDescActions( +#if NeedFunctionPrototypes + XkbDescPtr /* xkb */, + KeyCode /* first */, + CARD8 /* num */, + XkbChangesPtr /* changes */ +#endif +); + +extern void XkbUpdateActions( +#if NeedFunctionPrototypes + DeviceIntPtr /* pXDev */, + KeyCode /* first */, + CARD8 /* num */, + XkbChangesPtr /* pChanges */, + unsigned int * /* needChecksRtrn */, + XkbEventCausePtr /* cause */ +#endif +); + +extern void XkbUpdateCoreDescription( +#if NeedFunctionPrototypes + DeviceIntPtr /* keybd */, + Bool /* resize */ +#endif +); + +extern void XkbApplyMappingChange( +#if NeedFunctionPrototypes + DeviceIntPtr /* pXDev */, + CARD8 /* request */, + KeyCode /* firstKey */, + CARD8 /* num */, + ClientPtr /* client */ +#endif +); + +extern void XkbSetIndicators( +#if NeedFunctionPrototypes + DeviceIntPtr /* pXDev */, + CARD32 /* affect */, + CARD32 /* values */, + XkbEventCausePtr /* cause */ +#endif +); + +extern void XkbUpdateIndicators( +#if NeedFunctionPrototypes + DeviceIntPtr /* keybd */, + CARD32 /* changed */, + Bool /* check_edevs */, + XkbChangesPtr /* pChanges */, + XkbEventCausePtr /* cause */ +#endif +); + +extern XkbSrvLedInfoPtr XkbAllocSrvLedInfo( +#if NeedFunctionPrototypes + DeviceIntPtr /* dev */, + KbdFeedbackPtr /* kf */, + LedFeedbackPtr /* lf */, + unsigned int /* needed_parts */ +#endif +); + +extern XkbSrvLedInfoPtr XkbFindSrvLedInfo( +#if NeedFunctionPrototypes + DeviceIntPtr /* dev */, + unsigned int /* class */, + unsigned int /* id */, + unsigned int /* needed_parts */ +#endif +); + +extern void XkbApplyLedNameChanges( +#if NeedFunctionPrototypes + DeviceIntPtr /* dev */, + XkbSrvLedInfoPtr /* sli */, + unsigned int /* changed_names */, + xkbExtensionDeviceNotify * /* ed */, + XkbChangesPtr /* changes */, + XkbEventCausePtr /* cause */ +#endif +); + +extern void XkbApplyLedMapChanges( +#if NeedFunctionPrototypes + DeviceIntPtr /* dev */, + XkbSrvLedInfoPtr /* sli */, + unsigned int /* changed_maps */, + xkbExtensionDeviceNotify * /* ed */, + XkbChangesPtr /* changes */, + XkbEventCausePtr /* cause */ +#endif +); + +extern void XkbApplyLedStateChanges( +#if NeedFunctionPrototypes + DeviceIntPtr /* dev */, + XkbSrvLedInfoPtr /* sli */, + unsigned int /* changed_leds */, + xkbExtensionDeviceNotify * /* ed */, + XkbChangesPtr /* changes */, + XkbEventCausePtr /* cause */ +#endif +); + +extern void XkbUpdateLedAutoState( +#if NeedFunctionPrototypes + DeviceIntPtr /* dev */, + XkbSrvLedInfoPtr /* sli */, + unsigned int /* maps_to_check */, + xkbExtensionDeviceNotify * /* ed */, + XkbChangesPtr /* changes */, + XkbEventCausePtr /* cause */ +#endif +); + +extern void XkbFlushLedEvents( +#if NeedFunctionPrototypes + DeviceIntPtr /* dev */, + DeviceIntPtr /* kbd */, + XkbSrvLedInfoPtr /* sli */, + xkbExtensionDeviceNotify * /* ed */, + XkbChangesPtr /* changes */, + XkbEventCausePtr /* cause */ +#endif +); + +extern void XkbUpdateAllDeviceIndicators( +#if NeedFunctionPrototypes + XkbChangesPtr /* changes */, + XkbEventCausePtr /* cause */ +#endif +); + +extern unsigned int XkbIndicatorsToUpdate( +#if NeedFunctionPrototypes + DeviceIntPtr /* dev */, + unsigned long /* state_changes */, + Bool /* enabled_ctrl_changes */ +#endif +); + +extern void XkbComputeDerivedState( +#if NeedFunctionPrototypes + XkbSrvInfoPtr /* xkbi */ +#endif +); + +extern void XkbCheckSecondaryEffects( +#if NeedFunctionPrototypes + XkbSrvInfoPtr /* xkbi */, + unsigned int /* which */, + XkbChangesPtr /* changes */, + XkbEventCausePtr /* cause */ +#endif +); + +extern void XkbCheckIndicatorMaps( +#if NeedFunctionPrototypes + DeviceIntPtr /* dev */, + XkbSrvLedInfoPtr /* sli */, + unsigned int /* which */ +#endif +); + +extern unsigned int XkbStateChangedFlags( +#if NeedFunctionPrototypes + XkbStatePtr /* old */, + XkbStatePtr /* new */ +#endif +); + +extern void XkbSendStateNotify( +#if NeedFunctionPrototypes + DeviceIntPtr /* kbd */, + xkbStateNotify * /* pSN */ +#endif +); + +extern void XkbSendMapNotify( +#if NeedFunctionPrototypes + DeviceIntPtr /* kbd */, + xkbMapNotify * /* ev */ +#endif +); + +extern int XkbComputeControlsNotify( +#if NeedFunctionPrototypes + DeviceIntPtr /* kbd */, + XkbControlsPtr /* old */, + XkbControlsPtr /* new */, + xkbControlsNotify * /* pCN */, + Bool /* forceCtrlProc */ +#endif +); + +extern void XkbSendControlsNotify( +#if NeedFunctionPrototypes + DeviceIntPtr /* kbd */, + xkbControlsNotify * /* ev */ +#endif +); + +extern void XkbSendCompatMapNotify( +#if NeedFunctionPrototypes + DeviceIntPtr /* kbd */, + xkbCompatMapNotify * /* ev */ +#endif +); + +extern void XkbSendIndicatorNotify( +#if NeedFunctionPrototypes + DeviceIntPtr /* kbd */, + int /* xkbType */, + xkbIndicatorNotify * /* ev */ +#endif +); + +extern void XkbHandleBell( +#if NeedFunctionPrototypes + BOOL /* force */, + BOOL /* eventOnly */, + DeviceIntPtr /* kbd */, + CARD8 /* percent */, + pointer /* ctrl */, + CARD8 /* class */, + Atom /* name */, + WindowPtr /* pWin */, + ClientPtr /* pClient */ +#endif +); + +extern void XkbSendAccessXNotify( +#if NeedFunctionPrototypes + DeviceIntPtr /* kbd */, + xkbAccessXNotify * /* pEv */ +#endif +); + +extern void XkbSendNamesNotify( +#if NeedFunctionPrototypes + DeviceIntPtr /* kbd */, + xkbNamesNotify * /* ev */ +#endif +); + +extern void XkbSendCompatNotify( +#if NeedFunctionPrototypes + DeviceIntPtr /* kbd */, + xkbCompatMapNotify * /* ev */ +#endif +); + +extern void XkbSendActionMessage( +#if NeedFunctionPrototypes + DeviceIntPtr /* kbd */, + xkbActionMessage * /* ev */ +#endif +); + +extern void XkbSendExtensionDeviceNotify( +#if NeedFunctionPrototypes + DeviceIntPtr /* kbd */, + ClientPtr /* client */, + xkbExtensionDeviceNotify * /* ev */ +#endif +); + +extern void XkbSendNotification( +#if NeedFunctionPrototypes + DeviceIntPtr /* kbd */, + XkbChangesPtr /* pChanges */, + XkbEventCausePtr /* cause */ +#endif +); + +extern void XkbProcessKeyboardEvent( +#if NeedFunctionPrototypes + struct _xEvent * /* xE */, + DeviceIntPtr /* keybd */, + int /* count */ +#endif +); + +extern void XkbProcessOtherEvent( +#if NeedFunctionPrototypes + struct _xEvent * /* xE */, + DeviceIntPtr /* keybd */, + int /* count */ +#endif +); + +extern void XkbHandleActions( +#if NeedFunctionPrototypes + DeviceIntPtr /* dev */, + DeviceIntPtr /* kbd */, + struct _xEvent * /* xE */, + int /* count */ +#endif +); + +extern Bool XkbEnableDisableControls( +#if NeedFunctionPrototypes + XkbSrvInfoPtr /* xkbi */, + unsigned long /* change */, + unsigned long /* newValues */, + XkbChangesPtr /* changes */, + XkbEventCausePtr /* cause */ +#endif +); + +extern void AccessXInit( +#if NeedFunctionPrototypes + DeviceIntPtr /* dev */ +#endif +); + +extern Bool AccessXFilterPressEvent( +#if NeedFunctionPrototypes + register struct _xEvent * /* xE */, + register DeviceIntPtr /* keybd */, + int /* count */ +#endif +); + +extern Bool AccessXFilterReleaseEvent( +#if NeedFunctionPrototypes + register struct _xEvent * /* xE */, + register DeviceIntPtr /* keybd */, + int /* count */ +#endif +); + +extern void AccessXCancelRepeatKey( +#if NeedFunctionPrototypes + XkbSrvInfoPtr /* xkbi */, + KeyCode /* key */ +#endif +); + +extern void AccessXComputeCurveFactor( +#if NeedFunctionPrototypes + XkbSrvInfoPtr /* xkbi */, + XkbControlsPtr /* ctrls */ +#endif +); + +extern XkbDeviceLedInfoPtr XkbAddDeviceLedInfo( +#if NeedFunctionPrototypes + XkbDeviceInfoPtr /* devi */, + unsigned int /* ledClass */, + unsigned int /* ledId */ +#endif +); + +extern XkbDeviceInfoPtr XkbAllocDeviceInfo( +#if NeedFunctionPrototypes + unsigned int /* deviceSpec */, + unsigned int /* nButtons */, + unsigned int /* szLeds */ +#endif +); + +extern void XkbFreeDeviceInfo( +#if NeedFunctionPrototypes + XkbDeviceInfoPtr /* devi */, + unsigned int /* which */, + Bool /* freeDevI */ +#endif +); + +extern Status XkbResizeDeviceButtonActions( +#if NeedFunctionPrototypes + XkbDeviceInfoPtr /* devi */, + unsigned int /* newTotal */ +#endif +); + +extern XkbInterestPtr XkbFindClientResource( +#if NeedFunctionPrototypes + DevicePtr /* inDev */, + ClientPtr /* client */ +#endif +); + +extern XkbInterestPtr XkbAddClientResource( +#if NeedFunctionPrototypes + DevicePtr /* inDev */, + ClientPtr /* client */, + XID /* id */ +#endif +); + +extern int XkbRemoveClient( +#if NeedFunctionPrototypes + DevicePtr /* inDev */, + ClientPtr /* client */ +#endif +); + +extern int XkbRemoveResourceClient( +#if NeedFunctionPrototypes + DevicePtr /* inDev */, + XID /* id */ +#endif +); + +extern int XkbDDXInitDevice( +#if NeedFunctionPrototypes + DeviceIntPtr /* dev */ +#endif +); + +extern int XkbDDXAccessXBeep( +#if NeedFunctionPrototypes + DeviceIntPtr /* dev */, + unsigned int /* what */, + unsigned int /* which */ +#endif +); + +extern void XkbDDXKeyClick( +#if NeedFunctionPrototypes + DeviceIntPtr /* dev */, + int /* keycode */, + int /* synthetic */ +#endif +); + +extern int XkbDDXUsesSoftRepeat( +#if NeedFunctionPrototypes + DeviceIntPtr /* dev */ +#endif +); + +extern void XkbDDXKeybdCtrlProc( +#if NeedFunctionPrototypes + DeviceIntPtr /* dev */, + KeybdCtrl * /* ctrl */ +#endif +); + +extern void XkbDDXChangeControls( +#if NeedFunctionPrototypes + DeviceIntPtr /* dev */, + XkbControlsPtr /* old */, + XkbControlsPtr /* new */ +#endif +); + +extern void XkbDDXUpdateIndicators( +#if NeedFunctionPrototypes + DeviceIntPtr /* keybd */, + CARD32 /* newState */ +#endif +); + +extern void XkbDDXUpdateDeviceIndicators( +#if NeedFunctionPrototypes + DeviceIntPtr /* dev */, + XkbSrvLedInfoPtr /* sli */, + CARD32 /* newState */ +#endif +); + +extern void XkbDDXFakePointerButton( +#if NeedFunctionPrototypes + int /* event */, + int /* button */ +#endif +); + +extern void XkbDDXFakePointerMotion( +#if NeedFunctionPrototypes + unsigned int /* flags */, + int /* x */, + int /* y */ +#endif +); + +extern void XkbDDXFakeDeviceButton( +#if NeedFunctionPrototypes + DeviceIntPtr /* dev */, + Bool /* press */, + int /* button */ +#endif +); + +extern int XkbDDXTerminateServer( +#if NeedFunctionPrototypes + DeviceIntPtr /* dev */, + KeyCode /* key */, + XkbAction * /* act */ +#endif +); + +extern int XkbDDXSwitchScreen( +#if NeedFunctionPrototypes + DeviceIntPtr /* dev */, + KeyCode /* key */, + XkbAction * /* act */ +#endif +); + +extern void XkbDisableComputedAutoRepeats( +#if NeedFunctionPrototypes + DeviceIntPtr /* pXDev */, + unsigned int /* key */ +#endif +); + +extern void XkbSetRepeatKeys( +#if NeedFunctionPrototypes + DeviceIntPtr /* pXDev */, + int /* key */, + int /* onoff */ +#endif +); + +extern int XkbLatchModifiers( +#if NeedFunctionPrototypes + DeviceIntPtr /* pXDev */, + CARD8 /* mask */, + CARD8 /* latches */ +#endif +); + +extern int XkbLatchGroup( +#if NeedFunctionPrototypes + DeviceIntPtr /* pXDev */, + int /* group */ +#endif +); + +extern void XkbClearAllLatchesAndLocks( +#if NeedFunctionPrototypes + DeviceIntPtr /* dev */, + XkbSrvInfoPtr /* xkbi */, + Bool /* genEv */, + XkbEventCausePtr /* cause */ +#endif +); + +extern void XkbSetRulesDflts( +#if NeedFunctionPrototypes + char * /* rulesFile */, + char * /* model */, + char * /* layout */, + char * /* variant */, + char * /* options */ +#endif +); + +extern void XkbInitDevice( +#if NeedFunctionPrototypes + DeviceIntPtr /* pXDev */ +#endif +); + +extern Bool XkbInitKeyboardDeviceStruct( +#if NeedFunctionPrototypes + DeviceIntPtr /* pXDev */, + XkbComponentNamesPtr /* pNames */, + KeySymsPtr /* pSyms */, + CARD8 /* pMods */[], + BellProcPtr /* bellProc */, + KbdCtrlProcPtr /* ctrlProc */ +#endif +); + +extern void XkbInitDevice( +#if NeedFunctionPrototypes + DeviceIntPtr /* pXDev */ +#endif +); + +extern int SProcXkbDispatch( +#if NeedFunctionPrototypes + ClientPtr /* client */ +#endif +); + +extern XkbGeometryPtr XkbLookupNamedGeometry( +#if NeedFunctionPrototypes + DeviceIntPtr /* dev */, + Atom /* name */, + Bool * /* shouldFree */ +#endif +); + +extern char * _XkbDupString( +#if NeedFunctionPrototypes + char * /* str */ +#endif +); + +extern void XkbConvertCase( +#if NeedFunctionPrototypes + KeySym /* sym */, + KeySym * /* lower */, + KeySym * /* upper */ +#endif +); + +extern Status XkbChangeKeycodeRange( +#if NeedFunctionPrototypes + XkbDescPtr /* xkb */, + int /* minKC */, + int /* maxKC */, + XkbChangesPtr /* changes */ +#endif +); + +#ifdef XKBSRV_NEED_FILE_FUNCS + +#include "extensions/XKMformat.h" +#include "extensions/XKBfile.h" +#include "extensions/XKBrules.h" + +#define _XkbListKeymaps 0 +#define _XkbListKeycodes 1 +#define _XkbListTypes 2 +#define _XkbListCompat 3 +#define _XkbListSymbols 4 +#define _XkbListGeometry 5 +#define _XkbListNumComponents 6 + +typedef struct _XkbSrvListInfo { + int szPool; + int nPool; + char * pool; + + int maxRtrn; + int nTotal; + + char * pattern[_XkbListNumComponents]; + int nFound[_XkbListNumComponents]; +} XkbSrvListInfoRec,*XkbSrvListInfoPtr; + +char * +XkbGetRulesDflts( +#if NeedFunctionPrototypes + XkbRF_VarDefsPtr /* defs */ +#endif +); + +extern void XkbSetRulesUsed( +#if NeedFunctionPrototypes + XkbRF_VarDefsPtr /* defs */ +#endif +); + + +extern Status XkbDDXList( +#if NeedFunctionPrototypes + DeviceIntPtr /* dev */, + XkbSrvListInfoPtr /* listing */, + ClientPtr /* client */ +#endif +); + +extern unsigned int XkbDDXLoadKeymapByNames( +#if NeedFunctionPrototypes + DeviceIntPtr /* keybd */, + XkbComponentNamesPtr /* names */, + unsigned int /* want */, + unsigned int /* need */, + XkbFileInfoPtr /* finfoRtrn */, + char * /* keymapNameRtrn */, + int /* keymapNameRtrnLen */ +#endif +); + +extern Bool XkbDDXNamesFromRules( +#if NeedFunctionPrototypes + DeviceIntPtr /* keybd */, + char * /* rules */, + XkbRF_VarDefsPtr /* defs */, + XkbComponentNamesPtr /* names */ +#endif +); + +extern FILE *XkbDDXOpenConfigFile( +#if NeedFunctionPrototypes + char * /* mapName */, + char * /* fileNameRtrn */, + int /* fileNameRtrnLen */ +#endif +); + +extern Bool XkbDDXApplyConfig( +#if NeedFunctionPrototypes + XPointer /* cfg_in */, + XkbSrvInfoPtr /* xkbi */ +#endif +); + +extern XPointer XkbDDXPreloadConfig( +#if NeedFunctionPrototypes + char ** /* rulesFileRtrn */, + XkbRF_VarDefsPtr /* defs */, + XkbComponentNamesPtr /* names */, + DeviceIntPtr /* dev */ +#endif +); + +extern int XkbDDXUsesSoftRepeat( +#if NeedFunctionPrototypes + DeviceIntPtr /* pXDev */ +#endif +); + +extern void XkbDDXFakePointerMotion( +#if NeedFunctionPrototypes + unsigned int /* flags */, + int /* x */, + int /* y */ +#endif +); + +extern int _XkbStrCaseCmp( +#if NeedFunctionPrototypes + char * /* str1 */, + char * /* str2 */ +#endif +); + +#endif /* XKBSRV_NEED_FILE_FUNCS */ + + +_XFUNCPROTOEND + +#define XkbAtomGetString(d,s) NameForAtom(s) + +#endif /* _XKBSRV_H_ */ + + diff --git a/XKBstr.h b/XKBstr.h new file mode 100644 index 0000000..bc63f49 --- /dev/null +++ b/XKBstr.h @@ -0,0 +1,614 @@ +/* $Xorg: XKBstr.h,v 1.3 2000/08/18 04:05:45 coskrey Exp $ */ +/************************************************************ +Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc. + +Permission to use, copy, modify, and distribute this +software and its documentation for any purpose and without +fee is hereby granted, provided that the above copyright +notice appear in all copies and that both that copyright +notice and this permission notice appear in supporting +documentation, and that the name of Silicon Graphics not be +used in advertising or publicity pertaining to distribution +of the software without specific prior written permission. +Silicon Graphics makes no representation about the suitability +of this software for any purpose. It is provided "as is" +without any express or implied warranty. + +SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS +SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON +GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL +DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, +DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE +OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH +THE USE OR PERFORMANCE OF THIS SOFTWARE. + +********************************************************/ + +#ifndef _XKBSTR_H_ +#define _XKBSTR_H_ + +#include + +#define XkbCharToInt(v) ((v)&0x80?(int)((v)|(~0xff)):(int)((v)&0x7f)) +#define XkbIntTo2Chars(i,h,l) (((h)=((i>>8)&0xff)),((l)=((i)&0xff))) + +#if defined(WORD64) && defined(UNSIGNEDBITFIELDS) +#define Xkb2CharsToInt(h,l) ((h)&0x80?(int)(((h)<<8)|(l)|(~0xffff)):\ + (int)(((h)<<8)|(l)&0x7fff)) +#else +#define Xkb2CharsToInt(h,l) ((short)(((h)<<8)|(l))) +#endif + + /* + * Common data structures and access macros + */ + +typedef struct _XkbStateRec { + unsigned char group; + unsigned char locked_group; + unsigned short base_group; + unsigned short latched_group; + unsigned char mods; + unsigned char base_mods; + unsigned char latched_mods; + unsigned char locked_mods; + unsigned char compat_state; + unsigned char grab_mods; + unsigned char compat_grab_mods; + unsigned char lookup_mods; + unsigned char compat_lookup_mods; + unsigned short ptr_buttons; +} XkbStateRec,*XkbStatePtr; +#define XkbModLocks(s) ((s)->locked_mods) +#define XkbStateMods(s) ((s)->base_mods|(s)->latched_mods|XkbModLocks(s)) +#define XkbGroupLock(s) ((s)->locked_group) +#define XkbStateGroup(s) ((s)->base_group+(s)->latched_group+XkbGroupLock(s)) +#define XkbStateFieldFromRec(s) XkbBuildCoreState((s)->lookup_mods,(s)->group) +#define XkbGrabStateFromRec(s) XkbBuildCoreState((s)->grab_mods,(s)->group) + +typedef struct _XkbMods { + unsigned char mask; /* effective mods */ + unsigned char real_mods; + unsigned short vmods; +} XkbModsRec,*XkbModsPtr; + +typedef struct _XkbKTMapEntry { + Bool active; + unsigned char level; + XkbModsRec mods; +} XkbKTMapEntryRec,*XkbKTMapEntryPtr; + +typedef struct _XkbKeyType { + XkbModsRec mods; + unsigned char num_levels; + unsigned char map_count; + XkbKTMapEntryPtr map; + XkbModsPtr preserve; + Atom name; + Atom * level_names; +} XkbKeyTypeRec, *XkbKeyTypePtr; + +#define XkbNumGroups(g) ((g)&0x0f) +#define XkbOutOfRangeGroupInfo(g) ((g)&0xf0) +#define XkbOutOfRangeGroupAction(g) ((g)&0xc0) +#define XkbOutOfRangeGroupNumber(g) (((g)&0x30)>>4) +#define XkbSetGroupInfo(g,w,n) (((w)&0xc0)|(((n)&3)<<4)|((g)&0x0f)) +#define XkbSetNumGroups(g,n) (((g)&0xf0)|((n)&0x0f)) + + /* + * Structures and access macros used primarily by the server + */ + +typedef struct _XkbBehavior { + unsigned char type; + unsigned char data; +} XkbBehavior; + +#define XkbAnyActionDataSize 7 +typedef struct _XkbAnyAction { + unsigned char type; + unsigned char data[XkbAnyActionDataSize]; +} XkbAnyAction; + +typedef struct _XkbModAction { + unsigned char type; + unsigned char flags; + unsigned char mask; + unsigned char real_mods; + unsigned char vmods1; + unsigned char vmods2; +} XkbModAction; +#define XkbModActionVMods(a) \ + ((short)(((a)->vmods1<<8)|((a)->vmods2))) +#define XkbSetModActionVMods(a,v) \ + (((a)->vmods1=(((v)>>8)&0xff)),(a)->vmods2=((v)&0xff)) + +typedef struct _XkbGroupAction { + unsigned char type; + unsigned char flags; + char group_XXX; +} XkbGroupAction; +#define XkbSAGroup(a) (XkbCharToInt((a)->group_XXX)) +#define XkbSASetGroup(a,g) ((a)->group_XXX=(g)) + +typedef struct _XkbISOAction { + unsigned char type; + unsigned char flags; + unsigned char mask; + unsigned char real_mods; + char group_XXX; + unsigned char affect; + unsigned char vmods1; + unsigned char vmods2; +} XkbISOAction; + +typedef struct _XkbPtrAction { + unsigned char type; + unsigned char flags; + unsigned char high_XXX; + unsigned char low_XXX; + unsigned char high_YYY; + unsigned char low_YYY; +} XkbPtrAction; +#define XkbPtrActionX(a) (Xkb2CharsToInt((a)->high_XXX,(a)->low_XXX)) +#define XkbPtrActionY(a) (Xkb2CharsToInt((a)->high_YYY,(a)->low_YYY)) +#define XkbSetPtrActionX(a,x) (XkbIntTo2Chars(x,(a)->high_XXX,(a)->low_XXX)) +#define XkbSetPtrActionY(a,y) (XkbIntTo2Chars(y,(a)->high_YYY,(a)->low_YYY)) + +typedef struct _XkbPtrBtnAction { + unsigned char type; + unsigned char flags; + unsigned char count; + unsigned char button; +} XkbPtrBtnAction; + +typedef struct _XkbPtrDfltAction { + unsigned char type; + unsigned char flags; + unsigned char affect; + char valueXXX; +} XkbPtrDfltAction; +#define XkbSAPtrDfltValue(a) (XkbCharToInt((a)->valueXXX)) +#define XkbSASetPtrDfltValue(a,c) ((a)->valueXXX= ((c)&0xff)) + +typedef struct _XkbSwitchScreenAction { + unsigned char type; + unsigned char flags; + char screenXXX; +} XkbSwitchScreenAction; +#define XkbSAScreen(a) (XkbCharToInt((a)->screenXXX)) +#define XkbSASetScreen(a,s) ((a)->screenXXX= ((s)&0xff)) + +typedef struct _XkbCtrlsAction { + unsigned char type; + unsigned char flags; + unsigned char ctrls3; + unsigned char ctrls2; + unsigned char ctrls1; + unsigned char ctrls0; +} XkbCtrlsAction; +#define XkbActionSetCtrls(a,c) (((a)->ctrls3=(((c)>>24)&0xff)),\ + ((a)->ctrls2=(((c)>>16)&0xff)),\ + ((a)->ctrls1=(((c)>>8)&0xff)),\ + ((a)->ctrls0=((c)&0xff))) +#define XkbActionCtrls(a) ((((unsigned int)(a)->ctrls3)<<24)|\ + (((unsigned int)(a)->ctrls2)<<16)|\ + (((unsigned int)(a)->ctrls1)<<8)|\ + ((unsigned int)((a)->ctrls0))) + +typedef struct _XkbMessageAction { + unsigned char type; + unsigned char flags; + unsigned char message[6]; +} XkbMessageAction; + +typedef struct _XkbRedirectKeyAction { + unsigned char type; + unsigned char new_key; + unsigned char mods_mask; + unsigned char mods; + unsigned char vmods_mask0; + unsigned char vmods_mask1; + unsigned char vmods0; + unsigned char vmods1; +} XkbRedirectKeyAction; + +#define XkbSARedirectVMods(a) ((((unsigned int)(a)->vmods1)<<8)|\ + ((unsigned int)(a)->vmods0)) +#define XkbSARedirectSetVMods(a,m) (((a)->vmods_mask1=(((m)>>8)&0xff)),\ + ((a)->vmods_mask0=((m)&0xff))) +#define XkbSARedirectVModsMask(a) ((((unsigned int)(a)->vmods_mask1)<<8)|\ + ((unsigned int)(a)->vmods_mask0)) +#define XkbSARedirectSetVModsMask(a,m) (((a)->vmods_mask1=(((m)>>8)&0xff)),\ + ((a)->vmods_mask0=((m)&0xff))) + +typedef struct _XkbDeviceBtnAction { + unsigned char type; + unsigned char flags; + unsigned char count; + unsigned char button; + unsigned char device; +} XkbDeviceBtnAction; + +typedef struct _XkbDeviceValuatorAction { + unsigned char type; + unsigned char device; + unsigned char v1_what; + unsigned char v1_ndx; + unsigned char v1_value; + unsigned char v2_what; + unsigned char v2_ndx; + unsigned char v2_value; +} XkbDeviceValuatorAction; + +typedef union _XkbAction { + XkbAnyAction any; + XkbModAction mods; + XkbGroupAction group; + XkbISOAction iso; + XkbPtrAction ptr; + XkbPtrBtnAction btn; + XkbPtrDfltAction dflt; + XkbSwitchScreenAction screen; + XkbCtrlsAction ctrls; + XkbMessageAction msg; + XkbRedirectKeyAction redirect; + XkbDeviceBtnAction devbtn; + XkbDeviceValuatorAction devval; + unsigned char type; +} XkbAction; + +typedef struct _XkbControls { + unsigned char mk_dflt_btn; + unsigned char num_groups; + unsigned char groups_wrap; + XkbModsRec internal; + XkbModsRec ignore_lock; + unsigned int enabled_ctrls; + unsigned short repeat_delay; + unsigned short repeat_interval; + unsigned short slow_keys_delay; + unsigned short debounce_delay; + unsigned short mk_delay; + unsigned short mk_interval; + unsigned short mk_time_to_max; + unsigned short mk_max_speed; + short mk_curve; + unsigned short ax_options; + unsigned short ax_timeout; + unsigned short axt_opts_mask; + unsigned short axt_opts_values; + unsigned int axt_ctrls_mask; + unsigned int axt_ctrls_values; + unsigned char per_key_repeat[XkbPerKeyBitArraySize]; +} XkbControlsRec, *XkbControlsPtr; + +#define XkbAX_AnyFeedback(c) ((c)->enabled_ctrls&XkbAccessXFeedbackMask) +#define XkbAX_NeedOption(c,w) ((c)->ax_options&(w)) +#define XkbAX_NeedFeedback(c,w) (XkbAX_AnyFeedback(c)&&XkbAX_NeedOption(c,w)) + +typedef struct _XkbServerMapRec { + unsigned short num_acts; + unsigned short size_acts; + XkbAction *acts; + + XkbBehavior *behaviors; + unsigned short *key_acts; +#if defined(__cplusplus) || defined(c_plusplus) + /* explicit is a C++ reserved word */ + unsigned char *c_explicit; +#else + unsigned char *explicit; +#endif + unsigned char vmods[XkbNumVirtualMods]; + unsigned short *vmodmap; +} XkbServerMapRec, *XkbServerMapPtr; + +#define XkbSMKeyActionsPtr(m,k) (&(m)->acts[(m)->key_acts[k]]) + + /* + * Structures and access macros used primarily by clients + */ + +typedef struct _XkbSymMapRec { + unsigned char kt_index[XkbNumKbdGroups]; + unsigned char group_info; + unsigned char width; + unsigned short offset; +} XkbSymMapRec, *XkbSymMapPtr; + +typedef struct _XkbClientMapRec { + unsigned char size_types; + unsigned char num_types; + XkbKeyTypePtr types; + + unsigned short size_syms; + unsigned short num_syms; + KeySym *syms; + XkbSymMapPtr key_sym_map; + + unsigned char *modmap; +} XkbClientMapRec, *XkbClientMapPtr; + +#define XkbCMKeyGroupInfo(m,k) ((m)->key_sym_map[k].group_info) +#define XkbCMKeyNumGroups(m,k) (XkbNumGroups((m)->key_sym_map[k].group_info)) +#define XkbCMKeyGroupWidth(m,k,g) (XkbCMKeyType(m,k,g)->num_levels) +#define XkbCMKeyGroupsWidth(m,k) ((m)->key_sym_map[k].width) +#define XkbCMKeyTypeIndex(m,k,g) ((m)->key_sym_map[k].kt_index[g&0x3]) +#define XkbCMKeyType(m,k,g) (&(m)->types[XkbCMKeyTypeIndex(m,k,g)]) +#define XkbCMKeyNumSyms(m,k) (XkbCMKeyGroupsWidth(m,k)*XkbCMKeyNumGroups(m,k)) +#define XkbCMKeySymsOffset(m,k) ((m)->key_sym_map[k].offset) +#define XkbCMKeySymsPtr(m,k) (&(m)->syms[XkbCMKeySymsOffset(m,k)]) + + /* + * Compatibility structures and access macros + */ + +typedef struct _XkbSymInterpretRec { + KeySym sym; + unsigned char flags; + unsigned char match; + unsigned char mods; + unsigned char virtual_mod; + XkbAnyAction act; +} XkbSymInterpretRec,*XkbSymInterpretPtr; + +typedef struct _XkbCompatMapRec { + XkbSymInterpretPtr sym_interpret; + XkbModsRec groups[XkbNumKbdGroups]; + unsigned short num_si; + unsigned short size_si; +} XkbCompatMapRec, *XkbCompatMapPtr; + +typedef struct _XkbIndicatorMapRec { + unsigned char flags; + unsigned char which_groups; + unsigned char groups; + unsigned char which_mods; + XkbModsRec mods; + unsigned int ctrls; +} XkbIndicatorMapRec, *XkbIndicatorMapPtr; + +#define XkbIM_IsAuto(i) ((((i)->flags&XkbIM_NoAutomatic)==0)&&\ + (((i)->which_groups&&(i)->groups)||\ + ((i)->which_mods&&(i)->mods.mask)||\ + ((i)->ctrls))) +#define XkbIM_InUse(i) (((i)->flags)||((i)->which_groups)||\ + ((i)->which_mods)||((i)->ctrls)) + + +typedef struct _XkbIndicatorRec { + unsigned long phys_indicators; + XkbIndicatorMapRec maps[XkbNumIndicators]; +} XkbIndicatorRec,*XkbIndicatorPtr; + +typedef struct _XkbKeyNameRec { + char name[XkbKeyNameLength]; +} XkbKeyNameRec,*XkbKeyNamePtr; + +typedef struct _XkbKeyAliasRec { + char real[XkbKeyNameLength]; + char alias[XkbKeyNameLength]; +} XkbKeyAliasRec,*XkbKeyAliasPtr; + + /* + * Names for everything + */ +typedef struct _XkbNamesRec { + Atom keycodes; + Atom geometry; + Atom symbols; + Atom types; + Atom compat; + Atom vmods[XkbNumVirtualMods]; + Atom indicators[XkbNumIndicators]; + Atom groups[XkbNumKbdGroups]; + XkbKeyNamePtr keys; + XkbKeyAliasPtr key_aliases; + Atom *radio_groups; + Atom phys_symbols; + + unsigned char num_keys; + unsigned char num_key_aliases; + unsigned short num_rg; +} XkbNamesRec,*XkbNamesPtr; + +typedef struct _XkbGeometry *XkbGeometryPtr; + /* + * Tie it all together into one big keyboard description + */ +typedef struct _XkbDesc { + struct _XDisplay * dpy; + unsigned short flags; + unsigned short device_spec; + KeyCode min_key_code; + KeyCode max_key_code; + + XkbControlsPtr ctrls; + XkbServerMapPtr server; + XkbClientMapPtr map; + XkbIndicatorPtr indicators; + XkbNamesPtr names; + XkbCompatMapPtr compat; + XkbGeometryPtr geom; +} XkbDescRec, *XkbDescPtr; +#define XkbKeyKeyTypeIndex(d,k,g) (XkbCMKeyTypeIndex((d)->map,k,g)) +#define XkbKeyKeyType(d,k,g) (XkbCMKeyType((d)->map,k,g)) +#define XkbKeyGroupWidth(d,k,g) (XkbCMKeyGroupWidth((d)->map,k,g)) +#define XkbKeyGroupsWidth(d,k) (XkbCMKeyGroupsWidth((d)->map,k)) +#define XkbKeyGroupInfo(d,k) (XkbCMKeyGroupInfo((d)->map,(k))) +#define XkbKeyNumGroups(d,k) (XkbCMKeyNumGroups((d)->map,(k))) +#define XkbKeyNumSyms(d,k) (XkbCMKeyNumSyms((d)->map,(k))) +#define XkbKeySymsPtr(d,k) (XkbCMKeySymsPtr((d)->map,(k))) +#define XkbKeySym(d,k,n) (XkbKeySymsPtr(d,k)[n]) +#define XkbKeySymEntry(d,k,sl,g) \ + (XkbKeySym(d,k,((XkbKeyGroupsWidth(d,k)*(g))+(sl)))) +#define XkbKeyAction(d,k,n) \ + (XkbKeyHasActions(d,k)?&XkbKeyActionsPtr(d,k)[n]:NULL) +#define XkbKeyActionEntry(d,k,sl,g) \ + (XkbKeyHasActions(d,k)?\ + XkbKeyAction(d,k,((XkbKeyGroupsWidth(d,k)*(g))+(sl))):NULL) + +#define XkbKeyHasActions(d,k) ((d)->server->key_acts[k]!=0) +#define XkbKeyNumActions(d,k) (XkbKeyHasActions(d,k)?XkbKeyNumSyms(d,k):1) +#define XkbKeyActionsPtr(d,k) (XkbSMKeyActionsPtr((d)->server,k)) +#define XkbKeycodeInRange(d,k) (((k)>=(d)->min_key_code)&&\ + ((k)<=(d)->max_key_code)) +#define XkbNumKeys(d) ((d)->max_key_code-(d)->min_key_code+1) + + + /* + * The following structures can be used to track changes + * to a keyboard device + */ +typedef struct _XkbMapChanges { + unsigned short changed; + KeyCode min_key_code; + KeyCode max_key_code; + unsigned char first_type; + unsigned char num_types; + KeyCode first_key_sym; + unsigned char num_key_syms; + KeyCode first_key_act; + unsigned char num_key_acts; + KeyCode first_key_behavior; + unsigned char num_key_behaviors; + KeyCode first_key_explicit; + unsigned char num_key_explicit; + KeyCode first_modmap_key; + unsigned char num_modmap_keys; + KeyCode first_vmodmap_key; + unsigned char num_vmodmap_keys; + unsigned char pad; + unsigned short vmods; +} XkbMapChangesRec,*XkbMapChangesPtr; + +typedef struct _XkbControlsChanges { + unsigned int changed_ctrls; + unsigned int enabled_ctrls_changes; + Bool num_groups_changed; +} XkbControlsChangesRec,*XkbControlsChangesPtr; + +typedef struct _XkbIndicatorChanges { + unsigned int state_changes; + unsigned int map_changes; +} XkbIndicatorChangesRec,*XkbIndicatorChangesPtr; + +typedef struct _XkbNameChanges { + unsigned int changed; + unsigned char first_type; + unsigned char num_types; + unsigned char first_lvl; + unsigned char num_lvls; + unsigned char num_aliases; + unsigned char num_rg; + unsigned char first_key; + unsigned char num_keys; + unsigned short changed_vmods; + unsigned long changed_indicators; + unsigned char changed_groups; +} XkbNameChangesRec,*XkbNameChangesPtr; + +typedef struct _XkbCompatChanges { + unsigned char changed_groups; + unsigned short first_si; + unsigned short num_si; +} XkbCompatChangesRec,*XkbCompatChangesPtr; + +typedef struct _XkbChanges { + unsigned short device_spec; + unsigned short state_changes; + XkbMapChangesRec map; + XkbControlsChangesRec ctrls; + XkbIndicatorChangesRec indicators; + XkbNameChangesRec names; + XkbCompatChangesRec compat; +} XkbChangesRec, *XkbChangesPtr; + + /* + * These data structures are used to construct a keymap from + * a set of components or to list components in the server + * database. + */ +typedef struct _XkbComponentNames { + char * keymap; + char * keycodes; + char * types; + char * compat; + char * symbols; + char * geometry; +} XkbComponentNamesRec, *XkbComponentNamesPtr; + +typedef struct _XkbComponentName { + unsigned short flags; + char * name; +} XkbComponentNameRec,*XkbComponentNamePtr; + +typedef struct _XkbComponentList { + int num_keymaps; + int num_keycodes; + int num_types; + int num_compat; + int num_symbols; + int num_geometry; + XkbComponentNamePtr keymaps; + XkbComponentNamePtr keycodes; + XkbComponentNamePtr types; + XkbComponentNamePtr compat; + XkbComponentNamePtr symbols; + XkbComponentNamePtr geometry; +} XkbComponentListRec, *XkbComponentListPtr; + + /* + * The following data structures describe and track changes to a + * non-keyboard extension device + */ +typedef struct _XkbDeviceLedInfo { + unsigned short led_class; + unsigned short led_id; + unsigned int phys_indicators; + unsigned int maps_present; + unsigned int names_present; + unsigned int state; + Atom names[XkbNumIndicators]; + XkbIndicatorMapRec maps[XkbNumIndicators]; +} XkbDeviceLedInfoRec,*XkbDeviceLedInfoPtr; + +typedef struct _XkbDeviceInfo { + char * name; + Atom type; + unsigned short device_spec; + Bool has_own_state; + unsigned short supported; + unsigned short unsupported; + + unsigned short num_btns; + XkbAction * btn_acts; + + unsigned short sz_leds; + unsigned short num_leds; + unsigned short dflt_kbd_fb; + unsigned short dflt_led_fb; + XkbDeviceLedInfoPtr leds; +} XkbDeviceInfoRec,*XkbDeviceInfoPtr; + +#define XkbXI_DevHasBtnActs(d) (((d)->num_btns>0)&&((d)->btn_acts!=NULL)) +#define XkbXI_LegalDevBtn(d,b) (XkbXI_DevHasBtnActs(d)&&((b)<(d)->num_btns)) +#define XkbXI_DevHasLeds(d) (((d)->num_leds>0)&&((d)->leds!=NULL)) + +typedef struct _XkbDeviceLedChanges { + unsigned short led_class; + unsigned short led_id; + unsigned int defined; /* names or maps changed */ + struct _XkbDeviceLedChanges *next; +} XkbDeviceLedChangesRec,*XkbDeviceLedChangesPtr; + +typedef struct _XkbDeviceChanges { + unsigned int changed; + unsigned short first_btn; + unsigned short num_btns; + XkbDeviceLedChangesRec leds; +} XkbDeviceChangesRec,*XkbDeviceChangesPtr; + +#endif /* _XKBSTR_H_ */ -- cgit v1.2.1