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