diff options
author | Jon TURNEY <jon.turney@dronecode.org.uk> | 2010-04-16 18:13:50 +0100 |
---|---|---|
committer | Tiago Vignatti <tiago.vignatti@nokia.com> | 2010-04-23 15:59:49 +0300 |
commit | a7d398e545a4be5491248d5ccb303aa03ee1594f (patch) | |
tree | affd1e09c3e22c57195e1e1923a546113a2a83f2 /hw/xwin/winvalargs.c | |
parent | d8454ae488cfc073cd6010c9a08d53855a0c2612 (diff) |
Xwin: make screens structures run-time adjustable
Change g_ScreenInfo, an array of winScreenInfo elements, from a
static array of MAXSCREENS elements, to a dynamically allocated one
Fix up the validation that -screen option screen numbers are
contiguous from zero (which possibly didn't work correctly before
anyhow)
Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Reviewed-by: Jamey Sharp<jamey@minilop.net>
Reviewed-by: Tiago Vignatti <tiago.vignatti@nokia.com>
Diffstat (limited to 'hw/xwin/winvalargs.c')
-rwxr-xr-x | hw/xwin/winvalargs.c | 31 |
1 files changed, 15 insertions, 16 deletions
diff --git a/hw/xwin/winvalargs.c b/hw/xwin/winvalargs.c index 038e097a5..6f8d1c994 100755 --- a/hw/xwin/winvalargs.c +++ b/hw/xwin/winvalargs.c @@ -40,17 +40,24 @@ */ extern int g_iNumScreens; -extern winScreenInfo g_ScreenInfo[]; +extern winScreenInfo * g_ScreenInfo; extern Bool g_fXdmcpEnabled; /* - * Prototypes + * Verify all screens have been explicitly specified */ +static BOOL +isEveryScreenExplicit(void) +{ + int i; -Bool -winValidateArgs (void); + for (i = 0; i < g_iNumScreens; i++) + if (!g_ScreenInfo[i].fExplicitScreen) + return FALSE; + return TRUE; +} /* * winValidateArgs - Look for invalid argument combinations @@ -62,6 +69,7 @@ winValidateArgs (void) int i; int iMaxConsecutiveScreen = 0; BOOL fHasNormalScreen0 = FALSE; + BOOL fImplicitScreenFound = FALSE; /* * Check for a malformed set of -screen parameters. @@ -70,23 +78,14 @@ winValidateArgs (void) * XWin -screen 0 -screen 2 * XWin -screen 1 -screen 2 */ - for (i = 0; i < MAXSCREENS; i++) - { - if (g_ScreenInfo[i].fExplicitScreen) - iMaxConsecutiveScreen = i + 1; - } - winErrorFVerb (2, "winValidateArgs - g_iNumScreens: %d " - "iMaxConsecutiveScreen: %d\n", - g_iNumScreens, iMaxConsecutiveScreen); - if (g_iNumScreens < iMaxConsecutiveScreen) + if (!isEveryScreenExplicit()) { ErrorF ("winValidateArgs - Malformed set of screen parameter(s). " "Screens must be specified consecutively starting with " "screen 0. That is, you cannot have only a screen 1, nor " "could you have screen 0 and screen 2. You instead must " - "have screen 0, or screen 0 and screen 1, respectively. Of " - "you can specify as many screens as you want from 0 up to " - "%d.\n", MAXSCREENS - 1); + "have screen 0, or screen 0 and screen 1, respectively. " + "You can specify as many screens as you want.\n"); return FALSE; } |