Drop keysym.h pollution from XKBcommon.h
[platform/upstream/libxkbcommon.git] / include / X11 / extensions / XKBcommon.h
1 /*
2 Copyright 1985, 1987, 1990, 1998  The Open Group
3 Copyright 2008  Dan Nicholson
4
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:
11
12 The above copyright notice and this permission notice shall be included in
13 all copies or substantial portions of the Software.
14
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.
21
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.
26 */
27
28 #ifndef _XKBCOMMON_H_
29 #define _XKBCOMMON_H_
30
31 #include <stdio.h>
32 #include <X11/X.h>
33 #include <X11/Xdefs.h>
34 #include <X11/Xfuncproto.h>
35 #include <X11/extensions/XKBstrcommon.h>
36 #include <X11/extensions/XKBgeomcommon.h>
37 #include <X11/extensions/XKBrulescommon.h>
38
39 /* Common keyboard description structure */
40 typedef struct _XkbcDesc {
41     unsigned int        defined;
42     unsigned short      flags;
43     unsigned short      device_spec;
44     KeyCode             min_key_code;
45     KeyCode             max_key_code;
46
47     XkbControlsPtr      ctrls;
48     XkbServerMapPtr     server;
49     XkbClientMapPtr     map;
50     XkbIndicatorPtr     indicators;
51     XkbNamesPtr         names;
52     XkbCompatMapPtr     compat;
53     XkbGeometryPtr      geom;
54 } XkbcDescRec, *XkbcDescPtr;
55
56 #define _XkbcKSLower (1 << 0)
57 #define _XkbcKSUpper (1 << 1)
58
59 #define XkbcKSIsLower(k) (_XkbcKSCheckCase(k) & _XkbcKSLower)
60 #define XkbcKSIsUpper(k) (_XkbcKSCheckCase(k) & _XkbcKSUpper)
61 #define XkbcKSIsKeypad(k) \
62     (((k) >= XK_KP_Space) && ((k) <= XK_KP_Equal))
63 #define XkbcKSIsDeadKey(k) \
64     (((k) >= XK_dead_grave) && ((k) <= XK_dead_semivoiced_sound))
65
66 _XFUNCPROTOBEGIN
67
68 extern XkbcDescPtr
69 XkbcCompileKeymapFromRules(const char *rules, XkbRF_VarDefsPtr defs);
70
71 extern XkbcDescPtr
72 XkbcCompileKeymapFromComponents(XkbComponentNamesPtr ktcsg);
73
74 extern char *
75 XkbcKeysymToString(KeySym ks);
76
77 extern KeySym
78 XkbcStringToKeysym(const char *s);
79
80 extern int
81 XkbcAllocCompatMap(XkbcDescPtr xkb, unsigned which, unsigned nSI);
82
83 extern void
84 XkbcFreeCompatMap(XkbcDescPtr xkb, unsigned which, Bool freeMap);
85
86 extern int
87 XkbcAllocNames(XkbcDescPtr xkb, unsigned which, int nTotalRG, int nTotalAliases);
88
89 extern void
90 XkbcFreeNames(XkbcDescPtr xkb, unsigned which, Bool freeMap);
91
92 extern int
93 XkbcAllocControls(XkbcDescPtr xkb, unsigned which);
94
95 extern void
96 XkbcFreeControls(XkbcDescPtr xkb, unsigned which, Bool freeMap);
97
98 extern int
99 XkbcAllocIndicatorMaps(XkbcDescPtr xkb);
100
101 extern void
102 XkbcFreeIndicatorMaps(XkbcDescPtr xkb);
103
104 extern XkbcDescRec *
105 XkbcAllocKeyboard(void);
106
107 extern void
108 XkbcFreeKeyboard(XkbcDescPtr xkb, unsigned which, Bool freeAll);
109
110 extern int
111 XkbcAllocClientMap(XkbcDescPtr xkb, unsigned which, unsigned nTotalTypes);
112
113 extern int
114 XkbcAllocServerMap(XkbcDescPtr xkb, unsigned which, unsigned nNewActions);
115
116 extern int
117 XkbcCopyKeyType(XkbKeyTypePtr from, XkbKeyTypePtr into);
118
119 extern int
120 XkbcCopyKeyTypes(XkbKeyTypePtr from, XkbKeyTypePtr into, int num_types);
121
122 extern int
123 XkbcResizeKeyType(XkbcDescPtr xkb, int type_ndx, int map_count,
124                   Bool want_preserve, int new_num_lvls);
125
126 extern KeySym *
127 XkbcResizeKeySyms(XkbcDescPtr xkb, int key, int needed);
128
129 extern int
130 XkbcChangeKeycodeRange(XkbcDescPtr xkb, int minKC, int maxKC,
131                        XkbChangesPtr changes);
132
133 extern XkbAction *
134 XkbcResizeKeyActions(XkbcDescPtr xkb, int key, int needed);
135
136 extern void
137 XkbcFreeClientMap(XkbcDescPtr xkb, unsigned what, Bool freeMap);
138
139 extern void
140 XkbcFreeServerMap(XkbcDescPtr xkb, unsigned what, Bool freeMap);
141
142 extern void
143 XkbcFreeGeomProperties(XkbGeometryPtr geom, int first, int count, Bool freeAll);
144
145 extern void
146 XkbcFreeGeomKeyAliases(XkbGeometryPtr geom, int first, int count, Bool freeAll);
147
148 extern void
149 XkbcFreeGeomColors(XkbGeometryPtr geom, int first, int count, Bool freeAll);
150
151 extern void
152 XkbcFreeGeomPoints(XkbOutlinePtr outline, int first, int count, Bool freeAll);
153
154 extern void
155 XkbcFreeGeomOutlines(XkbShapePtr shape, int first, int count, Bool freeAll);
156
157 extern void
158 XkbcFreeGeomShapes(XkbGeometryPtr geom, int first, int count, Bool freeAll);
159
160 extern void
161 XkbcFreeGeomOverlayKeys(XkbOverlayRowPtr row, int first, int count,
162                         Bool freeAll);
163
164 extern void
165 XkbcFreeGeomOverlayRows(XkbOverlayPtr overlay, int first, int count,
166                         Bool freeAll);
167
168 extern void
169 XkbcFreeGeomOverlays(XkbSectionPtr section, int first, int count, Bool freeAll);
170
171 extern void
172 XkbcFreeGeomKeys(XkbRowPtr row, int first, int count, Bool freeAll);
173
174 extern void
175 XkbcFreeGeomRows(XkbSectionPtr section, int first, int count, Bool freeAll);
176
177 extern void
178 XkbcFreeGeomSections(XkbGeometryPtr geom, int first, int count, Bool freeAll);
179
180 extern void
181 XkbcFreeGeomDoodads(XkbDoodadPtr doodads, int nDoodads, Bool freeAll);
182
183 extern void
184 XkbcFreeGeometry(XkbGeometryPtr geom, unsigned which, Bool freeMap);
185
186 extern int
187 XkbcAllocGeomProps(XkbGeometryPtr geom, int nProps);
188
189 extern int
190 XkbcAllocGeomColors(XkbGeometryPtr geom, int nColors);
191
192 extern int
193 XkbcAllocGeomKeyAliases(XkbGeometryPtr geom, int nKeyAliases);
194
195 extern int
196 XkbcAllocGeomShapes(XkbGeometryPtr geom, int nShapes);
197
198 extern int
199 XkbcAllocGeomSections(XkbGeometryPtr geom, int nSections);
200
201 extern int
202 XkbcAllocGeomOverlays(XkbSectionPtr section, int nOverlays);
203
204 extern int
205 XkbcAllocGeomOverlayRows(XkbOverlayPtr overlay, int nRows);
206
207 extern int
208 XkbcAllocGeomOverlayKeys(XkbOverlayRowPtr row, int nKeys);
209
210 extern int
211 XkbcAllocGeomDoodads(XkbGeometryPtr geom, int nDoodads);
212
213 extern int
214 XkbcAllocGeomSectionDoodads(XkbSectionPtr section, int nDoodads);
215
216 extern int
217 XkbcAllocGeomOutlines(XkbShapePtr shape, int nOL);
218
219 extern int
220 XkbcAllocGeomRows(XkbSectionPtr section, int nRows);
221
222 extern int
223 XkbcAllocGeomPoints(XkbOutlinePtr ol, int nPts);
224
225 extern int
226 XkbcAllocGeomKeys(XkbRowPtr row, int nKeys);
227
228 extern int
229 XkbcAllocGeometry(XkbcDescPtr xkb, XkbGeometrySizesPtr sizes);
230
231 extern XkbPropertyPtr
232 XkbcAddGeomProperty(XkbGeometryPtr geom, char *name, char *value);
233
234 extern XkbKeyAliasPtr
235 XkbcAddGeomKeyAlias(XkbGeometryPtr geom, char *aliasStr, char *realStr);
236
237 extern XkbColorPtr
238 XkbcAddGeomColor(XkbGeometryPtr geom, char *spec, unsigned int pixel);
239
240 extern XkbOutlinePtr
241 XkbcAddGeomOutline(XkbShapePtr shape, int sz_points);
242
243 extern XkbShapePtr
244 XkbcAddGeomShape(XkbGeometryPtr geom, Atom name, int sz_outlines);
245
246 extern XkbKeyPtr
247 XkbcAddGeomKey(XkbRowPtr row);
248
249 extern XkbRowPtr
250 XkbcAddGeomRow(XkbSectionPtr section, int sz_keys);
251
252 extern XkbSectionPtr
253 XkbcAddGeomSection(XkbGeometryPtr geom, Atom name,
254                    int sz_rows, int sz_doodads, int sz_over);
255
256 extern XkbDoodadPtr
257 XkbcAddGeomDoodad(XkbGeometryPtr geom, XkbSectionPtr section, Atom name);
258
259 extern XkbOverlayKeyPtr
260 XkbcAddGeomOverlayKey(XkbOverlayPtr overlay, XkbOverlayRowPtr row,
261                       char *over, char *under);
262
263 extern XkbOverlayRowPtr
264 XkbcAddGeomOverlayRow(XkbOverlayPtr overlay, int row_under, int sz_keys);
265
266 extern XkbOverlayPtr
267 XkbcAddGeomOverlay(XkbSectionPtr section, Atom name, int sz_rows);
268
269 extern void
270 XkbcInitAtoms(void);
271
272 extern char *
273 XkbcAtomGetString(Atom atom);
274
275 extern Atom
276 XkbcInternAtom(char *name, Bool onlyIfExists);
277
278 extern char *
279 XkbcAtomText(Atom atm);
280
281 extern char *
282 XkbcVModIndexText(XkbcDescPtr xkb, unsigned ndx);
283
284 extern char *
285 XkbcVModMaskText(XkbcDescPtr xkb, unsigned modMask, unsigned mask);
286
287 extern char *
288 XkbcModIndexText(unsigned ndx);
289
290 extern char *
291 XkbcModMaskText(unsigned mask, Bool cFormat);
292
293 extern char *
294 XkbcConfigText(unsigned config);
295
296 extern char *
297 XkbcGeomFPText(int val);
298
299 extern char *
300 XkbcActionTypeText(unsigned type);
301
302 extern char *
303 XkbcKeysymText(KeySym sym);
304
305 extern char *
306 XkbcKeyNameText(char *name);
307
308 extern char *
309 XkbcSIMatchText(unsigned type);
310
311 extern Bool
312 XkbcComputeShapeBounds(XkbShapePtr shape);
313
314 extern Bool
315 XkbcComputeShapeTop(XkbShapePtr shape, XkbBoundsPtr bounds);
316
317 extern Bool
318 XkbcComputeRowBounds(XkbGeometryPtr geom, XkbSectionPtr section, XkbRowPtr row);
319
320 extern Bool
321 XkbcComputeSectionBounds(XkbGeometryPtr geom, XkbSectionPtr section);
322
323 extern Bool
324 XkbcRF_GetComponents(XkbRF_RulesPtr rules, XkbRF_VarDefsPtr defs,
325                      XkbComponentNamesPtr names);
326
327 extern XkbRF_RulePtr
328 XkbcRF_AddRule(XkbRF_RulesPtr rules);
329
330 extern XkbRF_GroupPtr
331 XkbcRF_AddGroup(XkbRF_RulesPtr rules);
332
333 extern Bool
334 XkbcRF_LoadRules(FILE *file, XkbRF_RulesPtr rules);
335
336 extern Bool
337 XkbcRF_LoadRulesByName(char *base, char *locale, XkbRF_RulesPtr rules);
338
339 extern XkbRF_VarDescPtr
340 XkbcRF_AddVarDesc(XkbRF_DescribeVarsPtr vars);
341
342 extern XkbRF_VarDescPtr
343 XkbcRF_AddVarDescCopy(XkbRF_DescribeVarsPtr vars, XkbRF_VarDescPtr from);
344
345 extern XkbRF_DescribeVarsPtr
346 XkbcRF_AddVarToDescribe(XkbRF_RulesPtr rules, char *name);
347
348 extern Bool
349 XkbcRF_LoadDescriptions(FILE *file, XkbRF_RulesPtr rules);
350
351 extern Bool
352 XkbcRF_LoadDescriptionsByName(char *base, char *locale, XkbRF_RulesPtr rules);
353
354 extern XkbRF_RulesPtr
355 XkbcRF_Load(char *base, char *locale, Bool wantDesc, Bool wantRules);
356
357 extern XkbRF_RulesPtr
358 XkbcRF_Create(int szRules, int szExtra);
359
360 extern void
361 XkbcRF_Free(XkbRF_RulesPtr rules, Bool freeRules);
362
363 extern int
364 XkbcInitCanonicalKeyTypes(XkbcDescPtr xkb, unsigned which, int keypadVMod);
365
366 extern Bool
367 XkbcVirtualModsToReal(XkbcDescPtr xkb, unsigned virtual_mask,
368                       unsigned *mask_rtrn);
369
370 extern Bool
371 XkbcComputeEffectiveMap(XkbcDescPtr xkb, XkbKeyTypePtr type,
372                         unsigned char *map_rtrn);
373
374 extern void
375 XkbcEnsureSafeMapName(char *name);
376
377 extern unsigned
378 _XkbcKSCheckCase(KeySym sym);
379
380 _XFUNCPROTOEND
381
382 #endif /* _XKBCOMMON_H_ */