summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJon TURNEY <jon.turney@dronecode.org.uk>2010-04-12 20:18:13 +0100
committerTiago Vignatti <tiago.vignatti@nokia.com>2010-04-23 15:55:17 +0300
commitd8454ae488cfc073cd6010c9a08d53855a0c2612 (patch)
tree163e5a8907a05f39bf54543b7330e9f90ea3c61c
parentb61870595ba4df06006d24ed8c07cfe781bce1b7 (diff)
Xwin: Simplify screen option processing
Use an instance of the XWin DDX-specific screen info structure to hold the current default values, to simplify greatly the code for applying options to all screens and remove all those loops over MAXSCREENS screens in the command line option processing Use g_iNumScreens for tracking the current initialized screen count 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>
-rw-r--r--hw/xwin/InitOutput.c24
-rw-r--r--hw/xwin/win.h6
-rw-r--r--hw/xwin/winglobals.c2
-rwxr-xr-xhw/xwin/winprocarg.c611
-rw-r--r--hw/xwin/winscrinit.c2
5 files changed, 158 insertions, 487 deletions
diff --git a/hw/xwin/InitOutput.c b/hw/xwin/InitOutput.c
index fd286de44..8c7ebf0ea 100644
--- a/hw/xwin/InitOutput.c
+++ b/hw/xwin/InitOutput.c
@@ -65,7 +65,6 @@ typedef HRESULT (*SHGETFOLDERPATHPROC)(
extern int g_iNumScreens;
extern winScreenInfo g_ScreenInfo[];
-extern int g_iLastScreen;
extern char * g_pszCommandLine;
extern Bool g_fSilentFatalError;
@@ -115,9 +114,6 @@ void
OsVendorVErrorF (const char *pszFormat, va_list va_args);
#endif
-void
-winInitializeDefaultScreens (void);
-
static Bool
winCheckDisplayNumber (void);
@@ -716,22 +712,16 @@ OsVendorInit (void)
/* Add a default screen if no screens were specified */
if (g_iNumScreens == 0)
{
- winDebug ("OsVendorInit - Creating bogus screen 0\n");
-
- /*
- * We need to initialize default screens if no arguments
- * were processed. Otherwise, the default screens would
- * already have been initialized by ddxProcessArgument ().
- */
- winInitializeDefaultScreens ();
+ winDebug ("OsVendorInit - Creating default screen 0\n");
/*
- * Add a screen 0 using the defaults set by
- * winInitializeDefaultScreens () and any additional parameters
- * processed by ddxProcessArgument ().
+ * We need to initialize the default screen 0 if no -screen
+ * arguments were processed.
+ *
+ * Add a screen 0 using the defaults set by winInitializeDefaultScreens()
+ * and any additional default screen parameters given
*/
- g_iNumScreens = 1;
- g_iLastScreen = 0;
+ winInitializeScreens(1);
/* We have to flag this as an explicit screen, even though it isn't */
g_ScreenInfo[0].fExplicitScreen = TRUE;
diff --git a/hw/xwin/win.h b/hw/xwin/win.h
index b1acd3e47..072c69121 100644
--- a/hw/xwin/win.h
+++ b/hw/xwin/win.h
@@ -1451,6 +1451,12 @@ Bool
winInitCursor (ScreenPtr pScreen);
/*
+ * winprocarg.c
+ */
+void
+winInitializeScreens(int maxscreens);
+
+/*
* END DDX and DIX Function Prototypes
*/
diff --git a/hw/xwin/winglobals.c b/hw/xwin/winglobals.c
index 926ce69b8..da7815560 100644
--- a/hw/xwin/winglobals.c
+++ b/hw/xwin/winglobals.c
@@ -42,7 +42,6 @@
int g_iNumScreens = 0;
winScreenInfo g_ScreenInfo[MAXSCREENS];
-int g_iLastScreen = -1;
#ifdef HAS_DEVWINDOWS
int g_fdMessageQueue = WIN_FD_INVALID;
#endif
@@ -57,7 +56,6 @@ DevPrivateKey g_iPixmapPrivateKey = &g_iPixmapPrivateKeyIndex;
static int g_iWindowPrivateKeyIndex;
DevPrivateKey g_iWindowPrivateKey = &g_iWindowPrivateKeyIndex;
unsigned long g_ulServerGeneration = 0;
-Bool g_fInitializedDefaultScreens = FALSE;
DWORD g_dwEnginesSupported = 0;
HINSTANCE g_hInstance = 0;
HWND g_hDlgDepthChange = NULL;
diff --git a/hw/xwin/winprocarg.c b/hw/xwin/winprocarg.c
index 66da76f6c..540adf706 100755
--- a/hw/xwin/winprocarg.c
+++ b/hw/xwin/winprocarg.c
@@ -46,8 +46,6 @@ from The Open Group.
extern int g_iNumScreens;
extern winScreenInfo g_ScreenInfo[];
-extern int g_iLastScreen;
-extern Bool g_fInitializedDefaultScreens;
#ifdef XWIN_CLIPBOARD
extern Bool g_fUnicodeClipboard;
extern Bool g_fClipboard;
@@ -129,25 +127,25 @@ winLogVersionInfo (void);
void OsVendorVErrorF (const char *pszFormat, va_list va_args);
#endif
-void
-winInitializeDefaultScreens (void);
-
/*
* Process arguments on the command line
*/
-void
-winInitializeDefaultScreens (void)
+static int iLastScreen = -1;
+static winScreenInfo defaultScreenInfo;
+
+static void
+winInitializeScreenDefaults(void)
{
- int i;
- DWORD dwWidth, dwHeight;
+ DWORD dwWidth, dwHeight;
+ static Bool fInitializedScreenDefaults = FALSE;
- /* Bail out early if default screens have already been initialized */
- if (g_fInitializedDefaultScreens)
+ /* Bail out early if default screen has already been initialized */
+ if (fInitializedScreenDefaults)
return;
/* Zero the memory used for storing the screen info */
- ZeroMemory (g_ScreenInfo, MAXSCREENS * sizeof (winScreenInfo));
+ memset(&defaultScreenInfo, 0, sizeof(winScreenInfo));
/* Get default width and height */
/*
@@ -157,62 +155,85 @@ winInitializeDefaultScreens (void)
dwWidth = GetSystemMetrics (SM_CXSCREEN);
dwHeight = GetSystemMetrics (SM_CYSCREEN);
- winErrorFVerb (2, "winInitializeDefaultScreens - w %d h %d\n",
+ winErrorFVerb (2, "winInitializeScreenDefaults - w %d h %d\n",
(int) dwWidth, (int) dwHeight);
/* Set a default DPI, if no parameter was passed */
if (monitorResolution == 0)
monitorResolution = WIN_DEFAULT_DPI;
- for (i = 0; i < MAXSCREENS; ++i)
- {
- g_ScreenInfo[i].dwScreen = i;
- g_ScreenInfo[i].dwWidth = dwWidth;
- g_ScreenInfo[i].dwHeight = dwHeight;
- g_ScreenInfo[i].dwUserWidth = dwWidth;
- g_ScreenInfo[i].dwUserHeight = dwHeight;
- g_ScreenInfo[i].fUserGaveHeightAndWidth
- = WIN_DEFAULT_USER_GAVE_HEIGHT_AND_WIDTH;
- g_ScreenInfo[i].fUserGavePosition = FALSE;
- g_ScreenInfo[i].dwBPP = WIN_DEFAULT_BPP;
- g_ScreenInfo[i].dwClipUpdatesNBoxes = WIN_DEFAULT_CLIP_UPDATES_NBOXES;
+ defaultScreenInfo.dwWidth = dwWidth;
+ defaultScreenInfo.dwHeight = dwHeight;
+ defaultScreenInfo.dwUserWidth = dwWidth;
+ defaultScreenInfo.dwUserHeight = dwHeight;
+ defaultScreenInfo.fUserGaveHeightAndWidth = WIN_DEFAULT_USER_GAVE_HEIGHT_AND_WIDTH;
+ defaultScreenInfo.fUserGavePosition = FALSE;
+ defaultScreenInfo.dwBPP = WIN_DEFAULT_BPP;
+ defaultScreenInfo.dwClipUpdatesNBoxes = WIN_DEFAULT_CLIP_UPDATES_NBOXES;
#ifdef XWIN_EMULATEPSEUDO
- g_ScreenInfo[i].fEmulatePseudo = WIN_DEFAULT_EMULATE_PSEUDO;
+ defaultScreenInfo.fEmulatePseudo = WIN_DEFAULT_EMULATE_PSEUDO;
#endif
- g_ScreenInfo[i].dwRefreshRate = WIN_DEFAULT_REFRESH;
- g_ScreenInfo[i].pfb = NULL;
- g_ScreenInfo[i].fFullScreen = FALSE;
- g_ScreenInfo[i].fDecoration = TRUE;
+ defaultScreenInfo.dwRefreshRate = WIN_DEFAULT_REFRESH;
+ defaultScreenInfo.pfb = NULL;
+ defaultScreenInfo.fFullScreen = FALSE;
+ defaultScreenInfo.fDecoration = TRUE;
#ifdef XWIN_MULTIWINDOWEXTWM
- g_ScreenInfo[i].fMWExtWM = FALSE;
- g_ScreenInfo[i].fInternalWM = FALSE;
+ defaultScreenInfo.fMWExtWM = FALSE;
+ defaultScreenInfo.fInternalWM = FALSE;
#endif
- g_ScreenInfo[i].fRootless = FALSE;
+ defaultScreenInfo.fRootless = FALSE;
#ifdef XWIN_MULTIWINDOW
- g_ScreenInfo[i].fMultiWindow = FALSE;
+ defaultScreenInfo.fMultiWindow = FALSE;
#endif
#if defined(XWIN_MULTIWINDOW) || defined(XWIN_MULTIWINDOWEXTWM)
- g_ScreenInfo[i].fMultiMonitorOverride = FALSE;
+ defaultScreenInfo.fMultiMonitorOverride = FALSE;
#endif
- g_ScreenInfo[i].fMultipleMonitors = FALSE;
- g_ScreenInfo[i].fLessPointer = FALSE;
- g_ScreenInfo[i].fScrollbars = FALSE;
- g_ScreenInfo[i].fNoTrayIcon = FALSE;
- g_ScreenInfo[i].iE3BTimeout = WIN_E3B_OFF;
- g_ScreenInfo[i].dwWidth_mm = (dwWidth / WIN_DEFAULT_DPI)
- * 25.4;
- g_ScreenInfo[i].dwHeight_mm = (dwHeight / WIN_DEFAULT_DPI)
- * 25.4;
- g_ScreenInfo[i].fUseWinKillKey = WIN_DEFAULT_WIN_KILL;
- g_ScreenInfo[i].fUseUnixKillKey = WIN_DEFAULT_UNIX_KILL;
- g_ScreenInfo[i].fIgnoreInput = FALSE;
- g_ScreenInfo[i].fExplicitScreen = FALSE;
- }
+ defaultScreenInfo.fMultipleMonitors = FALSE;
+ defaultScreenInfo.fLessPointer = FALSE;
+ defaultScreenInfo.fScrollbars = FALSE;
+ defaultScreenInfo.fNoTrayIcon = FALSE;
+ defaultScreenInfo.iE3BTimeout = WIN_E3B_OFF;
+ defaultScreenInfo.dwWidth_mm = (dwWidth / WIN_DEFAULT_DPI) * 25.4;
+ defaultScreenInfo.dwHeight_mm = (dwHeight / WIN_DEFAULT_DPI) * 25.4;
+ defaultScreenInfo.fUseWinKillKey = WIN_DEFAULT_WIN_KILL;
+ defaultScreenInfo.fUseUnixKillKey = WIN_DEFAULT_UNIX_KILL;
+ defaultScreenInfo.fIgnoreInput = FALSE;
+ defaultScreenInfo.fExplicitScreen = FALSE;
+
+ /* Note that the default screen has been initialized */
+ fInitializedScreenDefaults = TRUE;
+}
+
+static void
+winInitializeScreen(int i)
+{
+ winErrorFVerb (2, "winInitializeScreen - %d\n",i);
- /* Signal that the default screens have been initialized */
- g_fInitializedDefaultScreens = TRUE;
+ /* Initialize default screen values, if needed */
+ winInitializeScreenDefaults();
- winErrorFVerb (2, "winInitializeDefaultScreens - Returning\n");
+ /* Copy the default screen info */
+ g_ScreenInfo[i] = defaultScreenInfo;
+
+ /* Set the screen number */
+ g_ScreenInfo[i].dwScreen = i;
+}
+
+void
+winInitializeScreens(int maxscreens)
+{
+ int i;
+ winErrorFVerb (2, "winInitializeScreens - %i\n", maxscreens);
+
+ if (maxscreens > g_iNumScreens)
+ {
+ /* Set default values for any new screens */
+ for (i = g_iNumScreens; i < maxscreens ; i++)
+ winInitializeScreen(i);
+
+ /* Keep a count of the number of screens */
+ g_iNumScreens = maxscreens;
+ }
}
/* See Porting Layer Definition - p. 57 */
@@ -244,6 +265,7 @@ int
ddxProcessArgument (int argc, char *argv[], int i)
{
static Bool s_fBeenHere = FALSE;
+ winScreenInfo *screenInfoPtr = NULL;
/* Initialize once */
if (!s_fBeenHere)
@@ -276,7 +298,7 @@ ddxProcessArgument (int argc, char *argv[], int i)
*/
winErrorFVerb (2, "ddxProcessArgument - Initializing default "
"screens\n");
- winInitializeDefaultScreens ();
+ winInitializeScreenDefaults();
}
}
@@ -339,6 +361,14 @@ ddxProcessArgument (int argc, char *argv[], int i)
return 0;
}
+ /*
+ Initialize default values for any new screens
+
+ Note that default values can't change after a -screen option is
+ seen, so it's safe to do this for each screen as it is introduced
+ */
+ winInitializeScreens(nScreenNum+1);
+
/* look for @m where m is monitor number */
if (i + 2 < argc
&& 1 == sscanf(argv[i + 2], "@%d", (int *) &iMonitor))
@@ -505,14 +535,33 @@ ddxProcessArgument (int argc, char *argv[], int i)
* before a screen number apply to all screens, whereas parameters
* seen after a screen number apply to that screen number only.
*/
- g_iLastScreen = nScreenNum;
-
- /* Keep a count of the number of screens */
- ++g_iNumScreens;
+ iLastScreen = nScreenNum;
return iArgsProcessed;
}
+
+ /*
+ * Is this parameter attached to a screen or global?
+ *
+ * If the parameter is for all screens (appears before
+ * any -screen option), store it in the default screen
+ * info
+ *
+ * If the parameter is for a single screen (appears
+ * after a -screen option), store it in the screen info
+ * for that screen
+ *
+ */
+ if (iLastScreen == -1)
+ {
+ screenInfoPtr = &defaultScreenInfo;
+ }
+ else
+ {
+ screenInfoPtr = &(g_ScreenInfo[iLastScreen]);
+ }
+
/*
* Look for the '-engine n' argument
*/
@@ -541,22 +590,7 @@ ddxProcessArgument (int argc, char *argv[], int i)
return 0;
}
- /* Is this parameter attached to a screen or global? */
- if (-1 == g_iLastScreen)
- {
- int j;
-
- /* Parameter is for all screens */
- for (j = 0; j < MAXSCREENS; j++)
- {
- g_ScreenInfo[j].dwEnginePreferred = dwEngine;
- }
- }
- else
- {
- /* Parameter is for a single screen */
- g_ScreenInfo[g_iLastScreen].dwEnginePreferred = dwEngine;
- }
+ screenInfoPtr->dwEnginePreferred = dwEngine;
/* Indicate that we have processed the argument */
return 2;
@@ -567,30 +601,11 @@ ddxProcessArgument (int argc, char *argv[], int i)
*/
if (IS_OPTION ("-fullscreen"))
{
- /* Is this parameter attached to a screen or is it global? */
- if (-1 == g_iLastScreen)
- {
- int j;
-
- /* Parameter is for all screens */
- for (j = 0; j < MAXSCREENS; j++)
- {
-#if defined(XWIN_MULTIWINDOW) || defined(XWIN_MULTIWINDOWEXTWM)
- if (!g_ScreenInfo[j].fMultiMonitorOverride)
- g_ScreenInfo[j].fMultipleMonitors = FALSE;
-#endif
- g_ScreenInfo[j].fFullScreen = TRUE;
- }
- }
- else
- {
- /* Parameter is for a single screen */
#if defined(XWIN_MULTIWINDOW) || defined(XWIN_MULTIWINDOWEXTWM)
- if (!g_ScreenInfo[g_iLastScreen].fMultiMonitorOverride)
- g_ScreenInfo[g_iLastScreen].fMultipleMonitors = FALSE;
+ if (!screenInfoPtr->fMultiMonitorOverride)
+ screenInfoPtr->fMultipleMonitors = FALSE;
#endif
- g_ScreenInfo[g_iLastScreen].fFullScreen = TRUE;
- }
+ screenInfoPtr->fFullScreen = TRUE;
/* Indicate that we have processed this argument */
return 1;
@@ -601,22 +616,7 @@ ddxProcessArgument (int argc, char *argv[], int i)
*/
if (IS_OPTION ("-lesspointer"))
{
- /* Is this parameter attached to a screen or is it global? */
- if (-1 == g_iLastScreen)
- {
- int j;
-
- /* Parameter is for all screens */
- for (j = 0; j < MAXSCREENS; j++)
- {
- g_ScreenInfo[j].fLessPointer = TRUE;
- }
- }
- else
- {
- /* Parameter is for a single screen */
- g_ScreenInfo[g_iLastScreen].fLessPointer = TRUE;
- }
+ screenInfoPtr->fLessPointer = TRUE;
/* Indicate that we have processed this argument */
return 1;
@@ -627,30 +627,11 @@ ddxProcessArgument (int argc, char *argv[], int i)
*/
if (IS_OPTION ("-nodecoration"))
{
- /* Is this parameter attached to a screen or is it global? */
- if (-1 == g_iLastScreen)
- {
- int j;
-
- /* Parameter is for all screens */
- for (j = 0; j < MAXSCREENS; j++)
- {
#if defined(XWIN_MULTIWINDOW) || defined(XWIN_MULTIWINDOWEXTWM)
- if (!g_ScreenInfo[j].fMultiMonitorOverride)
- g_ScreenInfo[j].fMultipleMonitors = FALSE;
+ if (!screenInfoPtr->fMultiMonitorOverride)
+ screenInfoPtr->fMultipleMonitors = FALSE;
#endif
- g_ScreenInfo[j].fDecoration = FALSE;
- }
- }
- else
- {
- /* Parameter is for a single screen */
-#if defined(XWIN_MULTIWINDOW) || defined(XWIN_MULTIWINDOWEXTWM)
- if (!g_ScreenInfo[g_iLastScreen].fMultiMonitorOverride)
- g_ScreenInfo[g_iLastScreen].fMultipleMonitors = FALSE;
-#endif
- g_ScreenInfo[g_iLastScreen].fDecoration = FALSE;
- }
+ screenInfoPtr->fDecoration = FALSE;
/* Indicate that we have processed this argument */
return 1;
@@ -662,26 +643,9 @@ ddxProcessArgument (int argc, char *argv[], int i)
*/
if (IS_OPTION ("-mwextwm"))
{
- /* Is this parameter attached to a screen or is it global? */
- if (-1 == g_iLastScreen)
- {
- int j;
-
- /* Parameter is for all screens */
- for (j = 0; j < MAXSCREENS; j++)
- {
- if (!g_ScreenInfo[j].fMultiMonitorOverride)
- g_ScreenInfo[j].fMultipleMonitors = TRUE;
- g_ScreenInfo[j].fMWExtWM = TRUE;
- }
- }
- else
- {
- /* Parameter is for a single screen */
- if (!g_ScreenInfo[g_iLastScreen].fMultiMonitorOverride)
- g_ScreenInfo[g_iLastScreen].fMultipleMonitors = TRUE;
- g_ScreenInfo[g_iLastScreen].fMWExtWM = TRUE;
- }
+ if (!screenInfoPtr->fMultiMonitorOverride)
+ screenInfoPtr->fMultipleMonitors = TRUE;
+ screenInfoPtr->fMWExtWM = TRUE;
/* Indicate that we have processed this argument */
return 1;
@@ -691,28 +655,10 @@ ddxProcessArgument (int argc, char *argv[], int i)
*/
if (IS_OPTION ("-internalwm"))
{
- /* Is this parameter attached to a screen or is it global? */
- if (-1 == g_iLastScreen)
- {
- int j;
-
- /* Parameter is for all screens */
- for (j = 0; j < MAXSCREENS; j++)
- {
- if (!g_ScreenInfo[j].fMultiMonitorOverride)
- g_ScreenInfo[j].fMultipleMonitors = TRUE;
- g_ScreenInfo[j].fMWExtWM = TRUE;
- g_ScreenInfo[j].fInternalWM = TRUE;
- }
- }
- else
- {
- /* Parameter is for a single screen */
- if (!g_ScreenInfo[g_iLastScreen].fMultiMonitorOverride)
- g_ScreenInfo[g_iLastScreen].fMultipleMonitors = TRUE;
- g_ScreenInfo[g_iLastScreen].fMWExtWM = TRUE;
- g_ScreenInfo[g_iLastScreen].fInternalWM = TRUE;
- }
+ if (!screenInfoPtr->fMultiMonitorOverride)
+ screenInfoPtr->fMultipleMonitors = TRUE;
+ screenInfoPtr->fMWExtWM = TRUE;
+ screenInfoPtr->fInternalWM = TRUE;
/* Indicate that we have processed this argument */
return 1;
@@ -724,30 +670,11 @@ ddxProcessArgument (int argc, char *argv[], int i)
*/
if (IS_OPTION ("-rootless"))
{
- /* Is this parameter attached to a screen or is it global? */
- if (-1 == g_iLastScreen)
- {
- int j;
-
- /* Parameter is for all screens */
- for (j = 0; j < MAXSCREENS; j++)
- {
#if defined(XWIN_MULTIWINDOW) || defined(XWIN_MULTIWINDOWEXTWM)
- if (!g_ScreenInfo[j].fMultiMonitorOverride)
- g_ScreenInfo[j].fMultipleMonitors = FALSE;
+ if (!screenInfoPtr->fMultiMonitorOverride)
+ screenInfoPtr->fMultipleMonitors = FALSE;
#endif
- g_ScreenInfo[j].fRootless = TRUE;
- }
- }
- else
- {
- /* Parameter is for a single screen */
-#if defined(XWIN_MULTIWINDOW) || defined(XWIN_MULTIWINDOWEXTWM)
- if (!g_ScreenInfo[g_iLastScreen].fMultiMonitorOverride)
- g_ScreenInfo[g_iLastScreen].fMultipleMonitors = FALSE;
-#endif
- g_ScreenInfo[g_iLastScreen].fRootless = TRUE;
- }
+ screenInfoPtr->fRootless = TRUE;
/* Indicate that we have processed this argument */
return 1;
@@ -759,30 +686,11 @@ ddxProcessArgument (int argc, char *argv[], int i)
*/
if (IS_OPTION ("-multiwindow"))
{
- /* Is this parameter attached to a screen or is it global? */
- if (-1 == g_iLastScreen)
- {
- int j;
-
- /* Parameter is for all screens */
- for (j = 0; j < MAXSCREENS; j++)
- {
-#if defined(XWIN_MULTIWINDOW) || defined(XWIN_MULTIWINDOWEXTWM)
- if (!g_ScreenInfo[j].fMultiMonitorOverride)
- g_ScreenInfo[j].fMultipleMonitors = TRUE;
-#endif
- g_ScreenInfo[j].fMultiWindow = TRUE;
- }
- }
- else
- {
- /* Parameter is for a single screen */
#if defined(XWIN_MULTIWINDOW) || defined(XWIN_MULTIWINDOWEXTWM)
- if (!g_ScreenInfo[g_iLastScreen].fMultiMonitorOverride)
- g_ScreenInfo[g_iLastScreen].fMultipleMonitors = TRUE;
+ if (!screenInfoPtr->fMultiMonitorOverride)
+ screenInfoPtr->fMultipleMonitors = TRUE;
#endif
- g_ScreenInfo[g_iLastScreen].fMultiWindow = TRUE;
- }
+ screenInfoPtr->fMultiWindow = TRUE;
/* Indicate that we have processed this argument */
return 1;
@@ -795,28 +703,10 @@ ddxProcessArgument (int argc, char *argv[], int i)
if (IS_OPTION ("-multiplemonitors")
|| IS_OPTION ("-multimonitors"))
{
- /* Is this parameter attached to a screen or is it global? */
- if (-1 == g_iLastScreen)
- {
- int j;
-
- /* Parameter is for all screens */
- for (j = 0; j < MAXSCREENS; j++)
- {
-#if defined(XWIN_MULTIWINDOW) || defined(XWIN_MULTIWINDOWEXTWM)
- g_ScreenInfo[j].fMultiMonitorOverride = TRUE;
-#endif
- g_ScreenInfo[j].fMultipleMonitors = TRUE;
- }
- }
- else
- {
- /* Parameter is for a single screen */
#if defined(XWIN_MULTIWINDOW) || defined(XWIN_MULTIWINDOWEXTWM)
- g_ScreenInfo[g_iLastScreen].fMultiMonitorOverride = TRUE;
+ screenInfoPtr->fMultiMonitorOverride = TRUE;
#endif
- g_ScreenInfo[g_iLastScreen].fMultipleMonitors = TRUE;
- }
+ screenInfoPtr->fMultipleMonitors = TRUE;
/* Indicate that we have processed this argument */
return 1;
@@ -828,28 +718,10 @@ ddxProcessArgument (int argc, char *argv[], int i)
if (IS_OPTION ("-nomultiplemonitors")
|| IS_OPTION ("-nomultimonitors"))
{
- /* Is this parameter attached to a screen or is it global? */
- if (-1 == g_iLastScreen)
- {
- int j;
-
- /* Parameter is for all screens */
- for (j = 0; j < MAXSCREENS; j++)
- {
#if defined(XWIN_MULTIWINDOW) || defined(XWIN_MULTIWINDOWEXTWM)
- g_ScreenInfo[j].fMultiMonitorOverride = TRUE;
+ screenInfoPtr->fMultiMonitorOverride = TRUE;
#endif
- g_ScreenInfo[j].fMultipleMonitors = FALSE;
- }
- }
- else
- {
- /* Parameter is for a single screen */
-#if defined(XWIN_MULTIWINDOW) || defined(XWIN_MULTIWINDOWEXTWM)
- g_ScreenInfo[g_iLastScreen].fMultiMonitorOverride = TRUE;
-#endif
- g_ScreenInfo[g_iLastScreen].fMultipleMonitors = FALSE;
- }
+ screenInfoPtr->fMultipleMonitors = FALSE;
/* Indicate that we have processed this argument */
return 1;
@@ -861,22 +733,7 @@ ddxProcessArgument (int argc, char *argv[], int i)
*/
if (IS_OPTION ("-scrollbars"))
{
- /* Is this parameter attached to a screen or is it global? */
- if (-1 == g_iLastScreen)
- {
- int j;
-
- /* Parameter is for all screens */
- for (j = 0; j < MAXSCREENS; j++)
- {
- g_ScreenInfo[j].fScrollbars = TRUE;
- }
- }
- else
- {
- /* Parameter is for a single screen */
- g_ScreenInfo[g_iLastScreen].fScrollbars = TRUE;
- }
+ screenInfoPtr->fScrollbars = TRUE;
/* Indicate that we have processed this argument */
return 1;
@@ -914,22 +771,7 @@ ddxProcessArgument (int argc, char *argv[], int i)
*/
if (IS_OPTION ("-ignoreinput"))
{
- /* Is this parameter attached to a screen or is it global? */
- if (-1 == g_iLastScreen)
- {
- int j;
-
- /* Parameter is for all screens */
- for (j = 0; j < MAXSCREENS; j++)
- {
- g_ScreenInfo[j].fIgnoreInput = TRUE;
- }
- }
- else
- {
- /* Parameter is for a single screen */
- g_ScreenInfo[g_iLastScreen].fIgnoreInput = TRUE;
- }
+ screenInfoPtr->fIgnoreInput = TRUE;
/* Indicate that we have processed this argument */
return 1;
@@ -962,22 +804,7 @@ ddxProcessArgument (int argc, char *argv[], int i)
iE3BTimeout = WIN_DEFAULT_E3B_TIME;
}
- /* Is this parameter attached to a screen or is it global? */
- if (-1 == g_iLastScreen)
- {
- int j;
-
- /* Parameter is for all screens */
- for (j = 0; j < MAXSCREENS; j++)
- {
- g_ScreenInfo[j].iE3BTimeout = iE3BTimeout;
- }
- }
- else
- {
- /* Parameter is for a single screen */
- g_ScreenInfo[g_iLastScreen].iE3BTimeout = iE3BTimeout;
- }
+ screenInfoPtr->iE3BTimeout = iE3BTimeout;
/* Indicate that we have processed this argument */
return iArgsProcessed;
@@ -1000,23 +827,8 @@ ddxProcessArgument (int argc, char *argv[], int i)
/* Grab the argument */
dwBPP = atoi (argv[i]);
- /* Is this parameter attached to a screen or global? */
- if (-1 == g_iLastScreen)
- {
- int j;
+ screenInfoPtr->dwBPP = dwBPP;
- /* Parameter is for all screens */
- for (j = 0; j < MAXSCREENS; j++)
- {
- g_ScreenInfo[j].dwBPP = dwBPP;
- }
- }
- else
- {
- /* Parameter is for a single screen */
- g_ScreenInfo[g_iLastScreen].dwBPP = dwBPP;
- }
-
/* Indicate that we have processed the argument */
return 2;
}
@@ -1038,23 +850,8 @@ ddxProcessArgument (int argc, char *argv[], int i)
/* Grab the argument */
dwRefreshRate = atoi (argv[i]);
- /* Is this parameter attached to a screen or global? */
- if (-1 == g_iLastScreen)
- {
- int j;
+ screenInfoPtr->dwRefreshRate = dwRefreshRate;
- /* Parameter is for all screens */
- for (j = 0; j < MAXSCREENS; j++)
- {
- g_ScreenInfo[j].dwRefreshRate = dwRefreshRate;
- }
- }
- else
- {
- /* Parameter is for a single screen */
- g_ScreenInfo[g_iLastScreen].dwRefreshRate = dwRefreshRate;
- }
-
/* Indicate that we have processed the argument */
return 2;
}
@@ -1076,23 +873,8 @@ ddxProcessArgument (int argc, char *argv[], int i)
/* Grab the argument */
dwNumBoxes = atoi (argv[i]);
- /* Is this parameter attached to a screen or global? */
- if (-1 == g_iLastScreen)
- {
- int j;
+ screenInfoPtr->dwClipUpdatesNBoxes = dwNumBoxes;
- /* Parameter is for all screens */
- for (j = 0; j < MAXSCREENS; j++)
- {
- g_ScreenInfo[j].dwClipUpdatesNBoxes = dwNumBoxes;
- }
- }
- else
- {
- /* Parameter is for a single screen */
- g_ScreenInfo[g_iLastScreen].dwClipUpdatesNBoxes = dwNumBoxes;
- }
-
/* Indicate that we have processed the argument */
return 2;
}
@@ -1103,22 +885,7 @@ ddxProcessArgument (int argc, char *argv[], int i)
*/
if (IS_OPTION ("-emulatepseudo"))
{
- /* Is this parameter attached to a screen or is it global? */
- if (-1 == g_iLastScreen)
- {
- int j;
-
- /* Parameter is for all screens */
- for (j = 0; j < MAXSCREENS; j++)
- {
- g_ScreenInfo[j].fEmulatePseudo = TRUE;
- }
- }
- else
- {
- /* Parameter is for a single screen */
- g_ScreenInfo[g_iLastScreen].fEmulatePseudo = TRUE;
- }
+ screenInfoPtr->fEmulatePseudo = TRUE;
/* Indicate that we have processed this argument */
return 1;
@@ -1130,22 +897,7 @@ ddxProcessArgument (int argc, char *argv[], int i)
*/
if (IS_OPTION ("-nowinkill"))
{
- /* Is this parameter attached to a screen or is it global? */
- if (-1 == g_iLastScreen)
- {
- int j;
-
- /* Parameter is for all screens */
- for (j = 0; j < MAXSCREENS; j++)
- {
- g_ScreenInfo[j].fUseWinKillKey = FALSE;
- }
- }
- else
- {
- /* Parameter is for a single screen */
- g_ScreenInfo[g_iLastScreen].fUseWinKillKey = FALSE;
- }
+ screenInfoPtr->fUseWinKillKey = FALSE;
/* Indicate that we have processed this argument */
return 1;
@@ -1156,22 +908,7 @@ ddxProcessArgument (int argc, char *argv[], int i)
*/
if (IS_OPTION ("-winkill"))
{
- /* Is this parameter attached to a screen or is it global? */
- if (-1 == g_iLastScreen)
- {
- int j;
-
- /* Parameter is for all screens */
- for (j = 0; j < MAXSCREENS; j++)
- {
- g_ScreenInfo[j].fUseWinKillKey = TRUE;
- }
- }
- else
- {
- /* Parameter is for a single screen */
- g_ScreenInfo[g_iLastScreen].fUseWinKillKey = TRUE;
- }
+ screenInfoPtr->fUseWinKillKey = TRUE;
/* Indicate that we have processed this argument */
return 1;
@@ -1182,22 +919,7 @@ ddxProcessArgument (int argc, char *argv[], int i)
*/
if (IS_OPTION ("-nounixkill"))
{
- /* Is this parameter attached to a screen or is it global? */
- if (-1 == g_iLastScreen)
- {
- int j;
-
- /* Parameter is for all screens */
- for (j = 0; j < MAXSCREENS; j++)
- {
- g_ScreenInfo[j].fUseUnixKillKey = FALSE;
- }
- }
- else
- {
- /* Parameter is for a single screen */
- g_ScreenInfo[g_iLastScreen].fUseUnixKillKey = FALSE;
- }
+ screenInfoPtr->fUseUnixKillKey = FALSE;
/* Indicate that we have processed this argument */
return 1;
@@ -1208,22 +930,7 @@ ddxProcessArgument (int argc, char *argv[], int i)
*/
if (IS_OPTION ("-unixkill"))
{
- /* Is this parameter attached to a screen or is it global? */
- if (-1 == g_iLastScreen)
- {
- int j;
-
- /* Parameter is for all screens */
- for (j = 0; j < MAXSCREENS; j++)
- {
- g_ScreenInfo[j].fUseUnixKillKey = TRUE;
- }
- }
- else
- {
- /* Parameter is for a single screen */
- g_ScreenInfo[g_iLastScreen].fUseUnixKillKey = TRUE;
- }
+ screenInfoPtr->fUseUnixKillKey = TRUE;
/* Indicate that we have processed this argument */
return 1;
@@ -1234,22 +941,7 @@ ddxProcessArgument (int argc, char *argv[], int i)
*/
if (IS_OPTION ("-notrayicon"))
{
- /* Is this parameter attached to a screen or is it global? */
- if (-1 == g_iLastScreen)
- {
- int j;
-
- /* Parameter is for all screens */
- for (j = 0; j < MAXSCREENS; j++)
- {
- g_ScreenInfo[j].fNoTrayIcon = TRUE;
- }
- }
- else
- {
- /* Parameter is for a single screen */
- g_ScreenInfo[g_iLastScreen].fNoTrayIcon = TRUE;
- }
+ screenInfoPtr->fNoTrayIcon = TRUE;
/* Indicate that we have processed this argument */
return 1;
@@ -1260,22 +952,7 @@ ddxProcessArgument (int argc, char *argv[], int i)
*/
if (IS_OPTION ("-trayicon"))
{
- /* Is this parameter attached to a screen or is it global? */
- if (-1 == g_iLastScreen)
- {
- int j;
-
- /* Parameter is for all screens */
- for (j = 0; j < MAXSCREENS; j++)
- {
- g_ScreenInfo[j].fNoTrayIcon = FALSE;
- }
- }
- else
- {
- /* Parameter is for a single screen */
- g_ScreenInfo[g_iLastScreen].fNoTrayIcon = FALSE;
- }
+ screenInfoPtr->fNoTrayIcon = FALSE;
/* Indicate that we have processed this argument */
return 1;
diff --git a/hw/xwin/winscrinit.c b/hw/xwin/winscrinit.c
index 953548ec7..4fa987cd9 100644
--- a/hw/xwin/winscrinit.c
+++ b/hw/xwin/winscrinit.c
@@ -196,7 +196,7 @@ winScreenInit (int index,
/*
* In this case, some of the defaults set in
- * winInitializeDefaultScreens () are not correct ...
+ * winInitializeScreenDefaults() are not correct ...
*/
if (!pScreenInfo->fUserGaveHeightAndWidth)
{