Copy XkbAddGeom* functions from XKBlib
[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 <X11/X.h>
32 #include <X11/Xdefs.h>
33 #include <X11/Xfuncproto.h>
34 #include <X11/keysymdef.h>
35 #include <X11/extensions/XKBstrcommon.h>
36 #include <X11/extensions/XKBgeomcommon.h>
37
38 /* Common keyboard description structure */
39 typedef struct _XkbcDesc {
40     unsigned int        defined;
41     unsigned short      flags;
42     unsigned short      device_spec;
43     KeyCode             min_key_code;
44     KeyCode             max_key_code;
45
46     XkbControlsPtr      ctrls;
47     XkbServerMapPtr     server;
48     XkbClientMapPtr     map;
49     XkbIndicatorPtr     indicators;
50     XkbNamesPtr         names;
51     XkbCompatMapPtr     compat;
52     XkbGeometryPtr      geom;
53 } XkbcDescRec, *XkbcDescPtr;
54
55 _XFUNCPROTOBEGIN
56
57 extern char *
58 XkbcKeysymToString(KeySym ks);
59
60 extern KeySym
61 XkbcStringToKeysym(const char *s);
62
63 extern int
64 XkbcAllocCompatMap(XkbcDescPtr xkb, unsigned which, unsigned nSI);
65
66 extern void
67 XkbcFreeCompatMap(XkbcDescPtr xkb, unsigned which, Bool freeMap);
68
69 extern int
70 XkbcAllocNames(XkbcDescPtr xkb, unsigned which, int nTotalRG, int nTotalAliases);
71
72 extern void
73 XkbcFreeNames(XkbcDescPtr xkb, unsigned which, Bool freeMap);
74
75 extern int
76 XkbcAllocControls(XkbcDescPtr xkb, unsigned which);
77
78 extern void
79 XkbcFreeControls(XkbcDescPtr xkb, unsigned which, Bool freeMap);
80
81 extern int
82 XkbcAllocIndicatorMaps(XkbcDescPtr xkb);
83
84 extern void
85 XkbcFreeIndicatorMaps(XkbcDescPtr xkb);
86
87 extern XkbcDescRec *
88 XkbcAllocKeyboard(void);
89
90 extern int
91 XkbcAllocClientMap(XkbcDescPtr xkb, unsigned which, unsigned nTotalTypes);
92
93 extern int
94 XkbcAllocServerMap(XkbcDescPtr xkb, unsigned which, unsigned nNewActions);
95
96 extern void
97 XkbcFreeClientMap(XkbcDescPtr xkb, unsigned what, Bool freeMap);
98
99 extern void
100 XkbcFreeServerMap(XkbcDescPtr xkb, unsigned what, Bool freeMap);
101
102 extern void
103 XkbcFreeKeyboard(XkbcDescPtr xkb, unsigned which, Bool freeAll);
104
105 extern void
106 XkbcFreeGeomProperties(XkbGeometryPtr geom, int first, int count, Bool freeAll);
107
108 extern void
109 XkbcFreeGeomKeyAliases(XkbGeometryPtr geom, int first, int count, Bool freeAll);
110
111 extern void
112 XkbcFreeGeomColors(XkbGeometryPtr geom, int first, int count, Bool freeAll);
113
114 extern void
115 XkbcFreeGeomPoints(XkbOutlinePtr outline, int first, int count, Bool freeAll);
116
117 extern void
118 XkbcFreeGeomOutlines(XkbShapePtr shape, int first, int count, Bool freeAll);
119
120 extern void
121 XkbcFreeGeomShapes(XkbGeometryPtr geom, int first, int count, Bool freeAll);
122
123 extern void
124 XkbcFreeGeomOverlayKeys(XkbOverlayRowPtr row, int first, int count,
125                         Bool freeAll);
126
127 extern void
128 XkbcFreeGeomOverlayRows(XkbOverlayPtr overlay, int first, int count,
129                         Bool freeAll);
130
131 extern void
132 XkbcFreeGeomOverlays(XkbSectionPtr section, int first, int count, Bool freeAll);
133
134 extern void
135 XkbcFreeGeomKeys(XkbRowPtr row, int first, int count, Bool freeAll);
136
137 extern void
138 XkbcFreeGeomRows(XkbSectionPtr section, int first, int count, Bool freeAll);
139
140 extern void
141 XkbcFreeGeomSections(XkbGeometryPtr geom, int first, int count, Bool freeAll);
142
143 extern void
144 XkbcFreeGeomDoodads(XkbDoodadPtr doodads, int nDoodads, Bool freeAll);
145
146 extern void
147 XkbcFreeGeometry(XkbGeometryPtr geom, unsigned which, Bool freeMap);
148
149 extern int
150 XkbcAllocGeomProps(XkbGeometryPtr geom, int nProps);
151
152 extern int
153 XkbcAllocGeomColors(XkbGeometryPtr geom, int nColors);
154
155 extern int
156 XkbcAllocGeomKeyAliases(XkbGeometryPtr geom, int nKeyAliases);
157
158 extern int
159 XkbcAllocGeomShapes(XkbGeometryPtr geom, int nShapes);
160
161 extern int
162 XkbcAllocGeomSections(XkbGeometryPtr geom, int nSections);
163
164 extern int
165 XkbcAllocGeomOverlays(XkbSectionPtr section, int nOverlays);
166
167 extern int
168 XkbcAllocGeomOverlayRows(XkbOverlayPtr overlay, int nRows);
169
170 extern int
171 XkbcAllocGeomOverlayKeys(XkbOverlayRowPtr row, int nKeys);
172
173 extern int
174 XkbcAllocGeomDoodads(XkbGeometryPtr geom, int nDoodads);
175
176 extern int
177 XkbcAllocGeomSectionDoodads(XkbSectionPtr section, int nDoodads);
178
179 extern int
180 XkbcAllocGeomOutlines(XkbShapePtr shape, int nOL);
181
182 extern int
183 XkbcAllocGeomRows(XkbSectionPtr section, int nRows);
184
185 extern int
186 XkbcAllocGeomPoints(XkbOutlinePtr ol, int nPts);
187
188 extern int
189 XkbcAllocGeomKeys(XkbRowPtr row, int nKeys);
190
191 extern int
192 XkbcAllocGeometry(XkbcDescPtr xkb, XkbGeometrySizesPtr sizes);
193
194 extern XkbPropertyPtr
195 XkbcAddGeomProperty(XkbGeometryPtr geom, char *name, char *value);
196
197 extern XkbKeyAliasPtr
198 XkbcAddGeomKeyAlias(XkbGeometryPtr geom, char *aliasStr, char *realStr);
199
200 extern XkbColorPtr
201 XkbcAddGeomColor(XkbGeometryPtr geom, char *spec, unsigned int pixel);
202
203 extern XkbOutlinePtr
204 XkbcAddGeomOutline(XkbShapePtr shape, int sz_points);
205
206 extern XkbShapePtr
207 XkbcAddGeomShape(XkbGeometryPtr geom, Atom name, int sz_outlines);
208
209 extern XkbKeyPtr
210 XkbcAddGeomKey(XkbRowPtr row);
211
212 extern XkbRowPtr
213 XkbcAddGeomRow(XkbSectionPtr section, int sz_keys);
214
215 extern XkbSectionPtr
216 XkbcAddGeomSection(XkbGeometryPtr geom, Atom name,
217                    int sz_rows, int sz_doodads, int sz_over);
218
219 extern XkbDoodadPtr
220 XkbcAddGeomDoodad(XkbGeometryPtr geom, XkbSectionPtr section, Atom name);
221
222 extern XkbOverlayKeyPtr
223 XkbcAddGeomOverlayKey(XkbOverlayPtr overlay, XkbOverlayRowPtr row,
224                       char *over, char *under);
225
226 extern XkbOverlayRowPtr
227 XkbcAddGeomOverlayRow(XkbOverlayPtr overlay, int row_under, int sz_keys);
228
229 extern XkbOverlayPtr
230 XkbcAddGeomOverlay(XkbSectionPtr section, Atom name, int sz_rows);
231
232 extern void
233 XkbcInitAtoms(void);
234
235 extern char *
236 XkbcAtomGetString(Atom atom);
237
238 extern Atom
239 XkbcInternAtom(char *name, Bool onlyIfExists);
240
241 extern char *
242 XkbcAtomText(Atom atm);
243
244 extern char *
245 XkbcModMaskText(unsigned mask, Bool cFormat);
246
247 extern char *
248 XkbcConfigText(unsigned config);
249
250 extern char *
251 XkbcGeomFPText(int val);
252
253 extern char *
254 XkbcActionTypeText(unsigned type);
255
256 extern char *
257 XkbcKeysymText(KeySym sym);
258
259 extern char *
260 XkbcKeyNameText(char *name);
261
262 extern char *
263 XkbcSIMatchText(unsigned type);
264
265 _XFUNCPROTOEND
266
267 #endif /* _XKBCOMMON_H_ */