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.
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>
38 /* Common keyboard description structure */
39 typedef struct _XkbcDesc {
42 unsigned short device_spec;
47 XkbServerMapPtr server;
49 XkbIndicatorPtr indicators;
51 XkbCompatMapPtr compat;
53 } XkbcDescRec, *XkbcDescPtr;
55 #define XkbcKSIsKeypad(k) \
56 (((k) >= XK_KP_Space) && ((k) <= XK_KP_Equal))
57 #define XkbcKSIsDeadKey(k) \
58 (((k) >= XK_dead_grave) && ((k) <= XK_dead_semivoiced_sound))
63 XkbcKeysymToString(KeySym ks);
66 XkbcStringToKeysym(const char *s);
69 XkbcAllocCompatMap(XkbcDescPtr xkb, unsigned which, unsigned nSI);
72 XkbcFreeCompatMap(XkbcDescPtr xkb, unsigned which, Bool freeMap);
75 XkbcAllocNames(XkbcDescPtr xkb, unsigned which, int nTotalRG, int nTotalAliases);
78 XkbcFreeNames(XkbcDescPtr xkb, unsigned which, Bool freeMap);
81 XkbcAllocControls(XkbcDescPtr xkb, unsigned which);
84 XkbcFreeControls(XkbcDescPtr xkb, unsigned which, Bool freeMap);
87 XkbcAllocIndicatorMaps(XkbcDescPtr xkb);
90 XkbcFreeIndicatorMaps(XkbcDescPtr xkb);
93 XkbcAllocKeyboard(void);
96 XkbcAllocClientMap(XkbcDescPtr xkb, unsigned which, unsigned nTotalTypes);
99 XkbcAllocServerMap(XkbcDescPtr xkb, unsigned which, unsigned nNewActions);
102 XkbcFreeClientMap(XkbcDescPtr xkb, unsigned what, Bool freeMap);
105 XkbcFreeServerMap(XkbcDescPtr xkb, unsigned what, Bool freeMap);
108 XkbcFreeKeyboard(XkbcDescPtr xkb, unsigned which, Bool freeAll);
111 XkbcFreeGeomProperties(XkbGeometryPtr geom, int first, int count, Bool freeAll);
114 XkbcFreeGeomKeyAliases(XkbGeometryPtr geom, int first, int count, Bool freeAll);
117 XkbcFreeGeomColors(XkbGeometryPtr geom, int first, int count, Bool freeAll);
120 XkbcFreeGeomPoints(XkbOutlinePtr outline, int first, int count, Bool freeAll);
123 XkbcFreeGeomOutlines(XkbShapePtr shape, int first, int count, Bool freeAll);
126 XkbcFreeGeomShapes(XkbGeometryPtr geom, int first, int count, Bool freeAll);
129 XkbcFreeGeomOverlayKeys(XkbOverlayRowPtr row, int first, int count,
133 XkbcFreeGeomOverlayRows(XkbOverlayPtr overlay, int first, int count,
137 XkbcFreeGeomOverlays(XkbSectionPtr section, int first, int count, Bool freeAll);
140 XkbcFreeGeomKeys(XkbRowPtr row, int first, int count, Bool freeAll);
143 XkbcFreeGeomRows(XkbSectionPtr section, int first, int count, Bool freeAll);
146 XkbcFreeGeomSections(XkbGeometryPtr geom, int first, int count, Bool freeAll);
149 XkbcFreeGeomDoodads(XkbDoodadPtr doodads, int nDoodads, Bool freeAll);
152 XkbcFreeGeometry(XkbGeometryPtr geom, unsigned which, Bool freeMap);
155 XkbcAllocGeomProps(XkbGeometryPtr geom, int nProps);
158 XkbcAllocGeomColors(XkbGeometryPtr geom, int nColors);
161 XkbcAllocGeomKeyAliases(XkbGeometryPtr geom, int nKeyAliases);
164 XkbcAllocGeomShapes(XkbGeometryPtr geom, int nShapes);
167 XkbcAllocGeomSections(XkbGeometryPtr geom, int nSections);
170 XkbcAllocGeomOverlays(XkbSectionPtr section, int nOverlays);
173 XkbcAllocGeomOverlayRows(XkbOverlayPtr overlay, int nRows);
176 XkbcAllocGeomOverlayKeys(XkbOverlayRowPtr row, int nKeys);
179 XkbcAllocGeomDoodads(XkbGeometryPtr geom, int nDoodads);
182 XkbcAllocGeomSectionDoodads(XkbSectionPtr section, int nDoodads);
185 XkbcAllocGeomOutlines(XkbShapePtr shape, int nOL);
188 XkbcAllocGeomRows(XkbSectionPtr section, int nRows);
191 XkbcAllocGeomPoints(XkbOutlinePtr ol, int nPts);
194 XkbcAllocGeomKeys(XkbRowPtr row, int nKeys);
197 XkbcAllocGeometry(XkbcDescPtr xkb, XkbGeometrySizesPtr sizes);
199 extern XkbPropertyPtr
200 XkbcAddGeomProperty(XkbGeometryPtr geom, char *name, char *value);
202 extern XkbKeyAliasPtr
203 XkbcAddGeomKeyAlias(XkbGeometryPtr geom, char *aliasStr, char *realStr);
206 XkbcAddGeomColor(XkbGeometryPtr geom, char *spec, unsigned int pixel);
209 XkbcAddGeomOutline(XkbShapePtr shape, int sz_points);
212 XkbcAddGeomShape(XkbGeometryPtr geom, Atom name, int sz_outlines);
215 XkbcAddGeomKey(XkbRowPtr row);
218 XkbcAddGeomRow(XkbSectionPtr section, int sz_keys);
221 XkbcAddGeomSection(XkbGeometryPtr geom, Atom name,
222 int sz_rows, int sz_doodads, int sz_over);
225 XkbcAddGeomDoodad(XkbGeometryPtr geom, XkbSectionPtr section, Atom name);
227 extern XkbOverlayKeyPtr
228 XkbcAddGeomOverlayKey(XkbOverlayPtr overlay, XkbOverlayRowPtr row,
229 char *over, char *under);
231 extern XkbOverlayRowPtr
232 XkbcAddGeomOverlayRow(XkbOverlayPtr overlay, int row_under, int sz_keys);
235 XkbcAddGeomOverlay(XkbSectionPtr section, Atom name, int sz_rows);
241 XkbcAtomGetString(Atom atom);
244 XkbcInternAtom(char *name, Bool onlyIfExists);
247 XkbcAtomText(Atom atm);
250 XkbcVModIndexText(XkbcDescPtr xkb, unsigned ndx);
253 XkbcVModMaskText(XkbcDescPtr xkb, unsigned modMask, unsigned mask);
256 XkbcModIndexText(unsigned ndx);
259 XkbcModMaskText(unsigned mask, Bool cFormat);
262 XkbcConfigText(unsigned config);
265 XkbcGeomFPText(int val);
268 XkbcActionTypeText(unsigned type);
271 XkbcKeysymText(KeySym sym);
274 XkbcKeyNameText(char *name);
277 XkbcSIMatchText(unsigned type);
280 XkbcComputeShapeBounds(XkbShapePtr shape);
283 XkbcComputeShapeTop(XkbShapePtr shape, XkbBoundsPtr bounds);
286 XkbcComputeRowBounds(XkbGeometryPtr geom, XkbSectionPtr section, XkbRowPtr row);
289 XkbcComputeSectionBounds(XkbGeometryPtr geom, XkbSectionPtr section);
293 #endif /* _XKBCOMMON_H_ */