Initial commit
[xorg_rtime.git] / xorg-server-1.4 / hw / xnest / Args.c
blobf061f9e80ca5b98540f576ff0b72f0fa08f1db74
1 /*
3 Copyright 1993 by Davor Matic
5 Permission to use, copy, modify, distribute, and sell this software
6 and its documentation for any purpose is hereby granted without fee,
7 provided that the above copyright notice appear in all copies and that
8 both that copyright notice and this permission notice appear in
9 supporting documentation. Davor Matic makes no representations about
10 the suitability of this software for any purpose. It is provided "as
11 is" without express or implied warranty.
15 #ifdef HAVE_XNEST_CONFIG_H
16 #include <xnest-config.h>
17 #endif
19 #include <X11/X.h>
20 #include <X11/Xproto.h>
21 #include "screenint.h"
22 #include "input.h"
23 #include "misc.h"
24 #include "scrnintstr.h"
25 #include "servermd.h"
27 #include "Xnest.h"
29 #include "Display.h"
30 #include "Args.h"
32 char *xnestDisplayName = NULL;
33 Bool xnestSynchronize = False;
34 Bool xnestFullGeneration = False;
35 int xnestDefaultClass;
36 Bool xnestUserDefaultClass = False;
37 int xnestDefaultDepth;
38 Bool xnestUserDefaultDepth = False;
39 Bool xnestSoftwareScreenSaver = False;
40 int xnestX;
41 int xnestY;
42 unsigned int xnestWidth;
43 unsigned int xnestHeight;
44 int xnestUserGeometry = 0;
45 int xnestBorderWidth;
46 Bool xnestUserBorderWidth = False;
47 char *xnestWindowName = NULL;
48 int xnestNumScreens = 0;
49 Bool xnestDoDirectColormaps = False;
50 Window xnestParentWindow = 0;
52 /* ddxInitGlobals - called by |InitGlobals| from os/util.c */
53 void ddxInitGlobals(void)
55 #ifdef COMPOSITE
56 /* XXX terrible hack */
57 extern Bool noCompositeExtension;
58 noCompositeExtension = TRUE;
59 #endif
61 #ifdef XKB
62 extern Bool noXkbExtension;
63 noXkbExtension = TRUE;
64 #endif
67 int
68 ddxProcessArgument (int argc, char *argv[], int i)
70 if (!strcmp(argv[i], "-display")) {
71 if (++i < argc) {
72 xnestDisplayName = argv[i];
73 return 2;
75 return 0;
77 if (!strcmp(argv[i], "-sync")) {
78 xnestSynchronize = True;
79 return 1;
81 if (!strcmp(argv[i], "-full")) {
82 xnestFullGeneration = True;
83 return 1;
85 if (!strcmp(argv[i], "-class")) {
86 if (++i < argc) {
87 if (!strcmp(argv[i], "StaticGray")) {
88 xnestDefaultClass = StaticGray;
89 xnestUserDefaultClass = True;
90 return 2;
92 else if (!strcmp(argv[i], "GrayScale")) {
93 xnestDefaultClass = GrayScale;
94 xnestUserDefaultClass = True;
95 return 2;
97 else if (!strcmp(argv[i], "StaticColor")) {
98 xnestDefaultClass = StaticColor;
99 xnestUserDefaultClass = True;
100 return 2;
102 else if (!strcmp(argv[i], "PseudoColor")) {
103 xnestDefaultClass = PseudoColor;
104 xnestUserDefaultClass = True;
105 return 2;
107 else if (!strcmp(argv[i], "TrueColor")) {
108 xnestDefaultClass = TrueColor;
109 xnestUserDefaultClass = True;
110 return 2;
112 else if (!strcmp(argv[i], "DirectColor")) {
113 xnestDefaultClass = DirectColor;
114 xnestUserDefaultClass = True;
115 return 2;
118 return 0;
120 if (!strcmp(argv[i], "-cc")) {
121 if (++i < argc && sscanf(argv[i], "%i", &xnestDefaultClass) == 1) {
122 if (xnestDefaultClass >= 0 && xnestDefaultClass <= 5) {
123 xnestUserDefaultClass = True;
124 /* lex the OS layer process it as well, so return 0 */
127 return 0;
129 if (!strcmp(argv[i], "-depth")) {
130 if (++i < argc && sscanf(argv[i], "%i", &xnestDefaultDepth) == 1) {
131 if (xnestDefaultDepth > 0) {
132 xnestUserDefaultDepth = True;
133 return 2;
136 return 0;
138 if (!strcmp(argv[i], "-sss")) {
139 xnestSoftwareScreenSaver = True;
140 return 1;
142 if (!strcmp(argv[i], "-geometry")) {
143 if (++i < argc) {
144 xnestUserGeometry = XParseGeometry(argv[i],
145 &xnestX, &xnestY,
146 &xnestWidth, &xnestHeight);
147 if (xnestUserGeometry) return 2;
149 return 0;
151 if (!strcmp(argv[i], "-bw")) {
152 if (++i < argc && sscanf(argv[i], "%i", &xnestBorderWidth) == 1) {
153 if (xnestBorderWidth >= 0) {
154 xnestUserBorderWidth = True;
155 return 2;
158 return 0;
160 if (!strcmp(argv[i], "-name")) {
161 if (++i < argc) {
162 xnestWindowName = argv[i];
163 return 2;
165 return 0;
167 if (!strcmp(argv[i], "-scrns")) {
168 if (++i < argc && sscanf(argv[i], "%i", &xnestNumScreens) == 1) {
169 if (xnestNumScreens > 0) {
170 if (xnestNumScreens > MAXSCREENS) {
171 ErrorF("Maximum number of screens is %d.\n", MAXSCREENS);
172 xnestNumScreens = MAXSCREENS;
174 return 2;
177 return 0;
179 if (!strcmp(argv[i], "-install")) {
180 xnestDoDirectColormaps = True;
181 return 1;
183 if (!strcmp(argv[i], "-parent")) {
184 if (++i < argc) {
185 xnestParentWindow = (XID) strtol (argv[i], (char**)NULL, 0);
186 return 2;
189 return 0;
192 void ddxUseMsg()
194 ErrorF("-display string display name of the real server\n");
195 ErrorF("-sync sinchronize with the real server\n");
196 ErrorF("-full utilize full regeneration\n");
197 ErrorF("-class string default visual class\n");
198 ErrorF("-depth int default depth\n");
199 ErrorF("-sss use software screen saver\n");
200 ErrorF("-geometry WxH+X+Y window size and position\n");
201 ErrorF("-bw int window border width\n");
202 ErrorF("-name string window name\n");
203 ErrorF("-scrns int number of screens to generate\n");
204 ErrorF("-install instal colormaps directly\n");