2 *Copyright (C) 2003-2004 Harold L Hunt II All Rights Reserved.
4 *Permission is hereby granted, free of charge, to any person obtaining
5 * a copy of this software and associated documentation files (the
6 *"Software"), to deal in the Software without restriction, including
7 *without limitation the rights to use, copy, modify, merge, publish,
8 *distribute, sublicense, and/or sell copies of the Software, and to
9 *permit persons to whom the Software is furnished to do so, subject to
10 *the following conditions:
12 *The above copyright notice and this permission notice shall be
13 *included in all copies or substantial portions of the Software.
15 *THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16 *EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17 *MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18 *NONINFRINGEMENT. IN NO EVENT SHALL HAROLD L HUNT II BE LIABLE FOR
19 *ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
20 *CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21 *WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23 *Except as contained in this notice, the name of Harold L Hunt II
24 *shall not be used in advertising or otherwise to promote the sale, use
25 *or other dealings in this Software without prior written authorization
26 *from Harold L Hunt II.
28 * Authors: Harold L Hunt II
31 #ifdef HAVE_XWIN_CONFIG_H
32 #include <xwin-config.h>
39 * References to external symbols
42 extern int g_iNumScreens
;
43 extern winScreenInfo g_ScreenInfo
[];
44 extern Bool g_fXdmcpEnabled
;
52 winValidateArgs (void);
56 * winValidateArgs - Look for invalid argument combinations
60 winValidateArgs (void)
63 int iMaxConsecutiveScreen
= 0;
64 BOOL fHasNormalScreen0
= FALSE
;
67 * Check for a malformed set of -screen parameters.
68 * Examples of malformed parameters:
70 * XWin -screen 0 -screen 2
71 * XWin -screen 1 -screen 2
73 for (i
= 0; i
< MAXSCREENS
; i
++)
75 if (g_ScreenInfo
[i
].fExplicitScreen
)
76 iMaxConsecutiveScreen
= i
+ 1;
78 winErrorFVerb (2, "winValidateArgs - g_iNumScreens: %d "
79 "iMaxConsecutiveScreen: %d\n",
80 g_iNumScreens
, iMaxConsecutiveScreen
);
81 if (g_iNumScreens
< iMaxConsecutiveScreen
)
83 ErrorF ("winValidateArgs - Malformed set of screen parameter(s). "
84 "Screens must be specified consecutively starting with "
85 "screen 0. That is, you cannot have only a screen 1, nor "
86 "could you have screen 0 and screen 2. You instead must "
87 "have screen 0, or screen 0 and screen 1, respectively. Of "
88 "you can specify as many screens as you want from 0 up to "
89 "%d.\n", MAXSCREENS
- 1);
93 /* Loop through all screens */
94 for (i
= 0; i
< g_iNumScreens
; ++i
)
97 * Check for any combination of
98 * -multiwindow, -mwextwm, and -rootless.
103 /* Count conflicting options */
104 #ifdef XWIN_MULTIWINDOW
105 if (g_ScreenInfo
[i
].fMultiWindow
)
108 #ifdef XWIN_MULTIWINDOWEXTWM
109 if (g_ScreenInfo
[i
].fMWExtWM
)
112 if (g_ScreenInfo
[i
].fRootless
)
115 /* Check if the first screen is without rootless and multiwindow */
116 if (iCount
== 0 && i
== 0)
117 fHasNormalScreen0
= TRUE
;
119 /* Fail if two or more conflicting options */
122 ErrorF ("winValidateArgs - Only one of -multiwindow, -mwextwm, "
123 "and -rootless can be specific at a time.\n");
128 /* Check for -multiwindow or -mwextwm and Xdmcp */
129 /* allow xdmcp if screen 0 is normal. */
130 if (g_fXdmcpEnabled
&& !fHasNormalScreen0
132 #ifdef XWIN_MULTIWINDOW
133 || g_ScreenInfo
[i
].fMultiWindow
135 #ifdef XWIN_MULTIWINDOWEXTWM
136 || g_ScreenInfo
[i
].fMWExtWM
141 ErrorF ("winValidateArgs - Xdmcp (-query, -broadcast, or -indirect) "
142 "is invalid with -multiwindow or -mwextwm.\n");
146 /* Check for -multiwindow, -mwextwm, or -rootless and fullscreen */
147 if (g_ScreenInfo
[i
].fFullScreen
149 #ifdef XWIN_MULTIWINDOW
150 || g_ScreenInfo
[i
].fMultiWindow
152 #ifdef XWIN_MULTIWINDOWEXTWM
153 || g_ScreenInfo
[i
].fMWExtWM
155 || g_ScreenInfo
[i
].fRootless
)
158 ErrorF ("winValidateArgs - -fullscreen is invalid with "
159 "-multiwindow, -mwextwm, or -rootless.\n");
163 /* Check for !fullscreen and any fullscreen-only parameters */
164 if (!g_ScreenInfo
[i
].fFullScreen
165 && (g_ScreenInfo
[i
].dwRefreshRate
!= WIN_DEFAULT_BPP
166 || g_ScreenInfo
[i
].dwBPP
!= WIN_DEFAULT_REFRESH
))
168 ErrorF ("winValidateArgs - -refresh and -depth are only valid "
169 "with -fullscreen.\n");
173 /* Check for fullscreen and any non-fullscreen parameters */
174 if (g_ScreenInfo
[i
].fFullScreen
175 && (g_ScreenInfo
[i
].fScrollbars
176 || !g_ScreenInfo
[i
].fDecoration
177 || g_ScreenInfo
[i
].fLessPointer
))
179 ErrorF ("winValidateArgs - -fullscreen is invalid with "
180 "-scrollbars, -nodecoration, or -lesspointer.\n");
185 winDebug ("winValidateArgs - Returning.\n");