winconfig.h revision 05b261ec
1#ifndef __WIN_CONFIG_H__
2#define __WIN_CONFIG_H__
3/*
4 *Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved.
5 *
6 *Permission is hereby granted, free of charge, to any person obtaining
7 * a copy of this software and associated documentation files (the
8 *"Software"), to deal in the Software without restriction, including
9 *without limitation the rights to use, copy, modify, merge, publish,
10 *distribute, sublicense, and/or sell copies of the Software, and to
11 *permit persons to whom the Software is furnished to do so, subject to
12 *the following conditions:
13 *
14 *The above copyright notice and this permission notice shall be
15 *included in all copies or substantial portions of the Software.
16 *
17 *THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
18 *EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19 *MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
20 *NONINFRINGEMENT. IN NO EVENT SHALL THE XFREE86 PROJECT BE LIABLE FOR
21 *ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
22 *CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
23 *WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24 *
25 *Except as contained in this notice, the name of the XFree86 Project
26 *shall not be used in advertising or otherwise to promote the sale, use
27 *or other dealings in this Software without prior written authorization
28 *from the XFree86 Project.
29 *
30 * Authors: Alexander Gottwald
31 */
32
33#include "win.h"
34#ifdef XWIN_XF86CONFIG
35#include "../xfree86/parser/xf86Parser.h"
36#endif
37
38
39/* These are taken from hw/xfree86/common/xf86str.h */
40
41typedef struct
42{
43  CARD32 red, green, blue;
44}
45rgb;
46
47
48typedef struct
49{
50  float red, green, blue;
51}
52Gamma;
53
54
55typedef struct
56{
57  char *identifier;
58  char *vendor;
59  char *board;
60  char *chipset;
61  char *ramdac;
62  char *driver;
63  struct _confscreenrec *myScreenSection;
64  Bool claimed;
65  Bool active;
66  Bool inUse;
67  int videoRam;
68  int textClockFreq;
69  pointer options;
70  int screen;			/* For multi-CRTC cards */
71}
72GDevRec, *GDevPtr;
73
74
75typedef struct
76{
77  char *identifier;
78  char *driver;
79  pointer commonOptions;
80  pointer extraOptions;
81}
82IDevRec, *IDevPtr;
83
84
85typedef struct
86{
87  int frameX0;
88  int frameY0;
89  int virtualX;
90  int virtualY;
91  int depth;
92  int fbbpp;
93  rgb weight;
94  rgb blackColour;
95  rgb whiteColour;
96  int defaultVisual;
97  char **modes;
98  pointer options;
99}
100DispRec, *DispPtr;
101
102
103typedef struct _confxvportrec
104{
105  char *identifier;
106  pointer options;
107}
108confXvPortRec, *confXvPortPtr;
109
110
111typedef struct _confxvadaptrec
112{
113  char *identifier;
114  int numports;
115  confXvPortPtr ports;
116  pointer options;
117}
118confXvAdaptorRec, *confXvAdaptorPtr;
119
120
121typedef struct _confscreenrec
122{
123  char *id;
124  int screennum;
125  int defaultdepth;
126  int defaultbpp;
127  int defaultfbbpp;
128  GDevPtr device;
129  int numdisplays;
130  DispPtr displays;
131  int numxvadaptors;
132  confXvAdaptorPtr xvadaptors;
133  pointer options;
134}
135confScreenRec, *confScreenPtr;
136
137
138typedef enum
139{
140  PosObsolete = -1,
141  PosAbsolute = 0,
142  PosRightOf,
143  PosLeftOf,
144  PosAbove,
145  PosBelow,
146  PosRelative
147}
148PositionType;
149
150
151typedef struct _screenlayoutrec
152{
153  confScreenPtr screen;
154  char *topname;
155  confScreenPtr top;
156  char *bottomname;
157  confScreenPtr bottom;
158  char *leftname;
159  confScreenPtr left;
160  char *rightname;
161  confScreenPtr right;
162  PositionType where;
163  int x;
164  int y;
165  char *refname;
166  confScreenPtr refscreen;
167}
168screenLayoutRec, *screenLayoutPtr;
169
170
171typedef struct _serverlayoutrec
172{
173  char *id;
174  screenLayoutPtr screens;
175  GDevPtr inactives;
176  IDevPtr inputs;
177  pointer options;
178}
179serverLayoutRec, *serverLayoutPtr;
180
181
182/*
183 * winconfig.c
184 */
185
186typedef struct
187{
188  /* Files */
189#ifdef XWIN_XF86CONFIG
190  char *configFile;
191#endif
192  char *fontPath;
193  char *rgbPath;
194  /* input devices - keyboard */
195#ifdef XWIN_XF86CONFIG
196  char *keyboard;
197#endif
198#ifdef XKB
199  Bool noXkbExtension;
200  char *xkbMap;
201  char *xkbRules;
202  char *xkbModel;
203  char *xkbLayout;
204  char *xkbVariant;
205  char *xkbOptions;
206#endif
207  /* layout */
208  char *screenname;
209  /* mouse settings */
210  char *mouse;
211  Bool emulate3buttons;
212  long emulate3timeout;
213}
214WinCmdlineRec, *WinCmdlinePtr;
215
216
217extern WinCmdlineRec g_cmdline;
218#ifdef XWIN_XF86CONFIG
219extern XF86ConfigPtr g_xf86configptr;
220#endif
221extern serverLayoutRec g_winConfigLayout;
222
223
224/*
225 * Function prototypes
226 */
227
228Bool winReadConfigfile (void);
229Bool winConfigFiles (void);
230Bool winConfigOptions (void);
231Bool winConfigScreens (void);
232Bool winConfigKeyboard (DeviceIntPtr pDevice);
233Bool winConfigMouse (DeviceIntPtr pDevice);
234
235
236typedef struct
237{
238  double freq;
239  int units;
240}
241OptFrequency;
242
243
244typedef union
245{
246  unsigned long num;
247  char *str;
248  double realnum;
249  Bool bool;
250  OptFrequency freq;
251}
252ValueUnion;
253
254
255typedef enum
256{
257  OPTV_NONE = 0,
258  OPTV_INTEGER,
259  OPTV_STRING,			/* a non-empty string */
260  OPTV_ANYSTR,			/* Any string, including an empty one */
261  OPTV_REAL,
262  OPTV_BOOLEAN,
263  OPTV_FREQ
264}
265OptionValueType;
266
267
268typedef enum
269{
270  OPTUNITS_HZ = 1,
271  OPTUNITS_KHZ,
272  OPTUNITS_MHZ
273}
274OptFreqUnits;
275
276
277typedef struct
278{
279  int token;
280  const char *name;
281  OptionValueType type;
282  ValueUnion value;
283  Bool found;
284}
285OptionInfoRec, *OptionInfoPtr;
286
287
288/*
289 * Function prototypes
290 */
291
292char *winSetStrOption (pointer optlist, const char *name, char *deflt);
293int winSetBoolOption (pointer optlist, const char *name, int deflt);
294int winSetIntOption (pointer optlist, const char *name, int deflt);
295double winSetRealOption (pointer optlist, const char *name, double deflt);
296#ifdef XWIN_XF86CONFIG
297XF86OptionPtr winFindOption (XF86OptionPtr list, const char *name);
298char *winFindOptionValue (XF86OptionPtr list, const char *name);
299#endif
300int winNameCompare (const char *s1, const char *s2);
301char *winNormalizeName (const char *s);
302
303
304typedef struct
305{
306  struct
307  {
308    long leds;
309    long delay;
310    long rate;
311  }
312  keyboard;
313#ifdef XKB
314  struct
315  {
316    Bool disable;
317    char *rules;
318    char *model;
319    char *layout;
320    char *variant;
321    char *options;
322    char *initialMap;
323    char *keymap;
324    char *types;
325    char *compat;
326    char *keycodes;
327    char *symbols;
328    char *geometry;
329  }
330  xkb;
331#endif
332  struct
333  {
334    Bool emulate3Buttons;
335    long emulate3Timeout;
336  }
337  pointer;
338}
339winInfoRec, *winInfoPtr;
340
341
342extern winInfoRec g_winInfo;
343
344#endif
345