3 Copyright 1988, 1998 The Open Group
5 Permission to use, copy, modify, distribute, and sell this software and its
6 documentation for any purpose is hereby granted without fee, provided that
7 the above copyright notice appear in all copies and that both that
8 copyright notice and this permission notice appear in supporting
11 The above copyright notice and this permission notice shall be included
12 in all copies or substantial portions of the Software.
14 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15 OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
17 IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
18 OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19 ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20 OTHER DEALINGS IN THE SOFTWARE.
22 Except as contained in this notice, the name of The Open Group shall
23 not be used in advertising or otherwise to promote the sale, use or
24 other dealings in this Software without prior written authorization
33 * Input is parsed and a work queue is built that is executed later. This
34 * allows us to swap keys as well as ensure that we don't mess up the keyboard
35 * by doing a partial rebind.
38 enum opcode { doKeycode, doAddModifier, doRemoveModifier, doClearModifier,
42 enum opcode type; /* oneof enum opcode */
43 union op *next; /* next element in list or NULL */
48 * keycode KEYCODE = KEYSYM
49 * keysym OLDKEYSYM = NEWKEYSYM
51 * want to eval the OLDKEYSYM before executing the work list so that it isn't
52 * effected by any assignments.
56 enum opcode type; /* doKeycode */
57 union op *next; /* next element in list or NULL */
58 KeyCode target_keycode; /* key to which we are assigning */
59 int count; /* number of new keysyms */
60 KeySym *keysyms; /* new values to insert */
65 * add MODIFIER = KEYSYM ...
68 struct op_addmodifier {
69 enum opcode type; /* doAddModifier */
70 union op *next; /* next element in list or NULL */
71 int modifier; /* index into modifier list */
72 int count; /* number of keysyms */
73 KeySym *keysyms; /* new values to insert */
78 * remove MODIFIER = OLDKEYSYM ...
80 * want to eval the OLDKEYSYM before executing the work list so that it isn't
81 * effected by any assignments.
84 struct op_removemodifier {
85 enum opcode type; /* doRemoveModifier */
86 union op *next; /* next element in list or NULL */
87 int modifier; /* index into modifier list */
88 int count; /* number of keysyms */
89 KeyCode *keycodes; /* old values to remove */
97 struct op_clearmodifier {
98 enum opcode type; /* doClearModifier */
99 union op *next; /* next element in list or NULL */
100 int modifier; /* index into modifier list */
104 * pointer = NUMBER ...
106 * set pointer map to the positive numbers given on the right hand side
109 #define MAXBUTTONCODES 256 /* there are eight bits of buttons */
112 enum opcode type; /* doPointer */
113 union op *next; /* next element in list or NULL */
114 int count; /* number of new button codes */
115 unsigned char button_codes[MAXBUTTONCODES];
123 struct op_generic generic;
124 struct op_keycode keycode;
125 struct op_addmodifier addmodifier;
126 struct op_removemodifier removemodifier;
127 struct op_clearmodifier clearmodifier;
128 struct op_pointer pointer;
137 extern struct modtab {
143 #define AllocStruct(s) ((s *) malloc (sizeof (s)))
145 #define MAXKEYSYMNAMESIZE 80 /* absurdly large */