1 /************************************************************
2 Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc.
4 Permission to use, copy, modify, and distribute this
5 software and its documentation for any purpose and without
6 fee is hereby granted, provided that the above copyright
7 notice appear in all copies and that both that copyright
8 notice and this permission notice appear in supporting
9 documentation, and that the name of Silicon Graphics not be
10 used in advertising or publicity pertaining to distribution
11 of the software without specific prior written permission.
12 Silicon Graphics makes no representation about the suitability
13 of this software for any purpose. It is provided "as is"
14 without any express or implied warranty.
16 SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
17 SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
18 AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
19 GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
20 DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
21 DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
22 OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
23 THE USE OR PERFORMANCE OF THIS SOFTWARE.
25 ********************************************************/
32 #define XkbAddGeomKeyAlias SrvXkbAddGeomKeyAlias
33 #define XkbAddGeomColor SrvXkbAddGeomColor
34 #define XkbAddGeomDoodad SrvXkbAddGeomDoodad
35 #define XkbAddGeomKey SrvXkbAddGeomKey
36 #define XkbAddGeomOutline SrvXkbAddGeomOutline
37 #define XkbAddGeomOverlay SrvXkbAddGeomOverlay
38 #define XkbAddGeomOverlayRow SrvXkbAddGeomOverlayRow
39 #define XkbAddGeomOverlayKey SrvXkbAddGeomOverlayKey
40 #define XkbAddGeomProperty SrvXkbAddGeomProperty
41 #define XkbAddGeomRow SrvXkbAddGeomRow
42 #define XkbAddGeomSection SrvXkbAddGeomSection
43 #define XkbAddGeomShape SrvXkbAddGeomShape
44 #define XkbAllocGeometry SrvXkbAllocGeometry
45 #define XkbFreeGeomKeyAliases SrvXkbFreeGeomKeyAliases
46 #define XkbFreeGeomColors SrvXkbFreeGeomColors
47 #define XkbFreeGeomDoodads SrvXkbFreeGeomDoodads
48 #define XkbFreeGeomProperties SrvXkbFreeGeomProperties
49 #define XkbFreeGeomKeys SrvXkbFreeGeomKeys
50 #define XkbFreeGeomRows SrvXkbFreeGeomRows
51 #define XkbFreeGeomSections SrvXkbFreeGeomSections
52 #define XkbFreeGeomPoints SrvXkbFreeGeomPoints
53 #define XkbFreeGeomOutlines SrvXkbFreeGeomOutlines
54 #define XkbFreeGeomShapes SrvXkbFreeGeomShapes
55 #define XkbFreeGeometry SrvXkbFreeGeometry
57 typedef struct _XkbProperty
{
60 } XkbPropertyRec
, *XkbPropertyPtr
;
62 typedef struct _XkbColor
{
65 } XkbColorRec
, *XkbColorPtr
;
67 typedef struct _XkbPoint
{
70 } XkbPointRec
, *XkbPointPtr
;
72 typedef struct _XkbBounds
{
75 } XkbBoundsRec
, *XkbBoundsPtr
;
77 #define XkbBoundsWidth(b) (((b)->x2)-((b)->x1))
78 #define XkbBoundsHeight(b) (((b)->y2)-((b)->y1))
80 typedef struct _XkbOutline
{
81 unsigned short num_points
;
82 unsigned short sz_points
;
83 unsigned short corner_radius
;
85 } XkbOutlineRec
, *XkbOutlinePtr
;
87 typedef struct _XkbShape
{
89 unsigned short num_outlines
;
90 unsigned short sz_outlines
;
91 XkbOutlinePtr outlines
;
93 XkbOutlinePtr primary
;
95 } XkbShapeRec
, *XkbShapePtr
;
97 #define XkbOutlineIndex(s,o) ((int)((o)-&(s)->outlines[0]))
99 typedef struct _XkbShapeDoodad
{
102 unsigned char priority
;
106 unsigned short color_ndx
;
107 unsigned short shape_ndx
;
108 } XkbShapeDoodadRec
, *XkbShapeDoodadPtr
;
110 #define XkbShapeDoodadColor(g,d) (&(g)->colors[(d)->color_ndx])
111 #define XkbShapeDoodadShape(g,d) (&(g)->shapes[(d)->shape_ndx])
112 #define XkbSetShapeDoodadColor(g,d,c) ((d)->color_ndx= (c)-&(g)->colors[0])
113 #define XkbSetShapeDoodadShape(g,d,s) ((d)->shape_ndx= (s)-&(g)->shapes[0])
115 typedef struct _XkbTextDoodad
{
118 unsigned char priority
;
124 unsigned short color_ndx
;
127 } XkbTextDoodadRec
, *XkbTextDoodadPtr
;
129 #define XkbTextDoodadColor(g,d) (&(g)->colors[(d)->color_ndx])
130 #define XkbSetTextDoodadColor(g,d,c) ((d)->color_ndx= (c)-&(g)->colors[0])
132 typedef struct _XkbIndicatorDoodad
{
135 unsigned char priority
;
139 unsigned short shape_ndx
;
140 unsigned short on_color_ndx
;
141 unsigned short off_color_ndx
;
142 } XkbIndicatorDoodadRec
, *XkbIndicatorDoodadPtr
;
144 #define XkbIndicatorDoodadShape(g,d) (&(g)->shapes[(d)->shape_ndx])
145 #define XkbIndicatorDoodadOnColor(g,d) (&(g)->colors[(d)->on_color_ndx])
146 #define XkbIndicatorDoodadOffColor(g,d) (&(g)->colors[(d)->off_color_ndx])
147 #define XkbSetIndicatorDoodadOnColor(g,d,c) \
148 ((d)->on_color_ndx= (c)-&(g)->colors[0])
149 #define XkbSetIndicatorDoodadOffColor(g,d,c) \
150 ((d)->off_color_ndx= (c)-&(g)->colors[0])
151 #define XkbSetIndicatorDoodadShape(g,d,s) \
152 ((d)->shape_ndx= (s)-&(g)->shapes[0])
154 typedef struct _XkbLogoDoodad
{
157 unsigned char priority
;
161 unsigned short color_ndx
;
162 unsigned short shape_ndx
;
164 } XkbLogoDoodadRec
, *XkbLogoDoodadPtr
;
166 #define XkbLogoDoodadColor(g,d) (&(g)->colors[(d)->color_ndx])
167 #define XkbLogoDoodadShape(g,d) (&(g)->shapes[(d)->shape_ndx])
168 #define XkbSetLogoDoodadColor(g,d,c) ((d)->color_ndx= (c)-&(g)->colors[0])
169 #define XkbSetLogoDoodadShape(g,d,s) ((d)->shape_ndx= (s)-&(g)->shapes[0])
171 typedef struct _XkbAnyDoodad
{
174 unsigned char priority
;
178 } XkbAnyDoodadRec
, *XkbAnyDoodadPtr
;
180 typedef union _XkbDoodad
{
182 XkbShapeDoodadRec shape
;
183 XkbTextDoodadRec text
;
184 XkbIndicatorDoodadRec indicator
;
185 XkbLogoDoodadRec logo
;
186 } XkbDoodadRec
, *XkbDoodadPtr
;
188 #define XkbUnknownDoodad 0
189 #define XkbOutlineDoodad 1
190 #define XkbSolidDoodad 2
191 #define XkbTextDoodad 3
192 #define XkbIndicatorDoodad 4
193 #define XkbLogoDoodad 5
195 typedef struct _XkbKey
{
198 unsigned char shape_ndx
;
199 unsigned char color_ndx
;
200 } XkbKeyRec
, *XkbKeyPtr
;
202 #define XkbKeyShape(g,k) (&(g)->shapes[(k)->shape_ndx])
203 #define XkbKeyColor(g,k) (&(g)->colors[(k)->color_ndx])
204 #define XkbSetKeyShape(g,k,s) ((k)->shape_ndx= (s)-&(g)->shapes[0])
205 #define XkbSetKeyColor(g,k,c) ((k)->color_ndx= (c)-&(g)->colors[0])
207 typedef struct _XkbRow
{
210 unsigned short num_keys
;
211 unsigned short sz_keys
;
215 } XkbRowRec
, *XkbRowPtr
;
217 typedef struct _XkbSection
{
219 unsigned char priority
;
222 unsigned short width
;
223 unsigned short height
;
225 unsigned short num_rows
;
226 unsigned short num_doodads
;
227 unsigned short num_overlays
;
228 unsigned short sz_rows
;
229 unsigned short sz_doodads
;
230 unsigned short sz_overlays
;
232 XkbDoodadPtr doodads
;
234 struct _XkbOverlay
*overlays
;
235 } XkbSectionRec
, *XkbSectionPtr
;
237 typedef struct _XkbOverlayKey
{
240 } XkbOverlayKeyRec
, *XkbOverlayKeyPtr
;
242 typedef struct _XkbOverlayRow
{
243 unsigned short row_under
;
244 unsigned short num_keys
;
245 unsigned short sz_keys
;
246 XkbOverlayKeyPtr keys
;
247 } XkbOverlayRowRec
, *XkbOverlayRowPtr
;
249 typedef struct _XkbOverlay
{
251 XkbSectionPtr section_under
;
252 unsigned short num_rows
;
253 unsigned short sz_rows
;
254 XkbOverlayRowPtr rows
;
256 } XkbOverlayRec
, *XkbOverlayPtr
;
258 typedef struct _XkbGeometry
{
260 unsigned short width_mm
;
261 unsigned short height_mm
;
263 XkbColorPtr label_color
;
264 XkbColorPtr base_color
;
265 unsigned short sz_properties
;
266 unsigned short sz_colors
;
267 unsigned short sz_shapes
;
268 unsigned short sz_sections
;
269 unsigned short sz_doodads
;
270 unsigned short sz_key_aliases
;
271 unsigned short num_properties
;
272 unsigned short num_colors
;
273 unsigned short num_shapes
;
274 unsigned short num_sections
;
275 unsigned short num_doodads
;
276 unsigned short num_key_aliases
;
277 XkbPropertyPtr properties
;
280 XkbSectionPtr sections
;
281 XkbDoodadPtr doodads
;
282 XkbKeyAliasPtr key_aliases
;
285 #define XkbGeomColorIndex(g,c) ((int)((c)-&(g)->colors[0]))
287 #define XkbGeomPropertiesMask (1<<0)
288 #define XkbGeomColorsMask (1<<1)
289 #define XkbGeomShapesMask (1<<2)
290 #define XkbGeomSectionsMask (1<<3)
291 #define XkbGeomDoodadsMask (1<<4)
292 #define XkbGeomKeyAliasesMask (1<<5)
293 #define XkbGeomAllMask (0x3f)
295 typedef struct _XkbGeometrySizes
{
297 unsigned short num_properties
;
298 unsigned short num_colors
;
299 unsigned short num_shapes
;
300 unsigned short num_sections
;
301 unsigned short num_doodads
;
302 unsigned short num_key_aliases
;
303 } XkbGeometrySizesRec
, *XkbGeometrySizesPtr
;
306 * Specifies which items should be cleared in an XKB geometry array
307 * when the array is reallocated.
310 XKB_GEOM_CLEAR_NONE
, /* Don't clear any items, just reallocate. */
311 XKB_GEOM_CLEAR_EXCESS
, /* Clear new extra items after reallocation. */
312 XKB_GEOM_CLEAR_ALL
/* Clear all items after reallocation. */
315 extern XkbPropertyPtr
XkbAddGeomProperty(XkbGeometryPtr
/* geom */ ,
320 extern XkbKeyAliasPtr
XkbAddGeomKeyAlias(XkbGeometryPtr
/* geom */ ,
325 extern XkbColorPtr
XkbAddGeomColor(XkbGeometryPtr
/* geom */ ,
327 unsigned int /* pixel */
330 extern XkbOutlinePtr
XkbAddGeomOutline(XkbShapePtr
/* shape */ ,
334 extern XkbShapePtr
XkbAddGeomShape(XkbGeometryPtr
/* geom */ ,
336 int /* sz_outlines */
339 extern XkbKeyPtr
XkbAddGeomKey(XkbRowPtr
/* row */
342 extern XkbRowPtr
XkbAddGeomRow(XkbSectionPtr
/* section */ ,
346 extern XkbSectionPtr
XkbAddGeomSection(XkbGeometryPtr
/* geom */ ,
349 int /* sz_doodads */ ,
350 int /* sz_overlays */
353 extern XkbOverlayPtr
XkbAddGeomOverlay(XkbSectionPtr
/* section */ ,
358 extern XkbOverlayRowPtr
XkbAddGeomOverlayRow(XkbOverlayPtr
/* overlay */ ,
359 int /* row_under */ ,
363 extern XkbOverlayKeyPtr
XkbAddGeomOverlayKey(XkbOverlayPtr
/* overlay */ ,
364 XkbOverlayRowPtr
/* row */ ,
369 extern XkbDoodadPtr
XkbAddGeomDoodad(XkbGeometryPtr
/* geom */ ,
370 XkbSectionPtr
/* section */ ,
375 XkbFreeGeomKeyAliases(XkbGeometryPtr
/* geom */ ,
382 XkbFreeGeomColors(XkbGeometryPtr
/* geom */ ,
389 XkbFreeGeomDoodads(XkbDoodadPtr
/* doodads */ ,
395 XkbFreeGeomProperties(XkbGeometryPtr
/* geom */ ,
402 XkbFreeGeomOverlayKeys(XkbOverlayRowPtr
/* row */ ,
409 XkbFreeGeomOverlayRows(XkbOverlayPtr
/* overlay */ ,
416 XkbFreeGeomOverlays(XkbSectionPtr
/* section */ ,
423 XkbFreeGeomKeys(XkbRowPtr
/* row */ ,
430 XkbFreeGeomRows(XkbSectionPtr
/* section */ ,
437 XkbFreeGeomSections(XkbGeometryPtr
/* geom */ ,
444 XkbFreeGeomPoints(XkbOutlinePtr
/* outline */ ,
451 XkbFreeGeomOutlines(XkbShapePtr
/* shape */ ,
458 XkbFreeGeomShapes(XkbGeometryPtr
/* geom */ ,
465 XkbFreeGeometry(XkbGeometryPtr
/* geom */ ,
466 unsigned int /* which */ ,
471 XkbGeomRealloc(void ** /* buffer */ ,
475 XkbGeomClearance
/* clearance */
478 extern Status
XkbAllocGeomProps(XkbGeometryPtr
/* geom */ ,
482 extern Status
XkbAllocGeomKeyAliases(XkbGeometryPtr
/* geom */ ,
486 extern Status
XkbAllocGeomColors(XkbGeometryPtr
/* geom */ ,
490 extern Status
XkbAllocGeomShapes(XkbGeometryPtr
/* geom */ ,
494 extern Status
XkbAllocGeomSections(XkbGeometryPtr
/* geom */ ,
498 extern Status
XkbAllocGeomOverlays(XkbSectionPtr
/* section */ ,
502 extern Status
XkbAllocGeomOverlayRows(XkbOverlayPtr
/* overlay */ ,
506 extern Status
XkbAllocGeomOverlayKeys(XkbOverlayRowPtr
/* row */ ,
510 extern Status
XkbAllocGeomDoodads(XkbGeometryPtr
/* geom */ ,
514 extern Status
XkbAllocGeomSectionDoodads(XkbSectionPtr
/* section */ ,
518 extern Status
XkbAllocGeomOutlines(XkbShapePtr
/* shape */ ,
522 extern Status
XkbAllocGeomRows(XkbSectionPtr
/* section */ ,
526 extern Status
XkbAllocGeomPoints(XkbOutlinePtr
/* ol */ ,
530 extern Status
XkbAllocGeomKeys(XkbRowPtr
/* row */ ,
534 extern Status
XkbAllocGeometry(XkbDescPtr
/* xkb */ ,
535 XkbGeometrySizesPtr
/* sizes */
539 XkbComputeShapeTop(XkbShapePtr
/* shape */ ,
540 XkbBoundsPtr
/* bounds */
544 XkbComputeShapeBounds(XkbShapePtr
/* shape */
548 XkbComputeRowBounds(XkbGeometryPtr
/* geom */ ,
549 XkbSectionPtr
/* section */ ,
554 XkbComputeSectionBounds(XkbGeometryPtr
/* geom */ ,
555 XkbSectionPtr
/* section */
558 extern char *XkbFindOverlayForKey(XkbGeometryPtr
/* geom */ ,
559 XkbSectionPtr
/* wanted */ ,
563 #endif /* _XKBGEOM_H_ */