diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2020-03-09 15:27:38 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2020-03-09 15:27:38 (GMT) |
commit | b5074b17926bd20aab0e442bc360e90d5cbcc9d7 (patch) | |
tree | 520c4c283487a13e496c9bceeab70537d1d26dc4 /xlib/X11 | |
parent | 7b507ce5d4879deb3479ee07dc39e2f7b9bb86c2 (diff) | |
download | tk-b5074b17926bd20aab0e442bc360e90d5cbcc9d7.zip tk-b5074b17926bd20aab0e442bc360e90d5cbcc9d7.tar.gz tk-b5074b17926bd20aab0e442bc360e90d5cbcc9d7.tar.bz2 |
Add XkbOpenDisplay and XkbKeycodeToKeysym to X11 stub table. MacOS not done yet.
Diffstat (limited to 'xlib/X11')
-rw-r--r-- | xlib/X11/XKBlib.h | 1149 | ||||
-rw-r--r-- | xlib/X11/extensions/XKB.h | 786 | ||||
-rw-r--r-- | xlib/X11/extensions/XKBstr.h | 642 |
3 files changed, 2577 insertions, 0 deletions
diff --git a/xlib/X11/XKBlib.h b/xlib/X11/XKBlib.h new file mode 100644 index 0000000..8f6c72c --- /dev/null +++ b/xlib/X11/XKBlib.h @@ -0,0 +1,1149 @@ +/************************************************************ +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 _X11_XKBLIB_H_ +#define _X11_XKBLIB_H_ + +#include <X11/Xlib.h> +#include <X11/extensions/XKBstr.h> + +typedef struct _XkbAnyEvent { + int type; /* XkbAnyEvent */ + unsigned long serial; /* # of last req processed by server */ + Bool send_event; /* is this from a SendEvent request? */ + Display * display; /* Display the event was read from */ + Time time; /* milliseconds */ + int xkb_type; /* XKB event minor code */ + unsigned int device; /* device ID */ +} XkbAnyEvent; + +typedef struct _XkbNewKeyboardNotify { + int type; /* XkbAnyEvent */ + unsigned long serial; /* of last req processed by server */ + Bool send_event; /* is this from a SendEvent request? */ + Display * display; /* Display the event was read from */ + Time time; /* milliseconds */ + int xkb_type; /* XkbNewKeyboardNotify */ + int device; /* device ID */ + int old_device; /* device ID of previous keyboard */ + int min_key_code; /* minimum key code */ + int max_key_code; /* maximum key code */ + int old_min_key_code;/* min key code of previous kbd */ + int old_max_key_code;/* max key code of previous kbd */ + unsigned int changed; /* changed aspects of the keyboard */ + char req_major; /* major and minor opcode of req */ + char req_minor; /* that caused change, if applicable */ +} XkbNewKeyboardNotifyEvent; + +typedef struct _XkbMapNotifyEvent { + int type; /* XkbAnyEvent */ + unsigned long serial; /* of last req processed by server */ + Bool send_event; /* is this from a SendEvent request */ + Display * display; /* Display the event was read from */ + Time time; /* milliseconds */ + int xkb_type; /* XkbMapNotify */ + int device; /* device ID */ + unsigned int changed; /* fields which have been changed */ + unsigned int flags; /* reserved */ + int first_type; /* first changed key type */ + int num_types; /* number of changed key types */ + KeyCode min_key_code; + KeyCode max_key_code; + KeyCode first_key_sym; + KeyCode first_key_act; + KeyCode first_key_behavior; + KeyCode first_key_explicit; + KeyCode first_modmap_key; + KeyCode first_vmodmap_key; + int num_key_syms; + int num_key_acts; + int num_key_behaviors; + int num_key_explicit; + int num_modmap_keys; + int num_vmodmap_keys; + unsigned int vmods; /* mask of changed virtual mods */ +} XkbMapNotifyEvent; + +typedef struct _XkbStateNotifyEvent { + int type; /* XkbAnyEvent */ + unsigned long serial; /* # of last req processed by server */ + Bool send_event; /* is this from a SendEvent request? */ + Display * display; /* Display the event was read from */ + Time time; /* milliseconds */ + int xkb_type; /* XkbStateNotify */ + int device; /* device ID */ + unsigned int changed; /* mask of changed state components */ + int group; /* keyboard group */ + int base_group; /* base keyboard group */ + int latched_group; /* latched keyboard group */ + int locked_group; /* locked keyboard group */ + unsigned int mods; /* modifier state */ + unsigned int base_mods; /* base modifier state */ + unsigned int latched_mods; /* latched modifiers */ + unsigned int locked_mods; /* locked modifiers */ + int compat_state; /* compatibility state */ + unsigned char grab_mods; /* mods used for grabs */ + unsigned char compat_grab_mods;/* grab mods for non-XKB clients */ + unsigned char lookup_mods; /* mods sent to clients */ + unsigned char compat_lookup_mods; /* mods sent to non-XKB clients */ + int ptr_buttons; /* pointer button state */ + KeyCode keycode; /* keycode that caused the change */ + char event_type; /* KeyPress or KeyRelease */ + char req_major; /* Major opcode of request */ + char req_minor; /* Minor opcode of request */ +} XkbStateNotifyEvent; + +typedef struct _XkbControlsNotify { + int type; /* XkbAnyEvent */ + unsigned long serial; /* of last req processed by server */ + Bool send_event; /* is this from a SendEvent request? */ + Display * display; /* Display the event was read from */ + Time time; /* milliseconds */ + int xkb_type; /* XkbControlsNotify */ + int device; /* device ID */ + unsigned int changed_ctrls; /* controls with changed sub-values */ + unsigned int enabled_ctrls; /* controls currently enabled */ + unsigned int enabled_ctrl_changes;/* controls just {en,dis}abled */ + int num_groups; /* total groups on keyboard */ + KeyCode keycode; /* key that caused change or 0 */ + char event_type; /* type of event that caused change */ + char req_major; /* if keycode==0, major and minor */ + char req_minor; /* opcode of req that caused change */ +} XkbControlsNotifyEvent; + +typedef struct _XkbIndicatorNotify { + int type; /* XkbAnyEvent */ + unsigned long serial; /* of last req processed by server */ + Bool send_event; /* is this from a SendEvent request? */ + Display * display; /* Display the event was read from */ + Time time; /* milliseconds */ + int xkb_type; /* XkbIndicatorNotify */ + int device; /* device ID */ + unsigned int changed; /* indicators with new state or map */ + unsigned int state; /* current state of all indicators */ +} XkbIndicatorNotifyEvent; + +typedef struct _XkbNamesNotify { + int type; /* XkbAnyEvent */ + unsigned long serial; /* of last req processed by server */ + Bool send_event; /* is this from a SendEvent request? */ + Display * display; /* Display the event was read from */ + Time time; /* milliseconds */ + int xkb_type; /* XkbNamesNotify */ + int device; /* device ID */ + unsigned int changed; /* names that have changed */ + int first_type; /* first key type with new name */ + int num_types; /* number of key types with new names */ + int first_lvl; /* first key type new new level names */ + int num_lvls; /* # of key types w/new level names */ + int num_aliases; /* total number of key aliases*/ + int num_radio_groups;/* total number of radio groups */ + unsigned int changed_vmods; /* virtual modifiers with new names */ + unsigned int changed_groups; /* groups with new names */ + unsigned int changed_indicators;/* indicators with new names */ + int first_key; /* first key with new name */ + int num_keys; /* number of keys with new names */ +} XkbNamesNotifyEvent; + +typedef struct _XkbCompatMapNotify { + int type; /* XkbAnyEvent */ + unsigned long serial; /* of last req processed by server */ + Bool send_event; /* is this from a SendEvent request? */ + Display * display; /* Display the event was read from */ + Time time; /* milliseconds */ + int xkb_type; /* XkbCompatMapNotify */ + int device; /* device ID */ + unsigned int changed_groups; /* groups with new compat maps */ + int first_si; /* first new symbol interp */ + int num_si; /* number of new symbol interps */ + int num_total_si; /* total # of symbol interps */ +} XkbCompatMapNotifyEvent; + +typedef struct _XkbBellNotify { + int type; /* XkbAnyEvent */ + unsigned long serial; /* of last req processed by server */ + Bool send_event; /* is this from a SendEvent request? */ + Display * display; /* Display the event was read from */ + Time time; /* milliseconds */ + int xkb_type; /* XkbBellNotify */ + int device; /* device ID */ + int percent; /* requested volume as a % of maximum */ + int pitch; /* requested pitch in Hz */ + int duration; /* requested duration in useconds */ + int bell_class; /* (input extension) feedback class */ + int bell_id; /* (input extension) ID of feedback */ + Atom name; /* "name" of requested bell */ + Window window; /* window associated with event */ + Bool event_only; /* "event only" requested */ +} XkbBellNotifyEvent; + +typedef struct _XkbActionMessage { + int type; /* XkbAnyEvent */ + unsigned long serial; /* of last req processed by server */ + Bool send_event; /* is this from a SendEvent request? */ + Display * display; /* Display the event was read from */ + Time time; /* milliseconds */ + int xkb_type; /* XkbActionMessage */ + int device; /* device ID */ + KeyCode keycode; /* key that generated the event */ + Bool press; /* true if act caused by key press */ + Bool key_event_follows;/* true if key event also generated */ + int group; /* effective group */ + unsigned int mods; /* effective mods */ + char message[XkbActionMessageLength+1]; + /* message -- leave space for NUL */ +} XkbActionMessageEvent; + +typedef struct _XkbAccessXNotify { + int type; /* XkbAnyEvent */ + unsigned long serial; /* of last req processed by server */ + Bool send_event; /* is this from a SendEvent request? */ + Display * display; /* Display the event was read from */ + Time time; /* milliseconds */ + int xkb_type; /* XkbAccessXNotify */ + int device; /* device ID */ + int detail; /* XkbAXN_* */ + int keycode; /* key of event */ + int sk_delay; /* current slow keys delay */ + int debounce_delay; /* current debounce delay */ +} XkbAccessXNotifyEvent; + +typedef struct _XkbExtensionDeviceNotify { + int type; /* XkbAnyEvent */ + unsigned long serial; /* of last req processed by server */ + Bool send_event; /* is this from a SendEvent request? */ + Display * display; /* Display the event was read from */ + Time time; /* milliseconds */ + int xkb_type; /* XkbExtensionDeviceNotify */ + int device; /* device ID */ + unsigned int reason; /* reason for the event */ + unsigned int supported; /* mask of supported features */ + unsigned int unsupported; /* mask of unsupported features */ + /* that some app tried to use */ + int first_btn; /* first button that changed */ + int num_btns; /* range of buttons changed */ + unsigned int leds_defined; /* indicators with names or maps */ + unsigned int led_state; /* current state of the indicators */ + int led_class; /* feedback class for led changes */ + int led_id; /* feedback id for led changes */ +} XkbExtensionDeviceNotifyEvent; + +typedef union _XkbEvent { + int type; + XkbAnyEvent any; + XkbNewKeyboardNotifyEvent new_kbd; + XkbMapNotifyEvent map; + XkbStateNotifyEvent state; + XkbControlsNotifyEvent ctrls; + XkbIndicatorNotifyEvent indicators; + XkbNamesNotifyEvent names; + XkbCompatMapNotifyEvent compat; + XkbBellNotifyEvent bell; + XkbActionMessageEvent message; + XkbAccessXNotifyEvent accessx; + XkbExtensionDeviceNotifyEvent device; + XEvent core; +} XkbEvent; + +typedef struct _XkbKbdDpyState XkbKbdDpyStateRec,*XkbKbdDpyStatePtr; + + /* XkbOpenDisplay error codes */ +#define XkbOD_Success 0 +#define XkbOD_BadLibraryVersion 1 +#define XkbOD_ConnectionRefused 2 +#define XkbOD_NonXkbServer 3 +#define XkbOD_BadServerVersion 4 + + /* Values for XlibFlags */ +#define XkbLC_ForceLatin1Lookup (1<<0) +#define XkbLC_ConsumeLookupMods (1<<1) +#define XkbLC_AlwaysConsumeShiftAndLock (1<<2) +#define XkbLC_IgnoreNewKeyboards (1<<3) +#define XkbLC_ControlFallback (1<<4) +#define XkbLC_ConsumeKeysOnComposeFail (1<<29) +#define XkbLC_ComposeLED (1<<30) +#define XkbLC_BeepOnComposeFail (1<<31) + +#define XkbLC_AllComposeControls (0xc0000000) +#define XkbLC_AllControls (0xc000001f) + +_XFUNCPROTOBEGIN + +extern Bool XkbIgnoreExtension( + Bool /* ignore */ +); + +extern Display *XkbOpenDisplay( + char * /* name */, + int * /* ev_rtrn */, + int * /* err_rtrn */, + int * /* major_rtrn */, + int * /* minor_rtrn */, + int * /* reason */ +); + +extern Bool XkbQueryExtension( + Display * /* dpy */, + int * /* opcodeReturn */, + int * /* eventBaseReturn */, + int * /* errorBaseReturn */, + int * /* majorRtrn */, + int * /* minorRtrn */ +); + +extern Bool XkbUseExtension( + Display * /* dpy */, + int * /* major_rtrn */, + int * /* minor_rtrn */ +); + +extern Bool XkbLibraryVersion( + int * /* libMajorRtrn */, + int * /* libMinorRtrn */ +); + +extern unsigned int XkbSetXlibControls( + Display* /* dpy */, + unsigned int /* affect */, + unsigned int /* values */ +); + +extern unsigned int XkbGetXlibControls( + Display* /* dpy */ +); + +extern unsigned int XkbXlibControlsImplemented(void); + +typedef Atom (*XkbInternAtomFunc)( + Display * /* dpy */, + _Xconst char * /* name */, + Bool /* only_if_exists */ +); + +typedef char * (*XkbGetAtomNameFunc)( + Display * /* dpy */, + Atom /* atom */ +); + +extern void XkbSetAtomFuncs( + XkbInternAtomFunc /* getAtom */, + XkbGetAtomNameFunc /* getName */ +); + +extern KeySym XkbKeycodeToKeysym( + Display * /* dpy */, +#if NeedWidePrototypes + unsigned int /* kc */, +#else + KeyCode /* kc */, +#endif + int /* group */, + int /* level */ +); + +extern unsigned int XkbKeysymToModifiers( + Display * /* dpy */, + KeySym /* ks */ +); + +extern Bool XkbLookupKeySym( + Display * /* dpy */, + KeyCode /* keycode */, + unsigned int /* modifiers */, + unsigned int * /* modifiers_return */, + KeySym * /* keysym_return */ +); + +extern int XkbLookupKeyBinding( + Display * /* dpy */, + KeySym /* sym_rtrn */, + unsigned int /* mods */, + char * /* buffer */, + int /* nbytes */, + int * /* extra_rtrn */ +); + +extern Bool XkbTranslateKeyCode( + XkbDescPtr /* xkb */, + KeyCode /* keycode */, + unsigned int /* modifiers */, + unsigned int * /* modifiers_return */, + KeySym * /* keysym_return */ +); + +extern int XkbTranslateKeySym( + Display * /* dpy */, + register KeySym * /* sym_return */, + unsigned int /* modifiers */, + char * /* buffer */, + int /* nbytes */, + int * /* extra_rtrn */ +); + +extern Bool XkbSetAutoRepeatRate( + Display * /* dpy */, + unsigned int /* deviceSpec */, + unsigned int /* delay */, + unsigned int /* interval */ +); + +extern Bool XkbGetAutoRepeatRate( + Display * /* dpy */, + unsigned int /* deviceSpec */, + unsigned int * /* delayRtrn */, + unsigned int * /* intervalRtrn */ +); + +extern Bool XkbChangeEnabledControls( + Display * /* dpy */, + unsigned int /* deviceSpec */, + unsigned int /* affect */, + unsigned int /* values */ +); + +extern Bool XkbDeviceBell( + Display * /* dpy */, + Window /* win */, + int /* deviceSpec */, + int /* bellClass */, + int /* bellID */, + int /* percent */, + Atom /* name */ +); + +extern Bool XkbForceDeviceBell( + Display * /* dpy */, + int /* deviceSpec */, + int /* bellClass */, + int /* bellID */, + int /* percent */ +); + +extern Bool XkbDeviceBellEvent( + Display * /* dpy */, + Window /* win */, + int /* deviceSpec */, + int /* bellClass */, + int /* bellID */, + int /* percent */, + Atom /* name */ +); + +extern Bool XkbBell( + Display * /* dpy */, + Window /* win */, + int /* percent */, + Atom /* name */ +); + +extern Bool XkbForceBell( + Display * /* dpy */, + int /* percent */ +); + +extern Bool XkbBellEvent( + Display * /* dpy */, + Window /* win */, + int /* percent */, + Atom /* name */ +); + +extern Bool XkbSelectEvents( + Display * /* dpy */, + unsigned int /* deviceID */, + unsigned int /* affect */, + unsigned int /* values */ +); + +extern Bool XkbSelectEventDetails( + Display * /* dpy */, + unsigned int /* deviceID */, + unsigned int /* eventType */, + unsigned long /* affect */, + unsigned long /* details */ +); + +extern void XkbNoteMapChanges( + XkbMapChangesPtr /* old */, + XkbMapNotifyEvent * /* new */, + unsigned int /* wanted */ +); + +extern void XkbNoteNameChanges( + XkbNameChangesPtr /* old */, + XkbNamesNotifyEvent * /* new */, + unsigned int /* wanted */ +); + +extern Status XkbGetIndicatorState( + Display * /* dpy */, + unsigned int /* deviceSpec */, + unsigned int * /* pStateRtrn */ +); + +extern Status XkbGetDeviceIndicatorState( + Display * /* dpy */, + unsigned int /* deviceSpec */, + unsigned int /* ledClass */, + unsigned int /* ledID */, + unsigned int * /* pStateRtrn */ +); + +extern Status XkbGetIndicatorMap( + Display * /* dpy */, + unsigned long /* which */, + XkbDescPtr /* desc */ +); + +extern Bool XkbSetIndicatorMap( + Display * /* dpy */, + unsigned long /* which */, + XkbDescPtr /* desc */ +); + +#define XkbNoteIndicatorMapChanges(o,n,w) \ + ((o)->map_changes|=((n)->map_changes&(w))) +#define XkbNoteIndicatorStateChanges(o,n,w)\ + ((o)->state_changes|=((n)->state_changes&(w))) +#define XkbGetIndicatorMapChanges(d,x,c) \ + (XkbGetIndicatorMap((d),(c)->map_changes,x)) +#define XkbChangeIndicatorMaps(d,x,c) \ + (XkbSetIndicatorMap((d),(c)->map_changes,x)) + +extern Bool XkbGetNamedIndicator( + Display * /* dpy */, + Atom /* name */, + int * /* pNdxRtrn */, + Bool * /* pStateRtrn */, + XkbIndicatorMapPtr /* pMapRtrn */, + Bool * /* pRealRtrn */ +); + +extern Bool XkbGetNamedDeviceIndicator( + Display * /* dpy */, + unsigned int /* deviceSpec */, + unsigned int /* ledClass */, + unsigned int /* ledID */, + Atom /* name */, + int * /* pNdxRtrn */, + Bool * /* pStateRtrn */, + XkbIndicatorMapPtr /* pMapRtrn */, + Bool * /* pRealRtrn */ +); + +extern Bool XkbSetNamedIndicator( + Display * /* dpy */, + Atom /* name */, + Bool /* changeState */, + Bool /* state */, + Bool /* createNewMap */, + XkbIndicatorMapPtr /* pMap */ +); + +extern Bool XkbSetNamedDeviceIndicator( + Display * /* dpy */, + unsigned int /* deviceSpec */, + unsigned int /* ledClass */, + unsigned int /* ledID */, + Atom /* name */, + Bool /* changeState */, + Bool /* state */, + Bool /* createNewMap */, + XkbIndicatorMapPtr /* pMap */ +); + +extern Bool XkbLockModifiers( + Display * /* dpy */, + unsigned int /* deviceSpec */, + unsigned int /* affect */, + unsigned int /* values */ +); + +extern Bool XkbLatchModifiers( + Display * /* dpy */, + unsigned int /* deviceSpec */, + unsigned int /* affect */, + unsigned int /* values */ +); + +extern Bool XkbLockGroup( + Display * /* dpy */, + unsigned int /* deviceSpec */, + unsigned int /* group */ +); + +extern Bool XkbLatchGroup( + Display * /* dpy */, + unsigned int /* deviceSpec */, + unsigned int /* group */ +); + +extern Bool XkbSetServerInternalMods( + Display * /* dpy */, + unsigned int /* deviceSpec */, + unsigned int /* affectReal */, + unsigned int /* realValues */, + unsigned int /* affectVirtual */, + unsigned int /* virtualValues */ +); + +extern Bool XkbSetIgnoreLockMods( + Display * /* dpy */, + unsigned int /* deviceSpec */, + unsigned int /* affectReal */, + unsigned int /* realValues */, + unsigned int /* affectVirtual */, + unsigned int /* virtualValues */ +); + + +extern Bool XkbVirtualModsToReal( + XkbDescPtr /* xkb */, + unsigned int /* virtual_mask */, + unsigned int * /* mask_rtrn */ +); + +extern Bool XkbComputeEffectiveMap( + XkbDescPtr /* xkb */, + XkbKeyTypePtr /* type */, + unsigned char * /* map_rtrn */ +); + +extern Status XkbInitCanonicalKeyTypes( + XkbDescPtr /* xkb */, + unsigned int /* which */, + int /* keypadVMod */ +); + +extern XkbDescPtr XkbAllocKeyboard( + void +); + +extern void XkbFreeKeyboard( + XkbDescPtr /* xkb */, + unsigned int /* which */, + Bool /* freeDesc */ +); + +extern Status XkbAllocClientMap( + XkbDescPtr /* xkb */, + unsigned int /* which */, + unsigned int /* nTypes */ +); + +extern Status XkbAllocServerMap( + XkbDescPtr /* xkb */, + unsigned int /* which */, + unsigned int /* nActions */ +); + +extern void XkbFreeClientMap( + XkbDescPtr /* xkb */, + unsigned int /* what */, + Bool /* freeMap */ +); + +extern void XkbFreeServerMap( + XkbDescPtr /* xkb */, + unsigned int /* what */, + Bool /* freeMap */ +); + +extern XkbKeyTypePtr XkbAddKeyType( + XkbDescPtr /* xkb */, + Atom /* name */, + int /* map_count */, + Bool /* want_preserve */, + int /* num_lvls */ +); + +extern Status XkbAllocIndicatorMaps( + XkbDescPtr /* xkb */ +); + +extern void XkbFreeIndicatorMaps( + XkbDescPtr /* xkb */ +); + +extern XkbDescPtr XkbGetMap( + Display * /* dpy */, + unsigned int /* which */, + unsigned int /* deviceSpec */ +); + +extern Status XkbGetUpdatedMap( + Display * /* dpy */, + unsigned int /* which */, + XkbDescPtr /* desc */ +); + +extern Status XkbGetMapChanges( + Display * /* dpy */, + XkbDescPtr /* xkb */, + XkbMapChangesPtr /* changes */ +); + + +extern Status XkbRefreshKeyboardMapping( + XkbMapNotifyEvent * /* event */ +); + +extern Status XkbGetKeyTypes( + Display * /* dpy */, + unsigned int /* first */, + unsigned int /* num */, + XkbDescPtr /* xkb */ +); + +extern Status XkbGetKeySyms( + Display * /* dpy */, + unsigned int /* first */, + unsigned int /* num */, + XkbDescPtr /* xkb */ +); + +extern Status XkbGetKeyActions( + Display * /* dpy */, + unsigned int /* first */, + unsigned int /* num */, + XkbDescPtr /* xkb */ +); + +extern Status XkbGetKeyBehaviors( + Display * /* dpy */, + unsigned int /* firstKey */, + unsigned int /* nKeys */, + XkbDescPtr /* desc */ +); + +extern Status XkbGetVirtualMods( + Display * /* dpy */, + unsigned int /* which */, + XkbDescPtr /* desc */ +); + +extern Status XkbGetKeyExplicitComponents( + Display * /* dpy */, + unsigned int /* firstKey */, + unsigned int /* nKeys */, + XkbDescPtr /* desc */ +); + +extern Status XkbGetKeyModifierMap( + Display * /* dpy */, + unsigned int /* firstKey */, + unsigned int /* nKeys */, + XkbDescPtr /* desc */ +); + +extern Status XkbGetKeyVirtualModMap( + Display * /* dpy */, + unsigned int /* first */, + unsigned int /* num */, + XkbDescPtr /* xkb */ +); + +extern Status XkbAllocControls( + XkbDescPtr /* xkb */, + unsigned int /* which*/ +); + +extern void XkbFreeControls( + XkbDescPtr /* xkb */, + unsigned int /* which */, + Bool /* freeMap */ +); + +extern Status XkbGetControls( + Display * /* dpy */, + unsigned long /* which */, + XkbDescPtr /* desc */ +); + +extern Bool XkbSetControls( + Display * /* dpy */, + unsigned long /* which */, + XkbDescPtr /* desc */ +); + +extern void XkbNoteControlsChanges( + XkbControlsChangesPtr /* old */, + XkbControlsNotifyEvent * /* new */, + unsigned int /* wanted */ +); + +#define XkbGetControlsChanges(d,x,c) XkbGetControls(d,(c)->changed_ctrls,x) +#define XkbChangeControls(d,x,c) XkbSetControls(d,(c)->changed_ctrls,x) + +extern Status XkbAllocCompatMap( + XkbDescPtr /* xkb */, + unsigned int /* which */, + unsigned int /* nInterpret */ +); + +extern void XkbFreeCompatMap( + XkbDescPtr /* xkb */, + unsigned int /* which */, + Bool /* freeMap */ +); + +extern Status XkbGetCompatMap( + Display * /* dpy */, + unsigned int /* which */, + XkbDescPtr /* xkb */ +); + +extern Bool XkbSetCompatMap( + Display * /* dpy */, + unsigned int /* which */, + XkbDescPtr /* xkb */, + Bool /* updateActions */ +); + +extern XkbSymInterpretPtr XkbAddSymInterpret( + XkbDescPtr /* xkb */, + XkbSymInterpretPtr /* si */, + Bool /* updateMap */, + XkbChangesPtr /* changes */ +); + +extern Status XkbAllocNames( + XkbDescPtr /* xkb */, + unsigned int /* which */, + int /* nTotalRG */, + int /* nTotalAliases */ +); + +extern Status XkbGetNames( + Display * /* dpy */, + unsigned int /* which */, + XkbDescPtr /* desc */ +); + +extern Bool XkbSetNames( + Display * /* dpy */, + unsigned int /* which */, + unsigned int /* firstType */, + unsigned int /* nTypes */, + XkbDescPtr /* desc */ +); + +extern Bool XkbChangeNames( + Display * /* dpy */, + XkbDescPtr /* xkb */, + XkbNameChangesPtr /* changes */ +); + +extern void XkbFreeNames( + XkbDescPtr /* xkb */, + unsigned int /* which */, + Bool /* freeMap */ +); + + +extern Status XkbGetState( + Display * /* dpy */, + unsigned int /* deviceSpec */, + XkbStatePtr /* rtrnState */ +); + +extern Bool XkbSetMap( + Display * /* dpy */, + unsigned int /* which */, + XkbDescPtr /* desc */ +); + +extern Bool XkbChangeMap( + Display* /* dpy */, + XkbDescPtr /* desc */, + XkbMapChangesPtr /* changes */ +); + +extern Bool XkbSetDetectableAutoRepeat( + Display * /* dpy */, + Bool /* detectable */, + Bool * /* supported */ +); + +extern Bool XkbGetDetectableAutoRepeat( + Display * /* dpy */, + Bool * /* supported */ +); + +extern Bool XkbSetAutoResetControls( + Display * /* dpy */, + unsigned int /* changes */, + unsigned int * /* auto_ctrls */, + unsigned int * /* auto_values */ +); + +extern Bool XkbGetAutoResetControls( + Display * /* dpy */, + unsigned int * /* auto_ctrls */, + unsigned int * /* auto_ctrl_values */ +); + +extern Bool XkbSetPerClientControls( + Display * /* dpy */, + unsigned int /* change */, + unsigned int * /* values */ +); + +extern Bool XkbGetPerClientControls( + Display * /* dpy */, + unsigned int * /* ctrls */ +); + +extern Status XkbCopyKeyType( + XkbKeyTypePtr /* from */, + XkbKeyTypePtr /* into */ +); + +extern Status XkbCopyKeyTypes( + XkbKeyTypePtr /* from */, + XkbKeyTypePtr /* into */, + int /* num_types */ +); + +extern Status XkbResizeKeyType( + XkbDescPtr /* xkb */, + int /* type_ndx */, + int /* map_count */, + Bool /* want_preserve */, + int /* new_num_lvls */ +); + +extern KeySym *XkbResizeKeySyms( + XkbDescPtr /* desc */, + int /* forKey */, + int /* symsNeeded */ +); + +extern XkbAction *XkbResizeKeyActions( + XkbDescPtr /* desc */, + int /* forKey */, + int /* actsNeeded */ +); + +extern Status XkbChangeTypesOfKey( + XkbDescPtr /* xkb */, + int /* key */, + int /* num_groups */, + unsigned int /* groups */, + int * /* newTypes */, + XkbMapChangesPtr /* pChanges */ +); + +extern Status XkbChangeKeycodeRange( + XkbDescPtr /* xkb */, + int /* minKC */, + int /* maxKC */, + XkbChangesPtr /* changes */ +); + +/***====================================================================***/ + +extern XkbComponentListPtr XkbListComponents( + Display * /* dpy */, + unsigned int /* deviceSpec */, + XkbComponentNamesPtr /* ptrns */, + int * /* max_inout */ +); + +extern void XkbFreeComponentList( + XkbComponentListPtr /* list */ +); + +extern XkbDescPtr XkbGetKeyboard( + Display * /* dpy */, + unsigned int /* which */, + unsigned int /* deviceSpec */ +); + +extern XkbDescPtr XkbGetKeyboardByName( + Display * /* dpy */, + unsigned int /* deviceSpec */, + XkbComponentNamesPtr /* names */, + unsigned int /* want */, + unsigned int /* need */, + Bool /* load */ +); + +/***====================================================================***/ + +extern int XkbKeyTypesForCoreSymbols( /* returns # of groups */ + XkbDescPtr /* xkb */, /* keyboard device */ + int /* map_width */, /* width of core KeySym array */ + KeySym * /* core_syms */, /* always mapWidth symbols */ + unsigned int /* protected */, /* explicit key types */ + int * /* types_inout */, /* always four type indices */ + KeySym * /* xkb_syms_rtrn */ /* must have enough space */ +); + +extern Bool XkbApplyCompatMapToKey( /* False only on error */ + XkbDescPtr /* xkb */, /* keymap to be edited */ + KeyCode /* key */, /* key to be updated */ + XkbChangesPtr /* changes */ /* resulting changes to map */ +); + +extern Bool XkbUpdateMapFromCore( /* False only on error */ + XkbDescPtr /* xkb */, /* XKB keyboard to be edited */ + KeyCode /* first_key */, /* first changed key */ + int /* num_keys */, /* number of changed keys */ + int /* map_width */, /* width of core keymap */ + KeySym * /* core_keysyms */, /* symbols from core keymap */ + XkbChangesPtr /* changes */ /* resulting changes */ +); + +/***====================================================================***/ + +extern XkbDeviceLedInfoPtr XkbAddDeviceLedInfo( + XkbDeviceInfoPtr /* devi */, + unsigned int /* ledClass */, + unsigned int /* ledId */ +); + +extern Status XkbResizeDeviceButtonActions( + XkbDeviceInfoPtr /* devi */, + unsigned int /* newTotal */ +); + +extern XkbDeviceInfoPtr XkbAllocDeviceInfo( + unsigned int /* deviceSpec */, + unsigned int /* nButtons */, + unsigned int /* szLeds */ +); + +extern void XkbFreeDeviceInfo( + XkbDeviceInfoPtr /* devi */, + unsigned int /* which */, + Bool /* freeDevI */ +); + +extern void XkbNoteDeviceChanges( + XkbDeviceChangesPtr /* old */, + XkbExtensionDeviceNotifyEvent * /* new */, + unsigned int /* wanted */ +); + +extern XkbDeviceInfoPtr XkbGetDeviceInfo( + Display * /* dpy */, + unsigned int /* which */, + unsigned int /* deviceSpec */, + unsigned int /* ledClass */, + unsigned int /* ledID */ +); + +extern Status XkbGetDeviceInfoChanges( + Display * /* dpy */, + XkbDeviceInfoPtr /* devi */, + XkbDeviceChangesPtr /* changes */ +); + +extern Status XkbGetDeviceButtonActions( + Display * /* dpy */, + XkbDeviceInfoPtr /* devi */, + Bool /* all */, + unsigned int /* first */, + unsigned int /* nBtns */ +); + +extern Status XkbGetDeviceLedInfo( + Display * /* dpy */, + XkbDeviceInfoPtr /* devi */, + unsigned int /* ledClass (class, XIDflt, XIAll) */, + unsigned int /* ledId (id, XIDflt, XIAll) */, + unsigned int /* which (XkbXI_Indicator{Names,Map}Mask */ +); + +extern Bool XkbSetDeviceInfo( + Display * /* dpy */, + unsigned int /* which */, + XkbDeviceInfoPtr /* devi */ +); + +extern Bool XkbChangeDeviceInfo( + Display* /* dpy */, + XkbDeviceInfoPtr /* desc */, + XkbDeviceChangesPtr /* changes */ +); + +extern Bool XkbSetDeviceLedInfo( + Display * /* dpy */, + XkbDeviceInfoPtr /* devi */, + unsigned int /* ledClass */, + unsigned int /* ledID */, + unsigned int /* which */ +); + +extern Bool XkbSetDeviceButtonActions( + Display * /* dpy */, + XkbDeviceInfoPtr /* devi */, + unsigned int /* first */, + unsigned int /* nBtns */ +); + +/***====================================================================***/ + +extern char XkbToControl( + char /* c */ +); + +/***====================================================================***/ + +extern Bool XkbSetDebuggingFlags( + Display * /* dpy */, + unsigned int /* mask */, + unsigned int /* flags */, + char * /* msg */, + unsigned int /* ctrls_mask */, + unsigned int /* ctrls */, + unsigned int * /* rtrn_flags */, + unsigned int * /* rtrn_ctrls */ +); + +extern Bool XkbApplyVirtualModChanges( + XkbDescPtr /* xkb */, + unsigned int /* changed */, + XkbChangesPtr /* changes */ +); + +extern Bool XkbUpdateActionVirtualMods( + XkbDescPtr /* xkb */, + XkbAction * /* act */, + unsigned int /* changed */ +); + +extern void XkbUpdateKeyTypeVirtualMods( + XkbDescPtr /* xkb */, + XkbKeyTypePtr /* type */, + unsigned int /* changed */, + XkbChangesPtr /* changes */ +); + +_XFUNCPROTOEND + +#endif /* _X11_XKBLIB_H_ */ diff --git a/xlib/X11/extensions/XKB.h b/xlib/X11/extensions/XKB.h new file mode 100644 index 0000000..7e702eb --- /dev/null +++ b/xlib/X11/extensions/XKB.h @@ -0,0 +1,786 @@ +/************************************************************ +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 (0x7f) + + /* + * 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 XkbAccessXOptionsMask (XkbStickyKeysMask|XkbAccessXFeedbackMask) + +#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)<XkbNumKbdGroups)) + + /* + * GroupsWrap values: + * - The 'groupsWrap' field of an XkbControlsRec specifies the + * treatment of out of range groups. + * - Bits 6 and 7 of the group info field of a key symbol map + * specify the interpretation of out of range groups for the + * corresponding key. + */ +#define XkbWrapIntoRange (0x00) +#define XkbClampIntoRange (0x40) +#define XkbRedirectIntoRange (0x80) + + /* + * Action flags: Reported in the 'flags' field of most key actions. + * Interpretation depends on the type of the action; not all actions + * accept all flags. + * + * Option Used for Actions + * ------ ---------------- + * ClearLocks SetMods, LatchMods, SetGroup, LatchGroup + * LatchToLock SetMods, LatchMods, SetGroup, LatchGroup + * LockNoLock LockMods, ISOLock, LockPtrBtn, LockDeviceBtn + * LockNoUnlock LockMods, ISOLock, LockPtrBtn, LockDeviceBtn + * UseModMapMods SetMods, LatchMods, LockMods, ISOLock + * GroupAbsolute SetGroup, LatchGroup, LockGroup, ISOLock + * UseDfltButton PtrBtn, LockPtrBtn + * NoAcceleration MovePtr + * MoveAbsoluteX MovePtr + * MoveAbsoluteY MovePtr + * ISODfltIsGroup ISOLock + * ISONoAffectMods ISOLock + * ISONoAffectGroup ISOLock + * ISONoAffectPtr ISOLock + * ISONoAffectCtrls ISOLock + * MessageOnPress ActionMessage + * MessageOnRelease ActionMessage + * MessageGenKeyEvent ActionMessage + * AffectDfltBtn SetPtrDflt + * DfltBtnAbsolute SetPtrDflt + * SwitchApplication SwitchScreen + * SwitchAbsolute SwitchScreen + */ + +#define XkbSA_ClearLocks (1L << 0) +#define XkbSA_LatchToLock (1L << 1) + +#define XkbSA_LockNoLock (1L << 0) +#define XkbSA_LockNoUnlock (1L << 1) + +#define XkbSA_UseModMapMods (1L << 2) + +#define XkbSA_GroupAbsolute (1L << 2) +#define XkbSA_UseDfltButton 0 + +#define XkbSA_NoAcceleration (1L << 0) +#define XkbSA_MoveAbsoluteX (1L << 1) +#define XkbSA_MoveAbsoluteY (1L << 2) + +#define XkbSA_ISODfltIsGroup (1L << 7) +#define XkbSA_ISONoAffectMods (1L << 6) +#define XkbSA_ISONoAffectGroup (1L << 5) +#define XkbSA_ISONoAffectPtr (1L << 4) +#define XkbSA_ISONoAffectCtrls (1L << 3) +#define XkbSA_ISOAffectMask (0x78) + +#define XkbSA_MessageOnPress (1L << 0) +#define XkbSA_MessageOnRelease (1L << 1) +#define XkbSA_MessageGenKeyEvent (1L << 2) + +#define XkbSA_AffectDfltBtn 1 +#define XkbSA_DfltBtnAbsolute (1L << 2) + +#define XkbSA_SwitchApplication (1L << 0) +#define XkbSA_SwitchAbsolute (1L << 2) + + /* + * The following values apply to the SA_DeviceValuator + * action only. Valuator operations specify the action + * to be taken. Values specified in the action are + * multiplied by 2^scale before they are applied. + */ +#define XkbSA_IgnoreVal (0x00) +#define XkbSA_SetValMin (0x10) +#define XkbSA_SetValCenter (0x20) +#define XkbSA_SetValMax (0x30) +#define XkbSA_SetValRelative (0x40) +#define XkbSA_SetValAbsolute (0x50) +#define XkbSA_ValOpMask (0x70) +#define XkbSA_ValScaleMask (0x07) +#define XkbSA_ValOp(a) ((a)&XkbSA_ValOpMask) +#define XkbSA_ValScale(a) ((a)&XkbSA_ValScaleMask) + + /* + * Action types: specifies the type of a key action. Reported in the + * type field of all key actions. + */ +#define XkbSA_NoAction 0x00 +#define XkbSA_SetMods 0x01 +#define XkbSA_LatchMods 0x02 +#define XkbSA_LockMods 0x03 +#define XkbSA_SetGroup 0x04 +#define XkbSA_LatchGroup 0x05 +#define XkbSA_LockGroup 0x06 +#define XkbSA_MovePtr 0x07 +#define XkbSA_PtrBtn 0x08 +#define XkbSA_LockPtrBtn 0x09 +#define XkbSA_SetPtrDflt 0x0a +#define XkbSA_ISOLock 0x0b +#define XkbSA_Terminate 0x0c +#define XkbSA_SwitchScreen 0x0d +#define XkbSA_SetControls 0x0e +#define XkbSA_LockControls 0x0f +#define XkbSA_ActionMessage 0x10 +#define XkbSA_RedirectKey 0x11 +#define XkbSA_DeviceBtn 0x12 +#define XkbSA_LockDeviceBtn 0x13 +#define XkbSA_DeviceValuator 0x14 +#define XkbSA_LastAction XkbSA_DeviceValuator +#define XkbSA_NumActions (XkbSA_LastAction+1) + +#define XkbSA_XFree86Private 0x86 + + /* + * Specifies the key actions that clear latched groups or modifiers. + */ +#define XkbSA_BreakLatch \ + ((1<<XkbSA_NoAction)|(1<<XkbSA_PtrBtn)|(1<<XkbSA_LockPtrBtn)|\ + (1<<XkbSA_Terminate)|(1<<XkbSA_SwitchScreen)|(1<<XkbSA_SetControls)|\ + (1<<XkbSA_LockControls)|(1<<XkbSA_ActionMessage)|\ + (1<<XkbSA_RedirectKey)|(1<<XkbSA_DeviceBtn)|(1<<XkbSA_LockDeviceBtn)) + + /* + * Macros to classify key actions + */ +#define XkbIsModAction(a) (((a)->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) +/* Seems kinda silly to check that an unsigned char is <= 255... */ +#define XkbIsLegalKeycode(k) ((k)>=XkbMinLegalKeyCode) + + /* + * 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_UseBase|XkbIM_UseLatched|XkbIM_UseLocked\ + |XkbIM_UseEffective) +#define XkbIM_UseAnyMods (XkbIM_UseAnyGroup|XkbIM_UseCompat) + + /* + * Compatibility Map Components: + * - 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/xlib/X11/extensions/XKBstr.h b/xlib/X11/extensions/XKBstr.h new file mode 100644 index 0000000..ef26911 --- /dev/null +++ b/xlib/X11/extensions/XKBstr.h @@ -0,0 +1,642 @@ +/************************************************************ +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 <X11/extensions/XKB.h> + +#define XkbCharToInt(v) ((v)&0x80?(int)((v)|(~0xff)):(int)((v)&0x7f)) +#define XkbIntTo2Chars(i,h,l) (((h)=((i>>8)&0xff)),((l)=((i)&0xff))) +#define Xkb2CharsToInt(h,l) ((short)(((h)<<8)|(l))) + +/* + * The Xkb structs are full of implicit padding to properly align members. + * We can't clean that up without breaking ABI, so tell clang not to bother + * complaining about it. + */ +#ifdef __clang__ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wpadded" +#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; + /* map is an array of map_count XkbKTMapEntryRec structs */ + XkbKTMapEntryPtr map; + /* preserve is an array of map_count XkbModsRec structs */ + XkbModsPtr preserve; + Atom name; + /* level_names is an array of num_levels Atoms */ + 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)->vmods1=(((m)>>8)&0xff)),\ + ((a)->vmods0=((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 { + /* acts is an array of XkbActions structs, with size_acts entries + allocated, and num_acts entries used. */ + unsigned short num_acts; + unsigned short size_acts; + XkbAction *acts; + + /* behaviors, key_acts, explicit, & vmodmap are all arrays with + (xkb->max_key_code + 1) entries allocated for each. */ + 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 { + /* types is an array of XkbKeyTypeRec structs, with size_types entries + allocated, and num_types entries used. */ + unsigned char size_types; + unsigned char num_types; + XkbKeyTypePtr types; + + /* syms is an array of size_syms KeySyms, in which num_syms are used */ + unsigned short size_syms; + unsigned short num_syms; + KeySym *syms; + /* key_sym_map is an array of (max_key_code + 1) XkbSymMapRec structs */ + XkbSymMapPtr key_sym_map; + + /* modmap is an array of (max_key_code + 1) unsigned chars */ + 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 { + /* sym_interpret is an array of XkbSymInterpretRec structs, + in which size_si are allocated & num_si are used. */ + 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]; + /* keys is an array of (xkb->max_key_code + 1) XkbKeyNameRec entries */ + XkbKeyNamePtr keys; + /* key_aliases is an array of num_key_aliases XkbKeyAliasRec entries */ + XkbKeyAliasPtr key_aliases; + /* radio_groups is an array of num_rg Atoms */ + Atom *radio_groups; + Atom phys_symbols; + + /* num_keys seems to be unused in libX11 */ + 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; + + /* btn_acts is an array of num_btn XkbAction entries */ + 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; + /* leds is an array of XkbDeviceLedInfoRec in which + sz_leds entries are allocated and num_leds entries are used */ + 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; + +#ifdef __clang__ +#pragma clang diagnostic pop +#endif + +#endif /* _XKBSTR_H_ */ |