2 Copyright 1985, 1987, 1990, 1998 The Open Group
3 Copyright 2008 Dan Nicholson
5 Permission is hereby granted, free of charge, to any person obtaining a
6 copy of this software and associated documentation files (the "Software"),
7 to deal in the Software without restriction, including without limitation
8 the rights to use, copy, modify, merge, publish, distribute, sublicense,
9 and/or sell copies of the Software, and to permit persons to whom the
10 Software is furnished to do so, subject to the following conditions:
12 The above copyright notice and this permission notice shall be included in
13 all copies or substantial portions of the Software.
15 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
19 ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22 Except as contained in this notice, the names of the authors or their
23 institutions shall not be used in advertising or otherwise to promote the
24 sale, use or other dealings in this Software without prior written
25 authorization from the authors.
33 #include <X11/Xfuncproto.h>
34 #include <X11/extensions/XKBstrcommon.h>
35 #include <X11/extensions/XKBrulescommon.h>
40 /* Action structures used in the server */
42 #define XkbcAnyActionDataSize 18
43 typedef struct _XkbcAnyAction {
45 unsigned char pad[XkbcAnyActionDataSize];
48 typedef struct _XkbcModAction {
56 typedef struct _XkbcGroupAction {
62 typedef struct _XkbcISOAction {
72 typedef struct _XkbcCtrlsAction {
78 typedef struct _XkbcDeviceBtnAction {
84 } XkbcDeviceBtnAction;
86 typedef struct _XkbcDeviceValuatorAction {
95 } XkbcDeviceValuatorAction;
97 typedef struct _XkbcPtrDfltAction {
104 typedef struct _XkbcSwitchScreenAction {
108 } XkbcSwitchScreenAction;
110 typedef union _XkbcAction {
113 XkbcGroupAction group;
115 XkbcCtrlsAction ctrls;
116 XkbcDeviceBtnAction devbtn;
117 XkbcDeviceValuatorAction devval;
118 XkbcPtrDfltAction dflt;
119 XkbcSwitchScreenAction screen;
120 XkbRedirectKeyAction redirect; /* XXX wholly unnecessary? */
121 XkbPtrAction ptr; /* XXX delete for DeviceValuator */
122 XkbPtrBtnAction btn; /* XXX delete for DeviceBtn */
123 XkbMessageAction msg; /* XXX just delete */
127 typedef struct _XkbcSymInterpretRec {
132 unsigned char virtual_mod;
134 } XkbcSymInterpretRec,*XkbcSymInterpretPtr;
136 typedef struct _XkbcCompatMapRec {
137 XkbcSymInterpretPtr sym_interpret;
138 XkbModsRec groups[XkbNumKbdGroups];
139 unsigned short num_si;
140 unsigned short size_si;
141 } XkbcCompatMapRec, *XkbcCompatMapPtr;
143 typedef struct _XkbcClientMapRec {
144 unsigned char size_types;
145 unsigned char num_types;
148 unsigned short size_syms;
149 unsigned short num_syms;
151 XkbSymMapPtr key_sym_map;
153 unsigned char *modmap;
154 } XkbcClientMapRec, *XkbcClientMapPtr;
156 typedef struct _XkbcServerMapRec {
157 unsigned short num_acts;
158 unsigned short size_acts;
160 #if defined(__cplusplus) || defined(c_plusplus)
161 /* explicit is a C++ reserved word */
162 unsigned char * c_explicit;
164 unsigned char * explicit;
168 XkbBehavior *behaviors;
169 unsigned short *key_acts;
170 unsigned char *explicits;
171 uint32_t vmods[XkbNumVirtualMods];
173 } XkbcServerMapRec, *XkbcServerMapPtr;
175 /* Common keyboard description structure */
176 typedef struct _XkbcDesc {
177 unsigned int defined;
178 unsigned short flags;
179 unsigned short device_spec;
180 KeyCode min_key_code;
181 KeyCode max_key_code;
183 XkbControlsPtr ctrls;
184 XkbcServerMapPtr server;
185 XkbcClientMapPtr map;
186 XkbIndicatorPtr indicators;
188 XkbCompatMapPtr compat;
190 } XkbcDescRec, *XkbcDescPtr;
198 XkbcCompileKeymapFromRules(const XkbRMLVOSet *rmlvo);
201 XkbcCompileKeymapFromComponents(const XkbComponentNamesPtr ktcsg);
204 XkbcCompileKeymapFromFile(FILE *inputFile, const char *mapName);
206 extern XkbComponentListPtr
207 XkbcListComponents(XkbComponentNamesPtr ptrns, int *maxMatch);
210 * Canonicalises component names by prepending the relevant component from
211 * 'old' to the one in 'names' when the latter has a leading '+' or '|', and
212 * by replacing a '%' with the relevant component, e.g.:
215 * ------------------------------------------
218 * foo+%|baz bar foo+bar|baz
220 * If a component in names needs to be modified, the existing value will be
221 * free()d, and a new one allocated with malloc().
224 XkbcCanonicaliseComponents(XkbComponentNamesPtr names,
225 const XkbComponentNamesPtr old);
228 * Converts a keysym to a string; will return unknown Unicode codepoints
229 * as "Ua1b2", and other unknown keysyms as "0xabcd1234".
231 * The string returned may become invalidated after the next call to
232 * XkbcKeysymToString: if you need to preserve it, then you must
235 * This is CARD32 rather than KeySym, as KeySym changes size between
236 * client and server (no, really).
239 XkbcKeysymToString(CARD32 ks);
242 * See XkbcKeysymToString comments: this function will accept any string
243 * from that function.
246 XkbcStringToKeysym(const char *s);
253 #endif /* _XKBCOMMON_H_ */