1 /************************************************************
2  Copyright (c) 1994 by Silicon Graphics Computer Systems, Inc.
3 
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.
15 
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.
24 
25  ********************************************************/
26 
27 #ifndef _XKMFORMAT_H_
28 #define	_XKMFORMAT_H_ 1
29 
30 #include <X11/extensions/XKB.h>
31 #include <X11/extensions/XKBproto.h>
32 #include <X11/extensions/XKM.h>
33 
34 typedef	struct _xkmFileInfo {
35 	CARD8		type;
36 	CARD8		min_kc;
37 	CARD8		max_kc;
38 	CARD8		num_toc;
39 	CARD16		present;
40 	CARD16		pad;
41 } xkmFileInfo;
42 #define	sz_xkmFileInfo	8
43 
44 typedef	struct _xkmSectionInfo {
45 	CARD16		type;
46 	CARD16		format;
47 	CARD16		size;
48 	CARD16		offset;
49 } xkmSectionInfo;
50 #define	sz_xkmSectionInfo	8
51 
52 typedef struct _xkmKeyTypeDesc {
53 	CARD8		realMods;
54 	CARD8		numLevels;
55 	CARD16		virtualMods;
56 	CARD8		nMapEntries;
57 	CARD8		nLevelNames;
58 	CARD8		preserve;
59 	CARD8		pad;
60 } xkmKeyTypeDesc;
61 #define	sz_xkmKeyTypeDesc	8
62 
63 typedef struct _xkmKTMapEntryDesc {
64 	CARD8		level;
65 	CARD8		realMods;
66 	CARD16		virtualMods;
67 } xkmKTMapEntryDesc;
68 #define	sz_xkmKTMapEntryDesc	4
69 
70 typedef struct _xkmModsDesc {
71 	CARD8		realMods;
72 	CARD8		pad;
73 	CARD16		virtualMods;
74 } xkmModsDesc;
75 #define	sz_xkmModsDesc	4
76 
77 typedef struct _xkmVModMapDesc {
78 	CARD8		key;
79 	CARD8		pad;
80 	CARD16		vmods;
81 } xkmVModMapDesc;
82 #define	sz_xkmVModMapDesc	4
83 
84 typedef struct _xkmSymInterpretDesc {
85 	CARD32		sym;
86 	CARD8		mods;
87 	CARD8		match;
88 	CARD8		virtualMod;
89 	CARD8		flags;
90 	CARD8		actionType;
91 	CARD8		actionData[7];
92 } xkmSymInterpretDesc;
93 #define	sz_xkmSymInterpretDesc	16
94 
95 typedef struct _xkmBehaviorDesc {
96 	CARD8		type;
97 	CARD8		data;
98 	CARD16		pad;
99 } xkmBehaviorDesc;
100 #define	sz_xkmBehaviorDesc	4
101 
102 typedef struct _xkmActionDesc {
103 	CARD8		type;
104 	CARD8		data[7];
105 } xkmActionDesc;
106 #define	sz_xkmActionDesc	8
107 
108 #define	XkmKeyHasTypes		(0x0f)
109 #define	XkmKeyHasGroup1Type	(1<<0)
110 #define	XkmKeyHasGroup2Type	(1<<1)
111 #define	XkmKeyHasGroup3Type	(1<<2)
112 #define	XkmKeyHasGroup4Type	(1<<3)
113 #define	XkmKeyHasActions	(1<<4)
114 #define	XkmKeyHasBehavior	(1<<5)
115 #define	XkmRepeatingKey		(1<<6)
116 #define	XkmNonRepeatingKey	(1<<7)
117 
118 typedef struct _xkmKeySymMapDesc {
119 	CARD8		width;
120 	CARD8		num_groups;
121 	CARD8		modifier_map;
122 	CARD8		flags;
123 } xkmKeySymMapDesc;
124 #define sz_xkmKeySymMapDesc	4
125 
126 typedef struct _xkmIndicatorMapDesc {
127 	CARD8		indicator;
128 	CARD8		flags;
129 	CARD8		which_mods;
130 	CARD8		real_mods;
131 	CARD16		vmods;
132 	CARD8		which_groups;
133 	CARD8		groups;
134 	CARD32		ctrls;
135 } xkmIndicatorMapDesc;
136 #define sz_xkmIndicatorMapDesc	12
137 
138 typedef struct _xkmGeometryDesc {
139 	CARD16		width_mm;
140 	CARD16		height_mm;
141 	CARD8		base_color_ndx;
142 	CARD8		label_color_ndx;
143 	CARD16		num_properties;
144 	CARD16		num_colors;
145 	CARD16		num_shapes;
146 	CARD16		num_sections;
147 	CARD16		num_doodads;
148 	CARD16		num_key_aliases;
149 	CARD16		pad1;
150 } xkmGeometryDesc;
151 #define	sz_xkmGeometryDesc	20
152 
153 typedef struct _xkmPointDesc {
154 	INT16		x;
155 	INT16		y;
156 } xkmPointDesc;
157 #define	sz_xkmPointDesc		4
158 
159 typedef	struct _xkmOutlineDesc {
160 	CARD8		num_points;
161 	CARD8		corner_radius;
162 	CARD16		pad;
163 } xkmOutlineDesc;
164 #define	sz_xkmOutlineDesc	4
165 
166 typedef struct _xkmShapeDesc {
167 	CARD8		num_outlines;
168 	CARD8		primary_ndx;
169 	CARD8		approx_ndx;
170 	CARD8		pad;
171 } xkmShapeDesc;
172 #define	sz_xkmShapeDesc	4
173 
174 typedef struct _xkmSectionDesc {
175 	INT16		top;
176 	INT16		left;
177 	CARD16		width;
178 	CARD16		height;
179 	INT16		angle;
180 	CARD8		priority;
181 	CARD8		num_rows;
182 	CARD8		num_doodads;
183 	CARD8		num_overlays;
184 	CARD16		pad2;
185 } xkmSectionDesc;
186 #define	sz_xkmSectionDesc	16
187 
188 typedef struct _xkmRowDesc {
189 	INT16		top;
190 	INT16		left;
191 	CARD8		num_keys;
192 	BOOL		vertical;
193 	CARD16		pad;
194 } xkmRowDesc;
195 #define	sz_xkmRowDesc		8
196 
197 typedef struct _xkmKeyDesc {
198 	CARD8		name[XkbKeyNameLength];
199 	INT16		gap;
200 	CARD8		shape_ndx;
201 	CARD8		color_ndx;
202 } xkmKeyDesc;
203 #define	sz_xkmKeyDesc		8
204 
205 typedef struct _xkmOverlayDesc {
206 	CARD8		num_rows;
207 	CARD8		pad1;
208 	CARD16		pad2;
209 } xkmOverlayDesc;
210 #define	sz_xkmOverlayDesc	4
211 
212 typedef struct _xkmOverlayRowDesc {
213 	CARD8		row_under;
214 	CARD8		num_keys;
215 	CARD16		pad;
216 } xkmOverlayRowDesc;
217 #define	sz_xkmOverlayRowDesc	4
218 
219 typedef struct _xkmOverlayKeyDesc {
220 	char		over[XkbKeyNameLength];
221 	char		under[XkbKeyNameLength];
222 } xkmOverlayKeyDesc;
223 #define sz_xkmOverlayKeyDesc	8
224 
225 typedef struct _xkmShapeDoodadDesc {
226 	CARD8		type;
227 	CARD8		priority;
228 	INT16		top;
229 	INT16		left;
230 	INT16		angle;
231 	CARD8		color_ndx;
232 	CARD8		shape_ndx;
233 	CARD16		pad;
234 	CARD32		pad1;
235 } xkmShapeDoodadDesc;
236 #define	sz_xkmShapeDoodadDesc	16
237 
238 typedef struct _xkmTextDoodadDesc {
239 	CARD8	 	type;
240 	CARD8	 	priority;
241 	INT16	 	top;
242 	INT16	 	left;
243 	INT16	 	angle;
244 	CARD16		width;
245 	CARD16		height;
246 	CARD8	 	color_ndx;
247 	CARD8		pad1;
248 	CARD16		pad2;
249 } xkmTextDoodadDesc;
250 #define	sz_xkmTextDoodadDesc	16
251 
252 typedef struct _xkmIndicatorDoodadDesc {
253 	CARD8		type;
254 	CARD8		priority;
255 	INT16		top;
256 	INT16		left;
257 	CARD8		shape_ndx;
258 	CARD8		on_color_ndx;
259 	CARD8		off_color_ndx;
260 	CARD8		pad1;
261 	CARD16		pad2;
262 	CARD32		pad3;
263 } xkmIndicatorDoodadDesc;
264 #define	sz_xkmIndicatorDoodadDesc	16
265 
266 typedef struct _xkmLogoDoodadDesc {
267 	CARD8		type;
268 	CARD8		priority;
269 	INT16		top;
270 	INT16		left;
271 	INT16		angle;
272 	CARD8		color_ndx;
273 	CARD8		shape_ndx;
274 	CARD16		pad;
275 	CARD32		pad1;
276 } xkmLogoDoodadDesc;
277 #define	sz_xkmLogoDoodadDesc	16
278 
279 typedef struct _xkmAnyDoodadDesc {
280 	CARD8		type;
281 	CARD8		priority;
282 	INT16		top;
283 	INT16		left;
284 	CARD16		pad1;
285 	CARD32		pad2;
286 	CARD32		pad3;
287 } xkmAnyDoodadDesc;
288 #define	sz_xkmAnyDoodadDesc		16
289 
290 typedef union _xkmDoodadDesc {
291 	xkmAnyDoodadDesc	any;
292 	xkmShapeDoodadDesc	shape;
293 	xkmTextDoodadDesc	text;
294 	xkmIndicatorDoodadDesc	indicator;
295 	xkmLogoDoodadDesc	logo;
296 } xkmDoodadDesc;
297 #define	sz_xkmDoodadDesc		16
298 
299 #endif /* _XKMFORMAT_H_ */
300