| 1 |
/************************************************************ |
| 2 |
Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc. |
| 3 |
|
| 4 |
Permission to use, copy, modify, and distribute this |
| 5 |
software and its documentation for any purpose and without |
| 6 |
fee is hereby granted, provided that the above copyright |
| 7 |
notice appear in all copies and that both that copyright |
| 8 |
notice and this permission notice appear in supporting |
| 9 |
documentation, and that the name of Silicon Graphics not be |
| 10 |
used in advertising or publicity pertaining to distribution |
| 11 |
of the software without specific prior written permission. |
| 12 |
Silicon Graphics makes no representation about the suitability |
| 13 |
of this software for any purpose. It is provided "as is" |
| 14 |
without any express or implied warranty. |
| 15 |
|
| 16 |
SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS |
| 17 |
SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY |
| 18 |
AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON |
| 19 |
GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL |
| 20 |
DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, |
| 21 |
DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE |
| 22 |
OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH |
| 23 |
THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 24 |
|
| 25 |
********************************************************/ |
| 26 |
|
| 27 |
#ifndef _XKBSTR_H_ |
| 28 |
#define _XKBSTR_H_ |
| 29 |
|
| 30 |
#include <nx-X11/extensions/XKB.h> |
| 31 |
|
| 32 |
#define XkbCharToInt(v) ((v)&0x80?(int)((v)|(~0xff)):(int)((v)&0x7f)) |
| 33 |
#define XkbIntTo2Chars(i,h,l) (((h)=((i>>8)&0xff)),((l)=((i)&0xff))) |
| 34 |
|
| 35 |
#define Xkb2CharsToInt(h,l) ((short)(((h)<<8)|(l))) |
| 36 |
|
| 37 |
/* |
| 38 |
* Common data structures and access macros |
| 39 |
*/ |
| 40 |
|
| 41 |
typedef struct _XkbStateRec { |
| 42 |
unsigned char group; |
| 43 |
unsigned char locked_group; |
| 44 |
unsigned short base_group; |
| 45 |
unsigned short latched_group; |
| 46 |
unsigned char mods; |
| 47 |
unsigned char base_mods; |
| 48 |
unsigned char latched_mods; |
| 49 |
unsigned char locked_mods; |
| 50 |
unsigned char compat_state; |
| 51 |
unsigned char grab_mods; |
| 52 |
unsigned char compat_grab_mods; |
| 53 |
unsigned char lookup_mods; |
| 54 |
unsigned char compat_lookup_mods; |
| 55 |
unsigned short ptr_buttons; |
| 56 |
} XkbStateRec,*XkbStatePtr; |
| 57 |
#define XkbModLocks(s) ((s)->locked_mods) |
| 58 |
#define XkbStateMods(s) ((s)->base_mods|(s)->latched_mods|XkbModLocks(s)) |
| 59 |
#define XkbGroupLock(s) ((s)->locked_group) |
| 60 |
#define XkbStateGroup(s) ((s)->base_group+(s)->latched_group+XkbGroupLock(s)) |
| 61 |
#define XkbStateFieldFromRec(s) XkbBuildCoreState((s)->lookup_mods,(s)->group) |
| 62 |
#define XkbGrabStateFromRec(s) XkbBuildCoreState((s)->grab_mods,(s)->group) |
| 63 |
|
| 64 |
typedef struct _XkbMods { |
| 65 |
unsigned char mask; /* effective mods */ |
| 66 |
unsigned char real_mods; |
| 67 |
unsigned short vmods; |
| 68 |
} XkbModsRec,*XkbModsPtr; |
| 69 |
|
| 70 |
typedef struct _XkbKTMapEntry { |
| 71 |
Bool active; |
| 72 |
unsigned char level; |
| 73 |
XkbModsRec mods; |
| 74 |
} XkbKTMapEntryRec,*XkbKTMapEntryPtr; |
| 75 |
|
| 76 |
typedef struct _XkbKeyType { |
| 77 |
XkbModsRec mods; |
| 78 |
unsigned char num_levels; |
| 79 |
unsigned char map_count; |
| 80 |
XkbKTMapEntryPtr map; |
| 81 |
XkbModsPtr preserve; |
| 82 |
Atom name; |
| 83 |
Atom * level_names; |
| 84 |
} XkbKeyTypeRec, *XkbKeyTypePtr; |
| 85 |
|
| 86 |
#define XkbNumGroups(g) ((g)&0x0f) |
| 87 |
#define XkbOutOfRangeGroupInfo(g) ((g)&0xf0) |
| 88 |
#define XkbOutOfRangeGroupAction(g) ((g)&0xc0) |
| 89 |
#define XkbOutOfRangeGroupNumber(g) (((g)&0x30)>>4) |
| 90 |
#define XkbSetGroupInfo(g,w,n) (((w)&0xc0)|(((n)&3)<<4)|((g)&0x0f)) |
| 91 |
#define XkbSetNumGroups(g,n) (((g)&0xf0)|((n)&0x0f)) |
| 92 |
|
| 93 |
/* |
| 94 |
* Structures and access macros used primarily by the server |
| 95 |
*/ |
| 96 |
|
| 97 |
typedef struct _XkbBehavior { |
| 98 |
unsigned char type; |
| 99 |
unsigned char data; |
| 100 |
} XkbBehavior; |
| 101 |
|
| 102 |
#define XkbAnyActionDataSize 7 |
| 103 |
typedef struct _XkbAnyAction { |
| 104 |
unsigned char type; |
| 105 |
unsigned char data[XkbAnyActionDataSize]; |
| 106 |
} XkbAnyAction; |
| 107 |
|
| 108 |
typedef struct _XkbModAction { |
| 109 |
unsigned char type; |
| 110 |
unsigned char flags; |
| 111 |
unsigned char mask; |
| 112 |
unsigned char real_mods; |
| 113 |
unsigned char vmods1; |
| 114 |
unsigned char vmods2; |
| 115 |
} XkbModAction; |
| 116 |
#define XkbModActionVMods(a) \ |
| 117 |
((short)(((a)->vmods1<<8)|((a)->vmods2))) |
| 118 |
#define XkbSetModActionVMods(a,v) \ |
| 119 |
(((a)->vmods1=(((v)>>8)&0xff)),(a)->vmods2=((v)&0xff)) |
| 120 |
|
| 121 |
typedef struct _XkbGroupAction { |
| 122 |
unsigned char type; |
| 123 |
unsigned char flags; |
| 124 |
char group_XXX; |
| 125 |
} XkbGroupAction; |
| 126 |
#define XkbSAGroup(a) (XkbCharToInt((a)->group_XXX)) |
| 127 |
#define XkbSASetGroup(a,g) ((a)->group_XXX=(g)) |
| 128 |
|
| 129 |
typedef struct _XkbISOAction { |
| 130 |
unsigned char type; |
| 131 |
unsigned char flags; |
| 132 |
unsigned char mask; |
| 133 |
unsigned char real_mods; |
| 134 |
char group_XXX; |
| 135 |
unsigned char affect; |
| 136 |
unsigned char vmods1; |
| 137 |
unsigned char vmods2; |
| 138 |
} XkbISOAction; |
| 139 |
|
| 140 |
typedef struct _XkbPtrAction { |
| 141 |
unsigned char type; |
| 142 |
unsigned char flags; |
| 143 |
unsigned char high_XXX; |
| 144 |
unsigned char low_XXX; |
| 145 |
unsigned char high_YYY; |
| 146 |
unsigned char low_YYY; |
| 147 |
} XkbPtrAction; |
| 148 |
#define XkbPtrActionX(a) (Xkb2CharsToInt((a)->high_XXX,(a)->low_XXX)) |
| 149 |
#define XkbPtrActionY(a) (Xkb2CharsToInt((a)->high_YYY,(a)->low_YYY)) |
| 150 |
#define XkbSetPtrActionX(a,x) (XkbIntTo2Chars(x,(a)->high_XXX,(a)->low_XXX)) |
| 151 |
#define XkbSetPtrActionY(a,y) (XkbIntTo2Chars(y,(a)->high_YYY,(a)->low_YYY)) |
| 152 |
|
| 153 |
typedef struct _XkbPtrBtnAction { |
| 154 |
unsigned char type; |
| 155 |
unsigned char flags; |
| 156 |
unsigned char count; |
| 157 |
unsigned char button; |
| 158 |
} XkbPtrBtnAction; |
| 159 |
|
| 160 |
typedef struct _XkbPtrDfltAction { |
| 161 |
unsigned char type; |
| 162 |
unsigned char flags; |
| 163 |
unsigned char affect; |
| 164 |
char valueXXX; |
| 165 |
} XkbPtrDfltAction; |
| 166 |
#define XkbSAPtrDfltValue(a) (XkbCharToInt((a)->valueXXX)) |
| 167 |
#define XkbSASetPtrDfltValue(a,c) ((a)->valueXXX= ((c)&0xff)) |
| 168 |
|
| 169 |
typedef struct _XkbSwitchScreenAction { |
| 170 |
unsigned char type; |
| 171 |
unsigned char flags; |
| 172 |
char screenXXX; |
| 173 |
} XkbSwitchScreenAction; |
| 174 |
#define XkbSAScreen(a) (XkbCharToInt((a)->screenXXX)) |
| 175 |
#define XkbSASetScreen(a,s) ((a)->screenXXX= ((s)&0xff)) |
| 176 |
|
| 177 |
typedef struct _XkbCtrlsAction { |
| 178 |
unsigned char type; |
| 179 |
unsigned char flags; |
| 180 |
unsigned char ctrls3; |
| 181 |
unsigned char ctrls2; |
| 182 |
unsigned char ctrls1; |
| 183 |
unsigned char ctrls0; |
| 184 |
} XkbCtrlsAction; |
| 185 |
#define XkbActionSetCtrls(a,c) (((a)->ctrls3=(((c)>>24)&0xff)),\ |
| 186 |
((a)->ctrls2=(((c)>>16)&0xff)),\ |
| 187 |
((a)->ctrls1=(((c)>>8)&0xff)),\ |
| 188 |
((a)->ctrls0=((c)&0xff))) |
| 189 |
#define XkbActionCtrls(a) ((((unsigned int)(a)->ctrls3)<<24)|\ |
| 190 |
(((unsigned int)(a)->ctrls2)<<16)|\ |
| 191 |
(((unsigned int)(a)->ctrls1)<<8)|\ |
| 192 |
((unsigned int)((a)->ctrls0))) |
| 193 |
|
| 194 |
typedef struct _XkbMessageAction { |
| 195 |
unsigned char type; |
| 196 |
unsigned char flags; |
| 197 |
unsigned char message[6]; |
| 198 |
} XkbMessageAction; |
| 199 |
|
| 200 |
typedef struct _XkbRedirectKeyAction { |
| 201 |
unsigned char type; |
| 202 |
unsigned char new_key; |
| 203 |
unsigned char mods_mask; |
| 204 |
unsigned char mods; |
| 205 |
unsigned char vmods_mask0; |
| 206 |
unsigned char vmods_mask1; |
| 207 |
unsigned char vmods0; |
| 208 |
unsigned char vmods1; |
| 209 |
} XkbRedirectKeyAction; |
| 210 |
|
| 211 |
#define XkbSARedirectVMods(a) ((((unsigned int)(a)->vmods1)<<8)|\ |
| 212 |
((unsigned int)(a)->vmods0)) |
| 213 |
#define XkbSARedirectSetVMods(a,m) (((a)->vmods_mask1=(((m)>>8)&0xff)),\ |
| 214 |
((a)->vmods_mask0=((m)&0xff))) |
| 215 |
#define XkbSARedirectVModsMask(a) ((((unsigned int)(a)->vmods_mask1)<<8)|\ |
| 216 |
((unsigned int)(a)->vmods_mask0)) |
| 217 |
#define XkbSARedirectSetVModsMask(a,m) (((a)->vmods_mask1=(((m)>>8)&0xff)),\ |
| 218 |
((a)->vmods_mask0=((m)&0xff))) |
| 219 |
|
| 220 |
typedef struct _XkbDeviceBtnAction { |
| 221 |
unsigned char type; |
| 222 |
unsigned char flags; |
| 223 |
unsigned char count; |
| 224 |
unsigned char button; |
| 225 |
unsigned char device; |
| 226 |
} XkbDeviceBtnAction; |
| 227 |
|
| 228 |
typedef struct _XkbDeviceValuatorAction { |
| 229 |
unsigned char type; |
| 230 |
unsigned char device; |
| 231 |
unsigned char v1_what; |
| 232 |
unsigned char v1_ndx; |
| 233 |
unsigned char v1_value; |
| 234 |
unsigned char v2_what; |
| 235 |
unsigned char v2_ndx; |
| 236 |
unsigned char v2_value; |
| 237 |
} XkbDeviceValuatorAction; |
| 238 |
|
| 239 |
typedef union _XkbAction { |
| 240 |
XkbAnyAction any; |
| 241 |
XkbModAction mods; |
| 242 |
XkbGroupAction group; |
| 243 |
XkbISOAction iso; |
| 244 |
XkbPtrAction ptr; |
| 245 |
XkbPtrBtnAction btn; |
| 246 |
XkbPtrDfltAction dflt; |
| 247 |
XkbSwitchScreenAction screen; |
| 248 |
XkbCtrlsAction ctrls; |
| 249 |
XkbMessageAction msg; |
| 250 |
XkbRedirectKeyAction redirect; |
| 251 |
XkbDeviceBtnAction devbtn; |
| 252 |
XkbDeviceValuatorAction devval; |
| 253 |
unsigned char type; |
| 254 |
} XkbAction; |
| 255 |
|
| 256 |
typedef struct _XkbControls { |
| 257 |
unsigned char mk_dflt_btn; |
| 258 |
unsigned char num_groups; |
| 259 |
unsigned char groups_wrap; |
| 260 |
XkbModsRec internal; |
| 261 |
XkbModsRec ignore_lock; |
| 262 |
unsigned int enabled_ctrls; |
| 263 |
unsigned short repeat_delay; |
| 264 |
unsigned short repeat_interval; |
| 265 |
unsigned short slow_keys_delay; |
| 266 |
unsigned short debounce_delay; |
| 267 |
unsigned short mk_delay; |
| 268 |
unsigned short mk_interval; |
| 269 |
unsigned short mk_time_to_max; |
| 270 |
unsigned short mk_max_speed; |
| 271 |
short mk_curve; |
| 272 |
unsigned short ax_options; |
| 273 |
unsigned short ax_timeout; |
| 274 |
unsigned short axt_opts_mask; |
| 275 |
unsigned short axt_opts_values; |
| 276 |
unsigned int axt_ctrls_mask; |
| 277 |
unsigned int axt_ctrls_values; |
| 278 |
unsigned char per_key_repeat[XkbPerKeyBitArraySize]; |
| 279 |
} XkbControlsRec, *XkbControlsPtr; |
| 280 |
|
| 281 |
#define XkbAX_AnyFeedback(c) ((c)->enabled_ctrls&XkbAccessXFeedbackMask) |
| 282 |
#define XkbAX_NeedOption(c,w) ((c)->ax_options&(w)) |
| 283 |
#define XkbAX_NeedFeedback(c,w) (XkbAX_AnyFeedback(c)&&XkbAX_NeedOption(c,w)) |
| 284 |
|
| 285 |
typedef struct _XkbServerMapRec { |
| 286 |
unsigned short num_acts; |
| 287 |
unsigned short size_acts; |
| 288 |
XkbAction *acts; |
| 289 |
|
| 290 |
XkbBehavior *behaviors; |
| 291 |
unsigned short *key_acts; |
| 292 |
#if defined(__cplusplus) || defined(c_plusplus) |
| 293 |
/* explicit is a C++ reserved word */ |
| 294 |
unsigned char *c_explicit; |
| 295 |
#else |
| 296 |
unsigned char *explicit; |
| 297 |
#endif |
| 298 |
unsigned char vmods[XkbNumVirtualMods]; |
| 299 |
unsigned short *vmodmap; |
| 300 |
} XkbServerMapRec, *XkbServerMapPtr; |
| 301 |
|
| 302 |
#define XkbSMKeyActionsPtr(m,k) (&(m)->acts[(m)->key_acts[k]]) |
| 303 |
|
| 304 |
/* |
| 305 |
* Structures and access macros used primarily by clients |
| 306 |
*/ |
| 307 |
|
| 308 |
typedef struct _XkbSymMapRec { |
| 309 |
unsigned char kt_index[XkbNumKbdGroups]; |
| 310 |
unsigned char group_info; |
| 311 |
unsigned char width; |
| 312 |
unsigned short offset; |
| 313 |
} XkbSymMapRec, *XkbSymMapPtr; |
| 314 |
|
| 315 |
typedef struct _XkbClientMapRec { |
| 316 |
unsigned char size_types; |
| 317 |
unsigned char num_types; |
| 318 |
XkbKeyTypePtr types; |
| 319 |
|
| 320 |
unsigned short size_syms; |
| 321 |
unsigned short num_syms; |
| 322 |
KeySym *syms; |
| 323 |
XkbSymMapPtr key_sym_map; |
| 324 |
|
| 325 |
unsigned char *modmap; |
| 326 |
} XkbClientMapRec, *XkbClientMapPtr; |
| 327 |
|
| 328 |
#define XkbCMKeyGroupInfo(m,k) ((m)->key_sym_map[k].group_info) |
| 329 |
#define XkbCMKeyNumGroups(m,k) (XkbNumGroups((m)->key_sym_map[k].group_info)) |
| 330 |
#define XkbCMKeyGroupWidth(m,k,g) (XkbCMKeyType(m,k,g)->num_levels) |
| 331 |
#define XkbCMKeyGroupsWidth(m,k) ((m)->key_sym_map[k].width) |
| 332 |
#define XkbCMKeyTypeIndex(m,k,g) ((m)->key_sym_map[k].kt_index[g&0x3]) |
| 333 |
#define XkbCMKeyType(m,k,g) (&(m)->types[XkbCMKeyTypeIndex(m,k,g)]) |
| 334 |
#define XkbCMKeyNumSyms(m,k) (XkbCMKeyGroupsWidth(m,k)*XkbCMKeyNumGroups(m,k)) |
| 335 |
#define XkbCMKeySymsOffset(m,k) ((m)->key_sym_map[k].offset) |
| 336 |
#define XkbCMKeySymsPtr(m,k) (&(m)->syms[XkbCMKeySymsOffset(m,k)]) |
| 337 |
|
| 338 |
/* |
| 339 |
* Compatibility structures and access macros |
| 340 |
*/ |
| 341 |
|
| 342 |
typedef struct _XkbSymInterpretRec { |
| 343 |
KeySym sym; |
| 344 |
unsigned char flags; |
| 345 |
unsigned char match; |
| 346 |
unsigned char mods; |
| 347 |
unsigned char virtual_mod; |
| 348 |
XkbAnyAction act; |
| 349 |
} XkbSymInterpretRec,*XkbSymInterpretPtr; |
| 350 |
|
| 351 |
typedef struct _XkbCompatMapRec { |
| 352 |
XkbSymInterpretPtr sym_interpret; |
| 353 |
XkbModsRec groups[XkbNumKbdGroups]; |
| 354 |
unsigned short num_si; |
| 355 |
unsigned short size_si; |
| 356 |
} XkbCompatMapRec, *XkbCompatMapPtr; |
| 357 |
|
| 358 |
typedef struct _XkbIndicatorMapRec { |
| 359 |
unsigned char flags; |
| 360 |
unsigned char which_groups; |
| 361 |
unsigned char groups; |
| 362 |
unsigned char which_mods; |
| 363 |
XkbModsRec mods; |
| 364 |
unsigned int ctrls; |
| 365 |
} XkbIndicatorMapRec, *XkbIndicatorMapPtr; |
| 366 |
|
| 367 |
#define XkbIM_IsAuto(i) ((((i)->flags&XkbIM_NoAutomatic)==0)&&\ |
| 368 |
(((i)->which_groups&&(i)->groups)||\ |
| 369 |
((i)->which_mods&&(i)->mods.mask)||\ |
| 370 |
((i)->ctrls))) |
| 371 |
#define XkbIM_InUse(i) (((i)->flags)||((i)->which_groups)||\ |
| 372 |
((i)->which_mods)||((i)->ctrls)) |
| 373 |
|
| 374 |
|
| 375 |
typedef struct _XkbIndicatorRec { |
| 376 |
unsigned long phys_indicators; |
| 377 |
XkbIndicatorMapRec maps[XkbNumIndicators]; |
| 378 |
} XkbIndicatorRec,*XkbIndicatorPtr; |
| 379 |
|
| 380 |
typedef struct _XkbKeyNameRec { |
| 381 |
char name[XkbKeyNameLength]; |
| 382 |
} XkbKeyNameRec,*XkbKeyNamePtr; |
| 383 |
|
| 384 |
typedef struct _XkbKeyAliasRec { |
| 385 |
char real[XkbKeyNameLength]; |
| 386 |
char alias[XkbKeyNameLength]; |
| 387 |
} XkbKeyAliasRec,*XkbKeyAliasPtr; |
| 388 |
|
| 389 |
/* |
| 390 |
* Names for everything |
| 391 |
*/ |
| 392 |
typedef struct _XkbNamesRec { |
| 393 |
Atom keycodes; |
| 394 |
Atom geometry; |
| 395 |
Atom symbols; |
| 396 |
Atom types; |
| 397 |
Atom compat; |
| 398 |
Atom vmods[XkbNumVirtualMods]; |
| 399 |
Atom indicators[XkbNumIndicators]; |
| 400 |
Atom groups[XkbNumKbdGroups]; |
| 401 |
XkbKeyNamePtr keys; |
| 402 |
XkbKeyAliasPtr key_aliases; |
| 403 |
Atom *radio_groups; |
| 404 |
Atom phys_symbols; |
| 405 |
|
| 406 |
unsigned char num_keys; |
| 407 |
unsigned char num_key_aliases; |
| 408 |
unsigned short num_rg; |
| 409 |
} XkbNamesRec,*XkbNamesPtr; |
| 410 |
|
| 411 |
typedef struct _XkbGeometry *XkbGeometryPtr; |
| 412 |
/* |
| 413 |
* Tie it all together into one big keyboard description |
| 414 |
*/ |
| 415 |
typedef struct _XkbDesc { |
| 416 |
struct _XDisplay * dpy; |
| 417 |
unsigned short flags; |
| 418 |
unsigned short device_spec; |
| 419 |
KeyCode min_key_code; |
| 420 |
KeyCode max_key_code; |
| 421 |
|
| 422 |
XkbControlsPtr ctrls; |
| 423 |
XkbServerMapPtr server; |
| 424 |
XkbClientMapPtr map; |
| 425 |
XkbIndicatorPtr indicators; |
| 426 |
XkbNamesPtr names; |
| 427 |
XkbCompatMapPtr compat; |
| 428 |
XkbGeometryPtr geom; |
| 429 |
} XkbDescRec, *XkbDescPtr; |
| 430 |
#define XkbKeyKeyTypeIndex(d,k,g) (XkbCMKeyTypeIndex((d)->map,k,g)) |
| 431 |
#define XkbKeyKeyType(d,k,g) (XkbCMKeyType((d)->map,k,g)) |
| 432 |
#define XkbKeyGroupWidth(d,k,g) (XkbCMKeyGroupWidth((d)->map,k,g)) |
| 433 |
#define XkbKeyGroupsWidth(d,k) (XkbCMKeyGroupsWidth((d)->map,k)) |
| 434 |
#define XkbKeyGroupInfo(d,k) (XkbCMKeyGroupInfo((d)->map,(k))) |
| 435 |
#define XkbKeyNumGroups(d,k) (XkbCMKeyNumGroups((d)->map,(k))) |
| 436 |
#define XkbKeyNumSyms(d,k) (XkbCMKeyNumSyms((d)->map,(k))) |
| 437 |
#define XkbKeySymsPtr(d,k) (XkbCMKeySymsPtr((d)->map,(k))) |
| 438 |
#define XkbKeySym(d,k,n) (XkbKeySymsPtr(d,k)[n]) |
| 439 |
#define XkbKeySymEntry(d,k,sl,g) \ |
| 440 |
(XkbKeySym(d,k,((XkbKeyGroupsWidth(d,k)*(g))+(sl)))) |
| 441 |
#define XkbKeyAction(d,k,n) \ |
| 442 |
(XkbKeyHasActions(d,k)?&XkbKeyActionsPtr(d,k)[n]:NULL) |
| 443 |
#define XkbKeyActionEntry(d,k,sl,g) \ |
| 444 |
(XkbKeyHasActions(d,k)?\ |
| 445 |
XkbKeyAction(d,k,((XkbKeyGroupsWidth(d,k)*(g))+(sl))):NULL) |
| 446 |
|
| 447 |
#define XkbKeyHasActions(d,k) ((d)->server->key_acts[k]!=0) |
| 448 |
#define XkbKeyNumActions(d,k) (XkbKeyHasActions(d,k)?XkbKeyNumSyms(d,k):1) |
| 449 |
#define XkbKeyActionsPtr(d,k) (XkbSMKeyActionsPtr((d)->server,k)) |
| 450 |
#define XkbKeycodeInRange(d,k) (((k)>=(d)->min_key_code)&&\ |
| 451 |
((k)<=(d)->max_key_code)) |
| 452 |
#define XkbNumKeys(d) ((d)->max_key_code-(d)->min_key_code+1) |
| 453 |
|
| 454 |
|
| 455 |
/* |
| 456 |
* The following structures can be used to track changes |
| 457 |
* to a keyboard device |
| 458 |
*/ |
| 459 |
typedef struct _XkbMapChanges { |
| 460 |
unsigned short changed; |
| 461 |
KeyCode min_key_code; |
| 462 |
KeyCode max_key_code; |
| 463 |
unsigned char first_type; |
| 464 |
unsigned char num_types; |
| 465 |
KeyCode first_key_sym; |
| 466 |
unsigned char num_key_syms; |
| 467 |
KeyCode first_key_act; |
| 468 |
unsigned char num_key_acts; |
| 469 |
KeyCode first_key_behavior; |
| 470 |
unsigned char num_key_behaviors; |
| 471 |
KeyCode first_key_explicit; |
| 472 |
unsigned char num_key_explicit; |
| 473 |
KeyCode first_modmap_key; |
| 474 |
unsigned char num_modmap_keys; |
| 475 |
KeyCode first_vmodmap_key; |
| 476 |
unsigned char num_vmodmap_keys; |
| 477 |
unsigned char pad; |
| 478 |
unsigned short vmods; |
| 479 |
} XkbMapChangesRec,*XkbMapChangesPtr; |
| 480 |
|
| 481 |
typedef struct _XkbControlsChanges { |
| 482 |
unsigned int changed_ctrls; |
| 483 |
unsigned int enabled_ctrls_changes; |
| 484 |
Bool num_groups_changed; |
| 485 |
} XkbControlsChangesRec,*XkbControlsChangesPtr; |
| 486 |
|
| 487 |
typedef struct _XkbIndicatorChanges { |
| 488 |
unsigned int state_changes; |
| 489 |
unsigned int map_changes; |
| 490 |
} XkbIndicatorChangesRec,*XkbIndicatorChangesPtr; |
| 491 |
|
| 492 |
typedef struct _XkbNameChanges { |
| 493 |
unsigned int changed; |
| 494 |
unsigned char first_type; |
| 495 |
unsigned char num_types; |
| 496 |
unsigned char first_lvl; |
| 497 |
unsigned char num_lvls; |
| 498 |
unsigned char num_aliases; |
| 499 |
unsigned char num_rg; |
| 500 |
unsigned char first_key; |
| 501 |
unsigned char num_keys; |
| 502 |
unsigned short changed_vmods; |
| 503 |
unsigned long changed_indicators; |
| 504 |
unsigned char changed_groups; |
| 505 |
} XkbNameChangesRec,*XkbNameChangesPtr; |
| 506 |
|
| 507 |
typedef struct _XkbCompatChanges { |
| 508 |
unsigned char changed_groups; |
| 509 |
unsigned short first_si; |
| 510 |
unsigned short num_si; |
| 511 |
} XkbCompatChangesRec,*XkbCompatChangesPtr; |
| 512 |
|
| 513 |
typedef struct _XkbChanges { |
| 514 |
unsigned short device_spec; |
| 515 |
unsigned short state_changes; |
| 516 |
XkbMapChangesRec map; |
| 517 |
XkbControlsChangesRec ctrls; |
| 518 |
XkbIndicatorChangesRec indicators; |
| 519 |
XkbNameChangesRec names; |
| 520 |
XkbCompatChangesRec compat; |
| 521 |
} XkbChangesRec, *XkbChangesPtr; |
| 522 |
|
| 523 |
/* |
| 524 |
* These data structures are used to construct a keymap from |
| 525 |
* a set of components or to list components in the server |
| 526 |
* database. |
| 527 |
*/ |
| 528 |
typedef struct _XkbComponentNames { |
| 529 |
char * keymap; |
| 530 |
char * keycodes; |
| 531 |
char * types; |
| 532 |
char * compat; |
| 533 |
char * symbols; |
| 534 |
char * geometry; |
| 535 |
} XkbComponentNamesRec, *XkbComponentNamesPtr; |
| 536 |
|
| 537 |
typedef struct _XkbComponentName { |
| 538 |
unsigned short flags; |
| 539 |
char * name; |
| 540 |
} XkbComponentNameRec,*XkbComponentNamePtr; |
| 541 |
|
| 542 |
typedef struct _XkbComponentList { |
| 543 |
int num_keymaps; |
| 544 |
int num_keycodes; |
| 545 |
int num_types; |
| 546 |
int num_compat; |
| 547 |
int num_symbols; |
| 548 |
int num_geometry; |
| 549 |
XkbComponentNamePtr keymaps; |
| 550 |
XkbComponentNamePtr keycodes; |
| 551 |
XkbComponentNamePtr types; |
| 552 |
XkbComponentNamePtr compat; |
| 553 |
XkbComponentNamePtr symbols; |
| 554 |
XkbComponentNamePtr geometry; |
| 555 |
} XkbComponentListRec, *XkbComponentListPtr; |
| 556 |
|
| 557 |
/* |
| 558 |
* The following data structures describe and track changes to a |
| 559 |
* non-keyboard extension device |
| 560 |
*/ |
| 561 |
typedef struct _XkbDeviceLedInfo { |
| 562 |
unsigned short led_class; |
| 563 |
unsigned short led_id; |
| 564 |
unsigned int phys_indicators; |
| 565 |
unsigned int maps_present; |
| 566 |
unsigned int names_present; |
| 567 |
unsigned int state; |
| 568 |
Atom names[XkbNumIndicators]; |
| 569 |
XkbIndicatorMapRec maps[XkbNumIndicators]; |
| 570 |
} XkbDeviceLedInfoRec,*XkbDeviceLedInfoPtr; |
| 571 |
|
| 572 |
typedef struct _XkbDeviceInfo { |
| 573 |
char * name; |
| 574 |
Atom type; |
| 575 |
unsigned short device_spec; |
| 576 |
Bool has_own_state; |
| 577 |
unsigned short supported; |
| 578 |
unsigned short unsupported; |
| 579 |
|
| 580 |
unsigned short num_btns; |
| 581 |
XkbAction * btn_acts; |
| 582 |
|
| 583 |
unsigned short sz_leds; |
| 584 |
unsigned short num_leds; |
| 585 |
unsigned short dflt_kbd_fb; |
| 586 |
unsigned short dflt_led_fb; |
| 587 |
XkbDeviceLedInfoPtr leds; |
| 588 |
} XkbDeviceInfoRec,*XkbDeviceInfoPtr; |
| 589 |
|
| 590 |
#define XkbXI_DevHasBtnActs(d) (((d)->num_btns>0)&&((d)->btn_acts!=NULL)) |
| 591 |
#define XkbXI_LegalDevBtn(d,b) (XkbXI_DevHasBtnActs(d)&&((b)<(d)->num_btns)) |
| 592 |
#define XkbXI_DevHasLeds(d) (((d)->num_leds>0)&&((d)->leds!=NULL)) |
| 593 |
|
| 594 |
typedef struct _XkbDeviceLedChanges { |
| 595 |
unsigned short led_class; |
| 596 |
unsigned short led_id; |
| 597 |
unsigned int defined; /* names or maps changed */ |
| 598 |
struct _XkbDeviceLedChanges *next; |
| 599 |
} XkbDeviceLedChangesRec,*XkbDeviceLedChangesPtr; |
| 600 |
|
| 601 |
typedef struct _XkbDeviceChanges { |
| 602 |
unsigned int changed; |
| 603 |
unsigned short first_btn; |
| 604 |
unsigned short num_btns; |
| 605 |
XkbDeviceLedChangesRec leds; |
| 606 |
} XkbDeviceChangesRec,*XkbDeviceChangesPtr; |
| 607 |
|
| 608 |
#endif /* _XKBSTR_H_ */ |