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