1<?xml version="1.0" encoding="UTF-8" ?> 2<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN" "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd"> 3 4<appendix id='Translation_Table_Syntax'> 5<title>Translation Table Syntax</title> 6<para><emphasis role='strong'>Notation</emphasis></para> 7 8<para> 9Syntax is specified in EBNF notation with the following conventions: 10</para> 11 12<informaltable frame='none'> 13 <?dbfo keep-together="auto" ?> 14 <tgroup cols='2' align='left' colsep='0' rowsep='0'> 15 <colspec colwidth='0.1*' colname='c1'/> 16 <colspec colwidth='1.0*' colname='c2'/> 17 <tbody> 18 <row> 19 <entry>[ a ]</entry> 20 <entry>Means either nothing or “a”</entry> 21 </row> 22 <row> 23 <entry>{ a }</entry> 24 <entry>Means zero or more occurrences of “a”</entry> 25 </row> 26 <row> 27 <entry>( a | b )</entry> 28 <entry>Means either “a” or “b”</entry> 29 </row> 30 <row> 31 <entry>\\n</entry> 32 <entry>Is the newline character</entry> 33 </row> 34 </tbody> 35 </tgroup> 36</informaltable> 37 38<para> 39All terminals are enclosed in double quotation marks (" "). 40Informal descriptions are enclosed in angle brackets (< >). 41Syntax 42</para> 43 44<para>The syntax of a translation table is</para> 45<informaltable frame='none'> 46 <?dbfo keep-together="auto" ?> 47 <tgroup cols='2' align='left' colsep='0' rowsep='0'> 48 <colspec colwidth='0.2*' colname='c1'/> 49 <colspec colwidth='1.0*' colname='c2'/> 50 <tbody> 51 <row> 52 <entry>translationTable</entry> 53 <entry>= [ directive ] { production }</entry> 54 </row> 55 <row> 56 <entry>directive</entry> 57 <entry>= ( “#replace” | “#override” | “#augment” ) “\\n”</entry> 58 </row> 59 <row> 60 <entry>production</entry> 61 <entry>= lhs “:” rhs “\\n”</entry> 62 </row> 63 <row> 64 <entry>lhs</entry> 65 <entry>= ( event | keyseq ) { “,” (event | keyseq) }</entry> 66 </row> 67 <row> 68 <entry>keyseq</entry> 69 <entry>= “"” keychar {keychar} “"”</entry> 70 </row> 71 <row> 72 <entry>keychar</entry> 73 <entry>= [ “^” | “$” | “\\” ] <ISO Latin 1 character></entry> 74 </row> 75 <row> 76 <entry>event</entry> 77 <entry>= [modifier_list] “<”event_type“>” [ “(” count[“+”] “)” ] {detail}</entry> 78 </row> 79 <row> 80 <entry>modifier_list</entry> 81 <entry>= ( [“!”] [“:”] {modifier} ) | “None”</entry> 82 </row> 83 <row> 84 <entry>modifier</entry> 85 <entry>= [“~”] modifier_name</entry> 86 </row> 87 <row> 88 <entry>count</entry> 89 <entry>= (“1” | “2” | “3” | “4” | ...)</entry> 90 </row> 91 <row> 92 <entry>modifier_name</entry> 93 <entry>= “@” <keysym> | <see ModifierNames table below></entry> 94 </row> 95 <row> 96 <entry>event_type</entry> 97 <entry>= <see Event Types table below></entry> 98 </row> 99 <row> 100 <entry>detail</entry> 101 <entry>= <event specific details></entry> 102 </row> 103 <row> 104 <entry>rhs</entry> 105 <entry>= { name “(” [params] “)” }</entry> 106 </row> 107 <row> 108 <entry>name</entry> 109 <entry>= namechar { namechar }</entry> 110 </row> 111 <row> 112 <entry>namechar</entry> 113 <entry>= { “a”–“z” | “A”–“Z” | “0”–“9” | “_” | “–” }</entry> 114 </row> 115 <row> 116 <entry>params</entry> 117 <entry>= string {“,” string}</entry> 118 </row> 119 <row> 120 <entry>string</entry> 121 <entry>= quoted_string | unquoted_string</entry> 122 </row> 123 <row> 124 <entry>quoted_string</entry> 125 <entry>= <quote>"</quote> {<Latin 1 character> | escape_char} [“\\"” ] <quote>"</quote></entry> 126 </row> 127 <row> 128 <entry>escape_char</entry> 129 <entry>= “\\"”</entry> 130 </row> 131 <row> 132 <entry>unquoted_string</entry> 133 <entry>= {<Latin 1 character except space, tab, “,”, “\\n”, “)”>}</entry> 134 </row> 135 </tbody> 136 </tgroup> 137</informaltable> 138 139<para> 140The <emphasis remap='I'>params</emphasis> field is parsed into a list of 141<function>String</function> 142values that will be passed to the named action procedure. A 143<emphasis remap='I'>quoted string</emphasis> may contain an embedded quotation mark if the 144quotation mark is preceded by a single backslash (\). The 145three-character sequence “\\"” is interpreted as “single backslash 146followed by end-of-string”. 147</para> 148<para><emphasis role='strong'>Modifier Names</emphasis></para> 149 150<para> 151The modifier field is used to specify standard X keyboard and button 152modifier mask bits. 153Modifiers are legal on event types 154<function>KeyPress</function>, 155<function>KeyRelease</function>, 156<function>ButtonPress</function>, 157<function>ButtonRelease</function>, 158<function>MotionNotify</function>, 159<function>EnterNotify</function>, 160<function>LeaveNotify</function>, 161and their abbreviations. 162An error is generated when a translation table 163that contains modifiers for any other events is parsed. 164</para> 165 166<itemizedlist spacing='compact'> 167 <listitem> 168 <para> 169If the modifier list has no entries and is not “None”, 170it means “don't care” on all modifiers. 171 </para> 172 </listitem> 173 <listitem> 174 <para> 175If an exclamation point (!) is specified at the beginning 176of the modifier list, 177it means that the listed modifiers must be in the correct state 178and no other modifiers can be asserted. 179 </para> 180 </listitem> 181 <listitem> 182 <para> 183If any modifiers are specified 184and an exclamation point (!) is not specified, 185it means that the listed modifiers must be in the 186correct state and “don't care” about any other modifiers. 187 </para> 188 </listitem> 189 <listitem> 190 <para> 191If a modifier is preceded by a tilde (~), 192it means that that modifier must not be asserted. 193 </para> 194 </listitem> 195 <listitem> 196 <para> 197If “None” is specified, it means no modifiers can be asserted. 198 </para> 199 </listitem> 200 <listitem> 201 <para> 202If a colon (:) is specified at the beginning of the modifier list, 203it directs the Intrinsics to apply any standard modifiers in the 204event to map the event keycode into a KeySym. 205The default standard modifiers are Shift and Lock, 206with the interpretation as defined in <emphasis remap='I'>X Window 207System Protocol</emphasis>, Section 5. 208The resulting KeySym must exactly match the specified 209KeySym, and the nonstandard modifiers in the event must match the 210modifier list. 211For example, “:<Key>a” is distinct from “:<Key>A”, 212and “:Shift<Key>A” is distinct from “:<Key>A”. 213 </para> 214 </listitem> 215 <listitem> 216 <para> 217If both an exclamation point (!) and a colon (:) are specified at 218the beginning of the modifier list, it means that the listed 219modifiers must be in the correct state and that no other modifiers 220except the standard modifiers can be asserted. Any standard 221modifiers in the event are applied as for colon (:) above. 222 </para> 223 </listitem> 224 <listitem> 225 <para> 226If a colon (:) is not specified, 227no standard modifiers are applied. 228Then, for example, “<Key>A” and “<Key>a” are equivalent. 229 </para> 230 </listitem> 231</itemizedlist> 232 233<para> 234In key sequences, 235a circumflex (^) is an abbreviation for the Control modifier, 236a dollar sign ($) is an abbreviation for Meta, 237and a backslash (\) can be used to quote any 238character, in particular a double quote ("), a circumflex (^), 239a dollar sign ($), and another backslash (\). 240Briefly: 241</para> 242 243<programlisting> 244No modifiers: None <event> detail 245Any modifiers: <event> detail 246Only these modifiers: ! mod1 mod2 <event> detail 247These modifiers and any others: mod1 mod2 <event> detail 248</programlisting> 249 250<para> 251The use of “None” for a modifier list is identical to the use 252of an exclamation point with no modifiers. 253</para> 254 255<informaltable frame='topbot'> 256 <?dbfo keep-together="auto" ?> 257 <tgroup cols='3' align='left' colsep='0' rowsep='0'> 258 <colspec colwidth='1.0*' colname='c1'/> 259 <colspec colwidth='1.0*' colname='c2'/> 260 <colspec colwidth='1.0*' colname='c3'/> 261 <thead> 262 <row rowsep='1'> 263 <entry>Modifier</entry> 264 <entry>Abbreviation</entry> 265 <entry>Meaning</entry> 266 </row> 267 </thead> 268 <tbody> 269 <row> 270 <entry>Ctrl</entry> 271 <entry>c</entry> 272 <entry>Control modifier bit</entry> 273 </row> 274 <row> 275 <entry>Shift</entry> 276 <entry>s</entry> 277 <entry>Shift modifier bit</entry> 278 </row> 279 <row> 280 <entry>Lock</entry> 281 <entry>l</entry> 282 <entry>Lock modifier bit</entry> 283 </row> 284 <row> 285 <entry>Meta</entry> 286 <entry>m</entry> 287 <entry>Meta key modifier</entry> 288 </row> 289 <row> 290 <entry>Hyper</entry> 291 <entry>h</entry> 292 <entry>Hyper key modifier</entry> 293 </row> 294 <row> 295 <entry>Super</entry> 296 <entry>su</entry> 297 <entry>Super key modifier</entry> 298 </row> 299 <row> 300 <entry>Alt</entry> 301 <entry>a</entry> 302 <entry>Alt key modifier</entry> 303 </row> 304 <row> 305 <entry>Mod1</entry> 306 <entry></entry> 307 <entry>Mod1 modifier bit</entry> 308 </row> 309 <row> 310 <entry>Mod2</entry> 311 <entry></entry> 312 <entry>Mod2 modifier bit</entry> 313 </row> 314 <row> 315 <entry>Mod3</entry> 316 <entry></entry> 317 <entry>Mod3 modifier bit</entry> 318 </row> 319 <row> 320 <entry>Mod4</entry> 321 <entry></entry> 322 <entry>Mod4 modifier bit</entry> 323 </row> 324 <row> 325 <entry>Mod5</entry> 326 <entry></entry> 327 <entry>Mod5 modifier bit</entry> 328 </row> 329 <row> 330 <entry>Button1</entry> 331 <entry></entry> 332 <entry>Button1 modifier bit</entry> 333 </row> 334 <row> 335 <entry>Button2</entry> 336 <entry></entry> 337 <entry>Button2 modifier bit</entry> 338 </row> 339 <row> 340 <entry>Button3</entry> 341 <entry></entry> 342 <entry>Button3 modifier bit</entry> 343 </row> 344 <row> 345 <entry>Button4</entry> 346 <entry></entry> 347 <entry>Button4 modifier bit</entry> 348 </row> 349 <row> 350 <entry>Button5</entry> 351 <entry></entry> 352 <entry>Button5 modifier bit</entry> 353 </row> 354 <row> 355 <entry>None</entry> 356 <entry></entry> 357 <entry>No modifiers</entry> 358 </row> 359 <row> 360 <entry>Any</entry> 361 <entry></entry> 362 <entry>Any modifier combination</entry> 363 </row> 364 </tbody> 365 </tgroup> 366</informaltable> 367 368<para> 369A key modifier is any modifier bit one of whose corresponding KeyCodes 370contains the corresponding left or right KeySym. 371For example, 372“m” or “Meta” means any modifier bit mapping to a KeyCode 373whose KeySym list contains XK_Meta_L or XK_Meta_R. 374Note that this interpretation is for each display, 375not global or even for each application context. 376The Control, Shift, and Lock modifier names refer 377explicitly to the corresponding modifier bits; 378there is no additional interpretation of KeySyms for these modifiers. 379</para> 380 381<para> 382Because it is possible to associate arbitrary KeySyms with modifiers, the set of 383key modifiers is extensible. The “@” <keysym> syntax means any 384modifier bit whose corresponding KeyCode contains the specified KeySym name. 385</para> 386 387<para> 388A modifier_list/KeySym combination in a translation matches a 389modifiers/KeyCode combination in an event in the following ways: 390</para> 391 392<orderedlist> 393 <listitem> 394 <para> 395If a colon (:) is used, the Intrinsics call the display's 396<xref linkend='XtKeyProc' xrefstyle='select: title'/> 397with the KeyCode and modifiers. 398To match, (<emphasis remap='I'>modifiers</emphasis> & ~<emphasis remap='I'>modifiers_return</emphasis>) must equal <emphasis remap='I'>modifier_list</emphasis>, and 399<emphasis remap='I'>keysym_return</emphasis> must equal the given KeySym. 400 </para> 401 </listitem> 402 <listitem> 403 <para> 404If (:) is not used, the Intrinsics mask off all don't-care bits from the 405modifiers. 406This value must be equal to <emphasis remap='I'>modifier_list</emphasis>. 407Then, for each possible combination of 408don't-care modifiers in the modifier list, the Intrinsics call the display's 409<xref linkend='XtKeyProc' xrefstyle='select: title'/> 410with the KeyCode and that combination ORed with the cared-about modifier bits 411from the event. 412<emphasis remap='I'>Keysym_return</emphasis> must match the KeySym in the translation. 413 </para> 414 </listitem> 415</orderedlist> 416 417<para><emphasis role='strong'>Event Types</emphasis></para> 418 419<para> 420The event-type field describes XEvent types. 421In addition to the standard 422Xlib symbolic event type names, the following event type synonyms 423are defined: 424</para> 425 426<informaltable frame='topbot'> 427 <?dbfo keep-together="auto" ?> 428 <tgroup cols='2' align='left' colsep='0' rowsep='0'> 429 <colspec colwidth='1.0*' colname='c1'/> 430 <colspec colwidth='1.0*' colname='c2'/> 431 <thead> 432 <row rowsep='1'> 433 <entry>Type</entry> 434 <entry>Meaning</entry> 435 </row> 436 </thead> 437 <tbody> 438 <row> 439 <entry>Key</entry> 440 <entry><function>KeyPress</function></entry> 441 </row> 442 <row> 443 <entry>KeyDown</entry> 444 <entry><function>KeyPress</function></entry> 445 </row> 446 <row> 447 <entry>KeyUp</entry> 448 <entry><function>KeyRelease</function></entry> 449 </row> 450 <row> 451 <entry>BtnDown</entry> 452 <entry><function>ButtonPress</function></entry> 453 </row> 454 <row> 455 <entry>BtnUp</entry> 456 <entry><function>ButtonRelease</function></entry> 457 </row> 458 <row> 459 <entry>Motion</entry> 460 <entry><function>MotionNotify</function></entry> 461 </row> 462 <row> 463 <entry>PtrMoved</entry> 464 <entry><function>MotionNotify</function></entry> 465 </row> 466 <row> 467 <entry>MouseMoved</entry> 468 <entry><function>MotionNotify</function></entry> 469 </row> 470 <row> 471 <entry>Enter</entry> 472 <entry><function>EnterNotify</function></entry> 473 </row> 474 <row> 475 <entry>EnterWindow</entry> 476 <entry><function>EnterNotify</function></entry> 477 </row> 478 <row> 479 <entry>Leave</entry> 480 <entry><function>LeaveNotify</function></entry> 481 </row> 482 <row> 483 <entry>LeaveWindow</entry> 484 <entry><function>LeaveNotify</function></entry> 485 </row> 486 <row> 487 <entry>FocusIn</entry> 488 <entry><function>FocusIn</function></entry> 489 </row> 490 <row> 491 <entry>FocusOut</entry> 492 <entry><function>FocusOut</function></entry> 493 </row> 494 <row> 495 <entry>Keymap</entry> 496 <entry><function>KeymapNotify</function></entry> 497 </row> 498 <row> 499 <entry>Expose</entry> 500 <entry><function>Expose</function></entry> 501 </row> 502 <row> 503 <entry>GrExp</entry> 504 <entry><function>GraphicsExpose</function></entry> 505 </row> 506 <row> 507 <entry>NoExp</entry> 508 <entry><function>NoExpose</function></entry> 509 </row> 510 <row> 511 <entry>Visible</entry> 512 <entry><function>VisibilityNotify</function></entry> 513 </row> 514 <row> 515 <entry>Create</entry> 516 <entry><function>CreateNotify</function></entry> 517 </row> 518 <row> 519 <entry>Destroy</entry> 520 <entry><function>DestroyNotify</function></entry> 521 </row> 522 <row> 523 <entry>Unmap</entry> 524 <entry><function>UnmapNotify</function></entry> 525 </row> 526 <row> 527 <entry>Map</entry> 528 <entry><function>MapNotify</function></entry> 529 </row> 530 <row> 531 <entry>MapReq</entry> 532 <entry><function>MapRequest</function></entry> 533 </row> 534 <row> 535 <entry>Reparent</entry> 536 <entry><function>ReparentNotify</function></entry> 537 </row> 538 <row> 539 <entry>Configure</entry> 540 <entry><function>ConfigureNotify</function></entry> 541 </row> 542 <row> 543 <entry>ConfigureReq</entry> 544 <entry><function>ConfigureRequest</function></entry> 545 </row> 546 <row> 547 <entry>Grav</entry> 548 <entry><function>GravityNotify</function></entry> 549 </row> 550 <row> 551 <entry>ResReq</entry> 552 <entry><function>ResizeRequest</function></entry> 553 </row> 554 <row> 555 <entry>Circ</entry> 556 <entry><function>CirculateNotify</function></entry> 557 </row> 558 <row> 559 <entry>CircReq</entry> 560 <entry><function>CirculateRequest</function></entry> 561 </row> 562 <row> 563 <entry>Prop</entry> 564 <entry><function>PropertyNotify</function></entry> 565 </row> 566 <row> 567 <entry>SelClr</entry> 568 <entry><function>SelectionClear</function></entry> 569 </row> 570 <row> 571 <entry>SelReq</entry> 572 <entry><function>SelectionRequest</function></entry> 573 </row> 574 <row> 575 <entry>Select</entry> 576 <entry><function>SelectionNotify</function></entry> 577 </row> 578 <row> 579 <entry>Clrmap</entry> 580 <entry><function>ColormapNotify</function></entry> 581 </row> 582 <row> 583 <entry>Message</entry> 584 <entry><function>ClientMessage</function></entry> 585 </row> 586 <row> 587 <entry>Mapping</entry> 588 <entry><function>MappingNotify</function></entry> 589 </row> 590 </tbody> 591 </tgroup> 592</informaltable> 593 594<para>The supported abbreviations are:</para> 595 596<informaltable frame='topbot'> 597 <?dbfo keep-together="auto" ?> 598 <tgroup cols='3' align='left' rowsep='0' colsep='0'> 599 <colspec colwidth='1.0*' colname='c1'/> 600 <colspec colwidth='1.0*' colname='c2'/> 601 <colspec colwidth='1.0*' colname='c3'/> 602 <thead> 603 <row rowsep='1'> 604 <entry>Abbreviation</entry> 605 <entry>Event Type</entry> 606 <entry>Including</entry> 607 </row> 608 </thead> 609 <tbody> 610 <row> 611 <entry>Ctrl</entry> 612 <entry><function>KeyPress</function></entry> 613 <entry>with Control modifier</entry> 614 </row> 615 <row> 616 <entry>Meta</entry> 617 <entry><function>KeyPress</function></entry> 618 <entry>with Meta modifier</entry> 619 </row> 620 <row> 621 <entry>Shift</entry> 622 <entry><function>KeyPress</function></entry> 623 <entry>with Shift modifier</entry> 624 </row> 625 <row> 626 <entry>Btn1Down</entry> 627 <entry><function>ButtonPress</function></entry> 628 <entry>with Button1 detail</entry> 629 </row> 630 <row> 631 <entry>Btn1Up</entry> 632 <entry><function>ButtonRelease</function></entry> 633 <entry>with Button1 detail</entry> 634 </row> 635 <row> 636 <entry>Btn2Down</entry> 637 <entry><function>ButtonPress</function></entry> 638 <entry>with Button2 detail</entry> 639 </row> 640 <row> 641 <entry>Btn2Up</entry> 642 <entry><function>ButtonRelease</function></entry> 643 <entry>with Button2 detail</entry> 644 </row> 645 <row> 646 <entry>Btn3Down</entry> 647 <entry><function>ButtonPress</function></entry> 648 <entry>with Button3 detail</entry> 649 </row> 650 <row> 651 <entry>Btn3Up</entry> 652 <entry><function>ButtonRelease</function></entry> 653 <entry>with Button3 detail</entry> 654 </row> 655 <row> 656 <entry>Btn4Down</entry> 657 <entry><function>ButtonPress</function></entry> 658 <entry>with Button4 detail</entry> 659 </row> 660 <row> 661 <entry>Btn4Up</entry> 662 <entry><function>ButtonRelease</function></entry> 663 <entry>with Button4 detail</entry> 664 </row> 665 <row> 666 <entry>Btn5Down</entry> 667 <entry><function>ButtonPress</function></entry> 668 <entry>with Button5 detail</entry> 669 </row> 670 <row> 671 <entry>Btn5Up</entry> 672 <entry><function>ButtonRelease</function></entry> 673 <entry>with Button5 detail</entry> 674 </row> 675 <row> 676 <entry>BtnMotion</entry> 677 <entry><function>MotionNotify</function></entry> 678 <entry>with any button modifier</entry> 679 </row> 680 <row> 681 <entry>Btn1Motion</entry> 682 <entry><function>MotionNotify</function></entry> 683 <entry>with Button1 modifier</entry> 684 </row> 685 <row> 686 <entry>Btn2Motion</entry> 687 <entry><function>MotionNotify</function></entry> 688 <entry>with Button2 modifier</entry> 689 </row> 690 <row> 691 <entry>Btn3Motion</entry> 692 <entry><function>MotionNotify</function></entry> 693 <entry>with Button3 modifier</entry> 694 </row> 695 <row> 696 <entry>Btn4Motion</entry> 697 <entry><function>MotionNotify</function></entry> 698 <entry>with Button4 modifier</entry> 699 </row> 700 <row> 701 <entry>Btn5Motion</entry> 702 <entry><function>MotionNotify</function></entry> 703 <entry>with Button5 modifier</entry> 704 </row> 705 </tbody> 706 </tgroup> 707</informaltable> 708 709<para> 710The detail field is event-specific and normally corresponds to the 711detail field of the corresponding event as described 712by <emphasis remap='I'>X Window System Protocol</emphasis>, Section 11. 713The detail field is supported for the following event types: 714</para> 715 716<informaltable frame='none'> 717 <?dbfo keep-together="auto" ?> 718 <tgroup cols='2' align='left' rowsep='0' colsep='0'> 719 <colspec colwidth='0.5*' colname='c1'/> 720 <colspec colwidth='1.0*' colname='c2'/> 721 <tbody> 722 <row> 723 <entry>KeyPress</entry> 724 <entry>KeySym from event <emphasis>detail</emphasis> (keycode)</entry> 725 </row> 726 <row> 727 <entry>KeyRelease</entry> 728 <entry>KeySym from event <emphasis>detail</emphasis> (keycode)</entry> 729 </row> 730 <row> 731 <entry>ButtonPress</entry> 732 <entry>“Button” followed by button from event <emphasis>detail</emphasis> (e.g. <function>Button1</function>)</entry> 733 </row> 734 <row> 735 <entry>ButtonRelease</entry> 736 <entry>“Button” followed by button from event <emphasis>detail</emphasis> (e.g. <function>Button42</function>)</entry> 737 </row> 738 <row> 739 <entry>MotionNotify</entry> 740 <entry>event <emphasis>detail</emphasis></entry> 741 </row> 742 <row> 743 <entry>EnterNotify</entry> 744 <entry>event <emphasis>mode</emphasis></entry> 745 </row> 746 <row> 747 <entry>LeaveNotify</entry> 748 <entry>event <emphasis>mode</emphasis></entry> 749 </row> 750 <row> 751 <entry>FocusIn</entry> 752 <entry>event <emphasis>mode</emphasis></entry> 753 </row> 754 <row> 755 <entry>FocusOut</entry> 756 <entry>event <emphasis>mode</emphasis></entry> 757 </row> 758 <row> 759 <entry>PropertyNotify</entry> 760 <entry><emphasis>atom</emphasis></entry> 761 </row> 762 <row> 763 <entry>SelectionClear</entry> 764 <entry><emphasis>selection</emphasis></entry> 765 </row> 766 <row> 767 <entry>SelectionRequest</entry> 768 <entry><emphasis>selection</emphasis></entry> 769 </row> 770 <row> 771 <entry>SelectionNotify</entry> 772 <entry><emphasis>selection</emphasis></entry> 773 </row> 774 <row> 775 <entry>ClientMessage</entry> 776 <entry><emphasis>type</emphasis></entry> 777 </row> 778 <row> 779 <entry>MappingNotify</entry> 780 <entry><emphasis>request</emphasis></entry> 781 </row> 782 </tbody> 783 </tgroup> 784</informaltable> 785 786<para> 787If the event type is 788<function>KeyPress</function> 789or 790<function>KeyRelease</function>, 791the detail field 792specifies a KeySym name in standard format which is matched against 793the event as described above, for example, <Key>A. 794</para> 795 796<para> 797For the 798<function>PropertyNotify</function>, 799<function>SelectionClear</function>, 800<function>SelectionRequest</function>, 801<function>SelectionNotify</function>, 802and 803<function>ClientMessage</function> 804events the detail field is specified 805as an atom name; for example, <Message>WM_PROTOCOLS. For the 806<function>MotionNotify</function>, 807<function>EnterNotify</function>, 808<function>LeaveNotify</function>, 809<function>FocusIn</function>, 810<function>FocusOut</function>, 811and 812<function>MappingNotify</function> 813events, either the symbolic constants as defined by 814<emphasis remap='I'>X Window 815System Protocol</emphasis>, Section 11, 816or the numeric values may be specified. 817</para> 818 819<para> 820If no detail field is specified, then any value in the event detail is 821accepted as a match. 822</para> 823 824<para> 825A KeySym can be specified as any of the standard KeySym names, 826a hexadecimal number prefixed with “0x” or “0X”, 827an octal number prefixed with “0”, or a decimal number. 828A KeySym expressed as a single digit is interpreted as the 829corresponding Latin 1 KeySym, for example, “0” is the KeySym XK_0. 830Other single character KeySyms are treated as literal constants from Latin 1, 831for example, “!” is treated as 0x21. 832Standard KeySym names are as defined in 833<filename><X11/keysymdef.h></filename> 834with the “XK_” prefix removed. 835</para> 836 837<para><emphasis role='strong'>Canonical Representation</emphasis></para> 838 839<para> 840Every translation table has a unique, canonical text representation. This 841representation is passed to a widget's 842<function>display_accelerator</function> 843procedure to describe the accelerators installed on that widget. 844The canonical representation of a translation table is (see also 845“Syntax”) 846</para> 847 848<informaltable frame='none'> 849 <?dbfo keep-together="auto" ?> 850 <tgroup cols='2' align='left' colsep='0' rowsep='0'> 851 <colspec colwidth='0.2*' colname='c1'/> 852 <colspec colwidth='1.0*' colname='c2'/> 853 <tbody> 854 <row> 855 <entry>translationTable</entry> 856 <entry>= { production } 857 </entry> 858 </row> 859 <row> 860 <entry>production</entry> 861 <entry>= lhs “:” rhs “\\n” 862 </entry> 863 </row> 864 <row> 865 <entry>lhs</entry> 866 <entry>=event { “,” event } 867 </entry> 868 </row> 869 <row> 870 <entry>event</entry> 871 <entry>=[modifier_list] “<”event_type“>” [ “(” count[“+”] “)” ] {detail} 872 </entry> 873 </row> 874 <row> 875 <entry>modifier_list</entry> 876 <entry>= [“!”] [“:”] {modifier} 877 </entry> 878 </row> 879 <row> 880 <entry>modifier</entry> 881 <entry>= [“~”] modifier_name 882 </entry> 883 </row> 884 <row> 885 <entry>count</entry> 886 <entry>=(“1” | “2” | “3” | “4” | ...) 887 </entry> 888 </row> 889 <row> 890 <entry>modifier_name</entry> 891 <entry>= “@” <keysym> | <see canonical modifier names below> 892 </entry> 893 </row> 894 <row> 895 <entry>event_type</entry> 896 <entry>= <see canonical event types below> 897 </entry> 898 </row> 899 <row> 900 <entry>detail</entry> 901 <entry>=<event-specific details> 902 </entry> 903 </row> 904 <row> 905 <entry>rhs</entry> 906 <entry>={ name “(” [params] “)” } 907 </entry> 908 </row> 909 <row> 910 <entry>name</entry> 911 <entry>=namechar { namechar } 912 </entry> 913 </row> 914 <row> 915 <entry>namechar</entry> 916 <entry>= { “a”–“z” | “A”–“Z” | “0”–“9” | “_” | “-” } 917 </entry> 918 </row> 919 <row> 920 <entry>params</entry> 921 <entry>=string {“,” string} 922 </entry> 923 </row> 924 <row> 925 <entry>string</entry> 926 <entry>=quoted_string 927 </entry> 928 </row> 929 <row> 930 <entry>quoted_string</entry> 931 <entry>= <quote>"</quote> {<Latin 1 character> | escape_char} [“\\"” ] <quote>"</quote> 932 </entry> 933 </row> 934 <row> 935 <entry>escape_char</entry> 936 <entry>= “\\"” 937 </entry> 938 </row> 939 </tbody> 940 </tgroup> 941</informaltable> 942 943<para>The canonical modifier names are</para> 944 945<programlisting> 946 Ctrl Mod1 Button1 947 Shift Mod2 Button2 948 Lock Mod3 Button3 949 Mod4 Button4 950 Mod5 Button5 951</programlisting> 952 953<para>The canonical event types are</para> 954 955<informaltable frame='none'> 956 <?dbfo keep-together="auto" ?> 957 <tgroup cols='2' align='left' colsep='0' rowsep='0'> 958 <colspec colwidth='1.0*' colname='c1'/> 959 <colspec colwidth='1.0*' colname='c2'/> 960 <tbody> 961 <row> 962 <entry>KeyPress</entry> 963 <entry>KeyRelease</entry> 964 </row> 965 <row> 966 <entry>ButtonPress</entry> 967 <entry>ButtonRelease</entry> 968 </row> 969 <row> 970 <entry>MotionNotify</entry> 971 <entry>EnterNotify</entry> 972 </row> 973 <row> 974 <entry>LeaveNotify</entry> 975 <entry>FocusIn</entry> 976 </row> 977 <row> 978 <entry>FocusOut</entry> 979 <entry>KeymapNotify</entry> 980 </row> 981 <row> 982 <entry>Expose</entry> 983 <entry>GraphicsExpose,</entry> 984 </row> 985 <row> 986 <entry>NoExpose</entry> 987 <entry>VisibilityNotify</entry> 988 </row> 989 <row> 990 <entry>CreateNotify</entry> 991 <entry>DestroyNotify</entry> 992 </row> 993 <row> 994 <entry>UnmapNotify</entry> 995 <entry>MapNotify</entry> 996 </row> 997 <row> 998 <entry>MapRequest</entry> 999 <entry>ReparentNotify</entry> 1000 </row> 1001 <row> 1002 <entry>ConfigureNotify</entry> 1003 <entry>ConfigureRequest</entry> 1004 </row> 1005 <row> 1006 <entry>GravityNotify</entry> 1007 <entry>ResizeRequest</entry> 1008 </row> 1009 <row> 1010 <entry>CirculateNotify</entry> 1011 <entry>CirculateRequest</entry> 1012 </row> 1013 <row> 1014 <entry>PropertyNotify</entry> 1015 <entry>SelectionClear</entry> 1016 </row> 1017 <row> 1018 <entry>SelectionRequest</entry> 1019 <entry>SelectionNotify</entry> 1020 </row> 1021 <row> 1022 <entry>ColormapNotify</entry> 1023 <entry>ClientMessage</entry> 1024 </row> 1025 </tbody> 1026 </tgroup> 1027</informaltable> 1028 1029<para><emphasis role='strong'>Examples</emphasis></para> 1030 1031<itemizedlist spacing='compact'> 1032 <listitem> 1033 <para> 1034Always put more specific events in the table before more general ones: 1035 </para> 1036<programlisting> 1037 Shift <Btn1Down> : twas()\n\ 1038 <Btn1Down> : brillig() 1039</programlisting> 1040 </listitem> 1041 <listitem> 1042 <para> 1043For double-click on Button1 Up with Shift, use this specification: 1044 </para> 1045<programlisting> 1046Shift<Btn1Up>(2) : and() 1047</programlisting> 1048 </listitem> 1049 <listitem> 1050 <para> 1051This is equivalent to the following line with appropriate timers set 1052between events: 1053 </para> 1054<programlisting> 1055Shift<Btn1Down>,Shift<Btn1Up>,Shift<Btn1Down>,Shift<Btn1Up> : and() 1056</programlisting> 1057 </listitem> 1058 <listitem> 1059 <para> 1060For double-click on Button1 Down with Shift, use this specification: 1061 </para> 1062<programlisting> 1063Shift<Btn1Down>(2) : the() 1064</programlisting> 1065 </listitem> 1066 <listitem> 1067 <para> 1068This is equivalent to the following line with appropriate timers set 1069between events: 1070 </para> 1071<programlisting> 1072Shift<Btn1Down>,Shift<Btn1Up>,Shift<Btn1Down> : the() 1073</programlisting> 1074 </listitem> 1075 <listitem> 1076 <para> 1077Mouse motion is always discarded when it occurs between events in a table 1078where no motion event is specified: 1079 </para> 1080<programlisting> 1081<Btn1Down>,<Btn1Up> : slithy() 1082</programlisting> 1083 <para> 1084This is taken, even if the pointer moves a bit between the down and 1085up events. 1086Similarly, any motion event specified in a translation matches any number 1087of motion events. 1088If the motion event causes an action procedure to be invoked, 1089the procedure is invoked after each motion event. 1090 </para> 1091 </listitem> 1092 <listitem> 1093 <para> 1094If an event sequence consists of a sequence of events that is also a 1095noninitial subsequence of another translation, 1096it is not taken if it occurs in the context of the longer sequence. 1097This occurs mostly in sequences like the following: 1098 </para> 1099<programlisting> 1100<Btn1Down>,<Btn1Up> : toves()\n\ 1101<Btn1Up> : did() 1102</programlisting> 1103 <para> 1104The second translation is taken only if the button release is not 1105preceded by a button press or if there are intervening events between the 1106press and the release. 1107Be particularly aware of this when using the repeat notation, above, 1108with buttons and keys, 1109because their expansion includes additional events; 1110and when specifying motion events, because they are implicitly included 1111between any two other events. 1112In particular, 1113pointer motion and double-click translations cannot coexist in the same 1114translation table. 1115 </para> 1116 </listitem> 1117 <listitem> 1118 <para> 1119For single click on Button1 Up with Shift and Meta, use this specification: 1120 </para> 1121 </listitem> 1122 <listitem> 1123<programlisting> 1124Shift Meta <Btn1Down>, Shift Meta<Btn1Up>: gyre() 1125</programlisting> 1126 </listitem> 1127 <listitem> 1128 <para> 1129For multiple clicks greater or equal to a minimum number, 1130a plus sign (+) may be appended to the final (rightmost) 1131count in an event sequence. The actions will be invoked 1132on the <emphasis remap='I'>count</emphasis>-th click and each subsequent one arriving 1133within the multi-click time interval. For example: 1134 </para> 1135<programlisting> 1136Shift <Btn1Up>(2+) : and() 1137</programlisting> 1138 </listitem> 1139 <listitem> 1140 <para> 1141To indicate 1142<function>EnterNotify</function> 1143with any modifiers, use this specification: 1144 </para> 1145<programlisting> 1146<Enter> : gimble() 1147</programlisting> 1148 </listitem> 1149 <listitem> 1150 <para> 1151To indicate 1152<function>EnterNotify</function> 1153with no modifiers, use this specification: 1154 </para> 1155<programlisting> 1156None <Enter> : in() 1157</programlisting> 1158 </listitem> 1159 <listitem> 1160 <para> 1161To indicate 1162<function>EnterNotify</function> 1163with Button1 Down and Button2 Up and “don't care” about 1164the other modifiers, use this specification: 1165 </para> 1166<programlisting> 1167Button1 ~Button2 <Enter> : the() 1168</programlisting> 1169 </listitem> 1170 <listitem> 1171 <para> 1172To indicate 1173<function>EnterNotify</function> 1174with Button1 down and Button2 down exclusively, use this specification: 1175 </para> 1176<programlisting> 1177! Button1 Button2 <Enter> : wabe() 1178</programlisting> 1179 <para> 1180You do not need to use a tilde (~) with an exclamation point (!). 1181 </para> 1182 </listitem> 1183</itemizedlist> 1184</appendix> 1185