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>
37 /* Action structures used in the server */
39 #define XkbcAnyActionDataSize 18
40 typedef struct _XkbcAnyAction {
42 unsigned char pad[XkbcAnyActionDataSize];
45 typedef struct _XkbcModAction {
53 typedef struct _XkbcGroupAction {
59 typedef struct _XkbcISOAction {
69 typedef struct _XkbcCtrlsAction {
75 typedef struct _XkbcDeviceBtnAction {
81 } XkbcDeviceBtnAction;
83 typedef struct _XkbcDeviceValuatorAction {
92 } XkbcDeviceValuatorAction;
94 typedef struct _XkbcPtrDfltAction {
101 typedef struct _XkbcSwitchScreenAction {
105 } XkbcSwitchScreenAction;
107 typedef union _XkbcAction {
110 XkbcGroupAction group;
112 XkbcCtrlsAction ctrls;
113 XkbcDeviceBtnAction devbtn;
114 XkbcDeviceValuatorAction devval;
115 XkbcPtrDfltAction dflt;
116 XkbcSwitchScreenAction screen;
117 XkbRedirectKeyAction redirect; /* XXX wholly unnecessary? */
118 XkbPtrAction ptr; /* XXX delete for DeviceValuator */
119 XkbPtrBtnAction btn; /* XXX delete for DeviceBtn */
120 XkbMessageAction msg; /* XXX just delete */
124 typedef struct _XkbcServerMapRec {
125 unsigned short num_acts;
126 unsigned short size_acts;
128 #if defined(__cplusplus) || defined(c_plusplus)
129 /* explicit is a C++ reserved word */
130 unsigned char * c_explicit;
132 unsigned char * explicit;
136 XkbBehavior *behaviors;
137 unsigned short *key_acts;
138 unsigned char *explicits;
139 uint32_t vmods[XkbNumVirtualMods];
141 } XkbcServerMapRec, *XkbcServerMapPtr;
143 /* Common keyboard description structure */
144 typedef struct _XkbcDesc {
145 unsigned int defined;
146 unsigned short flags;
147 unsigned short device_spec;
148 KeyCode min_key_code;
149 KeyCode max_key_code;
151 XkbControlsPtr ctrls;
152 XkbcServerMapPtr server;
154 XkbIndicatorPtr indicators;
156 XkbCompatMapPtr compat;
158 } XkbcDescRec, *XkbcDescPtr;
166 XkbcCompileKeymapFromRules(const XkbRMLVOSet *rmlvo);
169 XkbcCompileKeymapFromComponents(const XkbComponentNamesPtr ktcsg);
172 XkbcCompileKeymapFromFile(FILE *inputFile, const char *mapName);
174 extern XkbComponentListPtr
175 XkbcListComponents(XkbComponentNamesPtr ptrns, int *maxMatch);
178 * Canonicalises component names by prepending the relevant component from
179 * 'old' to the one in 'names' when the latter has a leading '+' or '|', and
180 * by replacing a '%' with the relevant component, e.g.:
183 * ------------------------------------------
186 * foo+%|baz bar foo+bar|baz
188 * If a component in names needs to be modified, the existing value will be
189 * free()d, and a new one allocated with malloc().
192 XkbcCanonicaliseComponents(XkbComponentNamesPtr names,
193 const XkbComponentNamesPtr old);
196 * Converts a keysym to a string; will return unknown Unicode codepoints
197 * as "Ua1b2", and other unknown keysyms as "0xabcd1234".
199 * The string returned may become invalidated after the next call to
200 * XkbcKeysymToString: if you need to preserve it, then you must
204 XkbcKeysymToString(KeySym ks);
207 * See XkbcKeysymToString comments: this function will accept any string
208 * from that function.
211 XkbcStringToKeysym(const char *s);
215 #endif /* _XKBCOMMON_H_ */