Commit | Line | Data |
---|---|---|
a09e091a JB |
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 | /* These are taken from hw/xfree86/common/xf86str.h */ | |
39 | ||
40 | typedef struct { | |
41 | CARD32 red, green, blue; | |
42 | } rgb; | |
43 | ||
44 | typedef struct { | |
45 | float red, green, blue; | |
46 | } Gamma; | |
47 | ||
48 | typedef struct { | |
49 | char *identifier; | |
50 | char *vendor; | |
51 | char *board; | |
52 | char *chipset; | |
53 | char *ramdac; | |
54 | char *driver; | |
55 | struct _confscreenrec *myScreenSection; | |
56 | Bool claimed; | |
57 | Bool active; | |
58 | Bool inUse; | |
59 | int videoRam; | |
60 | int textClockFreq; | |
61 | pointer options; | |
62 | int screen; /* For multi-CRTC cards */ | |
63 | } GDevRec, *GDevPtr; | |
64 | ||
65 | typedef struct { | |
66 | char *identifier; | |
67 | char *driver; | |
68 | pointer commonOptions; | |
69 | pointer extraOptions; | |
70 | } IDevRec, *IDevPtr; | |
71 | ||
72 | typedef struct { | |
73 | int frameX0; | |
74 | int frameY0; | |
75 | int virtualX; | |
76 | int virtualY; | |
77 | int depth; | |
78 | int fbbpp; | |
79 | rgb weight; | |
80 | rgb blackColour; | |
81 | rgb whiteColour; | |
82 | int defaultVisual; | |
83 | char **modes; | |
84 | pointer options; | |
85 | } DispRec, *DispPtr; | |
86 | ||
87 | typedef struct _confxvportrec { | |
88 | char *identifier; | |
89 | pointer options; | |
90 | } confXvPortRec, *confXvPortPtr; | |
91 | ||
92 | typedef struct _confxvadaptrec { | |
93 | char *identifier; | |
94 | int numports; | |
95 | confXvPortPtr ports; | |
96 | pointer options; | |
97 | } confXvAdaptorRec, *confXvAdaptorPtr; | |
98 | ||
99 | typedef struct _confscreenrec { | |
100 | char *id; | |
101 | int screennum; | |
102 | int defaultdepth; | |
103 | int defaultbpp; | |
104 | int defaultfbbpp; | |
105 | GDevPtr device; | |
106 | int numdisplays; | |
107 | DispPtr displays; | |
108 | int numxvadaptors; | |
109 | confXvAdaptorPtr xvadaptors; | |
110 | pointer options; | |
111 | } confScreenRec, *confScreenPtr; | |
112 | ||
113 | typedef enum { | |
114 | PosObsolete = -1, | |
115 | PosAbsolute = 0, | |
116 | PosRightOf, | |
117 | PosLeftOf, | |
118 | PosAbove, | |
119 | PosBelow, | |
120 | PosRelative | |
121 | } PositionType; | |
122 | ||
123 | typedef struct _screenlayoutrec { | |
124 | confScreenPtr screen; | |
125 | char *topname; | |
126 | confScreenPtr top; | |
127 | char *bottomname; | |
128 | confScreenPtr bottom; | |
129 | char *leftname; | |
130 | confScreenPtr left; | |
131 | char *rightname; | |
132 | confScreenPtr right; | |
133 | PositionType where; | |
134 | int x; | |
135 | int y; | |
136 | char *refname; | |
137 | confScreenPtr refscreen; | |
138 | } screenLayoutRec, *screenLayoutPtr; | |
139 | ||
140 | typedef struct _serverlayoutrec { | |
141 | char *id; | |
142 | screenLayoutPtr screens; | |
143 | GDevPtr inactives; | |
144 | IDevPtr inputs; | |
145 | pointer options; | |
146 | } serverLayoutRec, *serverLayoutPtr; | |
147 | ||
148 | /* | |
149 | * winconfig.c | |
150 | */ | |
151 | ||
152 | typedef struct { | |
153 | /* Files */ | |
154 | #ifdef XWIN_XF86CONFIG | |
155 | char *configFile; | |
156 | char *configDir; | |
157 | #endif | |
158 | char *fontPath; | |
159 | /* input devices - keyboard */ | |
160 | #ifdef XWIN_XF86CONFIG | |
161 | char *keyboard; | |
162 | #endif | |
163 | char *xkbRules; | |
164 | char *xkbModel; | |
165 | char *xkbLayout; | |
166 | char *xkbVariant; | |
167 | char *xkbOptions; | |
168 | /* layout */ | |
169 | char *screenname; | |
170 | /* mouse settings */ | |
171 | char *mouse; | |
172 | Bool emulate3buttons; | |
173 | long emulate3timeout; | |
174 | } WinCmdlineRec, *WinCmdlinePtr; | |
175 | ||
176 | extern WinCmdlineRec g_cmdline; | |
177 | ||
178 | #ifdef XWIN_XF86CONFIG | |
179 | extern XF86ConfigPtr g_xf86configptr; | |
180 | #endif | |
181 | extern serverLayoutRec g_winConfigLayout; | |
182 | ||
183 | /* | |
184 | * Function prototypes | |
185 | */ | |
186 | ||
187 | Bool winReadConfigfile(void); | |
188 | Bool winConfigFiles(void); | |
189 | Bool winConfigOptions(void); | |
190 | Bool winConfigScreens(void); | |
191 | Bool winConfigKeyboard(DeviceIntPtr pDevice); | |
192 | Bool winConfigMouse(DeviceIntPtr pDevice); | |
193 | ||
194 | typedef struct { | |
195 | double freq; | |
196 | int units; | |
197 | } OptFrequency; | |
198 | ||
199 | typedef union { | |
200 | unsigned long num; | |
201 | char *str; | |
202 | double realnum; | |
203 | Bool bool; | |
204 | OptFrequency freq; | |
205 | } ValueUnion; | |
206 | ||
207 | typedef enum { | |
208 | OPTV_NONE = 0, | |
209 | OPTV_INTEGER, | |
210 | OPTV_STRING, /* a non-empty string */ | |
211 | OPTV_ANYSTR, /* Any string, including an empty one */ | |
212 | OPTV_REAL, | |
213 | OPTV_BOOLEAN, | |
214 | OPTV_PERCENT, | |
215 | OPTV_FREQ | |
216 | } OptionValueType; | |
217 | ||
218 | typedef enum { | |
219 | OPTUNITS_HZ = 1, | |
220 | OPTUNITS_KHZ, | |
221 | OPTUNITS_MHZ | |
222 | } OptFreqUnits; | |
223 | ||
224 | typedef struct { | |
225 | int token; | |
226 | const char *name; | |
227 | OptionValueType type; | |
228 | ValueUnion value; | |
229 | Bool found; | |
230 | } OptionInfoRec, *OptionInfoPtr; | |
231 | ||
232 | /* | |
233 | * Function prototypes | |
234 | */ | |
235 | ||
236 | char *winSetStrOption(pointer optlist, const char *name, char *deflt); | |
237 | int winSetBoolOption(pointer optlist, const char *name, int deflt); | |
238 | int winSetIntOption(pointer optlist, const char *name, int deflt); | |
239 | double winSetRealOption(pointer optlist, const char *name, double deflt); | |
240 | double winSetPercentOption(pointer optlist, const char *name, double deflt); | |
241 | ||
242 | #ifdef XWIN_XF86CONFIG | |
243 | XF86OptionPtr winFindOption(XF86OptionPtr list, const char *name); | |
244 | char *winFindOptionValue(XF86OptionPtr list, const char *name); | |
245 | #endif | |
246 | int winNameCompare(const char *s1, const char *s2); | |
247 | char *winNormalizeName(const char *s); | |
248 | ||
249 | typedef struct { | |
250 | struct { | |
251 | long leds; | |
252 | long delay; | |
253 | long rate; | |
254 | } keyboard; | |
255 | XkbRMLVOSet xkb; | |
256 | struct { | |
257 | Bool emulate3Buttons; | |
258 | long emulate3Timeout; | |
259 | } pointer; | |
260 | } winInfoRec, *winInfoPtr; | |
261 | ||
262 | extern winInfoRec g_winInfo; | |
263 | ||
264 | #endif |