1 | /*
|
---|
2 | * Copyright (c) 2000 by Conectiva S.A. (http://www.conectiva.com)
|
---|
3 | *
|
---|
4 | * Permission is hereby granted, free of charge, to any person obtaining a
|
---|
5 | * copy of this software and associated documentation files (the "Software"),
|
---|
6 | * to deal in the Software without restriction, including without limitation
|
---|
7 | * the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
---|
8 | * and/or sell copies of the Software, and to permit persons to whom the
|
---|
9 | * Software is furnished to do so, subject to the following conditions:
|
---|
10 | *
|
---|
11 | * The above copyright notice and this permission notice shall be included in
|
---|
12 | * all copies or substantial portions of the Software.
|
---|
13 | *
|
---|
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
---|
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
---|
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
---|
17 | * CONECTIVA LINUX BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
---|
18 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
|
---|
19 | * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
---|
20 | * SOFTWARE.
|
---|
21 | *
|
---|
22 | * Except as contained in this notice, the name of Conectiva Linux shall
|
---|
23 | * not be used in advertising or otherwise to promote the sale, use or other
|
---|
24 | * dealings in this Software without prior written authorization from
|
---|
25 | * Conectiva Linux.
|
---|
26 | *
|
---|
27 | * Author: Paulo César Pereira de Andrade <[email protected]>
|
---|
28 | *
|
---|
29 | * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/config.h,v 1.21 2004/02/13 23:58:52 dawes Exp $
|
---|
30 | */
|
---|
31 |
|
---|
32 | #ifdef HAVE_CONFIG_H
|
---|
33 | # include "xorg-config.h"
|
---|
34 | #endif
|
---|
35 |
|
---|
36 | #include <X11/IntrinsicP.h>
|
---|
37 | #include <X11/StringDefs.h>
|
---|
38 | #include <X11/Xmu/SysUtil.h>
|
---|
39 | #include <X11/Xos.h>
|
---|
40 | #include <stdio.h>
|
---|
41 | #include <stdlib.h>
|
---|
42 | #include <dirent.h>
|
---|
43 | #include <string.h>
|
---|
44 | #ifdef sun
|
---|
45 | #undef index
|
---|
46 | #undef rindex
|
---|
47 | #include <strings.h>
|
---|
48 | #endif
|
---|
49 | #include <unistd.h>
|
---|
50 |
|
---|
51 | #include <stdarg.h>
|
---|
52 |
|
---|
53 | #ifdef __UNIXOS2__
|
---|
54 | #define strcasecmp stricmp
|
---|
55 | #define setenv putenv
|
---|
56 | #define PATH_MAX 260
|
---|
57 | #endif
|
---|
58 |
|
---|
59 | /* Get PATH_MAX */
|
---|
60 | #ifndef PATH_MAX
|
---|
61 | # if defined(_POSIX_SOURCE)
|
---|
62 | # include <limits.h>
|
---|
63 | # else
|
---|
64 | # define _POSIX_SOURCE
|
---|
65 | # include <limits.h>
|
---|
66 | # undef _POSIX_SOURCE
|
---|
67 | # endif
|
---|
68 | # ifndef PATH_MAX
|
---|
69 | # ifdef MAXPATHLEN
|
---|
70 | # define PATH_MAX MAXPATHLEN
|
---|
71 | # else
|
---|
72 | # define PATH_MAX 1024
|
---|
73 | # endif
|
---|
74 | # endif
|
---|
75 | #endif
|
---|
76 |
|
---|
77 | #include <xf86Parser.h>
|
---|
78 | #include <X11/XKBlib.h>
|
---|
79 | #include <X11/extensions/XKBgeom.h>
|
---|
80 | #include <X11/extensions/XKM.h>
|
---|
81 | #include <X11/extensions/XKBfile.h>
|
---|
82 | #include <X11/extensions/XKBui.h>
|
---|
83 | #include <X11/extensions/XKBrules.h>
|
---|
84 |
|
---|
85 | #ifndef _xf86cfg_config_h
|
---|
86 | #define _xf86cfg_config_h
|
---|
87 |
|
---|
88 | /* Must match the offset in the xf86info structure at config.c,
|
---|
89 | * and is used also by interface.c
|
---|
90 | */
|
---|
91 | #define MOUSE 0
|
---|
92 | #define KEYBOARD 1
|
---|
93 | #define CARD 2
|
---|
94 | #define MONITOR 3
|
---|
95 | #define SCREEN 4
|
---|
96 | #define SERVER 5
|
---|
97 |
|
---|
98 | #define UNUSED 0
|
---|
99 | #define USED 1
|
---|
100 |
|
---|
101 | #define CONFIG_LAYOUT 0
|
---|
102 | #define CONFIG_SCREEN 1
|
---|
103 | #define CONFIG_MODELINE 2
|
---|
104 | #define CONFIG_ACCESSX 3
|
---|
105 | extern int config_mode;
|
---|
106 |
|
---|
107 | #ifndef __UNIXOS2__
|
---|
108 | #define CONFPATH "%A," "%R," \
|
---|
109 | "/etc/X11/%R," "%P/etc/X11/%R," \
|
---|
110 | "%E," "%F," \
|
---|
111 | "/etc/X11/%F," "%P/etc/X11/%F," \
|
---|
112 | "%D/%X," \
|
---|
113 | "/etc/X11/%X-%M," "/etc/X11/%X," "/etc/%X," \
|
---|
114 | "%P/etc/X11/%X.%H," "%P/etc/X11/%X-%M," \
|
---|
115 | "%P/etc/X11/%X," \
|
---|
116 | "%P/lib/X11/%X.%H," "%P/lib/X11/%X-%M," \
|
---|
117 | "%P/lib/X11/%X"
|
---|
118 | #define USER_CONFPATH "/etc/X11/%S," "%P/etc/X11/%S," \
|
---|
119 | "/etc/X11/%G," "%P/etc/X11/%G," \
|
---|
120 | "%P/etc/X11/%X.%H," "%P/etc/X11/%X-%M," \
|
---|
121 | "%P/etc/X11/%X," \
|
---|
122 | "%P/lib/X11/%X.%H," "%P/lib/X11/%X-%M," \
|
---|
123 | "%P/lib/X11/%X"
|
---|
124 | #else
|
---|
125 | #define CONFPATH "%&"XF86CONFIGDIR"/%R," "%&"XF86CONFIGDIR"/%X," \
|
---|
126 | "%A," "%R," \
|
---|
127 | "/etc/X11/%R," "%P/etc/X11/%R," \
|
---|
128 | "%E," "%F," \
|
---|
129 | "/etc/X11/%F," "%P/etc/X11/%F," \
|
---|
130 | "%D/%X," \
|
---|
131 | "/etc/X11/%X-%M," "/etc/X11/%X," "/etc/%X," \
|
---|
132 | "%P/etc/X11/%X.%H," "%P/etc/X11/%X-%M," \
|
---|
133 | "%P/etc/X11/%X," \
|
---|
134 | "%P/lib/X11/%X.%H," "%P/lib/X11/%X-%M," \
|
---|
135 | "%P/lib/X11/%X"
|
---|
136 | #define USER_CONFPATH "%&"XF86CONFIGDIR"/%X," "%&"XF86CONFIGDIR"/%X," \
|
---|
137 | "/etc/X11/%S," "%P/etc/X11/%S," \
|
---|
138 | "/etc/X11/%G," "%P/etc/X11/%G," \
|
---|
139 | "%P/etc/X11/%X.%H," "%P/etc/X11/%X-%M," \
|
---|
140 | "%P/etc/X11/%X," \
|
---|
141 | "%P/lib/X11/%X.%H," "%P/lib/X11/%X-%M," \
|
---|
142 | "%P/lib/X11/%X"
|
---|
143 | #endif
|
---|
144 |
|
---|
145 | /*
|
---|
146 | * Types
|
---|
147 | */
|
---|
148 | typedef struct _XF86SetupInfo XF86SetupInfo;
|
---|
149 | typedef void (*XF86SetupFunction)(XF86SetupInfo*);
|
---|
150 |
|
---|
151 | typedef struct _XF86SetupFunctionList {
|
---|
152 | XF86SetupFunction *functions;
|
---|
153 | int num_functions;
|
---|
154 | int cur_function;
|
---|
155 | } XF86SetupFunctionList;
|
---|
156 |
|
---|
157 | struct _XF86SetupInfo {
|
---|
158 | int num_lists;
|
---|
159 | int cur_list;
|
---|
160 | XF86SetupFunctionList *lists;
|
---|
161 | };
|
---|
162 |
|
---|
163 | typedef Bool (*ConfigCheckFunction)(void);
|
---|
164 |
|
---|
165 | typedef struct _xf86cfgDevice xf86cfgDevice;
|
---|
166 |
|
---|
167 | struct _xf86cfgDevice {
|
---|
168 | XtPointer config;
|
---|
169 | Widget widget;
|
---|
170 | int type, state, refcount;
|
---|
171 | };
|
---|
172 |
|
---|
173 | typedef struct {
|
---|
174 | XF86ConfScreenPtr screen;
|
---|
175 | Widget widget;
|
---|
176 | int type, state, refcount;
|
---|
177 | xf86cfgDevice *card;
|
---|
178 | xf86cfgDevice *monitor;
|
---|
179 | short row, column;
|
---|
180 | XRectangle rect;
|
---|
181 | short rotate;
|
---|
182 | } xf86cfgScreen;
|
---|
183 |
|
---|
184 | /* this structure is used just to restore
|
---|
185 | properly the monitors layout in the
|
---|
186 | screen window configuration.
|
---|
187 | */
|
---|
188 | typedef struct {
|
---|
189 | XF86ConfLayoutPtr layout;
|
---|
190 | xf86cfgScreen **screen;
|
---|
191 | XPoint *position;
|
---|
192 | int num_layouts;
|
---|
193 | } xf86cfgLayout;
|
---|
194 |
|
---|
195 | /* The vidmode extension usage is controlled by this structure.
|
---|
196 | * The information is read at startup, and added monitors cannot
|
---|
197 | * be configured, since they are not attached to a particular screen.
|
---|
198 | */
|
---|
199 | typedef struct _xf86cfgVidMode xf86cfgVidmode;
|
---|
200 |
|
---|
201 | typedef struct {
|
---|
202 | XF86ConfLayoutPtr layout; /* current layout */
|
---|
203 | Widget cpu;
|
---|
204 | xf86cfgLayout **layouts;
|
---|
205 | Cardinal num_layouts;
|
---|
206 | xf86cfgScreen **screens;
|
---|
207 | Cardinal num_screens;
|
---|
208 | xf86cfgDevice **devices;
|
---|
209 | Cardinal num_devices;
|
---|
210 | xf86cfgVidmode **vidmodes;
|
---|
211 | Cardinal num_vidmodes;
|
---|
212 | } xf86cfgComputer;
|
---|
213 |
|
---|
214 | /*
|
---|
215 | * Prototypes
|
---|
216 | */
|
---|
217 | void StartConfig(void);
|
---|
218 | Bool ConfigLoop(ConfigCheckFunction);
|
---|
219 | void ConfigError(void);
|
---|
220 | void ChangeScreen(XF86ConfMonitorPtr, XF86ConfMonitorPtr,
|
---|
221 | XF86ConfDevicePtr, XF86ConfDevicePtr);
|
---|
222 | void SetTip(xf86cfgDevice*);
|
---|
223 | Bool startx(void);
|
---|
224 | void endx(void);
|
---|
225 | void startaccessx(void);
|
---|
226 | void ConfigCancelAction(Widget, XEvent*, String*, Cardinal*);
|
---|
227 | void ExpertConfigureStart(void);
|
---|
228 | void ExpertConfigureEnd(void);
|
---|
229 | void ExpertCloseAction(Widget, XEvent*, String*, Cardinal*);
|
---|
230 | void ExpertCallback(Widget, XtPointer, XtPointer);
|
---|
231 |
|
---|
232 | /*
|
---|
233 | * Initialization
|
---|
234 | */
|
---|
235 | extern Widget toplevel, configp, current, back, next;
|
---|
236 | extern XtAppContext appcon;
|
---|
237 | extern XF86SetupInfo xf86info;
|
---|
238 | extern Widget ident_widget;
|
---|
239 | extern char *ident_string;
|
---|
240 | extern XF86ConfigPtr XF86Config;
|
---|
241 | extern char *XF86Config_path;
|
---|
242 | extern char *XF86Module_path;
|
---|
243 | extern char *XFree86_path;
|
---|
244 | extern char *XF86Font_path;
|
---|
245 | extern char *XF86RGB_path;
|
---|
246 | extern char *XFree86Dir;
|
---|
247 | extern xf86cfgComputer computer;
|
---|
248 | extern Atom wm_delete_window;
|
---|
249 | extern Display *DPY;
|
---|
250 | extern Pixmap menuPixmap;
|
---|
251 | #ifdef USE_MODULES
|
---|
252 | extern int nomodules;
|
---|
253 | #endif
|
---|
254 |
|
---|
255 | #endif /* _xf86cfg_config_h */
|
---|