Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:14:23

0001 /************************************************************
0002 Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc.
0003 
0004 Permission to use, copy, modify, and distribute this
0005 software and its documentation for any purpose and without
0006 fee is hereby granted, provided that the above copyright
0007 notice appear in all copies and that both that copyright
0008 notice and this permission notice appear in supporting
0009 documentation, and that the name of Silicon Graphics not be 
0010 used in advertising or publicity pertaining to distribution 
0011 of the software without specific prior written permission.
0012 Silicon Graphics makes no representation about the suitability 
0013 of this software for any purpose. It is provided "as is"
0014 without any express or implied warranty.
0015 
0016 SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS 
0017 SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY 
0018 AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
0019 GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL 
0020 DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, 
0021 DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE 
0022 OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION  WITH
0023 THE USE OR PERFORMANCE OF THIS SOFTWARE.
0024 
0025 ********************************************************/
0026 
0027 #ifndef _XKBSTR_H_
0028 #define _XKBSTR_H_
0029 
0030 #include <X11/extensions/XKB.h>
0031 
0032 #define XkbCharToInt(v)     ((v)&0x80?(int)((v)|(~0xff)):(int)((v)&0x7f))
0033 #define XkbIntTo2Chars(i,h,l)   (((h)=((i>>8)&0xff)),((l)=((i)&0xff)))
0034 #define Xkb2CharsToInt(h,l) ((short)(((h)<<8)|(l)))
0035 
0036 /*
0037  * The Xkb structs are full of implicit padding to properly align members.
0038  * We can't clean that up without breaking ABI, so tell clang not to bother
0039  * complaining about it.
0040  */
0041 #ifdef __clang__
0042 #pragma clang diagnostic push
0043 #pragma clang diagnostic ignored "-Wpadded"
0044 #endif
0045 
0046     /*
0047      * Common data structures and access macros
0048      */
0049 
0050 typedef struct _XkbStateRec {
0051     unsigned char   group;
0052     unsigned char   locked_group;
0053     unsigned short  base_group;
0054     unsigned short  latched_group;
0055     unsigned char   mods;
0056     unsigned char   base_mods;
0057     unsigned char   latched_mods;
0058     unsigned char   locked_mods;
0059     unsigned char   compat_state;
0060     unsigned char   grab_mods;
0061     unsigned char   compat_grab_mods;
0062     unsigned char   lookup_mods;
0063     unsigned char   compat_lookup_mods;
0064     unsigned short  ptr_buttons;
0065 } XkbStateRec,*XkbStatePtr;
0066 #define XkbModLocks(s)   ((s)->locked_mods)
0067 #define XkbStateMods(s)  ((s)->base_mods|(s)->latched_mods|XkbModLocks(s))
0068 #define XkbGroupLock(s)  ((s)->locked_group)
0069 #define XkbStateGroup(s) ((s)->base_group+(s)->latched_group+XkbGroupLock(s))
0070 #define XkbStateFieldFromRec(s) XkbBuildCoreState((s)->lookup_mods,(s)->group)
0071 #define XkbGrabStateFromRec(s)  XkbBuildCoreState((s)->grab_mods,(s)->group)
0072 
0073 typedef struct _XkbMods {
0074     unsigned char   mask;   /* effective mods */
0075     unsigned char   real_mods;
0076     unsigned short  vmods;
0077 } XkbModsRec,*XkbModsPtr;
0078 
0079 typedef struct _XkbKTMapEntry {
0080     Bool        active;
0081     unsigned char   level;
0082     XkbModsRec  mods;
0083 } XkbKTMapEntryRec,*XkbKTMapEntryPtr;
0084 
0085 typedef struct _XkbKeyType {
0086     XkbModsRec      mods;
0087     unsigned char       num_levels;
0088     unsigned char       map_count;
0089     /* map is an array of map_count XkbKTMapEntryRec structs */
0090     XkbKTMapEntryPtr    map;
0091     /* preserve is an array of map_count XkbModsRec structs */
0092     XkbModsPtr          preserve;
0093     Atom            name;
0094     /* level_names is an array of num_levels Atoms */
0095     Atom *          level_names;
0096 } XkbKeyTypeRec, *XkbKeyTypePtr;
0097 
0098 #define XkbNumGroups(g)         ((g)&0x0f)
0099 #define XkbOutOfRangeGroupInfo(g)   ((g)&0xf0)
0100 #define XkbOutOfRangeGroupAction(g) ((g)&0xc0)
0101 #define XkbOutOfRangeGroupNumber(g) (((g)&0x30)>>4)
0102 #define XkbSetGroupInfo(g,w,n)  (((w)&0xc0)|(((n)&3)<<4)|((g)&0x0f))
0103 #define XkbSetNumGroups(g,n)    (((g)&0xf0)|((n)&0x0f))
0104 
0105     /*
0106      * Structures and access macros used primarily by the server
0107      */
0108 
0109 typedef struct _XkbBehavior {
0110     unsigned char   type;
0111     unsigned char   data;
0112 } XkbBehavior;
0113 
0114 #define XkbAnyActionDataSize 7
0115 typedef struct _XkbAnyAction {
0116     unsigned char   type;
0117     unsigned char   data[XkbAnyActionDataSize];
0118 } XkbAnyAction;
0119 
0120 typedef struct _XkbModAction {
0121     unsigned char   type;
0122     unsigned char   flags;
0123     unsigned char   mask;
0124     unsigned char   real_mods;
0125     unsigned char   vmods1;
0126     unsigned char   vmods2;
0127 } XkbModAction;
0128 #define XkbModActionVMods(a)      \
0129     ((short)(((a)->vmods1<<8)|((a)->vmods2)))
0130 #define XkbSetModActionVMods(a,v) \
0131     (((a)->vmods1=(((v)>>8)&0xff)),(a)->vmods2=((v)&0xff))
0132 
0133 typedef struct _XkbGroupAction {
0134     unsigned char   type;
0135     unsigned char   flags;
0136     char        group_XXX;
0137 } XkbGroupAction;
0138 #define XkbSAGroup(a)       (XkbCharToInt((a)->group_XXX))
0139 #define XkbSASetGroup(a,g)  ((a)->group_XXX=(g))
0140 
0141 typedef struct _XkbISOAction {
0142     unsigned char   type;
0143     unsigned char   flags;
0144     unsigned char   mask;
0145     unsigned char   real_mods;
0146     char        group_XXX;
0147     unsigned char   affect;
0148     unsigned char   vmods1;
0149     unsigned char   vmods2;
0150 } XkbISOAction;
0151 
0152 typedef struct _XkbPtrAction {
0153     unsigned char   type;
0154     unsigned char   flags;
0155     unsigned char   high_XXX;
0156     unsigned char   low_XXX;
0157     unsigned char   high_YYY;
0158     unsigned char   low_YYY;
0159 } XkbPtrAction;
0160 #define XkbPtrActionX(a)      (Xkb2CharsToInt((a)->high_XXX,(a)->low_XXX))
0161 #define XkbPtrActionY(a)      (Xkb2CharsToInt((a)->high_YYY,(a)->low_YYY))
0162 #define XkbSetPtrActionX(a,x) (XkbIntTo2Chars(x,(a)->high_XXX,(a)->low_XXX))
0163 #define XkbSetPtrActionY(a,y) (XkbIntTo2Chars(y,(a)->high_YYY,(a)->low_YYY))
0164 
0165 typedef struct _XkbPtrBtnAction {
0166     unsigned char   type;
0167     unsigned char   flags;
0168     unsigned char   count;
0169     unsigned char   button;
0170 } XkbPtrBtnAction;
0171 
0172 typedef struct _XkbPtrDfltAction {
0173     unsigned char   type;
0174     unsigned char   flags;
0175     unsigned char   affect;
0176     char        valueXXX;
0177 } XkbPtrDfltAction;
0178 #define XkbSAPtrDfltValue(a)        (XkbCharToInt((a)->valueXXX))
0179 #define XkbSASetPtrDfltValue(a,c)   ((a)->valueXXX= ((c)&0xff))
0180 
0181 typedef struct _XkbSwitchScreenAction {
0182     unsigned char   type;
0183     unsigned char   flags;
0184     char        screenXXX;
0185 } XkbSwitchScreenAction;
0186 #define XkbSAScreen(a)          (XkbCharToInt((a)->screenXXX))
0187 #define XkbSASetScreen(a,s)     ((a)->screenXXX= ((s)&0xff))
0188 
0189 typedef struct _XkbCtrlsAction {
0190     unsigned char   type;
0191     unsigned char   flags;
0192     unsigned char   ctrls3;
0193     unsigned char   ctrls2;
0194     unsigned char   ctrls1;
0195     unsigned char   ctrls0;
0196 } XkbCtrlsAction;
0197 #define XkbActionSetCtrls(a,c)  (((a)->ctrls3=(((c)>>24)&0xff)),\
0198                     ((a)->ctrls2=(((c)>>16)&0xff)),\
0199                     ((a)->ctrls1=(((c)>>8)&0xff)),\
0200                     ((a)->ctrls0=((c)&0xff)))
0201 #define XkbActionCtrls(a) ((((unsigned int)(a)->ctrls3)<<24)|\
0202                (((unsigned int)(a)->ctrls2)<<16)|\
0203                (((unsigned int)(a)->ctrls1)<<8)|\
0204                ((unsigned int)((a)->ctrls0)))
0205 
0206 typedef struct _XkbMessageAction {
0207     unsigned char   type;
0208     unsigned char   flags;
0209     unsigned char   message[6];
0210 } XkbMessageAction;
0211 
0212 typedef struct  _XkbRedirectKeyAction {
0213     unsigned char   type;
0214     unsigned char   new_key;
0215     unsigned char   mods_mask;
0216     unsigned char   mods;
0217     unsigned char   vmods_mask0;
0218     unsigned char   vmods_mask1;
0219     unsigned char   vmods0;
0220     unsigned char   vmods1;
0221 } XkbRedirectKeyAction;
0222 
0223 #define XkbSARedirectVMods(a)       ((((unsigned int)(a)->vmods1)<<8)|\
0224                     ((unsigned int)(a)->vmods0))
0225 #define XkbSARedirectSetVMods(a,m)  (((a)->vmods1=(((m)>>8)&0xff)),\
0226                      ((a)->vmods0=((m)&0xff)))
0227 #define XkbSARedirectVModsMask(a)   ((((unsigned int)(a)->vmods_mask1)<<8)|\
0228                     ((unsigned int)(a)->vmods_mask0))
0229 #define XkbSARedirectSetVModsMask(a,m)  (((a)->vmods_mask1=(((m)>>8)&0xff)),\
0230                      ((a)->vmods_mask0=((m)&0xff)))
0231 
0232 typedef struct _XkbDeviceBtnAction {
0233     unsigned char   type;
0234     unsigned char   flags;
0235     unsigned char   count;
0236     unsigned char   button;
0237     unsigned char   device;
0238 } XkbDeviceBtnAction;
0239 
0240 typedef struct _XkbDeviceValuatorAction {
0241     unsigned char   type;
0242     unsigned char   device;
0243     unsigned char   v1_what;
0244     unsigned char   v1_ndx;
0245     unsigned char   v1_value;
0246     unsigned char   v2_what;
0247     unsigned char   v2_ndx;
0248     unsigned char   v2_value;
0249 } XkbDeviceValuatorAction;
0250 
0251 typedef union _XkbAction {
0252     XkbAnyAction        any;
0253     XkbModAction        mods;
0254     XkbGroupAction      group;
0255     XkbISOAction        iso;
0256     XkbPtrAction        ptr;
0257     XkbPtrBtnAction     btn;
0258     XkbPtrDfltAction    dflt;
0259     XkbSwitchScreenAction   screen;
0260     XkbCtrlsAction      ctrls;
0261     XkbMessageAction    msg;
0262     XkbRedirectKeyAction    redirect;
0263     XkbDeviceBtnAction  devbtn;
0264     XkbDeviceValuatorAction devval;
0265     unsigned char       type;
0266 } XkbAction;
0267 
0268 typedef struct _XkbControls {
0269     unsigned char   mk_dflt_btn;
0270     unsigned char   num_groups;
0271     unsigned char   groups_wrap;
0272     XkbModsRec  internal;
0273     XkbModsRec  ignore_lock;
0274     unsigned int    enabled_ctrls;
0275     unsigned short  repeat_delay;
0276     unsigned short  repeat_interval;
0277     unsigned short  slow_keys_delay;
0278     unsigned short  debounce_delay;
0279     unsigned short  mk_delay;
0280     unsigned short  mk_interval;
0281     unsigned short  mk_time_to_max;
0282     unsigned short  mk_max_speed;
0283          short  mk_curve;
0284     unsigned short  ax_options;
0285     unsigned short  ax_timeout;
0286     unsigned short  axt_opts_mask;
0287     unsigned short  axt_opts_values;
0288     unsigned int    axt_ctrls_mask;
0289     unsigned int    axt_ctrls_values;
0290     unsigned char   per_key_repeat[XkbPerKeyBitArraySize];
0291 } XkbControlsRec, *XkbControlsPtr;
0292 
0293 #define XkbAX_AnyFeedback(c)    ((c)->enabled_ctrls&XkbAccessXFeedbackMask)
0294 #define XkbAX_NeedOption(c,w)   ((c)->ax_options&(w))
0295 #define XkbAX_NeedFeedback(c,w) (XkbAX_AnyFeedback(c)&&XkbAX_NeedOption(c,w))
0296 
0297 typedef struct _XkbServerMapRec {
0298     /* acts is an array of XkbActions structs, with size_acts entries
0299        allocated, and num_acts entries used. */
0300     unsigned short       num_acts;
0301     unsigned short       size_acts;
0302     XkbAction       *acts;
0303 
0304     /* behaviors, key_acts, explicit, & vmodmap are all arrays with
0305        (xkb->max_key_code + 1) entries allocated for each. */
0306     XkbBehavior     *behaviors;
0307     unsigned short      *key_acts;
0308 #if defined(__cplusplus) || defined(c_plusplus)
0309     /* explicit is a C++ reserved word */
0310     unsigned char       *c_explicit;
0311 #else
0312     unsigned char       *explicit;
0313 #endif
0314     unsigned char        vmods[XkbNumVirtualMods];
0315     unsigned short      *vmodmap;
0316 } XkbServerMapRec, *XkbServerMapPtr;
0317 
0318 #define XkbSMKeyActionsPtr(m,k) (&(m)->acts[(m)->key_acts[k]])
0319 
0320     /*
0321      * Structures and access macros used primarily by clients
0322      */
0323 
0324 typedef struct _XkbSymMapRec {
0325     unsigned char    kt_index[XkbNumKbdGroups];
0326     unsigned char    group_info;
0327     unsigned char    width;
0328     unsigned short   offset;
0329 } XkbSymMapRec, *XkbSymMapPtr;
0330 
0331 typedef struct _XkbClientMapRec {
0332     /* types is an array of XkbKeyTypeRec structs, with size_types entries
0333        allocated, and num_types entries used. */
0334     unsigned char        size_types;
0335     unsigned char        num_types;
0336     XkbKeyTypePtr        types;
0337 
0338     /* syms is an array of size_syms KeySyms, in which num_syms are used */
0339     unsigned short       size_syms;
0340     unsigned short       num_syms;
0341     KeySym          *syms;
0342     /* key_sym_map is an array of (max_key_code + 1) XkbSymMapRec structs */
0343     XkbSymMapPtr         key_sym_map;
0344 
0345     /* modmap is an array of (max_key_code + 1) unsigned chars */
0346     unsigned char       *modmap;
0347 } XkbClientMapRec, *XkbClientMapPtr;
0348 
0349 #define XkbCMKeyGroupInfo(m,k)  ((m)->key_sym_map[k].group_info)
0350 #define XkbCMKeyNumGroups(m,k)   (XkbNumGroups((m)->key_sym_map[k].group_info))
0351 #define XkbCMKeyGroupWidth(m,k,g) (XkbCMKeyType(m,k,g)->num_levels)
0352 #define XkbCMKeyGroupsWidth(m,k) ((m)->key_sym_map[k].width)
0353 #define XkbCMKeyTypeIndex(m,k,g) ((m)->key_sym_map[k].kt_index[g&0x3])
0354 #define XkbCMKeyType(m,k,g)  (&(m)->types[XkbCMKeyTypeIndex(m,k,g)])
0355 #define XkbCMKeyNumSyms(m,k) (XkbCMKeyGroupsWidth(m,k)*XkbCMKeyNumGroups(m,k))
0356 #define XkbCMKeySymsOffset(m,k) ((m)->key_sym_map[k].offset)
0357 #define XkbCMKeySymsPtr(m,k)    (&(m)->syms[XkbCMKeySymsOffset(m,k)])
0358 
0359     /*
0360      * Compatibility structures and access macros
0361      */
0362 
0363 typedef struct _XkbSymInterpretRec {
0364     KeySym      sym;
0365     unsigned char   flags;
0366     unsigned char   match;
0367     unsigned char   mods;
0368     unsigned char   virtual_mod;
0369     XkbAnyAction    act;
0370 } XkbSymInterpretRec,*XkbSymInterpretPtr;
0371 
0372 typedef struct _XkbCompatMapRec {
0373     /* sym_interpret is an array of XkbSymInterpretRec structs,
0374        in which size_si are allocated & num_si are used. */
0375     XkbSymInterpretPtr   sym_interpret;
0376     XkbModsRec       groups[XkbNumKbdGroups];
0377     unsigned short       num_si;
0378     unsigned short       size_si;
0379 } XkbCompatMapRec, *XkbCompatMapPtr;
0380 
0381 typedef struct _XkbIndicatorMapRec {
0382     unsigned char   flags;
0383     unsigned char   which_groups;
0384     unsigned char   groups;
0385     unsigned char   which_mods;
0386     XkbModsRec  mods;
0387     unsigned int    ctrls;
0388 } XkbIndicatorMapRec, *XkbIndicatorMapPtr;
0389 
0390 #define XkbIM_IsAuto(i) ((((i)->flags&XkbIM_NoAutomatic)==0)&&\
0391                 (((i)->which_groups&&(i)->groups)||\
0392                  ((i)->which_mods&&(i)->mods.mask)||\
0393                  ((i)->ctrls)))
0394 #define XkbIM_InUse(i)  (((i)->flags)||((i)->which_groups)||\
0395                     ((i)->which_mods)||((i)->ctrls))
0396     
0397 
0398 typedef struct _XkbIndicatorRec {
0399     unsigned long       phys_indicators;
0400     XkbIndicatorMapRec  maps[XkbNumIndicators];
0401 } XkbIndicatorRec,*XkbIndicatorPtr;
0402 
0403 typedef struct _XkbKeyNameRec {
0404     char    name[XkbKeyNameLength];
0405 } XkbKeyNameRec,*XkbKeyNamePtr;
0406 
0407 typedef struct _XkbKeyAliasRec {
0408     char    real[XkbKeyNameLength];
0409     char    alias[XkbKeyNameLength];
0410 } XkbKeyAliasRec,*XkbKeyAliasPtr;
0411 
0412     /*
0413      * Names for everything 
0414      */
0415 typedef struct _XkbNamesRec {
0416     Atom          keycodes;
0417     Atom          geometry;
0418     Atom          symbols;
0419     Atom              types;
0420     Atom          compat;
0421     Atom          vmods[XkbNumVirtualMods];
0422     Atom          indicators[XkbNumIndicators];
0423     Atom          groups[XkbNumKbdGroups];
0424     /* keys is an array of (xkb->max_key_code + 1) XkbKeyNameRec entries */
0425     XkbKeyNamePtr     keys;
0426     /* key_aliases is an array of num_key_aliases XkbKeyAliasRec entries */
0427     XkbKeyAliasPtr    key_aliases;
0428     /* radio_groups is an array of num_rg Atoms */
0429     Atom         *radio_groups;
0430     Atom          phys_symbols;
0431 
0432     /* num_keys seems to be unused in libX11 */
0433     unsigned char     num_keys;
0434     unsigned char     num_key_aliases;
0435     unsigned short    num_rg;
0436 } XkbNamesRec,*XkbNamesPtr;
0437 
0438 typedef struct _XkbGeometry *XkbGeometryPtr;
0439     /*
0440      * Tie it all together into one big keyboard description
0441      */
0442 typedef struct _XkbDesc {
0443     struct _XDisplay *  dpy;
0444     unsigned short      flags;
0445     unsigned short      device_spec;
0446     KeyCode         min_key_code;
0447     KeyCode         max_key_code;
0448 
0449     XkbControlsPtr      ctrls;
0450     XkbServerMapPtr     server;
0451     XkbClientMapPtr     map;
0452     XkbIndicatorPtr     indicators;
0453     XkbNamesPtr     names;
0454     XkbCompatMapPtr     compat;
0455     XkbGeometryPtr      geom;
0456 } XkbDescRec, *XkbDescPtr;
0457 #define XkbKeyKeyTypeIndex(d,k,g)   (XkbCMKeyTypeIndex((d)->map,k,g))
0458 #define XkbKeyKeyType(d,k,g)        (XkbCMKeyType((d)->map,k,g))
0459 #define XkbKeyGroupWidth(d,k,g)     (XkbCMKeyGroupWidth((d)->map,k,g))
0460 #define XkbKeyGroupsWidth(d,k)      (XkbCMKeyGroupsWidth((d)->map,k))
0461 #define XkbKeyGroupInfo(d,k)        (XkbCMKeyGroupInfo((d)->map,(k)))
0462 #define XkbKeyNumGroups(d,k)        (XkbCMKeyNumGroups((d)->map,(k)))
0463 #define XkbKeyNumSyms(d,k)      (XkbCMKeyNumSyms((d)->map,(k)))
0464 #define XkbKeySymsPtr(d,k)      (XkbCMKeySymsPtr((d)->map,(k)))
0465 #define XkbKeySym(d,k,n)        (XkbKeySymsPtr(d,k)[n])
0466 #define XkbKeySymEntry(d,k,sl,g) \
0467     (XkbKeySym(d,k,((XkbKeyGroupsWidth(d,k)*(g))+(sl))))
0468 #define XkbKeyAction(d,k,n) \
0469     (XkbKeyHasActions(d,k)?&XkbKeyActionsPtr(d,k)[n]:NULL)
0470 #define XkbKeyActionEntry(d,k,sl,g) \
0471     (XkbKeyHasActions(d,k)?\
0472         XkbKeyAction(d,k,((XkbKeyGroupsWidth(d,k)*(g))+(sl))):NULL)
0473 
0474 #define XkbKeyHasActions(d,k)   ((d)->server->key_acts[k]!=0)
0475 #define XkbKeyNumActions(d,k)   (XkbKeyHasActions(d,k)?XkbKeyNumSyms(d,k):1)
0476 #define XkbKeyActionsPtr(d,k)   (XkbSMKeyActionsPtr((d)->server,k))
0477 #define XkbKeycodeInRange(d,k)  (((k)>=(d)->min_key_code)&&\
0478                  ((k)<=(d)->max_key_code))
0479 #define XkbNumKeys(d)       ((d)->max_key_code-(d)->min_key_code+1)
0480 
0481 
0482     /*
0483      * The following structures can be used to track changes
0484      * to a keyboard device
0485      */
0486 typedef struct _XkbMapChanges {
0487     unsigned short       changed;
0488     KeyCode          min_key_code;
0489     KeyCode          max_key_code;
0490     unsigned char        first_type;
0491     unsigned char        num_types;
0492     KeyCode          first_key_sym;
0493     unsigned char        num_key_syms;
0494     KeyCode          first_key_act;
0495     unsigned char        num_key_acts;
0496     KeyCode          first_key_behavior;
0497     unsigned char        num_key_behaviors;
0498     KeyCode          first_key_explicit;
0499     unsigned char        num_key_explicit;
0500     KeyCode          first_modmap_key;
0501     unsigned char        num_modmap_keys;
0502     KeyCode          first_vmodmap_key;
0503     unsigned char        num_vmodmap_keys;
0504     unsigned char        pad;
0505     unsigned short       vmods;
0506 } XkbMapChangesRec,*XkbMapChangesPtr;
0507 
0508 typedef struct _XkbControlsChanges {
0509     unsigned int         changed_ctrls;
0510     unsigned int         enabled_ctrls_changes;
0511     Bool             num_groups_changed;
0512 } XkbControlsChangesRec,*XkbControlsChangesPtr;
0513 
0514 typedef struct _XkbIndicatorChanges {
0515     unsigned int         state_changes;
0516     unsigned int         map_changes;
0517 } XkbIndicatorChangesRec,*XkbIndicatorChangesPtr;
0518 
0519 typedef struct _XkbNameChanges {
0520     unsigned int        changed;
0521     unsigned char       first_type;
0522     unsigned char       num_types;
0523     unsigned char       first_lvl;
0524     unsigned char       num_lvls;
0525     unsigned char       num_aliases;
0526     unsigned char       num_rg;
0527     unsigned char       first_key;
0528     unsigned char       num_keys;
0529     unsigned short      changed_vmods;
0530     unsigned long       changed_indicators;
0531     unsigned char       changed_groups;
0532 } XkbNameChangesRec,*XkbNameChangesPtr;
0533 
0534 typedef struct _XkbCompatChanges {
0535     unsigned char       changed_groups;
0536     unsigned short      first_si;
0537     unsigned short      num_si;
0538 } XkbCompatChangesRec,*XkbCompatChangesPtr;
0539 
0540 typedef struct _XkbChanges {
0541     unsigned short       device_spec;
0542     unsigned short       state_changes;
0543     XkbMapChangesRec     map;
0544     XkbControlsChangesRec    ctrls;
0545     XkbIndicatorChangesRec   indicators;
0546     XkbNameChangesRec    names;
0547     XkbCompatChangesRec  compat;
0548 } XkbChangesRec, *XkbChangesPtr;
0549 
0550     /*
0551      * These data structures are used to construct a keymap from 
0552      * a set of components or to list components in the server
0553      * database.
0554      */
0555 typedef struct _XkbComponentNames {
0556     char *           keymap;
0557     char *           keycodes;
0558     char *           types;
0559     char *           compat;
0560     char *           symbols;
0561     char *           geometry;
0562 } XkbComponentNamesRec, *XkbComponentNamesPtr;
0563 
0564 typedef struct _XkbComponentName {
0565     unsigned short      flags;
0566     char *          name;
0567 } XkbComponentNameRec,*XkbComponentNamePtr;
0568 
0569 typedef struct _XkbComponentList {
0570     int         num_keymaps;
0571     int         num_keycodes;
0572     int         num_types;
0573     int         num_compat;
0574     int         num_symbols;
0575     int         num_geometry;
0576     XkbComponentNamePtr keymaps;
0577     XkbComponentNamePtr     keycodes;
0578     XkbComponentNamePtr types;
0579     XkbComponentNamePtr compat;
0580     XkbComponentNamePtr symbols;
0581     XkbComponentNamePtr geometry;
0582 } XkbComponentListRec, *XkbComponentListPtr;
0583 
0584     /*
0585      * The following data structures describe and track changes to a 
0586      * non-keyboard extension device 
0587      */
0588 typedef struct _XkbDeviceLedInfo {
0589     unsigned short          led_class;
0590     unsigned short          led_id;
0591     unsigned int            phys_indicators;
0592     unsigned int            maps_present;
0593     unsigned int            names_present;
0594     unsigned int            state;
0595     Atom                names[XkbNumIndicators];
0596     XkbIndicatorMapRec      maps[XkbNumIndicators];
0597 } XkbDeviceLedInfoRec,*XkbDeviceLedInfoPtr;
0598 
0599 typedef struct _XkbDeviceInfo {
0600     char *          name;
0601     Atom            type;
0602     unsigned short      device_spec;
0603     Bool            has_own_state;
0604     unsigned short      supported;
0605     unsigned short      unsupported;
0606 
0607     /* btn_acts is an array of num_btn XkbAction entries */
0608     unsigned short      num_btns;
0609     XkbAction *     btn_acts;
0610 
0611     unsigned short      sz_leds;
0612     unsigned short      num_leds;
0613     unsigned short      dflt_kbd_fb;
0614     unsigned short      dflt_led_fb;
0615     /* leds is an array of XkbDeviceLedInfoRec in which
0616        sz_leds entries are allocated and num_leds entries are used */
0617     XkbDeviceLedInfoPtr leds;
0618 } XkbDeviceInfoRec,*XkbDeviceInfoPtr;
0619 
0620 #define XkbXI_DevHasBtnActs(d)  (((d)->num_btns>0)&&((d)->btn_acts!=NULL))
0621 #define XkbXI_LegalDevBtn(d,b)  (XkbXI_DevHasBtnActs(d)&&((b)<(d)->num_btns))
0622 #define XkbXI_DevHasLeds(d) (((d)->num_leds>0)&&((d)->leds!=NULL))
0623 
0624 typedef struct _XkbDeviceLedChanges {
0625     unsigned short      led_class;
0626     unsigned short      led_id;
0627     unsigned int        defined; /* names or maps changed */
0628     struct _XkbDeviceLedChanges *next;
0629 } XkbDeviceLedChangesRec,*XkbDeviceLedChangesPtr;
0630 
0631 typedef struct _XkbDeviceChanges {
0632     unsigned int        changed;
0633     unsigned short      first_btn;
0634     unsigned short      num_btns;
0635     XkbDeviceLedChangesRec  leds;
0636 } XkbDeviceChangesRec,*XkbDeviceChangesPtr;
0637 
0638 #ifdef __clang__
0639 #pragma clang diagnostic pop
0640 #endif
0641 
0642 #endif /* _XKBSTR_H_ */