1 .\" $Xorg: appB,v 1.3 2000/08/17 19:42:48 cpqbld Exp $
2 .\" Copyright \(co 1985, 1986, 1987, 1988, 1991, 1994
5 .\" Permission is hereby granted, free of charge, to any person obtaining
6 .\" a copy of this software and associated documentation files (the
7 .\" "Software"), to deal in the Software without restriction, including
8 .\" without limitation the rights to use, copy, modify, merge, publish,
9 .\" distribute, sublicense, and/or sell copies of the Software, and to
10 .\" permit persons to whom the Software is furnished to do so, subject to
11 .\" the following conditions:
13 .\" The above copyright notice and this permission notice shall be included
14 .\" in all copies or substantial portions of the Software.
16 .\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
17 .\" OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18 .\" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
19 .\" IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR
20 .\" OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
21 .\" ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22 .\" OTHER DEALINGS IN THE SOFTWARE.
24 .\" Except as contained in this notice, the name of the X Consortium shall
25 .\" not be used in advertising or otherwise to promote the sale, use or
26 .\" other dealings in this Software without prior written authorization
27 .\" from the X Consortium.
29 .\" Copyright \(co 1985, 1986, 1987, 1988, 1991, 1994
30 .\" Digital Equipment Corporation, Maynard, Massachusetts.
32 .\" Permission to use, copy, modify and distribute this documentation for any
33 .\" purpose and without fee is hereby granted, provided that the above copyright
34 .\" notice appears in all copies and that both that copyright notice and this
35 .\" permission notice appear in supporting documentation, and that the name of
36 .\" Digital not be used in in advertising or publicity pertaining
37 .\" to distribution of the software without specific, written prior permission.
38 .\" Digital makes no representations about the suitability of the
39 .\" software described herein for any purpose.
40 .\" It is provided ``as is'' without express or implied warranty.
46 \s+1\fBAppendix B\fP\s-1
48 \s+1\fBTranslation Table Syntax\fP\s-1
52 \fBAppendix B \(em Translation Table Syntax\fP
54 .IN "Translation tables"
58 Syntax is specified in EBNF notation with the following conventions:
61 [ a ] Means either nothing or ``a''
62 { a } Means zero or more occurrences of ``a''
63 ( a | b ) Means either ``a'' or ``b''
64 \\\\n Is the newline character
67 All terminals are enclosed in double quotation marks (`` '').
68 Informal descriptions are enclosed in angle brackets (< >).
72 The syntax of a translation table is
75 translationTable = [ directive ] { production }
76 directive = ( ``#replace'' | ``#override'' | ``#augment'' ) ``\\\\n''
77 production = lhs ``:'' rhs ``\\\\n''
78 lhs = ( event | keyseq ) { ``,'' (event | keyseq) }
79 keyseq = ``"'' keychar {keychar} ``"''
80 keychar = [ ``^'' | ``$'' | ``\\\\'' ] <ISO Latin 1 character>
81 event = [modifier_list] ``<''event_type``>'' [ ``('' count[``+''] ``)'' ] {detail}
82 modifier_list = ( [``!''] [``:''] {modifier} ) | ``None''
83 modifier = [``~''] modifier_name
84 count = (``1'' | ``2'' | ``3'' | ``4'' | ...)
85 modifier_name = ``@'' <keysym> | <see ModifierNames table below>
86 event_type = <see Event Types table below>
87 detail = <event specific details>
88 rhs = { name ``('' [params] ``)'' }
89 name = namechar { namechar }
90 namechar = { ``a''-``z'' | ``A''-``Z'' | ``0''-``9'' | ``_'' | ``-'' }
91 params = string {``,'' string}
92 string = quoted_string | unquoted_string
93 quoted_string = ``"'' {<Latin 1 character> | escape_char} [``\\\\\\\\'' ] ``"''
94 escape_char = ``\\\\"''
95 unquoted_string = {<Latin 1 character except space, tab, ``,'', ``\\\\n'', ``)''>}
99 The \fIparams\fP field is parsed into a list of
101 values that will be passed to the named action procedure. A
102 \fIquoted string\fP may contain an embedded quotation mark if the
103 quotation mark is preceded by a single backslash (\\). The
104 three-character sequence ``\\\\"'' is interpreted as ``single backslash
105 followed by end-of-string''.
110 The modifier field is used to specify standard X keyboard and button
112 Modifiers are legal on event types
120 and their abbreviations.
121 An error is generated when a translation table
122 that contains modifiers for any other events is parsed.
124 If the modifier list has no entries and is not ``None'',
125 it means ``don't care'' on all modifiers.
127 If an exclamation point (!) is specified at the beginning
128 of the modifier list,
129 it means that the listed modifiers must be in the correct state
130 and no other modifiers can be asserted.
132 If any modifiers are specified
133 and an exclamation point (!) is not specified,
134 it means that the listed modifiers must be in the
135 correct state and ``don't care'' about any other modifiers.
137 If a modifier is preceded by a tilde (~),
138 it means that that modifier must not be asserted.
140 If ``None'' is specified, it means no modifiers can be asserted.
142 If a colon (:) is specified at the beginning of the modifier list,
143 it directs the \*(xI to apply any standard modifiers in the
144 event to map the event keycode into a KeySym.
145 The default standard modifiers are Shift and Lock,
146 with the interpretation as defined in \fI\*(xP\fP, Section 5.
147 The resulting KeySym must exactly match the specified
148 KeySym, and the nonstandard modifiers in the event must match the
150 For example, ``:<Key>a'' is distinct from ``:<Key>A'',
151 and ``:Shift<Key>A'' is distinct from ``:<Key>A''.
153 If both an exclamation point (!) and a colon (:) are specified at
154 the beginning of the modifier list, it means that the listed
155 modifiers must be in the correct state and that no other modifiers
156 except the standard modifiers can be asserted. Any standard
157 modifiers in the event are applied as for colon (:) above.
159 If a colon (:) is not specified,
160 no standard modifiers are applied.
161 Then, for example, ``<Key>A'' and ``<Key>a'' are equivalent.
164 a circumflex (^) is an abbreviation for the Control modifier,
165 a dollar sign ($) is an abbreviation for Meta,
166 and a backslash (\\) can be used to quote any
167 character, in particular a double quote ("), a circumflex (^),
168 a dollar sign ($), and another backslash (\\).
174 No modifiers: None <event> detail
175 Any modifiers: <event> detail
176 Only these modifiers: ! mod1 mod2 <event> detail
177 These modifiers and any others: mod1 mod2 <event> detail
180 The use of ``None'' for a modifier list is identical to the use
181 of an exclamation point with no modifers.
184 lw(1i) lw(1i) lw(3i).
187 Modifier Abbreviation Meaning
193 Ctrl c Control modifier bit
194 Shift s Shift modifier bit
195 Lock l Lock modifier bit
196 Meta m Meta key modifier
197 Hyper h Hyper key modifier
198 Super su Super key modifier
199 Alt a Alt key modifier
200 Mod1 Mod1 modifier bit
201 Mod2 Mod2 modifier bit
202 Mod3 Mod3 modifier bit
203 Mod4 Mod4 modifier bit
204 Mod5 Mod5 modifier bit
205 Button1 Button1 modifier bit
206 Button2 Button2 modifier bit
207 Button3 Button3 modifier bit
208 Button4 Button4 modifier bit
209 Button5 Button5 modifier bit
211 Any Any modifier combination
217 A key modifier is any modifier bit one of whose corresponding KeyCodes
218 contains the corresponding left or right KeySym.
220 ``m'' or ``Meta'' means any modifier bit mapping to a KeyCode
221 whose KeySym list contains XK_Meta_L or XK_Meta_R.
222 Note that this interpretation is for each display,
223 not global or even for each application context.
224 The Control, Shift, and Lock modifier names refer
225 explicitly to the corresponding modifier bits;
226 there is no additional interpretation of KeySyms for these modifiers.
228 Because it is possible to associate arbitrary KeySyms with modifiers, the set of
229 key modifiers is extensible. The ``@'' <keysym> syntax means any
230 modifier bit whose corresponding KeyCode contains the specified KeySym name.
232 A modifier_list/KeySym combination in a translation matches a
233 modifiers/KeyCode combination in an event in the following ways:
235 If a colon (:) is used, the \*(xI call the display's
237 with the KeyCode and modifiers.
238 To match, (\fImodifiers\fP & ~\fImodifiers_return\fP) must equal \fImodifier_list\fP, and
239 \fIkeysym_return\fP must equal the given KeySym.
241 If (:) is not used, the \*(xI mask off all don't-care bits from the
243 This value must be equal to \fImodifier_list\fP.
244 Then, for each possible combination of
245 don't-care modifiers in the modifier list, the \*(xI call the display's
247 with the KeyCode and that combination ORed with the cared-about modifier bits
249 \fIKeysym_return\fP must match the KeySym in the translation.
253 The event-type field describes XEvent types.
254 In addition to the standard
255 Xlib symbolic event type names, the following event type synonyms
383 The supported abbreviations are:
385 lw(1.5i) lw(1.25i) lw(1.75i).
388 Abbreviation Event Type Including
396 T} with Control modifier
399 T} with Meta modifier
402 T} with Shift modifier
405 T} with Button1 detail
408 T} with Button1 detail
411 T} with Button2 detail
414 T} with Button2 detail
417 T} with Button3 detail
420 T} with Button3 detail
423 T} with Button4 detail
426 T} with Button4 detail
429 T} with Button5 detail
432 T} with Button5 detail
435 T} with any button modifier
438 T} with Button1 modifier
441 T} with Button2 modifier
444 T} with Button3 modifier
447 T} with Button4 modifier
450 T} with Button5 modifier
456 The detail field is event-specific and normally corresponds to the
457 detail field of the corresponding event as described
458 by \fI\*(xP\fP, Section 11. The detail field is supported
459 for the following event types:
470 KeyPress KeySym from event \fIdetail\fP (keycode)
471 KeyRelease KeySym from event \fIdetail\fP (keycode)
472 ButtonPress button from event \fIdetail\fP
473 ButtonRelease button from event \fIdetail\fP
474 MotionNotify event \fIdetail\fP
475 EnterNotify event \fImode\fP
476 LeaveNotify event \fImode\fP
477 FocusIn event \fImode\fP
478 FocusOut event \fImode\fP
479 PropertyNotify \fIatom\fP
480 SelectionClear \fIselection\fP
481 SelectionRequest \fIselection\fP
482 SelectionNotify \fIselection\fP
483 ClientMessage \fItype\fP
484 MappingNotify \fIrequest\fP
494 specifies a KeySym name in standard format which is matched against
495 the event as described above, for example, <Key>A.
500 .PN SelectionRequest ,
501 .PN SelectionNotify ,
504 events the detail field is specified
505 as an atom name; for example, <Message>WM_PROTOCOLS. For the
513 events, either the symbolic constants as defined by
514 \fI\*(xP\fP, Section 11,
515 or the numeric values may be specified.
517 If no detail field is specified, then any value in the event detail is
520 A KeySym can be specified as any of the standard KeySym names,
521 a hexadecimal number prefixed with ``0x'' or ``0X'',
522 an octal number prefixed with ``0'', or a decimal number.
523 A KeySym expressed as a single digit is interpreted as the
524 corresponding Latin 1 KeySym, for example, ``0'' is the KeySym XK_0.
525 Other single character KeySyms are treated as literal constants from Latin 1,
526 for example, ``!'' is treated as 0x21.
527 Standard KeySym names are as defined in
528 .Pn < X11/keysymdef.h >
529 with the ``XK_'' prefix removed.
532 Canonical Representation
534 Every translation table has a unique, canonical text representation. This
535 representation is passed to a widget's
536 .PN display_accelerator
537 procedure to describe the accelerators installed on that widget.
538 The canonical representation of a translation table is (see also
542 translationTable = { production }
543 production = lhs ``:'' rhs ``\\\\n''
544 lhs = event { ``,'' event }
545 event = [modifier_list] ``<''event_type``>'' [ ``('' count[``+''] ``)'' ] {detail}
546 modifier_list = [``!''] [``:''] {modifier}
547 modifier = [``~''] modifier_name
548 count = (``1'' | ``2'' | ``3'' | ``4'' | ...)
549 modifier_name = ``@'' <keysym> | <see canonical modifier names below>
550 event_type = <see canonical event types below>
551 detail = <event-specific details>
552 rhs = { name ``('' [params] ``)'' }
553 name = namechar { namechar }
554 namechar = { ``a''-``z'' | ``A''-``Z'' | ``0''-``9'' | ``_'' | ``-'' }
555 params = string {``,'' string}
556 string = quoted_string
557 quoted_string = ``"'' {<Latin 1 character> | escape_char} [``\\\\\\\\'' ] ``"''
558 escape_char = ``\\\\"''
561 The canonical modifier names are
573 The canonical event types are
664 Always put more specific events in the table before more general ones:
667 Shift <Btn1Down> : twas()\\n\\
668 <Btn1Down> : brillig()
672 For double-click on Button1 Up with Shift, use this specification:
675 Shift<Btn1Up>(2) : and()
678 This is equivalent to the following line with appropriate timers set
682 Shift<Btn1Down>,Shift<Btn1Up>,Shift<Btn1Down>,Shift<Btn1Up> : and()
685 For double-click on Button1 Down with Shift, use this specification:
688 Shift<Btn1Down>(2) : the()
691 This is equivalent to the following line with appropriate timers set
695 Shift<Btn1Down>,Shift<Btn1Up>,Shift<Btn1Down> : the()
698 Mouse motion is always discarded when it occurs between events in a table
699 where no motion event is specified:
702 <Btn1Down>,<Btn1Up> : slithy()
705 This is taken, even if the pointer moves a bit between the down and
707 Similarly, any motion event specified in a translation matches any number
709 If the motion event causes an action procedure to be invoked,
710 the procedure is invoked after each motion event.
712 If an event sequence consists of a sequence of events that is also a
713 noninitial subsequence of another translation,
714 it is not taken if it occurs in the context of the longer sequence.
715 This occurs mostly in sequences like the following:
718 <Btn1Down>,<Btn1Up> : toves()\\n\\
722 The second translation is taken only if the button release is not
723 preceded by a button press or if there are intervening events between the
724 press and the release.
725 Be particularly aware of this when using the repeat notation, above,
726 with buttons and keys,
727 because their expansion includes additional events;
728 and when specifying motion events, because they are implicitly included
729 between any two other events.
731 pointer motion and double-click translations cannot coexist in the same
734 For single click on Button1 Up with Shift and Meta, use this specification:
737 Shift Meta <Btn1Down>, Shift Meta<Btn1Up>: gyre()
740 For multiple clicks greater or equal to a minimum number,
741 a plus sign (+) may be appended to the final (rightmost)
742 count in an event sequence. The actions will be invoked
743 on the \fIcount\fP-th click and each subsequent one arriving
744 within the multi-click time interval. For example:
747 Shift <Btn1Up>(2+) : and()
752 with any modifiers, use this specification:
760 with no modifiers, use this specification:
768 with Button1 Down and Button2 Up and ``don't care'' about
769 the other modifiers, use this specification:
772 Button1 ~Button2 <Enter> : the()
777 with Button1 down and Button2 down exclusively, use this specification:
780 ! Button1 Button2 <Enter> : wabe()
783 You do not need to use a tilde (~) with an exclamation point (!).