1VirtualBindings(library call) VirtualBindings(library call)
2
3
4
6 VirtualBindings — Bindings for virtual mouse and key events
7
9 The Motif reference pages describe key translations in terms of virtual
10 bindings, based on those described in the Motif Style Guide.
11
12 Bindings for osf Keysyms
13 Keysym strings that begin with <osf> are not part of the X server's
14 keyboard mapping. Instead, these keysyms are produced on the client
15 side at run time. They are interpreted by the routine XmTranslateKey,
16 and are used by the translation manager when the server delivers an
17 actual key event. For each application, a mapping is maintained
18 between <osf> keysyms and keysyms that correspond to actual keys. This
19 mapping is based on information obtained at application startup from
20 one of the following sources, listed in order of precedence:
21
22 · The XmNdefaultVirtualBindings resource from Display.
23
24 · A property on the root window, which can be set by mwm on
25 startup, or by the xmbind client, or on prior startup of a Motif
26 application.
27
28 · The file .motifbind in the user's home directory.
29
30 · A set of bindings based on the vendor string and optionally the
31 vendor release of the X server. Motif searches for these bind‐
32 ings in the following steps:
33
34 0. If the file xmbind.alias exists in the user's home direc‐
35 tory, Motif searches this file for a pathname associated
36 with the vendor string or with the vendor string and vendor
37 release. If it finds such a pathname and if that file
38 exists, Motif loads the bindings contained in that file.
39
40 1. If it has found no bindings, Motif next looks for the file
41 xmbind.alias in the directory specified by the environment
42 variable XMBINDDIR, if XMBINDDIR is set, or in the direc‐
43 tory /usr/share/X11/bindings if XMBINDDIR is not set. If
44 this file exists Motif searches it for a pathname associ‐
45 ated with the vendor string or with the vendor string and
46 vendor release. If it finds such a pathname and if that
47 file exists, Motif loads the bindings contained in that
48 file.
49
50 2. If it still has found no bindings, Motif loads a set of
51 hard-coded fallback bindings.
52
53 The xmbind.alias file contains zero or more lines of the following
54 form:
55
56 "vendor_string[ vendor_release]" bindings_file
57
58 where vendor_string is the X server vendor name as returned by the X
59 client xdpyinfo or the Xlib function XServerVendor, and must appear in
60 double quotes. If vendor_release is included, it is the X server ven‐
61 dor release number as returned by the X client xdpyinfo or the Xlib
62 function XVendorRelease, and must also be contained within the double
63 quotes separated by one space from vendor_string. The vendor_release
64 argument is provided to allow support of changes in keyboard hardware
65 from a vendor, assuming that the vendor increments the release number
66 to flag such changes. Alternatively, the vendor may simply use a
67 unique vendor string for each different keyboard.
68
69 The bindings_file argument is the pathname of the file containing the
70 bindings themselves. It can be a relative or absolute pathname. If it
71 it is a relative pathname, it is relative to the location of the
72 xmbind.alias file.
73
74 Comment lines in the xmbind.alias file begin with ! (exclamation
75 point).
76
77 The bindings found in either the .motifbind file or the vendor mapping
78 are placed in a property on the root window. This property is used to
79 determine the bindings for subsequent Motif applications.
80
81 On startup mwm attempts to load the file .motifbind in the user's home
82 directory. If this is unsuccessful, it loads the vendor bindings as
83 described previously. It places the bindings it loads in a property on
84 the root window for use by subsequent Motif applications.
85
86 The xmbind function loads bindings from a file if that file is speci‐
87 fied on the command line. If no file is specified on the command line,
88 it attempts to load the file .motifbind in the user's home directory.
89 If this fails, it loads the vendor bindings as described previously.
90 It places the bindings it loads in a property on the root window for
91 use by subsequent Motif applications.
92
93 The format of the specification for mapping <osf> keysyms to actual
94 keysyms is similar to that of a specification for an event translation.
95 (See below) The syntax is specified (and below) here in EBNF notation
96 using the following conventions:
97
98 [a] Means either nothing or a
99 {a} Means zero or more occurrences of a
100 (a|b) Means either a or b.
101
102 Terminals are enclosed in double quotation marks.
103
104 The syntax of an <osf> keysym binding specification is as follows:
105
106 binding_spec = {line "\n"} [line]
107 line = virtual_keysym ":" list_of_key_event
108 list_of_key_event= key_event { "," key_event}
109 key_event = {modifier_name} "<Key>" actual_keysym
110 virtual_keysym = keysym
111 actual_keysym = keysym
112 keysym = A valid X11 keysym name that is
113 mapped by XStringToKeysym
114
115 As with event translations, more specific event descriptions must pre‐
116 cede less specific descriptions. For example, an event description for
117 a key with a modifier must precede a description for the same key with‐
118 out the same modifier.
119
120 Following is an example of a specification for the defaultVirtualBind‐
121 ings resource in a resource file:
122
123 *defaultVirtualBindings: \
124 osfBackSpace: <Key>BackSpace \n\
125 osfInsert: <Key>InsertChar \n\
126 osfDelete: <Key>DeleteChar \n\
127 ...
128 osfLeft: <Key>left, Ctrl<Key>H
129
130 The format of a .motifbind file or of a file containing vendor bindings
131 is the same, except that the binding specification for each keysym is
132 placed on a separate line. The previous example specification appears
133 as follows in a .motifbind or vendor bindings file:
134
135 osfBackSpace: <Key>BackSpace
136 osfInsert: <Key>InsertChar
137 osfDelete: <Key>DeleteChar
138 ...
139 osfLeft: <Key>left, Ctrl<Key>H
140
141 The following table lists the fixed fallback default bindings for <osf>
142 keysyms.
143
144 ┌─────────────────────────────────────────────────────────┐
145 │ Fallback Defaul│t Bindings for osf Keysyms │
146 │<osf Keysym> │ Fallback Default Binding │
147 ├──────────────────────┼──────────────────────────────────┤
148 │<osfActivate>: │ <Key>KP_Enter, <Key>Execute │
149 ├──────────────────────┼──────────────────────────────────┤
150 │<osfAddMode>: │ Shift<Key>F8 │
151 ├──────────────────────┼──────────────────────────────────┤
152 │<osfBackSpace>: │ <Key>BackSpace │
153 ├──────────────────────┼──────────────────────────────────┤
154 │<osfBeginLine>: │ <Key>Home, <Key>Begin │
155 ├──────────────────────┼──────────────────────────────────┤
156 │<osfCancel>: │ <Key>Escape, <Key>Cancel │
157 ├──────────────────────┼──────────────────────────────────┤
158 │<osfClear>: │ <Key>Clear │
159 ├──────────────────────┼──────────────────────────────────┤
160 │<osfCopy>: │ unbound │
161 ├──────────────────────┼──────────────────────────────────┤
162 │<osfCut>: │ unbound │
163 ├──────────────────────┼──────────────────────────────────┤
164 │<osfDelete>: │ <Key>Delete │
165 ├──────────────────────┼──────────────────────────────────┤
166 │<osfDeselectAll>: │ unbound │
167 ├──────────────────────┼──────────────────────────────────┤
168 │<osfDown>: │ <Key>Down │
169 ├──────────────────────┼──────────────────────────────────┤
170 │<osfEndLine>: │ <Key>End │
171 ├──────────────────────┼──────────────────────────────────┤
172 │<osfHelp>: │ <Key>F1, <Key>Help │
173 ├──────────────────────┼──────────────────────────────────┤
174 │<osfInsert>: │ <Key>Insert │
175 ├──────────────────────┼──────────────────────────────────┤
176 │<osfLeft>: │ <Key>Left │
177 ├──────────────────────┼──────────────────────────────────┤
178 │<osfLeftLine>: │ unbound │
179 ├──────────────────────┼──────────────────────────────────┤
180 │<osfMenu>: │ Shift<Key>F10, <Key>Menu │
181 ├──────────────────────┼──────────────────────────────────┤
182 │<osfMenuBar>: │ <Key>F10, Shift<Key>Menu │
183 ├──────────────────────┼──────────────────────────────────┤
184 │<osfNextMinor>: │ unbound │
185 ├──────────────────────┼──────────────────────────────────┤
186 │<osfPageDown>: │ <Key>Next │
187 ├──────────────────────┼──────────────────────────────────┤
188 │<osfPageLeft>: │ unbound │
189 ├──────────────────────┼──────────────────────────────────┤
190 │<osfPageRight>: │ unbound │
191 ├──────────────────────┼──────────────────────────────────┤
192 │<osfPageUp>: │ <Key>Prior │
193 ├──────────────────────┼──────────────────────────────────┤
194 │<osfPaste>: │ unbound │
195 ├──────────────────────┼──────────────────────────────────┤
196 │<osfPrimaryPaste>: │ unbound │
197 ├──────────────────────┼──────────────────────────────────┤
198 │<osfPriorMinor>: │ unbound │
199 ├──────────────────────┼──────────────────────────────────┤
200 │<osfReselect>: │ unbound │
201 ├──────────────────────┼──────────────────────────────────┤
202 │<osfRestore>: │ unbound │
203 ├──────────────────────┼──────────────────────────────────┤
204 │<osfRight>: │ <Key>Right │
205 ├──────────────────────┼──────────────────────────────────┤
206 │<osfRightLine>: │ unbound │
207 ├──────────────────────┼──────────────────────────────────┤
208 │<osfSelect>: │ <Key>Select │
209 ├──────────────────────┼──────────────────────────────────┤
210 │<osfSelectAll>: │ unbound │
211 ├──────────────────────┼──────────────────────────────────┤
212 │<osfSwitchDirection>: │ Alt<Key>Return, Alt<Key>KP_Enter │
213 ├──────────────────────┼──────────────────────────────────┤
214 │<osfUndo>: │ <Key>Undo │
215 ├──────────────────────┼──────────────────────────────────┤
216 │<osfUp>: │ <Key>Up │
217 ├──────────────────────┼──────────────────────────────────┤
218 └──────────────────────┴──────────────────────────────────┘
219 Changes in the Handling of Shifted Keys
220 In conjunction with MIT X11R5 Patch 24, this version of Motif intro‐
221 duces a change in the way that keys involving the <Shift> modifier are
222 processed. This change allows the numeric keypad to be used to generate
223 numbers using the standard X mechanisms. Since the default behavior is
224 now to honor the xmodmap keymap bindings, translations and virtual key
225 bindings that use <Shift> may behave differently. A common symptom is
226 that unshifted keypad and function keys (with or without other modi‐
227 fiers) produce the expected results, but shifted ones do not.
228
229 To obtain the old behavior you can remove the shifted interpretation
230 from problematic keys using the xmodmap utility. Each entry in a
231 xmodmap keymap table contains up to four keysym bindings. The second
232 and fourth keysyms are for shifted keys. If an expression contains only
233 two keysyms, simply remove the second keysym. If an entry contains
234 three or more keysyms, replace the second keysym with NoSymbol and
235 remove the fourth keysym.
236
237 Action Translations
238 The translation table syntax used by Motif is completely specified in
239 the X11R5 Toolkit Intrinsics Documentation. For the complete syntax
240 description, and for general instructions about writing or modifying a
241 translation table, please refer to this document. A brief summary of
242 the translation table format, however, is included below.
243
244 The syntax is defined as in the binding syntax specification above.
245 Informal descriptions are contained in angle brackets (<>).
246
247 TranslationTable= [ directive ] { production }
248 directive = ( "#replace" | "#override" | "#augment") "\n"
249 production = lhs ":" rhs "\n"
250 lhs = ( event | keyseq) {"," ( event | keyseq) }
251 keyseq = """ keychar { keychar } """
252 keychar = ( "^" | "$" | "\\") <ISO Latin 1 character>
253 event = [ modifier_list ] "<" event_type ">" [ count ] {detail}
254 modifier_list = ( ["!"][":"] { modifier } | "None")
255 modifier = [ "~" ] ( "@" <keysym> | <name from table below>)
256 count = "(" <positive integer> [ "+" ] ")"
257 rhs = { action_name "(" [params] ")" }
258 params = string { "," string }
259
260 The string field need not be quoted unless it includes a space or tab
261 character, or any comma, newline, or parenthesis. The entire list of
262 string values making up the params field will ba passed to the named
263 action routine.
264
265 The details field may be used to specify a keysym that will identify a
266 particular key event. For example, <Key> is the name of a type of
267 event, but it must be modified by the details field to name a specific
268 event, such as <Key>A.
269
270 Modifier Names The modifier list, which may be empty, consists of a
271 list of modifier keys that must be pressed with the key sequence. The
272 modifier keys may abbreviated with single letters, as in the following
273 list of the familiar modifiers:
274
275 s Shift
276
277 c or ^ Ctrl (Control)
278
279 m or $ Meta
280
281 a Alt
282
283 Other modifiers are available, such as "Mod5" and "Button2." These have
284 no abbreviation (although the "Button" modifiers may be abbreviated in
285 combination with events, as outlined below). If a modifier list has no
286 entries, and is not "None", it means the position of the modifier keys
287 is irrelevant. If modifiers are listed, the designated keys must be in
288 the specified position, but the unlisted modifier keys are irrelevant.
289 If the list begins with an exclamation point (!), however, the unlisted
290 modifiers may not be asserted. In addition, if a modifier name is pre‐
291 ceded by a tilde (~), the corresponding key must not be pressed.
292
293 If a modifier list begins with a colon (:), X tries to use the standard
294 modifiers (Shift and Lock), if present, to map the key event code into
295 a recognized keysym.
296
297 Event Types These are a few of the recognized event types.
298
299 Key or KeyDown
300 A keyboard key was pressed.
301
302 KeyUp A keyboard key was released.
303
304 BtnDown A mouse button was pressed.
305
306 BtnUp A mouse button was released.
307
308 Motion The mouse pointer moved.
309
310 Enter The pointer entered the widget's window.
311
312 Leave The pointer left the widget's window.
313
314 FocusIn The widget has received focus.
315
316 FocusOut The widget has lost focus.
317
318 There are some event abbreviations available. For example, <Btn1Motion>
319 is actually a "Motion" event, modified with the "Button1" modifier
320 (Button1<Motion>). Similarly, <Btn3Up> is actually a "BtnUp" event with
321 the "Button3" modifier. These abbreviations are used extensively in the
322 Motif translation tables.
323
325 xmbind(1)
326
327
328
329 VirtualBindings(library call)