ch12.xml revision e9fcaa8a
1<chapter id='interpreting_key_events'> 2<title>Interpreting Key Events</title> 3 4<para> 5Xkb provides functions to help developers interpret key events without having 6to directly interpret Xkb data structures. Xkb also modifies the behavior of 7several core X library functions. 8</para> 9 10<sect1 id='effects_of_xkb_on_the_core_x_library'> 11<title>Effects of Xkb on the Core X Library</title> 12 13<para> 14When support for Xkb is built into the X library, the <emphasis> 15XOpenDisplay</emphasis> 16 function looks for a compatible version of Xkb on the server. If it finds a 17compatible version, it initializes the extension and enables <emphasis> 18implicit support</emphasis> 19 for Xkb in a number of X library functions. This makes it possible for clients 20to take advantage of nearly all Xkb features without having to be rewritten or 21even recompiled, if they are built with shared libraries. This implicit support 22is invisible to most clients, but it can have side effects, so the extension 23includes ways to control or disable it. 24</para> 25 26 27<sect2 id='effects_of_xkb_on_event_state'> 28<title>Effects of Xkb on Event State</title> 29 30<para> 31Because <emphasis> 32XOpenDisplay</emphasis> 33 initializes Xkb, some events contain an Xkb description of the keyboard state 34instead of that normally used by the core protocol. See section 17.1.1 for more 35information about the differences between Xkb keyboard state and that reported 36by the core protocol. 37</para> 38 39 40</sect2> 41<sect2 id='effects_of_xkb_on_mappingnotify_events'> 42<title>Effects of Xkb on MappingNotify Events</title> 43 44<para> 45When Xkb is missing or disabled, the X library tracks changes to the keyboard 46mapping using <emphasis> 47MappingNotify</emphasis> 48 events. Whenever the keyboard mapping is changed, the server sends all clients 49a <emphasis> 50MappingNotify</emphasis> 51 event to report the change. When a client receives a <emphasis> 52MappingNotify</emphasis> 53 event, it is supposed to call <emphasis> 54XRefreshKeyboardMapping</emphasis> 55 to update the keyboard description used internally by the X library. 56</para> 57 58 59<para> 60The X Keyboard Extension uses <emphasis> 61XkbMapNotify</emphasis> 62 and <emphasis> 63XkbNewKeyboardNotify</emphasis> 64 events to track changes to the keyboard mapping. When an Xkb-aware client 65receives either event, it should call <emphasis> 66XkbRefreshKeyboardMapping</emphasis> 67 to update the keyboard description used internally by the X library. To avoid 68duplicate events, the X server does not send core protocol <emphasis> 69MappingNotify</emphasis> 70 events to a client that has selected for <emphasis> 71XkbMapNotify</emphasis> 72 events. 73</para> 74 75 76<para> 77The implicit support for Xkb selects for <emphasis> 78XkbMapNotify</emphasis> 79 events. This means that clients that do not explicitly use Xkb but that are 80using a version of the X library that has implicit support for Xkb do not 81receive <emphasis> 82MappingNotify</emphasis> 83 events over the wire. Clients that were not written with Xkb in mind do not 84recognize or properly handle the new Xkb events, so the implicit support 85converts them to <emphasis> 86MappingNotify</emphasis> 87 events that report approximately the same information, unless the client has 88explicitly selected for the Xkb version of the event. 89</para> 90 91 92<para> 93An Xkb-capable X server does not send events from keys that fall outside the 94legal range of keycodes expected by that client. Once the server sends a client 95an <emphasis> 96XkbNewKeyboardNotify</emphasis> 97 event, it reports events from all keys because it assumes that any client that 98has receieved an <emphasis> 99XkbNewKeyboardNotify</emphasis> 100 event expects key events from the new range of keycodes. The implicit support 101for Xkb asks for <emphasis> 102XkbNewKeyboardNotify</emphasis> 103 events, so the range of keycodes reported to the client might vary without the 104client’s knowledge. Most clients don’t really care about the range of legal 105keycodes, but some clients maintain information about each key and might have 106problems with events that come from unexpected keys. Such clients can set the 107<emphasis> 108XkbLC_IgnoreNewKeyboards</emphasis> 109 library control (see section 11.3.1) to prevent the implicit support from 110requesting notification of changes to the legal range of keycodes. 111</para> 112 113 114</sect2> 115<sect2 id='x_library_functions_affected_by_xkb'> 116<title>X Library Functions Affected by Xkb</title> 117 118<para> 119The following X library functions are modified by Xkb: 120</para> 121 122<para><programlisting> 123 <emphasis>XKeycodeToKeysym</emphasis> 124 <emphasis>XKeysymToKeycode</emphasis> 125 <emphasis>XLookupKeysym</emphasis> 126 <emphasis>XLookupString</emphasis> 127 <emphasis>XRefreshKeyboardMapping</emphasis> 128 <emphasis>XRebindKeysym</emphasis> 129</programlisting></para> 130 131<para> 132The implicit support for Xkb replaces a number of X library functions with 133versions that understand and use the X Keyboard Extension. In most cases, the 134semantics of the new versions are identical to those of the old, but there are 135occasional visible differences. This section lists all of the functions that 136are affected and the differences in behavior, if any, that are visible to 137clients. 138</para> 139 140 141<para> 142The <emphasis> 143XKeycodeToKeysym</emphasis> 144 function reports the keysym associated with a particular index for a single 145key. The index specifies a column of symbols in the core keyboard mapping (that 146is, as reported by the core protocol <emphasis> 147GetKeyboardMapping</emphasis> 148 request). The order of the symbols in the core mapping does not necessarily 149correspond to the order of the symbols used by Xkb; section 17.1.3 describes 150the differences. 151</para> 152 153 154<para> 155The <emphasis> 156XKeysymToKeycode</emphasis> 157 function reports a keycode to which a particular keysym is bound. When Xkb is 158missing or disabled, this function looks in each column of the core keyboard 159mapping in turn and returns the lowest numbered key that matches in the lowest 160numbered group. When Xkb is present, this function uses the Xkb ordering for 161symbols instead. 162</para> 163 164 165<para> 166The <emphasis> 167XLookupKeysym</emphasis> 168 function reports the symbol in a specific column of the key associated with an 169event. Whether or not Xkb is present, the column specifies an index into the 170core symbol mapping. 171</para> 172 173 174<para> 175The <emphasis> 176XLookupString</emphasis> 177 function reports the symbol and string associated with a key event, taking 178into account the keycode and keyboard state as reported in the event. When Xkb 179is disabled or missing, <emphasis> 180XLookupString</emphasis> 181 uses the rules specified by the core protocol and reports only ISO Latin-1 182characters. When Xkb is present, <emphasis> 183XLookupString</emphasis> 184 uses the explicit keyboard group, key types, and rules specified by Xkb. When 185Xkb is present, <emphasis> 186XLookupString</emphasis> 187 is allowed, but not required, to return strings in character sets other than 188ISO Latin-1, depending on the current locale. If any key bindings are defined, 189<emphasis> 190XLookupString</emphasis> 191 does not use any consumed modifiers (see sections 11.1.2 and 15.2) to 192determine matching bindings. 193</para> 194 195 196<para> 197The <emphasis> 198XRefreshKeyboardMapping</emphasis> 199 function updates the X library’s internal representation of the keyboard to 200reflect changes reported via <emphasis> 201MappingNotify</emphasis> 202 events. When Xkb is missing or disabled, this function reloads the entire 203modifier map or keyboard mapping. When Xkb is present, the implicit Xkb support 204keeps track of the changed components reported by each <emphasis> 205XkbMapNotify</emphasis> 206 event and updates only those pieces of the keyboard description that have 207changed. If the implicit support has not noted any keyboard mapping changes, 208<emphasis> 209XRefreshKeyboardMapping</emphasis> 210 updates the entire keyboard description. 211</para> 212 213 214<para> 215The <emphasis> 216XRebindKeysym</emphasis> 217 function associates a string with a keysym and a set of modifiers. Xkb does 218not directly change this function, but it does affect the way that the state 219reported in the event is compared to the state specified to <emphasis> 220XRebindKeysym</emphasis> 221. When Xkb is missing or disabled, <emphasis> 222XLookupString</emphasis> 223 returns the specified string if the modifiers in the event exactly match the 224modifiers from this call. When Xkb is present, any modifiers used to determine 225the keysym are consumed and are not used to look up the string. 226</para> 227 228 229</sect2> 230</sect1> 231<sect1 id='xkb_event_and_keymap_functions'> 232<title>Xkb Event and Keymap Functions</title> 233 234<para> 235To find the keysym bound to a particular key at a specified group and shift 236level, use <emphasis>XkbKeycodeToKeysym</emphasis>. 237</para> 238 239<informaltable frame='none'> 240<tgroup cols='1'> 241<colspec colsep='0'/> 242<tbody> 243 <row rowsep='0'> 244 <entry role='functiondecl'> 245KeySym <emphasis> 246XkbKeycodeToKeysym</emphasis> 247(<emphasis> 248dpy, kc, group, level</emphasis> 249) 250 </entry> 251 </row> 252 <row rowsep='0'> 253 <entry role='functionargdecl'> 254Display * dpy; /* connection to X server */ 255 </entry> 256 </row> 257 <row rowsep='0'> 258 <entry role='functionargdecl'> 259KeyCode kc; /* key of interest */ 260 </entry> 261 </row> 262 <row rowsep='0'> 263 <entry role='functionargdecl'> 264unsigned int group; /* group of interest */ 265 </entry> 266 </row> 267 <row rowsep='0'> 268 <entry role='functionargdecl'> 269unsigned int level; /* shift level of interest */ 270 </entry> 271</row> 272</tbody> 273</tgroup> 274</informaltable> 275 276<para> 277<emphasis> 278XkbKeycodeToKeysym</emphasis> 279 returns the keysym bound to a particular group and shift level for a 280particular key on the core keyboard. If <emphasis> 281kc</emphasis> 282 is not a legal keycode for the core keyboard, or if <emphasis> 283group</emphasis> 284 or <emphasis> 285level</emphasis> 286 are out of range for the specified key, <emphasis> 287XkbKeycodeToKeysym</emphasis> 288 returns <emphasis> 289NoSymbol</emphasis> 290. 291</para> 292 293 294<para> 295To find the set of modifiers bound to a particular keysym on the core keyboard, 296use <emphasis> 297XkbKeysymToModifiers</emphasis> 298. 299</para> 300 301 302<informaltable frame='none'> 303<tgroup cols='1'> 304<colspec colsep='0'/> 305<tbody> 306 <row rowsep='0'> 307 <entry role='functiondecl'> 308unsigned<emphasis> 309 </emphasis> 310int <emphasis> 311XkbKeysymToModifiers</emphasis> 312(<emphasis> 313dpy</emphasis> 314,<emphasis> 315 ks</emphasis> 316) 317 </entry> 318 </row> 319 <row rowsep='0'> 320 <entry role='functionargdecl'> 321Display *<emphasis> 322 dpy</emphasis> 323; /* connection to X server */ 324 </entry> 325 </row> 326 <row rowsep='0'> 327 <entry role='functionargdecl'> 328KeySym <emphasis> 329 ks</emphasis> 330; /* keysym of interest */ 331 </entry> 332</row> 333</tbody> 334</tgroup> 335</informaltable> 336 337<para> 338<emphasis> 339XkbKeysymToModifiers</emphasis> 340 finds the set of modifiers currently bound to the keysym <emphasis> 341ks</emphasis> 342 on the core keyboard. The value returned is the mask of modifiers bound to the 343keysym <emphasis> 344ks</emphasis> 345. If no modifiers are bound to the keysym, <emphasis> 346XkbKeysymToModifiers</emphasis> 347 returns zero; otherwise, it returns the inclusive OR of zero or more of the 348following: <emphasis> 349ShiftMask</emphasis> 350, <emphasis> 351ControlMask</emphasis> 352, <emphasis> 353LockMask</emphasis> 354, <emphasis> 355Mod1Mask</emphasis> 356, <emphasis> 357Mod2Mask</emphasis> 358, <emphasis> 359Mod3Mask</emphasis> 360, <emphasis> 361Mod4Mask,</emphasis> 362 and <emphasis> 363Mod5Mask</emphasis> 364. 365</para> 366 367 368<para> 369Use <emphasis> 370XkbLookupKeySym</emphasis> 371 to find the symbol associated with a key for a particular state. 372</para> 373 374 375<informaltable frame='none'> 376<tgroup cols='1'> 377<colspec colsep='0'/> 378<tbody> 379 <row rowsep='0'> 380 <entry role='functiondecl'> 381Bool <emphasis> 382XkbLookupKeySym</emphasis> 383(<emphasis> 384dpy</emphasis> 385,<emphasis> 386 key</emphasis> 387,<emphasis> 388 state</emphasis> 389,<emphasis> 390 mods_rtrn</emphasis> 391,<emphasis> 392 sym_rtrn</emphasis> 393) 394 </entry> 395 </row> 396 <row rowsep='0'> 397 <entry role='functionargdecl'> 398Display * <emphasis> 399 dpy</emphasis> 400; /* connection to X server */ 401 </entry> 402 </row> 403 <row rowsep='0'> 404 <entry role='functionargdecl'> 405KeyCode <emphasis> 406 key</emphasis> 407; /* key for which symbols are to be found */ 408 </entry> 409 </row> 410 <row rowsep='0'> 411 <entry role='functionargdecl'> 412unsigned int <emphasis> 413 state</emphasis> 414; /* state for which symbol should be found */ 415 </entry> 416 </row> 417 <row rowsep='0'> 418 <entry role='functionargdecl'> 419unsigned int * <emphasis> 420 mods_rtrn</emphasis> 421; /* backfilled with unconsumed modifiers */ 422 </entry> 423 </row> 424 <row rowsep='0'> 425 <entry role='functionargdecl'> 426KeySym *<emphasis> 427 sym_rtrn</emphasis> 428; /* backfilled with symbol associated with key + state */ 429 </entry> 430</row> 431</tbody> 432</tgroup> 433</informaltable> 434 435<para> 436<emphasis> 437XkbLookupKeySym</emphasis> 438 is the equivalent of the core <emphasis> 439XLookupKeySym</emphasis> 440 function. For the core keyboard, given a keycode <emphasis> 441key</emphasis> 442 and an Xkb state <emphasis> 443state</emphasis> 444, <emphasis> 445XkbLookupKeySym</emphasis> 446 returns the symbol associated with the key in <emphasis> 447sym_rtrn</emphasis> 448 and the list of modifiers that should still be applied in <emphasis> 449mods_rtrn</emphasis> 450. The <emphasis> 451state</emphasis> 452 parameter is the state from a <emphasis> 453KeyPress</emphasis> 454 or <emphasis> 455KeyRelease</emphasis> 456 event. <emphasis> 457XkbLookupKeySym</emphasis> 458 returns <emphasis> 459True</emphasis> 460 if it succeeds. 461</para> 462 463 464<para> 465Use <emphasis> 466XkbLookupKeyBinding</emphasis> 467 to find the string bound to a key by <emphasis> 468XRebindKeySym</emphasis> 469. <emphasis> 470XkbLookupKeyBinding</emphasis> 471 is the equivalent of the core <emphasis> 472XLookupString</emphasis> 473 function. 474</para> 475 476 477<informaltable frame='none'> 478<tgroup cols='1'> 479<colspec colsep='0'/> 480<tbody> 481 <row rowsep='0'> 482 <entry role='functiondecl'> 483int <emphasis> 484XkbLookupKeyBinding</emphasis> 485(<emphasis> 486dpy</emphasis> 487,<emphasis> 488 sym</emphasis> 489,<emphasis> 490 state</emphasis> 491,<emphasis> 492 buf</emphasis> 493,<emphasis> 494 nbytes</emphasis> 495,<emphasis> 496 extra_rtrn</emphasis> 497) 498 </entry> 499 </row> 500 <row rowsep='0'> 501 <entry role='functionargdecl'> 502Display * <emphasis> 503 dpy</emphasis> 504; /* connection to server */ 505 </entry> 506 </row> 507 <row rowsep='0'> 508 <entry role='functionargdecl'> 509KeySym<emphasis> 510 sym</emphasis> 511; /* symbol to be looked up */ 512 </entry> 513 </row> 514 <row rowsep='0'> 515 <entry role='functionargdecl'> 516unsigned int <emphasis> 517state</emphasis> 518; /* state for which string is to be looked up */ 519 </entry> 520 </row> 521 <row rowsep='0'> 522 <entry role='functionargdecl'> 523char * <emphasis> 524 buf</emphasis> 525; /* buffer into which returned string is written */ 526 </entry> 527 </row> 528 <row rowsep='0'> 529 <entry role='functionargdecl'> 530int <emphasis> 531 nbytes</emphasis> 532; /* size of buffer in bytes */ 533 </entry> 534 </row> 535 <row rowsep='0'> 536 <entry role='functionargdecl'> 537int * <emphasis> 538 extra_rtrn</emphasis> 539; /* backfilled with number bytes overflow */ 540 </entry> 541</row> 542</tbody> 543</tgroup> 544</informaltable> 545 546<para> 547<emphasis> 548XRebindKeysym</emphasis> 549 binds an ASCII string to a specified keysym, so that the string and keysym are 550returned when the key is pressed and a specified list of modifiers are also 551being held down. <emphasis> 552XkbLookupKeyBinding</emphasis> 553 returns in <emphasis> 554buf</emphasis> 555 the string associated with the keysym <emphasis> 556sym</emphasis> 557 and modifier state <emphasis> 558state</emphasis> 559. <emphasis> 560buf</emphasis> 561 is <emphasis> 562NULL</emphasis> 563 terminated unless there’s an overflow. If the string returned is larger than 564<emphasis> 565nbytes</emphasis> 566, a count of bytes that does not fit into the buffer is returned in extra_rtrn. 567<emphasis> 568XkbTranslateKeySym</emphasis> 569 returns the number of bytes that it placed into <emphasis> 570buf</emphasis> 571. 572</para> 573 574 575<para> 576To find the string and symbol associated with a keysym for a given keyboard 577state, use <emphasis> 578XkbTranslateKeySym</emphasis> 579. 580</para> 581 582 583<informaltable frame='none'> 584<tgroup cols='1'> 585<colspec colsep='0'/> 586<tbody> 587 <row rowsep='0'> 588 <entry role='functiondecl'> 589int <emphasis> 590XkbTranslateKeySym</emphasis> 591(<emphasis> 592dpy</emphasis> 593,<emphasis> 594 sym_inout</emphasis> 595,<emphasis> 596 mods</emphasis> 597,<emphasis> 598 buf</emphasis> 599,<emphasis> 600 nbytes</emphasis> 601, <emphasis> 602extra_rtrn</emphasis> 603) 604 </entry> 605 </row> 606 <row rowsep='0'> 607 <entry role='functionargdecl'> 608Display * <emphasis> 609 dpy</emphasis> 610; /* connection to X server */ 611 </entry> 612 </row> 613 <row rowsep='0'> 614 <entry role='functionargdecl'> 615KeySym * <emphasis> 616 sym_inout</emphasis> 617; /* symbol to be translated; result of translation */ 618 </entry> 619 </row> 620 <row rowsep='0'> 621 <entry role='functionargdecl'> 622unsigned int <emphasis> 623 mods</emphasis> 624; /* modifiers to apply to <emphasis> 625sym_inout</emphasis> 626 */ 627 </entry> 628 </row> 629 <row rowsep='0'> 630 <entry role='functionargdecl'> 631char * <emphasis> 632 buf</emphasis> 633; /* buffer into which returned string is written */ 634 </entry> 635 </row> 636 <row rowsep='0'> 637 <entry role='functionargdecl'> 638int <emphasis> 639 nbytes</emphasis> 640; /* size of buffer in bytes */ 641 </entry> 642 </row> 643 <row rowsep='0'> 644 <entry role='functionargdecl'> 645int *<emphasis> 646 extra_rtrn</emphasis> 647; /* number of bytes overflow*/ 648 </entry> 649</row> 650</tbody> 651</tgroup> 652</informaltable> 653 654<para> 655<emphasis> 656XkbTranslateKeySym</emphasis> 657 applies the transformations specified in <emphasis> 658mods</emphasis> 659 to the symbol specified by <emphasis> 660sym_inout</emphasis> 661. It returns in <emphasis> 662buf</emphasis> 663 the string, if any, associated with the keysym for the current locale. If the 664transformations in <emphasis> 665mods</emphasis> 666 changes the keysym, <emphasis> 667sym_inout</emphasis> 668 is updated accordingly. If the string returned is larger than <emphasis> 669nbytes</emphasis> 670, a count of bytes that does not fit into the buffer is returned in extra_rtrn. 671<emphasis> 672XkbTranslateKeySym</emphasis> 673 returns the number of bytes it placed into <emphasis> 674buf</emphasis> 675. 676</para> 677 678 679<para> 680To update the keyboard description that is internal to the X library, use 681<emphasis> 682XkbRefreshKeyboardMapping</emphasis> 683. 684</para> 685 686 687<informaltable frame='none'> 688<tgroup cols='1'> 689<colspec colsep='0'/> 690<tbody> 691 <row rowsep='0'> 692 <entry role='functiondecl'> 693Status <emphasis> 694XkbRefreshKeyboardMapping</emphasis> 695(<emphasis> 696event)</emphasis> 697 </entry> 698 </row> 699 <row rowsep='0'> 700 <entry role='functionargdecl'> 701XkbMapNotifyEvent * <emphasis> 702 event</emphasis> 703; /* event initiating remapping */ 704 </entry> 705</row> 706</tbody> 707</tgroup> 708</informaltable> 709 710<para> 711<emphasis> 712XkbRefreshKeyboardMapping</emphasis> 713 is the Xkb equivalent of the core <emphasis> 714XRefreshKeyboardMapping</emphasis> 715 function. It requests that the X server send the current key mapping 716information to this client. A client usually invokes <emphasis> 717XkbRefreshKeyboardMapping</emphasis> 718 after receiving an <emphasis> 719XkbMapNotify</emphasis> 720 event. <emphasis> 721XkbRefreshKeyboardMapping</emphasis> 722 returns <emphasis> 723Success</emphasis> 724 if it succeeds and <emphasis> 725BadMatch</emphasis> 726 if the event is not an Xkb event. 727</para> 728 729 730<para> 731The <emphasis> 732XkbMapNotify</emphasis> 733 event can be generated when some client calls <emphasis> 734XkbSetMap</emphasis> 735, <emphasis> 736XkbChangeMap</emphasis> 737, <emphasis> 738XkbGetKeyboardByName</emphasis> 739, or any of the standard X library functions that change the keyboard mapping 740or modifier mapping. 741</para> 742 743 744<para> 745To translate a keycode to a key symbol and modifiers, use <emphasis> 746XkbTranslateKeyCode</emphasis> 747. 748</para> 749 750 751<informaltable frame='none'> 752<tgroup cols='1'> 753<colspec colsep='0'/> 754<tbody> 755 <row rowsep='0'> 756 <entry role='functiondecl'> 757Booll <emphasis> 758XkbTranslateKeyCode</emphasis> 759(<emphasis> 760xkb, key, mods, mods_rtrn, keysym_rtrn)</emphasis> 761 </entry> 762 </row> 763 <row rowsep='0'> 764 <entry role='functionargdecl'> 765XkbDescPtr <emphasis> 766xkb</emphasis> 767; /* keyboard description to use for translation */ 768 </entry> 769 </row> 770 <row rowsep='0'> 771 <entry role='functionargdecl'> 772KeyCode <emphasis> 773key</emphasis> 774; /* keycode to translate */ 775 </entry> 776 </row> 777 <row rowsep='0'> 778 <entry role='functionargdecl'> 779unsigned int <emphasis> 780mods</emphasis> 781; /* modifiers to apply when translating <emphasis> 782key</emphasis> 783 */ 784 </entry> 785 </row> 786 <row rowsep='0'> 787 <entry role='functionargdecl'> 788unsigned int * <emphasis> 789mods_rtrn</emphasis> 790; /* backfilled with unconsumed modifiers */ 791 </entry> 792 </row> 793 <row rowsep='0'> 794 <entry role='functionargdecl'> 795KeySym * <emphasis> 796keysym_rtrn</emphasis> 797; /* keysym resulting from translation */ 798 </entry> 799</row> 800</tbody> 801</tgroup> 802</informaltable> 803 804<para> 805<emphasis> 806mods_rtrn</emphasis> 807 is backfilled with the modifiers consumed by the translation process. 808<emphasis> 809mods</emphasis> 810 is a bitwise inclusive OR of the legal modifier masks: <emphasis> 811ShiftMask</emphasis> 812, <emphasis> 813LockMask</emphasis> 814, <emphasis> 815ControlMask</emphasis> 816, <emphasis> 817Mod1Mask</emphasis> 818, <emphasis> 819Mod2Mask</emphasis> 820, <emphasis> 821Mod3Mask</emphasis> 822, <emphasis> 823Mod4Mask</emphasis> 824, <emphasis> 825Mod5Mask</emphasis> 826.The <emphasis> 827AlwaysConsumeShiftAndLock</emphasis> 828 library control (see section 11.1.3), if enabled, causes <emphasis> 829XkbTranslateKeyCode</emphasis> 830 to consume shift and lock.<emphasis> 831 XkbTranslateKeyCode</emphasis> 832 returns <emphasis> 833True</emphasis> 834 if the translation resulted in a keysym, and <emphasis> 835False</emphasis> 836 if it resulted in <emphasis> 837NoSymbol</emphasis> 838. 839</para> 840</sect1> 841</chapter> 842