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>
38 * Verify all screens have been explicitly specified
41 isEveryScreenExplicit(void)
45 for (i
= 0; i
< g_iNumScreens
; i
++)
46 if (!g_ScreenInfo
[i
].fExplicitScreen
)
53 * winValidateArgs - Look for invalid argument combinations
60 BOOL fHasNormalScreen0
= FALSE
;
63 * Check for a malformed set of -screen parameters.
64 * Examples of malformed parameters:
66 * XWin -screen 0 -screen 2
67 * XWin -screen 1 -screen 2
69 if (!isEveryScreenExplicit()) {
70 ErrorF("winValidateArgs - Malformed set of screen parameter(s). "
71 "Screens must be specified consecutively starting with "
72 "screen 0. That is, you cannot have only a screen 1, nor "
73 "could you have screen 0 and screen 2. You instead must "
74 "have screen 0, or screen 0 and screen 1, respectively. "
75 "You can specify as many screens as you want.\n");
79 /* Loop through all screens */
80 for (i
= 0; i
< g_iNumScreens
; ++i
) {
82 * Check for any combination of
83 * -multiwindow, -mwextwm, and -rootless.
88 /* Count conflicting options */
89 #ifdef XWIN_MULTIWINDOW
90 if (g_ScreenInfo
[i
].fMultiWindow
)
93 #ifdef XWIN_MULTIWINDOWEXTWM
94 if (g_ScreenInfo
[i
].fMWExtWM
)
97 if (g_ScreenInfo
[i
].fRootless
)
100 /* Check if the first screen is without rootless and multiwindow */
101 if (iCount
== 0 && i
== 0)
102 fHasNormalScreen0
= TRUE
;
104 /* Fail if two or more conflicting options */
106 ErrorF("winValidateArgs - Only one of -multiwindow, -mwextwm, "
107 "and -rootless can be specific at a time.\n");
112 /* Check for -multiwindow or -mwextwm and Xdmcp */
113 /* allow xdmcp if screen 0 is normal. */
114 if (g_fXdmcpEnabled
&& !fHasNormalScreen0
&& (FALSE
115 #ifdef XWIN_MULTIWINDOW
119 #ifdef XWIN_MULTIWINDOWEXTWM
125 ErrorF("winValidateArgs - Xdmcp (-query, -broadcast, or -indirect) "
126 "is invalid with -multiwindow or -mwextwm.\n");
130 /* Check for -multiwindow, -mwextwm, or -rootless and fullscreen */
131 if (g_ScreenInfo
[i
].fFullScreen
&& (FALSE
132 #ifdef XWIN_MULTIWINDOW
133 || g_ScreenInfo
[i
].fMultiWindow
135 #ifdef XWIN_MULTIWINDOWEXTWM
136 || g_ScreenInfo
[i
].fMWExtWM
138 || g_ScreenInfo
[i
].fRootless
)
140 ErrorF("winValidateArgs - -fullscreen is invalid with "
141 "-multiwindow, -mwextwm, or -rootless.\n");
145 /* Check for !fullscreen and any fullscreen-only parameters */
146 if (!g_ScreenInfo
[i
].fFullScreen
147 && (g_ScreenInfo
[i
].dwRefreshRate
!= WIN_DEFAULT_REFRESH
148 || g_ScreenInfo
[i
].dwBPP
!= WIN_DEFAULT_BPP
)) {
149 ErrorF("winValidateArgs - -refresh and -depth are only valid "
150 "with -fullscreen.\n");
154 /* Check for fullscreen and any non-fullscreen parameters */
155 if (g_ScreenInfo
[i
].fFullScreen
156 && ((g_ScreenInfo
[i
].iResizeMode
!= notAllowed
)
157 || !g_ScreenInfo
[i
].fDecoration
158 || g_ScreenInfo
[i
].fLessPointer
)) {
159 ErrorF("winValidateArgs - -fullscreen is invalid with "
160 "-scrollbars, -resize, -nodecoration, or -lesspointer.\n");
165 winDebug("winValidateArgs - Returning.\n");