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/keysym.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 _XkbcKSLower (1 << 0)
56 #define _XkbcKSUpper (1 << 1)
58 #define XkbcKSIsLower(k) (_XkbcKSCheckCase(k) & _XkbcKSLower)
59 #define XkbcKSIsUpper(k) (_XkbcKSCheckCase(k) & _XkbcKSUpper)
60 #define XkbcKSIsKeypad(k) \
61 (((k) >= XK_KP_Space) && ((k) <= XK_KP_Equal))
62 #define XkbcKSIsDeadKey(k) \
63 (((k) >= XK_dead_grave) && ((k) <= XK_dead_semivoiced_sound))
68 XkbcKeysymToString(KeySym ks);
71 XkbcStringToKeysym(const char *s);
74 XkbcAllocCompatMap(XkbcDescPtr xkb, unsigned which, unsigned nSI);
77 XkbcFreeCompatMap(XkbcDescPtr xkb, unsigned which, Bool freeMap);
80 XkbcAllocNames(XkbcDescPtr xkb, unsigned which, int nTotalRG, int nTotalAliases);
83 XkbcFreeNames(XkbcDescPtr xkb, unsigned which, Bool freeMap);
86 XkbcAllocControls(XkbcDescPtr xkb, unsigned which);
89 XkbcFreeControls(XkbcDescPtr xkb, unsigned which, Bool freeMap);
92 XkbcAllocIndicatorMaps(XkbcDescPtr xkb);
95 XkbcFreeIndicatorMaps(XkbcDescPtr xkb);
98 XkbcAllocKeyboard(void);
101 XkbcFreeKeyboard(XkbcDescPtr xkb, unsigned which, Bool freeAll);
104 XkbcAllocClientMap(XkbcDescPtr xkb, unsigned which, unsigned nTotalTypes);
107 XkbcAllocServerMap(XkbcDescPtr xkb, unsigned which, unsigned nNewActions);
110 XkbcCopyKeyType(XkbKeyTypePtr from, XkbKeyTypePtr into);
113 XkbcCopyKeyTypes(XkbKeyTypePtr from, XkbKeyTypePtr into, int num_types);
116 XkbcResizeKeyType(XkbcDescPtr xkb, int type_ndx, int map_count,
117 Bool want_preserve, int new_num_lvls);
120 XkbcResizeKeySyms(XkbcDescPtr xkb, int key, int needed);
123 XkbcChangeKeycodeRange(XkbcDescPtr xkb, int minKC, int maxKC,
124 XkbChangesPtr changes);
127 XkbcResizeKeyActions(XkbcDescPtr xkb, int key, int needed);
130 XkbcFreeClientMap(XkbcDescPtr xkb, unsigned what, Bool freeMap);
133 XkbcFreeServerMap(XkbcDescPtr xkb, unsigned what, Bool freeMap);
136 XkbcFreeGeomProperties(XkbGeometryPtr geom, int first, int count, Bool freeAll);
139 XkbcFreeGeomKeyAliases(XkbGeometryPtr geom, int first, int count, Bool freeAll);
142 XkbcFreeGeomColors(XkbGeometryPtr geom, int first, int count, Bool freeAll);
145 XkbcFreeGeomPoints(XkbOutlinePtr outline, int first, int count, Bool freeAll);
148 XkbcFreeGeomOutlines(XkbShapePtr shape, int first, int count, Bool freeAll);
151 XkbcFreeGeomShapes(XkbGeometryPtr geom, int first, int count, Bool freeAll);
154 XkbcFreeGeomOverlayKeys(XkbOverlayRowPtr row, int first, int count,
158 XkbcFreeGeomOverlayRows(XkbOverlayPtr overlay, int first, int count,
162 XkbcFreeGeomOverlays(XkbSectionPtr section, int first, int count, Bool freeAll);
165 XkbcFreeGeomKeys(XkbRowPtr row, int first, int count, Bool freeAll);
168 XkbcFreeGeomRows(XkbSectionPtr section, int first, int count, Bool freeAll);
171 XkbcFreeGeomSections(XkbGeometryPtr geom, int first, int count, Bool freeAll);
174 XkbcFreeGeomDoodads(XkbDoodadPtr doodads, int nDoodads, Bool freeAll);
177 XkbcFreeGeometry(XkbGeometryPtr geom, unsigned which, Bool freeMap);
180 XkbcAllocGeomProps(XkbGeometryPtr geom, int nProps);
183 XkbcAllocGeomColors(XkbGeometryPtr geom, int nColors);
186 XkbcAllocGeomKeyAliases(XkbGeometryPtr geom, int nKeyAliases);
189 XkbcAllocGeomShapes(XkbGeometryPtr geom, int nShapes);
192 XkbcAllocGeomSections(XkbGeometryPtr geom, int nSections);
195 XkbcAllocGeomOverlays(XkbSectionPtr section, int nOverlays);
198 XkbcAllocGeomOverlayRows(XkbOverlayPtr overlay, int nRows);
201 XkbcAllocGeomOverlayKeys(XkbOverlayRowPtr row, int nKeys);
204 XkbcAllocGeomDoodads(XkbGeometryPtr geom, int nDoodads);
207 XkbcAllocGeomSectionDoodads(XkbSectionPtr section, int nDoodads);
210 XkbcAllocGeomOutlines(XkbShapePtr shape, int nOL);
213 XkbcAllocGeomRows(XkbSectionPtr section, int nRows);
216 XkbcAllocGeomPoints(XkbOutlinePtr ol, int nPts);
219 XkbcAllocGeomKeys(XkbRowPtr row, int nKeys);
222 XkbcAllocGeometry(XkbcDescPtr xkb, XkbGeometrySizesPtr sizes);
224 extern XkbPropertyPtr
225 XkbcAddGeomProperty(XkbGeometryPtr geom, char *name, char *value);
227 extern XkbKeyAliasPtr
228 XkbcAddGeomKeyAlias(XkbGeometryPtr geom, char *aliasStr, char *realStr);
231 XkbcAddGeomColor(XkbGeometryPtr geom, char *spec, unsigned int pixel);
234 XkbcAddGeomOutline(XkbShapePtr shape, int sz_points);
237 XkbcAddGeomShape(XkbGeometryPtr geom, Atom name, int sz_outlines);
240 XkbcAddGeomKey(XkbRowPtr row);
243 XkbcAddGeomRow(XkbSectionPtr section, int sz_keys);
246 XkbcAddGeomSection(XkbGeometryPtr geom, Atom name,
247 int sz_rows, int sz_doodads, int sz_over);
250 XkbcAddGeomDoodad(XkbGeometryPtr geom, XkbSectionPtr section, Atom name);
252 extern XkbOverlayKeyPtr
253 XkbcAddGeomOverlayKey(XkbOverlayPtr overlay, XkbOverlayRowPtr row,
254 char *over, char *under);
256 extern XkbOverlayRowPtr
257 XkbcAddGeomOverlayRow(XkbOverlayPtr overlay, int row_under, int sz_keys);
260 XkbcAddGeomOverlay(XkbSectionPtr section, Atom name, int sz_rows);
266 XkbcAtomGetString(Atom atom);
269 XkbcInternAtom(char *name, Bool onlyIfExists);
272 XkbcAtomText(Atom atm);
275 XkbcVModIndexText(XkbcDescPtr xkb, unsigned ndx);
278 XkbcVModMaskText(XkbcDescPtr xkb, unsigned modMask, unsigned mask);
281 XkbcModIndexText(unsigned ndx);
284 XkbcModMaskText(unsigned mask, Bool cFormat);
287 XkbcConfigText(unsigned config);
290 XkbcGeomFPText(int val);
293 XkbcActionTypeText(unsigned type);
296 XkbcKeysymText(KeySym sym);
299 XkbcKeyNameText(char *name);
302 XkbcSIMatchText(unsigned type);
305 XkbcComputeShapeBounds(XkbShapePtr shape);
308 XkbcComputeShapeTop(XkbShapePtr shape, XkbBoundsPtr bounds);
311 XkbcComputeRowBounds(XkbGeometryPtr geom, XkbSectionPtr section, XkbRowPtr row);
314 XkbcComputeSectionBounds(XkbGeometryPtr geom, XkbSectionPtr section);
317 XkbcInitCanonicalKeyTypes(XkbcDescPtr xkb, unsigned which, int keypadVMod);
320 XkbcVirtualModsToReal(XkbcDescPtr xkb, unsigned virtual_mask,
321 unsigned *mask_rtrn);
324 XkbcComputeEffectiveMap(XkbcDescPtr xkb, XkbKeyTypePtr type,
325 unsigned char *map_rtrn);
328 XkbcEnsureSafeMapName(char *name);
331 _XkbcKSCheckCase(KeySym sym);
335 #endif /* _XKBCOMMON_H_ */