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