winconfig.h revision 4642e01f
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  /* input devices - keyboard */
194#ifdef XWIN_XF86CONFIG
195  char *keyboard;
196#endif
197#ifdef XKB
198  Bool noXkbExtension;
199  char *xkbMap;
200  char *xkbRules;
201  char *xkbModel;
202  char *xkbLayout;
203  char *xkbVariant;
204  char *xkbOptions;
205#endif
206  /* layout */
207  char *screenname;
208  /* mouse settings */
209  char *mouse;
210  Bool emulate3buttons;
211  long emulate3timeout;
212}
213WinCmdlineRec, *WinCmdlinePtr;
214
215
216extern WinCmdlineRec g_cmdline;
217#ifdef XWIN_XF86CONFIG
218extern XF86ConfigPtr g_xf86configptr;
219#endif
220extern serverLayoutRec g_winConfigLayout;
221
222
223/*
224 * Function prototypes
225 */
226
227Bool winReadConfigfile (void);
228Bool winConfigFiles (void);
229Bool winConfigOptions (void);
230Bool winConfigScreens (void);
231Bool winConfigKeyboard (DeviceIntPtr pDevice);
232Bool winConfigMouse (DeviceIntPtr pDevice);
233
234
235typedef struct
236{
237  double freq;
238  int units;
239}
240OptFrequency;
241
242
243typedef union
244{
245  unsigned long num;
246  char *str;
247  double realnum;
248  Bool bool;
249  OptFrequency freq;
250}
251ValueUnion;
252
253
254typedef enum
255{
256  OPTV_NONE = 0,
257  OPTV_INTEGER,
258  OPTV_STRING,			/* a non-empty string */
259  OPTV_ANYSTR,			/* Any string, including an empty one */
260  OPTV_REAL,
261  OPTV_BOOLEAN,
262  OPTV_FREQ
263}
264OptionValueType;
265
266
267typedef enum
268{
269  OPTUNITS_HZ = 1,
270  OPTUNITS_KHZ,
271  OPTUNITS_MHZ
272}
273OptFreqUnits;
274
275
276typedef struct
277{
278  int token;
279  const char *name;
280  OptionValueType type;
281  ValueUnion value;
282  Bool found;
283}
284OptionInfoRec, *OptionInfoPtr;
285
286
287/*
288 * Function prototypes
289 */
290
291char *winSetStrOption (pointer optlist, const char *name, char *deflt);
292int winSetBoolOption (pointer optlist, const char *name, int deflt);
293int winSetIntOption (pointer optlist, const char *name, int deflt);
294double winSetRealOption (pointer optlist, const char *name, double deflt);
295#ifdef XWIN_XF86CONFIG
296XF86OptionPtr winFindOption (XF86OptionPtr list, const char *name);
297char *winFindOptionValue (XF86OptionPtr list, const char *name);
298#endif
299int winNameCompare (const char *s1, const char *s2);
300char *winNormalizeName (const char *s);
301
302
303typedef struct
304{
305  struct
306  {
307    long leds;
308    long delay;
309    long rate;
310  }
311  keyboard;
312#ifdef XKB
313  struct
314  {
315    Bool disable;
316    char *rules;
317    char *model;
318    char *layout;
319    char *variant;
320    char *options;
321    char *initialMap;
322    char *keymap;
323    char *types;
324    char *compat;
325    char *keycodes;
326    char *symbols;
327    char *geometry;
328  }
329  xkb;
330#endif
331  struct
332  {
333    Bool emulate3Buttons;
334    long emulate3Timeout;
335  }
336  pointer;
337}
338winInfoRec, *winInfoPtr;
339
340
341extern winInfoRec g_winInfo;
342
343#endif
344