Git init
[framework/uifw/xorg/proto/x11proto-kb.git] / XKBgeom.h
1 /* $Xorg: XKBgeom.h,v 1.3 2000/08/18 04:05:45 coskrey Exp $ */
2 /************************************************************
3 Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc.
4
5 Permission to use, copy, modify, and distribute this
6 software and its documentation for any purpose and without
7 fee is hereby granted, provided that the above copyright
8 notice appear in all copies and that both that copyright
9 notice and this permission notice appear in supporting
10 documentation, and that the name of Silicon Graphics not be 
11 used in advertising or publicity pertaining to distribution 
12 of the software without specific prior written permission.
13 Silicon Graphics makes no representation about the suitability 
14 of this software for any purpose. It is provided "as is"
15 without any express or implied warranty.
16
17 SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS 
18 SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY 
19 AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
20 GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL 
21 DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, 
22 DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE 
23 OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION  WITH
24 THE USE OR PERFORMANCE OF THIS SOFTWARE.
25
26 ********************************************************/
27 /* $XFree86: xc/include/extensions/XKBgeom.h,v 3.9 2002/09/18 17:11:40 tsi Exp $ */
28
29 #ifndef _XKBGEOM_H_
30 #define _XKBGEOM_H_
31
32 #include <X11/extensions/XKBstr.h>
33
34 #ifdef XKB_IN_SERVER
35 #define XkbAddGeomKeyAlias              SrvXkbAddGeomKeyAlias
36 #define XkbAddGeomColor                 SrvXkbAddGeomColor
37 #define XkbAddGeomDoodad                SrvXkbAddGeomDoodad
38 #define XkbAddGeomKey                   SrvXkbAddGeomKey
39 #define XkbAddGeomOutline               SrvXkbAddGeomOutline
40 #define XkbAddGeomOverlay               SrvXkbAddGeomOverlay
41 #define XkbAddGeomOverlayRow            SrvXkbAddGeomOverlayRow
42 #define XkbAddGeomOverlayKey            SrvXkbAddGeomOverlayKey
43 #define XkbAddGeomProperty              SrvXkbAddGeomProperty
44 #define XkbAddGeomRow                   SrvXkbAddGeomRow
45 #define XkbAddGeomSection               SrvXkbAddGeomSection
46 #define XkbAddGeomShape                 SrvXkbAddGeomShape
47 #define XkbAllocGeomKeyAliases          SrvXkbAllocGeomKeyAliases
48 #define XkbAllocGeomColors              SrvXkbAllocGeomColors
49 #define XkbAllocGeomDoodads             SrvXkbAllocGeomDoodads
50 #define XkbAllocGeomKeys                SrvXkbAllocGeomKeys
51 #define XkbAllocGeomOutlines            SrvXkbAllocGeomOutlines
52 #define XkbAllocGeomPoints              SrvXkbAllocGeomPoints
53 #define XkbAllocGeomProps               SrvXkbAllocGeomProps
54 #define XkbAllocGeomRows                SrvXkbAllocGeomRows
55 #define XkbAllocGeomSectionDoodads      SrvXkbAllocGeomSectionDoodads
56 #define XkbAllocGeomSections            SrvXkbAllocGeomSections
57 #define XkbAllocGeomOverlays            SrvXkbAllocGeomOverlays
58 #define XkbAllocGeomOverlayRows         SrvXkbAllocGeomOverlayRows
59 #define XkbAllocGeomOverlayKeys         SrvXkbAllocGeomOverlayKeys
60 #define XkbAllocGeomShapes              SrvXkbAllocGeomShapes
61 #define XkbAllocGeometry                SrvXkbAllocGeometry
62 #define XkbFreeGeomKeyAliases           SrvXkbFreeGeomKeyAliases
63 #define XkbFreeGeomColors               SrvXkbFreeGeomColors
64 #define XkbFreeGeomDoodads              SrvXkbFreeGeomDoodads
65 #define XkbFreeGeomProperties           SrvXkbFreeGeomProperties
66 #define XkbFreeGeomOverlayKeys          SrvXkbFreeGeomOverlayKeys
67 #define XkbFreeGeomOverlayRows          SrvXkbFreeGeomOverlayRows
68 #define XkbFreeGeomOverlays             SrvXkbFreeGeomOverlays
69 #define XkbFreeGeomKeys                 SrvXkbFreeGeomKeys
70 #define XkbFreeGeomRows                 SrvXkbFreeGeomRows
71 #define XkbFreeGeomSections             SrvXkbFreeGeomSections
72 #define XkbFreeGeomPoints               SrvXkbFreeGeomPoints
73 #define XkbFreeGeomOutlines             SrvXkbFreeGeomOutlines
74 #define XkbFreeGeomShapes               SrvXkbFreeGeomShapes
75 #define XkbFreeGeometry                 SrvXkbFreeGeometry
76 #endif
77
78 typedef struct _XkbProperty {
79         char    *name;
80         char    *value;
81 } XkbPropertyRec,*XkbPropertyPtr;
82
83 typedef struct _XkbColor {
84         unsigned int    pixel;
85         char *          spec;
86 } XkbColorRec,*XkbColorPtr;
87
88 typedef struct _XkbPoint {
89         short   x;
90         short   y;
91 } XkbPointRec, *XkbPointPtr;
92
93 typedef struct  _XkbBounds {
94         short   x1,y1;
95         short   x2,y2;
96 } XkbBoundsRec, *XkbBoundsPtr;
97 #define XkbBoundsWidth(b)       (((b)->x2)-((b)->x1))
98 #define XkbBoundsHeight(b)      (((b)->y2)-((b)->y1))
99
100 typedef struct _XkbOutline {
101         unsigned short  num_points;
102         unsigned short  sz_points;
103         unsigned short  corner_radius;
104         XkbPointPtr     points;
105 } XkbOutlineRec, *XkbOutlinePtr;
106
107 typedef struct _XkbShape {
108         Atom             name;
109         unsigned short   num_outlines;
110         unsigned short   sz_outlines;
111         XkbOutlinePtr    outlines;
112         XkbOutlinePtr    approx;
113         XkbOutlinePtr    primary;
114         XkbBoundsRec     bounds;
115 } XkbShapeRec, *XkbShapePtr;
116 #define XkbOutlineIndex(s,o)    ((int)((o)-&(s)->outlines[0]))
117
118 typedef struct _XkbShapeDoodad {
119         Atom             name;
120         unsigned char    type;
121         unsigned char    priority;
122         short            top;
123         short            left;
124         short            angle;
125         unsigned short   color_ndx;
126         unsigned short   shape_ndx;
127 } XkbShapeDoodadRec, *XkbShapeDoodadPtr;
128 #define XkbShapeDoodadColor(g,d)        (&(g)->colors[(d)->color_ndx])
129 #define XkbShapeDoodadShape(g,d)        (&(g)->shapes[(d)->shape_ndx])
130 #define XkbSetShapeDoodadColor(g,d,c)   ((d)->color_ndx= (c)-&(g)->colors[0])
131 #define XkbSetShapeDoodadShape(g,d,s)   ((d)->shape_ndx= (s)-&(g)->shapes[0])
132
133 typedef struct _XkbTextDoodad {
134         Atom             name;
135         unsigned char    type;
136         unsigned char    priority;
137         short            top;
138         short            left;
139         short            angle;
140         short            width;
141         short            height;
142         unsigned short   color_ndx;
143         char *           text;
144         char *           font;
145 } XkbTextDoodadRec, *XkbTextDoodadPtr;
146 #define XkbTextDoodadColor(g,d) (&(g)->colors[(d)->color_ndx])
147 #define XkbSetTextDoodadColor(g,d,c)    ((d)->color_ndx= (c)-&(g)->colors[0])
148
149 typedef struct _XkbIndicatorDoodad {
150         Atom             name;
151         unsigned char    type;
152         unsigned char    priority;
153         short            top;
154         short            left;
155         short            angle;
156         unsigned short   shape_ndx;
157         unsigned short   on_color_ndx;
158         unsigned short   off_color_ndx;
159 } XkbIndicatorDoodadRec, *XkbIndicatorDoodadPtr;
160 #define XkbIndicatorDoodadShape(g,d)    (&(g)->shapes[(d)->shape_ndx])
161 #define XkbIndicatorDoodadOnColor(g,d)  (&(g)->colors[(d)->on_color_ndx])
162 #define XkbIndicatorDoodadOffColor(g,d) (&(g)->colors[(d)->off_color_ndx])
163 #define XkbSetIndicatorDoodadOnColor(g,d,c) \
164                                 ((d)->on_color_ndx= (c)-&(g)->colors[0])
165 #define XkbSetIndicatorDoodadOffColor(g,d,c) \
166                                 ((d)->off_color_ndx= (c)-&(g)->colors[0])
167 #define XkbSetIndicatorDoodadShape(g,d,s) \
168                                 ((d)->shape_ndx= (s)-&(g)->shapes[0])
169
170 typedef struct _XkbLogoDoodad {
171         Atom             name;
172         unsigned char    type;
173         unsigned char    priority;
174         short            top;
175         short            left;
176         short            angle;
177         unsigned short   color_ndx;
178         unsigned short   shape_ndx;
179         char *           logo_name;
180 } XkbLogoDoodadRec, *XkbLogoDoodadPtr;
181 #define XkbLogoDoodadColor(g,d)         (&(g)->colors[(d)->color_ndx])
182 #define XkbLogoDoodadShape(g,d)         (&(g)->shapes[(d)->shape_ndx])
183 #define XkbSetLogoDoodadColor(g,d,c)    ((d)->color_ndx= (c)-&(g)->colors[0])
184 #define XkbSetLogoDoodadShape(g,d,s)    ((d)->shape_ndx= (s)-&(g)->shapes[0])
185
186 typedef struct _XkbAnyDoodad {
187         Atom             name;
188         unsigned char    type;
189         unsigned char    priority;
190         short            top;
191         short            left;
192         short            angle;
193 } XkbAnyDoodadRec, *XkbAnyDoodadPtr;
194
195 typedef union _XkbDoodad {
196         XkbAnyDoodadRec         any;
197         XkbShapeDoodadRec       shape;
198         XkbTextDoodadRec        text;
199         XkbIndicatorDoodadRec   indicator;
200         XkbLogoDoodadRec        logo;
201 } XkbDoodadRec, *XkbDoodadPtr;
202
203 #define XkbUnknownDoodad        0
204 #define XkbOutlineDoodad        1
205 #define XkbSolidDoodad          2
206 #define XkbTextDoodad           3
207 #define XkbIndicatorDoodad      4
208 #define XkbLogoDoodad           5
209
210 typedef struct _XkbKey {
211         XkbKeyNameRec    name;
212         short            gap;
213         unsigned char    shape_ndx;
214         unsigned char    color_ndx;
215 } XkbKeyRec, *XkbKeyPtr;
216 #define XkbKeyShape(g,k)        (&(g)->shapes[(k)->shape_ndx])
217 #define XkbKeyColor(g,k)        (&(g)->colors[(k)->color_ndx])
218 #define XkbSetKeyShape(g,k,s)   ((k)->shape_ndx= (s)-&(g)->shapes[0])
219 #define XkbSetKeyColor(g,k,c)   ((k)->color_ndx= (c)-&(g)->colors[0])
220
221 typedef struct _XkbRow {
222         short           top;
223         short           left;
224         unsigned short  num_keys;
225         unsigned short  sz_keys;
226         int             vertical;
227         XkbKeyPtr       keys;
228         XkbBoundsRec    bounds;
229 } XkbRowRec, *XkbRowPtr;
230
231 typedef struct _XkbSection {
232         Atom             name;
233         unsigned char    priority;
234         short            top;
235         short            left;
236         unsigned short   width;
237         unsigned short   height;
238         short            angle;
239         unsigned short   num_rows;
240         unsigned short   num_doodads;
241         unsigned short   num_overlays;
242         unsigned short   sz_rows;
243         unsigned short   sz_doodads;
244         unsigned short   sz_overlays;
245         XkbRowPtr        rows;
246         XkbDoodadPtr     doodads;
247         XkbBoundsRec     bounds;
248         struct _XkbOverlay *overlays;
249 } XkbSectionRec, *XkbSectionPtr;
250
251 typedef struct _XkbOverlayKey {
252         XkbKeyNameRec   over;
253         XkbKeyNameRec   under;
254 } XkbOverlayKeyRec,*XkbOverlayKeyPtr;
255
256 typedef struct _XkbOverlayRow {
257         unsigned short          row_under;
258         unsigned short          num_keys;
259         unsigned short          sz_keys;
260         XkbOverlayKeyPtr        keys;
261 } XkbOverlayRowRec,*XkbOverlayRowPtr;
262
263 typedef struct _XkbOverlay {
264         Atom                    name;
265         XkbSectionPtr           section_under;
266         unsigned short          num_rows;
267         unsigned short          sz_rows;
268         XkbOverlayRowPtr        rows;
269         XkbBoundsPtr            bounds;
270 } XkbOverlayRec,*XkbOverlayPtr;
271
272 typedef struct _XkbGeometry {
273         Atom             name;
274         unsigned short   width_mm;
275         unsigned short   height_mm;
276         char *           label_font;
277         XkbColorPtr      label_color;
278         XkbColorPtr      base_color;
279         unsigned short   sz_properties;
280         unsigned short   sz_colors;
281         unsigned short   sz_shapes;
282         unsigned short   sz_sections;
283         unsigned short   sz_doodads;
284         unsigned short   sz_key_aliases;
285         unsigned short   num_properties;
286         unsigned short   num_colors;
287         unsigned short   num_shapes;
288         unsigned short   num_sections;
289         unsigned short   num_doodads;
290         unsigned short   num_key_aliases;
291         XkbPropertyPtr   properties;
292         XkbColorPtr      colors;
293         XkbShapePtr      shapes;
294         XkbSectionPtr    sections;
295         XkbDoodadPtr     doodads;
296         XkbKeyAliasPtr   key_aliases;
297 } XkbGeometryRec;
298 #define XkbGeomColorIndex(g,c)  ((int)((c)-&(g)->colors[0]))
299
300 #define XkbGeomPropertiesMask   (1<<0)
301 #define XkbGeomColorsMask       (1<<1)
302 #define XkbGeomShapesMask       (1<<2)
303 #define XkbGeomSectionsMask     (1<<3)
304 #define XkbGeomDoodadsMask      (1<<4)
305 #define XkbGeomKeyAliasesMask   (1<<5)
306 #define XkbGeomAllMask          (0x3f)
307
308 typedef struct _XkbGeometrySizes {
309         unsigned int    which;
310         unsigned short  num_properties;
311         unsigned short  num_colors;
312         unsigned short  num_shapes;
313         unsigned short  num_sections;
314         unsigned short  num_doodads;
315         unsigned short  num_key_aliases;
316 } XkbGeometrySizesRec,*XkbGeometrySizesPtr;
317
318 _XFUNCPROTOBEGIN
319
320 extern  XkbPropertyPtr
321 XkbAddGeomProperty(
322     XkbGeometryPtr      /* geom */,
323     char *              /* name */,
324     char *              /* value */
325 );
326
327 extern  XkbKeyAliasPtr
328 XkbAddGeomKeyAlias(
329     XkbGeometryPtr      /* geom */,
330     char *              /* alias */,
331     char *              /* real */
332 );
333
334 extern  XkbColorPtr
335 XkbAddGeomColor(
336     XkbGeometryPtr      /* geom */,
337     char *              /* spec */,
338     unsigned int        /* pixel */
339 );
340
341 extern  XkbOutlinePtr
342 XkbAddGeomOutline(
343     XkbShapePtr         /* shape */,
344     int                 /* sz_points */
345 );
346
347 extern XkbShapePtr
348 XkbAddGeomShape(
349     XkbGeometryPtr      /* geom */,
350     Atom                /* name */,
351     int                 /* sz_outlines */
352 );
353
354 extern XkbKeyPtr
355 XkbAddGeomKey(
356     XkbRowPtr           /* row */
357 );
358
359 extern XkbRowPtr
360 XkbAddGeomRow(
361     XkbSectionPtr       /* section */,
362     int                 /* sz_keys */
363 );
364
365 extern XkbSectionPtr
366 XkbAddGeomSection(
367     XkbGeometryPtr      /* geom */,
368     Atom                /* name */,
369     int                 /* sz_rows */,
370     int                 /* sz_doodads */,
371     int                 /* sz_overlays */
372 );
373
374 extern XkbOverlayPtr
375 XkbAddGeomOverlay(
376     XkbSectionPtr       /* section */,
377     Atom                /* name */,
378     int                 /* sz_rows */
379 );
380
381 extern XkbOverlayRowPtr
382 XkbAddGeomOverlayRow(
383     XkbOverlayPtr       /* overlay */,
384     int                 /* row_under */,
385     int                 /* sz_keys */
386 );
387
388 extern XkbOverlayKeyPtr
389 XkbAddGeomOverlayKey(
390     XkbOverlayPtr       /* overlay */,
391     XkbOverlayRowPtr    /* row */,
392     char *              /* over */,
393     char *              /* under */
394 );
395
396 extern XkbDoodadPtr
397 XkbAddGeomDoodad(
398     XkbGeometryPtr      /* geom */,
399     XkbSectionPtr       /* section */,
400     Atom                /* name */
401 );
402
403
404 extern void
405 XkbFreeGeomKeyAliases(
406     XkbGeometryPtr      /* geom */,
407     int                 /* first */,
408     int                 /* count */,
409     Bool                /* freeAll */
410 );
411
412 extern void
413 XkbFreeGeomColors(
414     XkbGeometryPtr      /* geom */,
415     int                 /* first */,
416     int                 /* count */,
417     Bool                /* freeAll */
418 );
419
420 extern void
421 XkbFreeGeomDoodads(
422     XkbDoodadPtr        /* doodads */,
423     int                 /* nDoodads */,
424     Bool                /* freeAll */
425 );
426
427
428 extern void
429 XkbFreeGeomProperties(
430     XkbGeometryPtr      /* geom */,
431     int                 /* first */,
432     int                 /* count */,
433     Bool                /* freeAll */
434 );
435
436 extern void
437 XkbFreeGeomOverlayKeys(
438     XkbOverlayRowPtr    /* row */,
439     int                 /* first */,
440     int                 /* count */,
441     Bool                /* freeAll */
442 );
443
444 extern void
445 XkbFreeGeomOverlayRows(
446     XkbOverlayPtr       /* overlay */,
447     int                 /* first */,
448     int                 /* count */,
449     Bool                /* freeAll */
450 );
451
452 extern void
453 XkbFreeGeomOverlays(
454     XkbSectionPtr       /* section */,
455     int                 /* first */,
456     int                 /* count */,
457     Bool                /* freeAll */
458 );
459
460 extern void
461 XkbFreeGeomKeys(
462     XkbRowPtr           /* row */,
463     int                 /* first */,
464     int                 /* count */,
465     Bool                /* freeAll */
466 );
467
468 extern void
469 XkbFreeGeomRows(
470     XkbSectionPtr       /* section */,
471     int                 /* first */,
472     int                 /* count */,
473     Bool                /* freeAll */
474 );
475
476 extern void
477 XkbFreeGeomSections(
478     XkbGeometryPtr      /* geom */,
479     int                 /* first */,
480     int                 /* count */,
481     Bool                /* freeAll */
482 );
483
484
485 extern void
486 XkbFreeGeomPoints(
487     XkbOutlinePtr       /* outline */,
488     int                 /* first */,
489     int                 /* count */,
490     Bool                /* freeAll */
491 );
492
493 extern void
494 XkbFreeGeomOutlines(
495     XkbShapePtr         /* shape */,
496     int                 /* first */,
497     int                 /* count */,
498     Bool                /* freeAll */
499 );
500
501 extern void
502 XkbFreeGeomShapes(
503     XkbGeometryPtr      /* geom */,
504     int                 /* first */,
505     int                 /* count */,
506     Bool                /* freeAll */
507 );
508
509 extern void
510 XkbFreeGeometry(
511     XkbGeometryPtr      /* geom */,
512     unsigned int        /* which */,
513     Bool                /* freeMap */
514 );
515
516 extern Status
517 XkbAllocGeomProps(
518     XkbGeometryPtr      /* geom */,
519     int                 /* nProps */
520 );
521
522 extern Status
523 XkbAllocGeomKeyAliases(
524     XkbGeometryPtr      /* geom */,
525     int                 /* nAliases */
526 );
527
528 extern Status
529 XkbAllocGeomColors(
530     XkbGeometryPtr      /* geom */,
531     int                 /* nColors */
532 );
533
534 extern Status
535 XkbAllocGeomShapes(
536     XkbGeometryPtr      /* geom */,
537     int                 /* nShapes */
538 );
539
540 extern Status
541 XkbAllocGeomSections(
542     XkbGeometryPtr      /* geom */,
543     int                 /* nSections */
544 );
545
546 extern Status
547 XkbAllocGeomOverlays(
548     XkbSectionPtr       /* section */,
549     int                 /* num_needed */
550 );
551
552 extern Status
553 XkbAllocGeomOverlayRows(
554     XkbOverlayPtr       /* overlay */,
555     int                 /* num_needed */
556 );
557
558 extern Status
559 XkbAllocGeomOverlayKeys(
560     XkbOverlayRowPtr    /* row */,
561     int                 /* num_needed */
562 );
563
564 extern Status
565 XkbAllocGeomDoodads(
566     XkbGeometryPtr      /* geom */,
567     int                 /* nDoodads */
568 );
569
570 extern Status
571 XkbAllocGeomSectionDoodads(
572     XkbSectionPtr       /* section */,
573     int                 /* nDoodads */
574 );
575
576 extern Status
577 XkbAllocGeomOutlines(
578     XkbShapePtr         /* shape */,
579     int                 /* nOL */
580 );
581
582 extern Status
583 XkbAllocGeomRows(
584     XkbSectionPtr       /* section */,
585     int                 /* nRows */
586 );
587
588 extern Status
589 XkbAllocGeomPoints(
590     XkbOutlinePtr       /* ol */,
591     int                 /* nPts */
592 );
593
594 extern Status
595 XkbAllocGeomKeys(
596     XkbRowPtr           /* row */,
597     int                 /* nKeys */
598 );
599
600 extern  Status
601 XkbAllocGeometry(
602         XkbDescPtr              /* xkb */,
603         XkbGeometrySizesPtr     /* sizes */
604 );
605
606 extern  Status
607 XkbSetGeometry(
608         Display *               /* dpy */,
609         unsigned                /* deviceSpec */,
610         XkbGeometryPtr          /* geom */
611 );
612
613 extern  Bool
614 XkbComputeShapeTop(
615         XkbShapePtr             /* shape */,
616         XkbBoundsPtr            /* bounds */
617 );
618
619 extern  Bool
620 XkbComputeShapeBounds(
621         XkbShapePtr             /* shape */
622 );
623
624 extern  Bool
625 XkbComputeRowBounds(
626         XkbGeometryPtr          /* geom */,
627         XkbSectionPtr           /* section */,
628         XkbRowPtr               /* row */
629 );
630
631 extern  Bool
632 XkbComputeSectionBounds(
633         XkbGeometryPtr          /* geom */,
634         XkbSectionPtr           /* section */
635 );
636
637 extern  char *
638 XkbFindOverlayForKey(
639         XkbGeometryPtr          /* geom */,
640         XkbSectionPtr           /* wanted */,
641         char *                  /* under */
642 );
643
644 extern  Status
645 XkbGetGeometry(
646     Display *                   /* dpy */,
647     XkbDescPtr                  /* xkb */
648 );
649
650 extern  Status
651 XkbGetNamedGeometry(
652     Display *                   /* dpy */,
653     XkbDescPtr                  /* xkb */,
654     Atom                        /* name */
655 );
656
657 _XFUNCPROTOEND
658
659 #endif /* _XKBSTR_H_ */