1706f2543Smrg#ifndef __WIN_CONFIG_H__
2706f2543Smrg#define __WIN_CONFIG_H__
3706f2543Smrg/*
4706f2543Smrg *Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved.
5706f2543Smrg *
6706f2543Smrg *Permission is hereby granted, free of charge, to any person obtaining
7706f2543Smrg * a copy of this software and associated documentation files (the
8706f2543Smrg *"Software"), to deal in the Software without restriction, including
9706f2543Smrg *without limitation the rights to use, copy, modify, merge, publish,
10706f2543Smrg *distribute, sublicense, and/or sell copies of the Software, and to
11706f2543Smrg *permit persons to whom the Software is furnished to do so, subject to
12706f2543Smrg *the following conditions:
13706f2543Smrg *
14706f2543Smrg *The above copyright notice and this permission notice shall be
15706f2543Smrg *included in all copies or substantial portions of the Software.
16706f2543Smrg *
17706f2543Smrg *THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
18706f2543Smrg *EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19706f2543Smrg *MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
20706f2543Smrg *NONINFRINGEMENT. IN NO EVENT SHALL THE XFREE86 PROJECT BE LIABLE FOR
21706f2543Smrg *ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
22706f2543Smrg *CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
23706f2543Smrg *WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24706f2543Smrg *
25706f2543Smrg *Except as contained in this notice, the name of the XFree86 Project
26706f2543Smrg *shall not be used in advertising or otherwise to promote the sale, use
27706f2543Smrg *or other dealings in this Software without prior written authorization
28706f2543Smrg *from the XFree86 Project.
29706f2543Smrg *
30706f2543Smrg * Authors: Alexander Gottwald
31706f2543Smrg */
32706f2543Smrg
33706f2543Smrg#include "win.h"
34706f2543Smrg#ifdef XWIN_XF86CONFIG
35706f2543Smrg#include "../xfree86/parser/xf86Parser.h"
36706f2543Smrg#endif
37706f2543Smrg
38706f2543Smrg
39706f2543Smrg/* These are taken from hw/xfree86/common/xf86str.h */
40706f2543Smrg
41706f2543Smrgtypedef struct
42706f2543Smrg{
43706f2543Smrg  CARD32 red, green, blue;
44706f2543Smrg}
45706f2543Smrgrgb;
46706f2543Smrg
47706f2543Smrg
48706f2543Smrgtypedef struct
49706f2543Smrg{
50706f2543Smrg  float red, green, blue;
51706f2543Smrg}
52706f2543SmrgGamma;
53706f2543Smrg
54706f2543Smrg
55706f2543Smrgtypedef struct
56706f2543Smrg{
57706f2543Smrg  char *identifier;
58706f2543Smrg  char *vendor;
59706f2543Smrg  char *board;
60706f2543Smrg  char *chipset;
61706f2543Smrg  char *ramdac;
62706f2543Smrg  char *driver;
63706f2543Smrg  struct _confscreenrec *myScreenSection;
64706f2543Smrg  Bool claimed;
65706f2543Smrg  Bool active;
66706f2543Smrg  Bool inUse;
67706f2543Smrg  int videoRam;
68706f2543Smrg  int textClockFreq;
69706f2543Smrg  pointer options;
70706f2543Smrg  int screen;			/* For multi-CRTC cards */
71706f2543Smrg}
72706f2543SmrgGDevRec, *GDevPtr;
73706f2543Smrg
74706f2543Smrg
75706f2543Smrgtypedef struct
76706f2543Smrg{
77706f2543Smrg  char *identifier;
78706f2543Smrg  char *driver;
79706f2543Smrg  pointer commonOptions;
80706f2543Smrg  pointer extraOptions;
81706f2543Smrg}
82706f2543SmrgIDevRec, *IDevPtr;
83706f2543Smrg
84706f2543Smrg
85706f2543Smrgtypedef struct
86706f2543Smrg{
87706f2543Smrg  int frameX0;
88706f2543Smrg  int frameY0;
89706f2543Smrg  int virtualX;
90706f2543Smrg  int virtualY;
91706f2543Smrg  int depth;
92706f2543Smrg  int fbbpp;
93706f2543Smrg  rgb weight;
94706f2543Smrg  rgb blackColour;
95706f2543Smrg  rgb whiteColour;
96706f2543Smrg  int defaultVisual;
97706f2543Smrg  char **modes;
98706f2543Smrg  pointer options;
99706f2543Smrg}
100706f2543SmrgDispRec, *DispPtr;
101706f2543Smrg
102706f2543Smrg
103706f2543Smrgtypedef struct _confxvportrec
104706f2543Smrg{
105706f2543Smrg  char *identifier;
106706f2543Smrg  pointer options;
107706f2543Smrg}
108706f2543SmrgconfXvPortRec, *confXvPortPtr;
109706f2543Smrg
110706f2543Smrg
111706f2543Smrgtypedef struct _confxvadaptrec
112706f2543Smrg{
113706f2543Smrg  char *identifier;
114706f2543Smrg  int numports;
115706f2543Smrg  confXvPortPtr ports;
116706f2543Smrg  pointer options;
117706f2543Smrg}
118706f2543SmrgconfXvAdaptorRec, *confXvAdaptorPtr;
119706f2543Smrg
120706f2543Smrg
121706f2543Smrgtypedef struct _confscreenrec
122706f2543Smrg{
123706f2543Smrg  char *id;
124706f2543Smrg  int screennum;
125706f2543Smrg  int defaultdepth;
126706f2543Smrg  int defaultbpp;
127706f2543Smrg  int defaultfbbpp;
128706f2543Smrg  GDevPtr device;
129706f2543Smrg  int numdisplays;
130706f2543Smrg  DispPtr displays;
131706f2543Smrg  int numxvadaptors;
132706f2543Smrg  confXvAdaptorPtr xvadaptors;
133706f2543Smrg  pointer options;
134706f2543Smrg}
135706f2543SmrgconfScreenRec, *confScreenPtr;
136706f2543Smrg
137706f2543Smrg
138706f2543Smrgtypedef enum
139706f2543Smrg{
140706f2543Smrg  PosObsolete = -1,
141706f2543Smrg  PosAbsolute = 0,
142706f2543Smrg  PosRightOf,
143706f2543Smrg  PosLeftOf,
144706f2543Smrg  PosAbove,
145706f2543Smrg  PosBelow,
146706f2543Smrg  PosRelative
147706f2543Smrg}
148706f2543SmrgPositionType;
149706f2543Smrg
150706f2543Smrg
151706f2543Smrgtypedef struct _screenlayoutrec
152706f2543Smrg{
153706f2543Smrg  confScreenPtr screen;
154706f2543Smrg  char *topname;
155706f2543Smrg  confScreenPtr top;
156706f2543Smrg  char *bottomname;
157706f2543Smrg  confScreenPtr bottom;
158706f2543Smrg  char *leftname;
159706f2543Smrg  confScreenPtr left;
160706f2543Smrg  char *rightname;
161706f2543Smrg  confScreenPtr right;
162706f2543Smrg  PositionType where;
163706f2543Smrg  int x;
164706f2543Smrg  int y;
165706f2543Smrg  char *refname;
166706f2543Smrg  confScreenPtr refscreen;
167706f2543Smrg}
168706f2543SmrgscreenLayoutRec, *screenLayoutPtr;
169706f2543Smrg
170706f2543Smrg
171706f2543Smrgtypedef struct _serverlayoutrec
172706f2543Smrg{
173706f2543Smrg  char *id;
174706f2543Smrg  screenLayoutPtr screens;
175706f2543Smrg  GDevPtr inactives;
176706f2543Smrg  IDevPtr inputs;
177706f2543Smrg  pointer options;
178706f2543Smrg}
179706f2543SmrgserverLayoutRec, *serverLayoutPtr;
180706f2543Smrg
181706f2543Smrg
182706f2543Smrg/*
183706f2543Smrg * winconfig.c
184706f2543Smrg */
185706f2543Smrg
186706f2543Smrgtypedef struct
187706f2543Smrg{
188706f2543Smrg  /* Files */
189706f2543Smrg#ifdef XWIN_XF86CONFIG
190706f2543Smrg  char *configFile;
191706f2543Smrg  char *configDir;
192706f2543Smrg#endif
193706f2543Smrg  char *fontPath;
194706f2543Smrg  /* input devices - keyboard */
195706f2543Smrg#ifdef XWIN_XF86CONFIG
196706f2543Smrg  char *keyboard;
197706f2543Smrg#endif
198706f2543Smrg  char *xkbRules;
199706f2543Smrg  char *xkbModel;
200706f2543Smrg  char *xkbLayout;
201706f2543Smrg  char *xkbVariant;
202706f2543Smrg  char *xkbOptions;
203706f2543Smrg  /* layout */
204706f2543Smrg  char *screenname;
205706f2543Smrg  /* mouse settings */
206706f2543Smrg  char *mouse;
207706f2543Smrg  Bool emulate3buttons;
208706f2543Smrg  long emulate3timeout;
209706f2543Smrg}
210706f2543SmrgWinCmdlineRec, *WinCmdlinePtr;
211706f2543Smrg
212706f2543Smrg
213706f2543Smrgextern WinCmdlineRec g_cmdline;
214706f2543Smrg#ifdef XWIN_XF86CONFIG
215706f2543Smrgextern XF86ConfigPtr g_xf86configptr;
216706f2543Smrg#endif
217706f2543Smrgextern serverLayoutRec g_winConfigLayout;
218706f2543Smrg
219706f2543Smrg
220706f2543Smrg/*
221706f2543Smrg * Function prototypes
222706f2543Smrg */
223706f2543Smrg
224706f2543SmrgBool winReadConfigfile (void);
225706f2543SmrgBool winConfigFiles (void);
226706f2543SmrgBool winConfigOptions (void);
227706f2543SmrgBool winConfigScreens (void);
228706f2543SmrgBool winConfigKeyboard (DeviceIntPtr pDevice);
229706f2543SmrgBool winConfigMouse (DeviceIntPtr pDevice);
230706f2543Smrg
231706f2543Smrg
232706f2543Smrgtypedef struct
233706f2543Smrg{
234706f2543Smrg  double freq;
235706f2543Smrg  int units;
236706f2543Smrg}
237706f2543SmrgOptFrequency;
238706f2543Smrg
239706f2543Smrg
240706f2543Smrgtypedef union
241706f2543Smrg{
242706f2543Smrg  unsigned long num;
243706f2543Smrg  char *str;
244706f2543Smrg  double realnum;
245706f2543Smrg  Bool bool;
246706f2543Smrg  OptFrequency freq;
247706f2543Smrg}
248706f2543SmrgValueUnion;
249706f2543Smrg
250706f2543Smrg
251706f2543Smrgtypedef enum
252706f2543Smrg{
253706f2543Smrg  OPTV_NONE = 0,
254706f2543Smrg  OPTV_INTEGER,
255706f2543Smrg  OPTV_STRING,			/* a non-empty string */
256706f2543Smrg  OPTV_ANYSTR,			/* Any string, including an empty one */
257706f2543Smrg  OPTV_REAL,
258706f2543Smrg  OPTV_BOOLEAN,
259706f2543Smrg  OPTV_PERCENT,
260706f2543Smrg  OPTV_FREQ
261706f2543Smrg}
262706f2543SmrgOptionValueType;
263706f2543Smrg
264706f2543Smrg
265706f2543Smrgtypedef enum
266706f2543Smrg{
267706f2543Smrg  OPTUNITS_HZ = 1,
268706f2543Smrg  OPTUNITS_KHZ,
269706f2543Smrg  OPTUNITS_MHZ
270706f2543Smrg}
271706f2543SmrgOptFreqUnits;
272706f2543Smrg
273706f2543Smrg
274706f2543Smrgtypedef struct
275706f2543Smrg{
276706f2543Smrg  int token;
277706f2543Smrg  const char *name;
278706f2543Smrg  OptionValueType type;
279706f2543Smrg  ValueUnion value;
280706f2543Smrg  Bool found;
281706f2543Smrg}
282706f2543SmrgOptionInfoRec, *OptionInfoPtr;
283706f2543Smrg
284706f2543Smrg
285706f2543Smrg/*
286706f2543Smrg * Function prototypes
287706f2543Smrg */
288706f2543Smrg
289706f2543Smrgchar *winSetStrOption (pointer optlist, const char *name, char *deflt);
290706f2543Smrgint winSetBoolOption (pointer optlist, const char *name, int deflt);
291706f2543Smrgint winSetIntOption (pointer optlist, const char *name, int deflt);
292706f2543Smrgdouble winSetRealOption (pointer optlist, const char *name, double deflt);
293706f2543Smrgdouble winSetPercentOption (pointer optlist, const char *name, double deflt);
294706f2543Smrg#ifdef XWIN_XF86CONFIG
295706f2543SmrgXF86OptionPtr winFindOption (XF86OptionPtr list, const char *name);
296706f2543Smrgchar *winFindOptionValue (XF86OptionPtr list, const char *name);
297706f2543Smrg#endif
298706f2543Smrgint winNameCompare (const char *s1, const char *s2);
299706f2543Smrgchar *winNormalizeName (const char *s);
300706f2543Smrg
301706f2543Smrg
302706f2543Smrgtypedef struct
303706f2543Smrg{
304706f2543Smrg  struct
305706f2543Smrg  {
306706f2543Smrg    long leds;
307706f2543Smrg    long delay;
308706f2543Smrg    long rate;
309706f2543Smrg  }
310706f2543Smrg  keyboard;
311706f2543Smrg  XkbRMLVOSet xkb;
312706f2543Smrg  struct
313706f2543Smrg  {
314706f2543Smrg    Bool emulate3Buttons;
315706f2543Smrg    long emulate3Timeout;
316706f2543Smrg  }
317706f2543Smrg  pointer;
318706f2543Smrg}
319706f2543SmrgwinInfoRec, *winInfoPtr;
320706f2543Smrg
321706f2543Smrg
322706f2543Smrgextern winInfoRec g_winInfo;
323706f2543Smrg
324706f2543Smrg#endif
325