2008-11-02 08:26:08 -07:00
|
|
|
/************************************************************
|
|
|
|
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>
|
|
|
|
|
2010-07-27 13:02:24 -06:00
|
|
|
#define XkbCharToInt(v) ((int) ((v) & 0x80 ? ((v) | (~0xff)) : ((v) & 0x7f)))
|
|
|
|
#define XkbIntTo2Chars(i, h, l) ((h) = (i >> 8) & 0xff, (l) = (i) & 0xff)
|
2008-11-02 08:26:08 -07:00
|
|
|
|
|
|
|
#if defined(WORD64) && defined(UNSIGNEDBITFIELDS)
|
2010-07-27 13:02:24 -06:00
|
|
|
#define Xkb2CharsToInt(h, l) ((int) ((h) & 0x80 ? \
|
|
|
|
(((h) << 8) | (l) | (~0xffff)) : \
|
|
|
|
(((h) << 8) | (l) & 0x7fff))
|
2008-11-02 08:26:08 -07:00
|
|
|
#else
|
|
|
|
#define Xkb2CharsToInt(h,l) ((short)(((h)<<8)|(l)))
|
|
|
|
#endif
|
|
|
|
|
2012-06-10 07:21:05 -06:00
|
|
|
/*
|
|
|
|
* Common data structures and access macros
|
|
|
|
*/
|
2008-11-02 08:26:08 -07:00
|
|
|
|
|
|
|
typedef struct _XkbStateRec {
|
2012-06-10 07:21:05 -06:00
|
|
|
unsigned char group; /* base + latched + locked */
|
|
|
|
/* FIXME: Why are base + latched short and not char?? */
|
|
|
|
unsigned short base_group; /* physically ... down? */
|
|
|
|
unsigned short latched_group;
|
|
|
|
unsigned char locked_group;
|
|
|
|
|
|
|
|
unsigned char mods; /* base + latched + locked */
|
|
|
|
unsigned char base_mods; /* physically down */
|
|
|
|
unsigned char latched_mods;
|
|
|
|
unsigned char locked_mods;
|
|
|
|
|
|
|
|
unsigned char compat_state; /* mods + group for core state */
|
|
|
|
|
|
|
|
/* grab mods = all depressed and latched mods, _not_ locked mods */
|
|
|
|
unsigned char grab_mods; /* grab mods minus internal mods */
|
|
|
|
unsigned char compat_grab_mods; /* grab mods + group for core state,
|
|
|
|
but not locked groups if
|
|
|
|
IgnoreGroupLocks set */
|
|
|
|
|
|
|
|
/* effective mods = all mods (depressed, latched, locked) */
|
|
|
|
unsigned char lookup_mods; /* effective mods minus internal mods */
|
|
|
|
unsigned char compat_lookup_mods; /* effective mods + group */
|
|
|
|
|
|
|
|
unsigned short ptr_buttons; /* core pointer buttons */
|
|
|
|
} XkbStateRec, *XkbStatePtr;
|
|
|
|
|
2008-11-02 08:26:08 -07:00
|
|
|
#define XkbStateFieldFromRec(s) XkbBuildCoreState((s)->lookup_mods,(s)->group)
|
|
|
|
#define XkbGrabStateFromRec(s) XkbBuildCoreState((s)->grab_mods,(s)->group)
|
|
|
|
|
|
|
|
typedef struct _XkbMods {
|
2012-06-10 07:21:05 -06:00
|
|
|
unsigned char mask; /* effective mods */
|
|
|
|
unsigned char real_mods;
|
|
|
|
unsigned short vmods;
|
|
|
|
} XkbModsRec, *XkbModsPtr;
|
2008-11-02 08:26:08 -07:00
|
|
|
|
|
|
|
typedef struct _XkbKTMapEntry {
|
2012-06-10 07:21:05 -06:00
|
|
|
Bool active;
|
|
|
|
unsigned char level;
|
|
|
|
XkbModsRec mods;
|
|
|
|
} XkbKTMapEntryRec, *XkbKTMapEntryPtr;
|
2008-11-02 08:26:08 -07:00
|
|
|
|
|
|
|
typedef struct _XkbKeyType {
|
2012-06-10 07:21:05 -06:00
|
|
|
XkbModsRec mods;
|
|
|
|
unsigned char num_levels;
|
|
|
|
unsigned char map_count;
|
|
|
|
XkbKTMapEntryPtr map;
|
|
|
|
XkbModsPtr preserve;
|
|
|
|
Atom name;
|
|
|
|
Atom *level_names;
|
2008-11-02 08:26:08 -07:00
|
|
|
} XkbKeyTypeRec, *XkbKeyTypePtr;
|
|
|
|
|
|
|
|
#define XkbNumGroups(g) ((g)&0x0f)
|
|
|
|
#define XkbOutOfRangeGroupInfo(g) ((g)&0xf0)
|
|
|
|
#define XkbOutOfRangeGroupAction(g) ((g)&0xc0)
|
|
|
|
#define XkbOutOfRangeGroupNumber(g) (((g)&0x30)>>4)
|
2010-07-27 13:02:24 -06:00
|
|
|
#define XkbSetGroupInfo(g, w, n) (((w) & 0xc0) | (((n) & 3) << 4) | \
|
|
|
|
((g) & 0x0f))
|
2008-11-02 08:26:08 -07:00
|
|
|
#define XkbSetNumGroups(g,n) (((g)&0xf0)|((n)&0x0f))
|
|
|
|
|
2012-06-10 07:21:05 -06:00
|
|
|
/*
|
|
|
|
* Structures and access macros used primarily by the server
|
|
|
|
*/
|
2008-11-02 08:26:08 -07:00
|
|
|
|
|
|
|
typedef struct _XkbBehavior {
|
2012-06-10 07:21:05 -06:00
|
|
|
unsigned char type;
|
|
|
|
unsigned char data;
|
2008-11-02 08:26:08 -07:00
|
|
|
} XkbBehavior;
|
|
|
|
|
|
|
|
#define XkbAnyActionDataSize 7
|
2012-06-10 07:21:05 -06:00
|
|
|
typedef struct _XkbAnyAction {
|
|
|
|
unsigned char type;
|
|
|
|
unsigned char data[XkbAnyActionDataSize];
|
2008-11-02 08:26:08 -07:00
|
|
|
} XkbAnyAction;
|
|
|
|
|
|
|
|
typedef struct _XkbModAction {
|
2012-06-10 07:21:05 -06:00
|
|
|
unsigned char type;
|
|
|
|
unsigned char flags;
|
|
|
|
unsigned char mask;
|
|
|
|
unsigned char real_mods;
|
|
|
|
/* FIXME: Make this an int. */
|
|
|
|
unsigned char vmods1;
|
|
|
|
unsigned char vmods2;
|
2008-11-02 08:26:08 -07:00
|
|
|
} XkbModAction;
|
2012-06-10 07:21:05 -06:00
|
|
|
|
2010-07-27 13:02:24 -06:00
|
|
|
#define XkbModActionVMods(a) ((short) (((a)->vmods1 << 8) | (a)->vmods2))
|
2008-11-02 08:26:08 -07:00
|
|
|
#define XkbSetModActionVMods(a,v) \
|
2010-07-27 13:02:24 -06:00
|
|
|
((a)->vmods1 = (((v) >> 8) & 0xff), \
|
|
|
|
(a)->vmods2 = (v) & 0xff)
|
2008-11-02 08:26:08 -07:00
|
|
|
|
|
|
|
typedef struct _XkbGroupAction {
|
2012-06-10 07:21:05 -06:00
|
|
|
unsigned char type;
|
|
|
|
unsigned char flags;
|
|
|
|
/* FIXME: Make this an int. */
|
|
|
|
char group_XXX;
|
2008-11-02 08:26:08 -07:00
|
|
|
} XkbGroupAction;
|
2012-06-10 07:21:05 -06:00
|
|
|
|
2008-11-02 08:26:08 -07:00
|
|
|
#define XkbSAGroup(a) (XkbCharToInt((a)->group_XXX))
|
|
|
|
#define XkbSASetGroup(a,g) ((a)->group_XXX=(g))
|
|
|
|
|
|
|
|
typedef struct _XkbISOAction {
|
2012-06-10 07:21:05 -06:00
|
|
|
unsigned char type;
|
|
|
|
unsigned char flags;
|
|
|
|
unsigned char mask;
|
|
|
|
unsigned char real_mods;
|
|
|
|
/* FIXME: Make this an int. */
|
|
|
|
char group_XXX;
|
|
|
|
unsigned char affect;
|
|
|
|
unsigned char vmods1;
|
|
|
|
unsigned char vmods2;
|
2008-11-02 08:26:08 -07:00
|
|
|
} XkbISOAction;
|
|
|
|
|
|
|
|
typedef struct _XkbPtrAction {
|
2012-06-10 07:21:05 -06:00
|
|
|
unsigned char type;
|
|
|
|
unsigned char flags;
|
|
|
|
/* FIXME: Make this an int. */
|
|
|
|
unsigned char high_XXX;
|
|
|
|
unsigned char low_XXX;
|
|
|
|
unsigned char high_YYY;
|
|
|
|
unsigned char low_YYY;
|
2008-11-02 08:26:08 -07:00
|
|
|
} XkbPtrAction;
|
2012-06-10 07:21:05 -06:00
|
|
|
|
2008-11-02 08:26:08 -07:00
|
|
|
#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 {
|
2012-06-10 07:21:05 -06:00
|
|
|
unsigned char type;
|
|
|
|
unsigned char flags;
|
|
|
|
unsigned char count;
|
|
|
|
unsigned char button;
|
2008-11-02 08:26:08 -07:00
|
|
|
} XkbPtrBtnAction;
|
|
|
|
|
|
|
|
typedef struct _XkbPtrDfltAction {
|
2012-06-10 07:21:05 -06:00
|
|
|
unsigned char type;
|
|
|
|
unsigned char flags;
|
|
|
|
unsigned char affect;
|
|
|
|
char valueXXX;
|
2008-11-02 08:26:08 -07:00
|
|
|
} XkbPtrDfltAction;
|
2012-06-10 07:21:05 -06:00
|
|
|
|
2008-11-02 08:26:08 -07:00
|
|
|
#define XkbSAPtrDfltValue(a) (XkbCharToInt((a)->valueXXX))
|
2010-07-27 13:02:24 -06:00
|
|
|
#define XkbSASetPtrDfltValue(a, c) ((a)->valueXXX = (c) & 0xff)
|
2008-11-02 08:26:08 -07:00
|
|
|
|
|
|
|
typedef struct _XkbSwitchScreenAction {
|
2012-06-10 07:21:05 -06:00
|
|
|
unsigned char type;
|
|
|
|
unsigned char flags;
|
|
|
|
char screenXXX;
|
2008-11-02 08:26:08 -07:00
|
|
|
} XkbSwitchScreenAction;
|
2012-06-10 07:21:05 -06:00
|
|
|
|
2008-11-02 08:26:08 -07:00
|
|
|
#define XkbSAScreen(a) (XkbCharToInt((a)->screenXXX))
|
2010-07-27 13:02:24 -06:00
|
|
|
#define XkbSASetScreen(a, s) ((a)->screenXXX = (s) & 0xff)
|
2008-11-02 08:26:08 -07:00
|
|
|
|
|
|
|
typedef struct _XkbCtrlsAction {
|
2012-06-10 07:21:05 -06:00
|
|
|
unsigned char type;
|
|
|
|
unsigned char flags;
|
|
|
|
/* FIXME: Make this an int. */
|
|
|
|
unsigned char ctrls3;
|
|
|
|
unsigned char ctrls2;
|
|
|
|
unsigned char ctrls1;
|
|
|
|
unsigned char ctrls0;
|
2008-11-02 08:26:08 -07:00
|
|
|
} XkbCtrlsAction;
|
2012-06-10 07:21:05 -06:00
|
|
|
|
2010-07-27 13:02:24 -06:00
|
|
|
#define XkbActionSetCtrls(a, c) ((a)->ctrls3 = ((c) >> 24) & 0xff, \
|
|
|
|
(a)->ctrls2 = ((c) >> 16) & 0xff, \
|
|
|
|
(a)->ctrls1 = ((c) >> 8) & 0xff, \
|
|
|
|
(a)->ctrls0 = (c) & 0xff)
|
2008-11-02 08:26:08 -07:00
|
|
|
#define XkbActionCtrls(a) ((((unsigned int)(a)->ctrls3)<<24)|\
|
|
|
|
(((unsigned int)(a)->ctrls2)<<16)|\
|
|
|
|
(((unsigned int)(a)->ctrls1)<<8)|\
|
2010-07-27 13:02:24 -06:00
|
|
|
((unsigned int) (a)->ctrls0))
|
2008-11-02 08:26:08 -07:00
|
|
|
|
|
|
|
typedef struct _XkbMessageAction {
|
2012-06-10 07:21:05 -06:00
|
|
|
unsigned char type;
|
|
|
|
unsigned char flags;
|
|
|
|
unsigned char message[6];
|
2008-11-02 08:26:08 -07:00
|
|
|
} XkbMessageAction;
|
|
|
|
|
2012-06-10 07:21:05 -06:00
|
|
|
typedef struct _XkbRedirectKeyAction {
|
|
|
|
unsigned char type;
|
|
|
|
unsigned char new_key;
|
|
|
|
unsigned char mods_mask;
|
|
|
|
unsigned char mods;
|
|
|
|
/* FIXME: Make this an int. */
|
|
|
|
unsigned char vmods_mask0;
|
|
|
|
unsigned char vmods_mask1;
|
|
|
|
unsigned char vmods0;
|
|
|
|
unsigned char vmods1;
|
2008-11-02 08:26:08 -07:00
|
|
|
} XkbRedirectKeyAction;
|
|
|
|
|
|
|
|
#define XkbSARedirectVMods(a) ((((unsigned int)(a)->vmods1)<<8)|\
|
|
|
|
((unsigned int)(a)->vmods0))
|
2010-07-27 13:02:24 -06:00
|
|
|
/* FIXME: This is blatantly not setting vmods. Yeesh. */
|
2008-11-02 08:26:08 -07:00
|
|
|
#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 {
|
2012-06-10 07:21:05 -06:00
|
|
|
unsigned char type;
|
|
|
|
unsigned char flags;
|
|
|
|
unsigned char count;
|
|
|
|
unsigned char button;
|
|
|
|
unsigned char device;
|
2008-11-02 08:26:08 -07:00
|
|
|
} XkbDeviceBtnAction;
|
|
|
|
|
|
|
|
typedef struct _XkbDeviceValuatorAction {
|
2012-06-10 07:21:05 -06:00
|
|
|
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;
|
2008-11-02 08:26:08 -07:00
|
|
|
} XkbDeviceValuatorAction;
|
|
|
|
|
2012-06-10 07:21:05 -06:00
|
|
|
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;
|
2008-11-02 08:26:08 -07:00
|
|
|
} XkbAction;
|
|
|
|
|
2012-06-10 07:21:05 -06:00
|
|
|
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];
|
2008-11-02 08:26:08 -07:00
|
|
|
} XkbControlsRec, *XkbControlsPtr;
|
|
|
|
|
|
|
|
#define XkbAX_AnyFeedback(c) ((c)->enabled_ctrls&XkbAccessXFeedbackMask)
|
|
|
|
#define XkbAX_NeedOption(c,w) ((c)->ax_options&(w))
|
2010-07-27 13:02:24 -06:00
|
|
|
#define XkbAX_NeedFeedback(c, w) (XkbAX_AnyFeedback((c)) && \
|
|
|
|
XkbAX_NeedOption((c), (w)))
|
2008-11-02 08:26:08 -07:00
|
|
|
|
|
|
|
typedef struct _XkbServerMapRec {
|
2012-06-10 07:21:05 -06:00
|
|
|
unsigned short num_acts;
|
|
|
|
unsigned short size_acts;
|
|
|
|
XkbAction *acts;
|
2008-11-02 08:26:08 -07:00
|
|
|
|
2012-06-10 07:21:05 -06:00
|
|
|
XkbBehavior *behaviors;
|
|
|
|
unsigned short *key_acts;
|
2008-11-02 08:26:08 -07:00
|
|
|
#if defined(__cplusplus) || defined(c_plusplus)
|
2012-06-10 07:21:05 -06:00
|
|
|
/* explicit is a C++ reserved word */
|
|
|
|
unsigned char *c_explicit;
|
2008-11-02 08:26:08 -07:00
|
|
|
#else
|
2012-06-10 07:21:05 -06:00
|
|
|
unsigned char *explicit;
|
2008-11-02 08:26:08 -07:00
|
|
|
#endif
|
2012-06-10 07:21:05 -06:00
|
|
|
unsigned char vmods[XkbNumVirtualMods];
|
|
|
|
unsigned short *vmodmap;
|
2008-11-02 08:26:08 -07:00
|
|
|
} XkbServerMapRec, *XkbServerMapPtr;
|
|
|
|
|
2010-07-27 13:02:24 -06:00
|
|
|
#define XkbSMKeyActionsPtr(m, k) (&(m)->acts[(m)->key_acts[(k)]])
|
2008-11-02 08:26:08 -07:00
|
|
|
|
2012-06-10 07:21:05 -06:00
|
|
|
/*
|
|
|
|
* Structures and access macros used primarily by clients
|
|
|
|
*/
|
2008-11-02 08:26:08 -07:00
|
|
|
|
2012-06-10 07:21:05 -06:00
|
|
|
typedef struct _XkbSymMapRec {
|
|
|
|
unsigned char kt_index[XkbNumKbdGroups];
|
|
|
|
unsigned char group_info;
|
|
|
|
unsigned char width;
|
|
|
|
unsigned short offset;
|
2008-11-02 08:26:08 -07:00
|
|
|
} XkbSymMapRec, *XkbSymMapPtr;
|
|
|
|
|
|
|
|
typedef struct _XkbClientMapRec {
|
2012-06-10 07:21:05 -06:00
|
|
|
unsigned char size_types;
|
|
|
|
unsigned char num_types;
|
|
|
|
XkbKeyTypePtr types;
|
2008-11-02 08:26:08 -07:00
|
|
|
|
2012-06-10 07:21:05 -06:00
|
|
|
unsigned short size_syms;
|
|
|
|
unsigned short num_syms;
|
|
|
|
KeySym *syms;
|
|
|
|
XkbSymMapPtr key_sym_map;
|
2008-11-02 08:26:08 -07:00
|
|
|
|
2012-06-10 07:21:05 -06:00
|
|
|
unsigned char *modmap;
|
2008-11-02 08:26:08 -07:00
|
|
|
} XkbClientMapRec, *XkbClientMapPtr;
|
|
|
|
|
2010-07-27 13:02:24 -06:00
|
|
|
#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))])
|
2008-11-02 08:26:08 -07:00
|
|
|
|
2012-06-10 07:21:05 -06:00
|
|
|
/*
|
|
|
|
* Compatibility structures and access macros
|
|
|
|
*/
|
2008-11-02 08:26:08 -07:00
|
|
|
|
|
|
|
typedef struct _XkbSymInterpretRec {
|
2012-06-10 07:21:05 -06:00
|
|
|
KeySym sym;
|
|
|
|
unsigned char flags;
|
|
|
|
unsigned char match;
|
|
|
|
unsigned char mods;
|
|
|
|
unsigned char virtual_mod;
|
|
|
|
XkbAnyAction act;
|
|
|
|
} XkbSymInterpretRec, *XkbSymInterpretPtr;
|
2008-11-02 08:26:08 -07:00
|
|
|
|
|
|
|
typedef struct _XkbCompatMapRec {
|
2012-06-10 07:21:05 -06:00
|
|
|
XkbSymInterpretPtr sym_interpret;
|
|
|
|
XkbModsRec groups[XkbNumKbdGroups];
|
|
|
|
unsigned short num_si;
|
|
|
|
unsigned short size_si;
|
2008-11-02 08:26:08 -07:00
|
|
|
} XkbCompatMapRec, *XkbCompatMapPtr;
|
|
|
|
|
|
|
|
typedef struct _XkbIndicatorMapRec {
|
2012-06-10 07:21:05 -06:00
|
|
|
unsigned char flags;
|
|
|
|
/* FIXME: For some reason, interepretation of groups is wildly
|
|
|
|
* different between which being base/latched/locked. */
|
|
|
|
unsigned char which_groups;
|
|
|
|
unsigned char groups;
|
|
|
|
unsigned char which_mods;
|
|
|
|
XkbModsRec mods;
|
|
|
|
unsigned int ctrls;
|
2008-11-02 08:26:08 -07:00
|
|
|
} XkbIndicatorMapRec, *XkbIndicatorMapPtr;
|
|
|
|
|
2010-07-27 13:02:24 -06:00
|
|
|
#define XkbIM_IsAuto(i) (!((i)->flags & XkbIM_NoAutomatic) && \
|
2008-11-02 08:26:08 -07:00
|
|
|
(((i)->which_groups&&(i)->groups)||\
|
|
|
|
((i)->which_mods&&(i)->mods.mask)||\
|
2010-07-27 13:02:24 -06:00
|
|
|
(i)->ctrls))
|
|
|
|
#define XkbIM_InUse(i) ((i)->flags || (i)->which_groups || (i)->which_mods || \
|
|
|
|
(i)->ctrls)
|
2008-11-02 08:26:08 -07:00
|
|
|
|
|
|
|
typedef struct _XkbIndicatorRec {
|
2012-06-10 07:21:05 -06:00
|
|
|
unsigned long phys_indicators;
|
|
|
|
XkbIndicatorMapRec maps[XkbNumIndicators];
|
|
|
|
} XkbIndicatorRec, *XkbIndicatorPtr;
|
2008-11-02 08:26:08 -07:00
|
|
|
|
2012-06-10 07:21:05 -06:00
|
|
|
typedef struct _XkbKeyNameRec {
|
|
|
|
char name[XkbKeyNameLength];
|
|
|
|
} XkbKeyNameRec, *XkbKeyNamePtr;
|
2008-11-02 08:26:08 -07:00
|
|
|
|
|
|
|
typedef struct _XkbKeyAliasRec {
|
2012-06-10 07:21:05 -06:00
|
|
|
char real[XkbKeyNameLength];
|
|
|
|
char alias[XkbKeyNameLength];
|
|
|
|
} XkbKeyAliasRec, *XkbKeyAliasPtr;
|
2008-11-02 08:26:08 -07:00
|
|
|
|
2012-06-10 07:21:05 -06:00
|
|
|
/*
|
|
|
|
* Names for everything
|
|
|
|
*/
|
2008-11-02 08:26:08 -07:00
|
|
|
typedef struct _XkbNamesRec {
|
2012-06-10 07:21:05 -06:00
|
|
|
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 {
|
|
|
|
unsigned int defined;
|
|
|
|
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;
|
2008-11-02 08:26:08 -07:00
|
|
|
} XkbDescRec, *XkbDescPtr;
|
2012-06-10 07:21:05 -06:00
|
|
|
|
2010-07-27 13:02:24 -06:00
|
|
|
#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)))
|
2008-11-02 08:26:08 -07:00
|
|
|
#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)))
|
2010-07-27 13:02:24 -06:00
|
|
|
#define XkbKeySym(d, k, n) (XkbKeySymsPtr((d), (k))[(n)])
|
2008-11-02 08:26:08 -07:00
|
|
|
#define XkbKeySymEntry(d,k,sl,g) \
|
2010-07-27 13:02:24 -06:00
|
|
|
(XkbKeySym((d), (k), (XkbKeyGroupsWidth((d), (k)) * (g)) + (sl)))
|
2008-11-02 08:26:08 -07:00
|
|
|
#define XkbKeyAction(d,k,n) \
|
2010-07-27 13:02:24 -06:00
|
|
|
(XkbKeyHasActions((d), (k)) ? & XkbKeyActionsPtr((d), (k))[(n)] : NULL)
|
2008-11-02 08:26:08 -07:00
|
|
|
#define XkbKeyActionEntry(d,k,sl,g) \
|
2010-07-27 13:02:24 -06:00
|
|
|
(XkbKeyHasActions((d), (k)) ? \
|
|
|
|
XkbKeyAction((d), (k), ((XkbKeyGroupsWidth((d), (k)) * (g)) + (sl))) : \
|
|
|
|
NULL)
|
|
|
|
|
|
|
|
#define XkbKeyHasActions(d, k) (!!(d)->server->key_acts[(k)])
|
|
|
|
#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)
|
2008-11-02 08:26:08 -07:00
|
|
|
#define XkbNumKeys(d) ((d)->max_key_code-(d)->min_key_code+1)
|
|
|
|
|
2012-06-10 07:21:05 -06:00
|
|
|
/*
|
|
|
|
* The following structures can be used to track changes
|
|
|
|
* to a keyboard device
|
|
|
|
*/
|
2008-11-02 08:26:08 -07:00
|
|
|
typedef struct _XkbMapChanges {
|
2012-06-10 07:21:05 -06:00
|
|
|
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;
|
2008-11-02 08:26:08 -07:00
|
|
|
|
|
|
|
typedef struct _XkbControlsChanges {
|
2012-06-10 07:21:05 -06:00
|
|
|
unsigned int changed_ctrls;
|
|
|
|
unsigned int enabled_ctrls_changes;
|
|
|
|
Bool num_groups_changed;
|
|
|
|
} XkbControlsChangesRec, *XkbControlsChangesPtr;
|
2008-11-02 08:26:08 -07:00
|
|
|
|
|
|
|
typedef struct _XkbIndicatorChanges {
|
2012-06-10 07:21:05 -06:00
|
|
|
unsigned int state_changes;
|
|
|
|
unsigned int map_changes;
|
|
|
|
} XkbIndicatorChangesRec, *XkbIndicatorChangesPtr;
|
2008-11-02 08:26:08 -07:00
|
|
|
|
|
|
|
typedef struct _XkbNameChanges {
|
2012-06-10 07:21:05 -06:00
|
|
|
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;
|
2008-11-02 08:26:08 -07:00
|
|
|
|
|
|
|
typedef struct _XkbCompatChanges {
|
2012-06-10 07:21:05 -06:00
|
|
|
unsigned char changed_groups;
|
|
|
|
unsigned short first_si;
|
|
|
|
unsigned short num_si;
|
|
|
|
} XkbCompatChangesRec, *XkbCompatChangesPtr;
|
2008-11-02 08:26:08 -07:00
|
|
|
|
|
|
|
typedef struct _XkbChanges {
|
2012-06-10 07:21:05 -06:00
|
|
|
unsigned short device_spec;
|
|
|
|
unsigned short state_changes;
|
|
|
|
XkbMapChangesRec map;
|
|
|
|
XkbControlsChangesRec ctrls;
|
|
|
|
XkbIndicatorChangesRec indicators;
|
|
|
|
XkbNameChangesRec names;
|
|
|
|
XkbCompatChangesRec compat;
|
2008-11-02 08:26:08 -07:00
|
|
|
} XkbChangesRec, *XkbChangesPtr;
|
|
|
|
|
2012-06-10 07:21:05 -06:00
|
|
|
/*
|
|
|
|
* These data structures are used to construct a keymap from
|
|
|
|
* a set of components or to list components in the server
|
|
|
|
* database.
|
|
|
|
*/
|
2008-11-02 08:26:08 -07:00
|
|
|
typedef struct _XkbComponentNames {
|
2012-06-10 07:21:05 -06:00
|
|
|
char *keycodes;
|
|
|
|
char *types;
|
|
|
|
char *compat;
|
|
|
|
char *symbols;
|
|
|
|
char *geometry;
|
2008-11-02 08:26:08 -07:00
|
|
|
} XkbComponentNamesRec, *XkbComponentNamesPtr;
|
|
|
|
|
|
|
|
typedef struct _XkbComponentName {
|
2012-06-10 07:21:05 -06:00
|
|
|
unsigned short flags;
|
|
|
|
char *name;
|
|
|
|
} XkbComponentNameRec, *XkbComponentNamePtr;
|
2008-11-02 08:26:08 -07:00
|
|
|
|
|
|
|
typedef struct _XkbComponentList {
|
2012-06-10 07:21:05 -06:00
|
|
|
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;
|
2008-11-02 08:26:08 -07:00
|
|
|
} XkbComponentListRec, *XkbComponentListPtr;
|
|
|
|
|
2012-06-10 07:21:05 -06:00
|
|
|
/*
|
|
|
|
* The following data structures describe and track changes to a
|
|
|
|
* non-keyboard extension device
|
|
|
|
*/
|
2008-11-02 08:26:08 -07:00
|
|
|
typedef struct _XkbDeviceLedInfo {
|
2012-06-10 07:21:05 -06:00
|
|
|
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;
|
2008-11-02 08:26:08 -07:00
|
|
|
|
|
|
|
typedef struct _XkbDeviceInfo {
|
2012-06-10 07:21:05 -06:00
|
|
|
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;
|
2008-11-02 08:26:08 -07:00
|
|
|
|
2010-07-27 13:02:24 -06:00
|
|
|
#define XkbXI_DevHasBtnActs(d) ((d)->num_btns > 0 && (d)->btn_acts)
|
|
|
|
#define XkbXI_LegalDevBtn(d,b) (XkbXI_DevHasBtnActs(d) && (b) < (d)->num_btns)
|
|
|
|
#define XkbXI_DevHasLeds(d) ((d)->num_leds > 0 && (d)->leds)
|
2008-11-02 08:26:08 -07:00
|
|
|
|
|
|
|
typedef struct _XkbDeviceLedChanges {
|
2012-06-10 07:21:05 -06:00
|
|
|
unsigned short led_class;
|
|
|
|
unsigned short led_id;
|
|
|
|
unsigned int defined; /* names or maps changed */
|
|
|
|
struct _XkbDeviceLedChanges *next;
|
|
|
|
} XkbDeviceLedChangesRec, *XkbDeviceLedChangesPtr;
|
2008-11-02 08:26:08 -07:00
|
|
|
|
|
|
|
typedef struct _XkbDeviceChanges {
|
2012-06-10 07:21:05 -06:00
|
|
|
unsigned int changed;
|
|
|
|
unsigned short first_btn;
|
|
|
|
unsigned short num_btns;
|
|
|
|
XkbDeviceLedChangesRec leds;
|
|
|
|
} XkbDeviceChangesRec, *XkbDeviceChangesPtr;
|
2008-11-02 08:26:08 -07:00
|
|
|
|
2012-06-10 07:21:05 -06:00
|
|
|
#endif /* _XKBSTR_H_ */
|