winprocarg.c revision 05b261ec
105b261ecSmrg/* 205b261ecSmrg 305b261ecSmrgCopyright 1993, 1998 The Open Group 405b261ecSmrg 505b261ecSmrgPermission to use, copy, modify, distribute, and sell this software and its 605b261ecSmrgdocumentation for any purpose is hereby granted without fee, provided that 705b261ecSmrgthe above copyright notice appear in all copies and that both that 805b261ecSmrgcopyright notice and this permission notice appear in supporting 905b261ecSmrgdocumentation. 1005b261ecSmrg 1105b261ecSmrgThe above copyright notice and this permission notice shall be included 1205b261ecSmrgin all copies or substantial portions of the Software. 1305b261ecSmrg 1405b261ecSmrgTHE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 1505b261ecSmrgOR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 1605b261ecSmrgMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 1705b261ecSmrgIN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR 1805b261ecSmrgOTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 1905b261ecSmrgARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 2005b261ecSmrgOTHER DEALINGS IN THE SOFTWARE. 2105b261ecSmrg 2205b261ecSmrgExcept as contained in this notice, the name of The Open Group shall 2305b261ecSmrgnot be used in advertising or otherwise to promote the sale, use or 2405b261ecSmrgother dealings in this Software without prior written authorization 2505b261ecSmrgfrom The Open Group. 2605b261ecSmrg 2705b261ecSmrg*/ 2805b261ecSmrg 2905b261ecSmrg#ifdef HAVE_XWIN_CONFIG_H 3005b261ecSmrg#include <xwin-config.h> 3105b261ecSmrg#endif 3205b261ecSmrg#ifdef XVENDORNAME 3305b261ecSmrg#define VENDOR_STRING XVENDORNAME 3405b261ecSmrg#define VERSION_STRING XORG_RELEASE 3505b261ecSmrg#define VENDOR_CONTACT BUILDERADDR 3605b261ecSmrg#endif 3705b261ecSmrg#include "win.h" 3805b261ecSmrg#include "winconfig.h" 3905b261ecSmrg#include "winprefs.h" 4005b261ecSmrg#include "winmsg.h" 4105b261ecSmrg 4205b261ecSmrg/* 4305b261ecSmrg * References to external symbols 4405b261ecSmrg */ 4505b261ecSmrg 4605b261ecSmrgextern int g_iNumScreens; 4705b261ecSmrgextern winScreenInfo g_ScreenInfo[]; 4805b261ecSmrgextern int g_iLastScreen; 4905b261ecSmrgextern Bool g_fInitializedDefaultScreens; 5005b261ecSmrg#ifdef XWIN_CLIPBOARD 5105b261ecSmrgextern Bool g_fUnicodeClipboard; 5205b261ecSmrgextern Bool g_fClipboard; 5305b261ecSmrg#endif 5405b261ecSmrgextern int g_iLogVerbose; 5505b261ecSmrgextern char * g_pszLogFile; 5605b261ecSmrg#ifdef RELOCATE_PROJECTROOT 5705b261ecSmrgextern Bool g_fLogFileChanged; 5805b261ecSmrg#endif 5905b261ecSmrgextern Bool g_fXdmcpEnabled; 6005b261ecSmrgextern char * g_pszCommandLine; 6105b261ecSmrgextern Bool g_fKeyboardHookLL; 6205b261ecSmrgextern Bool g_fNoHelpMessageBox; 6305b261ecSmrgextern Bool g_fSoftwareCursor; 6405b261ecSmrgextern Bool g_fSilentDupError; 6505b261ecSmrg 6605b261ecSmrg/* globals required by callback function for monitor information */ 6705b261ecSmrgstruct GetMonitorInfoData { 6805b261ecSmrg int requestedMonitor; 6905b261ecSmrg int monitorNum; 7005b261ecSmrg Bool bUserSpecifiedMonitor; 7105b261ecSmrg Bool bMonitorSpecifiedExists; 7205b261ecSmrg int monitorOffsetX; 7305b261ecSmrg int monitorOffsetY; 7405b261ecSmrg int monitorHeight; 7505b261ecSmrg int monitorWidth; 7605b261ecSmrg}; 7705b261ecSmrg 7805b261ecSmrgtypedef wBOOL (*ENUMDISPLAYMONITORSPROC)(HDC,LPCRECT,MONITORENUMPROC,LPARAM); 7905b261ecSmrgENUMDISPLAYMONITORSPROC _EnumDisplayMonitors; 8005b261ecSmrg 8105b261ecSmrgwBOOL CALLBACK getMonitorInfo(HMONITOR hMonitor, HDC hdc, LPRECT rect, LPARAM _data); 8205b261ecSmrg 8305b261ecSmrgstatic Bool QueryMonitor(int index, struct GetMonitorInfoData *data) 8405b261ecSmrg{ 8505b261ecSmrg /* Load EnumDisplayMonitors from DLL */ 8605b261ecSmrg HMODULE user32; 8705b261ecSmrg FARPROC func; 8805b261ecSmrg user32 = LoadLibrary("user32.dll"); 8905b261ecSmrg if (user32 == NULL) 9005b261ecSmrg { 9105b261ecSmrg winW32Error(2, "Could not open user32.dll"); 9205b261ecSmrg return FALSE; 9305b261ecSmrg } 9405b261ecSmrg func = GetProcAddress(user32, "EnumDisplayMonitors"); 9505b261ecSmrg if (func == NULL) 9605b261ecSmrg { 9705b261ecSmrg winW32Error(2, "Could not resolve EnumDisplayMonitors: "); 9805b261ecSmrg return FALSE; 9905b261ecSmrg } 10005b261ecSmrg _EnumDisplayMonitors = (ENUMDISPLAYMONITORSPROC)func; 10105b261ecSmrg 10205b261ecSmrg /* prepare data */ 10305b261ecSmrg if (data == NULL) 10405b261ecSmrg return FALSE; 10505b261ecSmrg memset(data, 0, sizeof(*data)); 10605b261ecSmrg data->requestedMonitor = index; 10705b261ecSmrg 10805b261ecSmrg /* query information */ 10905b261ecSmrg _EnumDisplayMonitors(NULL, NULL, getMonitorInfo, (LPARAM) data); 11005b261ecSmrg 11105b261ecSmrg /* cleanup */ 11205b261ecSmrg FreeLibrary(user32); 11305b261ecSmrg return TRUE; 11405b261ecSmrg} 11505b261ecSmrg 11605b261ecSmrg/* 11705b261ecSmrg * Function prototypes 11805b261ecSmrg */ 11905b261ecSmrg 12005b261ecSmrgvoid 12105b261ecSmrgwinLogCommandLine (int argc, char *argv[]); 12205b261ecSmrg 12305b261ecSmrgvoid 12405b261ecSmrgwinLogVersionInfo (void); 12505b261ecSmrg 12605b261ecSmrg#ifdef DDXOSVERRORF 12705b261ecSmrgvoid OsVendorVErrorF (const char *pszFormat, va_list va_args); 12805b261ecSmrg#endif 12905b261ecSmrg 13005b261ecSmrgvoid 13105b261ecSmrgwinInitializeDefaultScreens (void); 13205b261ecSmrg 13305b261ecSmrg/* 13405b261ecSmrg * Process arguments on the command line 13505b261ecSmrg */ 13605b261ecSmrg 13705b261ecSmrgvoid 13805b261ecSmrgwinInitializeDefaultScreens (void) 13905b261ecSmrg{ 14005b261ecSmrg int i; 14105b261ecSmrg DWORD dwWidth, dwHeight; 14205b261ecSmrg 14305b261ecSmrg /* Bail out early if default screens have already been initialized */ 14405b261ecSmrg if (g_fInitializedDefaultScreens) 14505b261ecSmrg return; 14605b261ecSmrg 14705b261ecSmrg /* Zero the memory used for storing the screen info */ 14805b261ecSmrg ZeroMemory (g_ScreenInfo, MAXSCREENS * sizeof (winScreenInfo)); 14905b261ecSmrg 15005b261ecSmrg /* Get default width and height */ 15105b261ecSmrg /* 15205b261ecSmrg * NOTE: These defaults will cause the window to cover only 15305b261ecSmrg * the primary monitor in the case that we have multiple monitors. 15405b261ecSmrg */ 15505b261ecSmrg dwWidth = GetSystemMetrics (SM_CXSCREEN); 15605b261ecSmrg dwHeight = GetSystemMetrics (SM_CYSCREEN); 15705b261ecSmrg 15805b261ecSmrg winErrorFVerb (2, "winInitializeDefaultScreens - w %d h %d\n", 15905b261ecSmrg (int) dwWidth, (int) dwHeight); 16005b261ecSmrg 16105b261ecSmrg /* Set a default DPI, if no parameter was passed */ 16205b261ecSmrg if (monitorResolution == 0) 16305b261ecSmrg monitorResolution = WIN_DEFAULT_DPI; 16405b261ecSmrg 16505b261ecSmrg for (i = 0; i < MAXSCREENS; ++i) 16605b261ecSmrg { 16705b261ecSmrg g_ScreenInfo[i].dwScreen = i; 16805b261ecSmrg g_ScreenInfo[i].dwWidth = dwWidth; 16905b261ecSmrg g_ScreenInfo[i].dwHeight = dwHeight; 17005b261ecSmrg g_ScreenInfo[i].dwUserWidth = dwWidth; 17105b261ecSmrg g_ScreenInfo[i].dwUserHeight = dwHeight; 17205b261ecSmrg g_ScreenInfo[i].fUserGaveHeightAndWidth 17305b261ecSmrg = WIN_DEFAULT_USER_GAVE_HEIGHT_AND_WIDTH; 17405b261ecSmrg g_ScreenInfo[i].fUserGavePosition = FALSE; 17505b261ecSmrg g_ScreenInfo[i].dwBPP = WIN_DEFAULT_BPP; 17605b261ecSmrg g_ScreenInfo[i].dwClipUpdatesNBoxes = WIN_DEFAULT_CLIP_UPDATES_NBOXES; 17705b261ecSmrg#ifdef XWIN_EMULATEPSEUDO 17805b261ecSmrg g_ScreenInfo[i].fEmulatePseudo = WIN_DEFAULT_EMULATE_PSEUDO; 17905b261ecSmrg#endif 18005b261ecSmrg g_ScreenInfo[i].dwRefreshRate = WIN_DEFAULT_REFRESH; 18105b261ecSmrg g_ScreenInfo[i].pfb = NULL; 18205b261ecSmrg g_ScreenInfo[i].fFullScreen = FALSE; 18305b261ecSmrg g_ScreenInfo[i].fDecoration = TRUE; 18405b261ecSmrg#ifdef XWIN_MULTIWINDOWEXTWM 18505b261ecSmrg g_ScreenInfo[i].fMWExtWM = FALSE; 18605b261ecSmrg g_ScreenInfo[i].fInternalWM = FALSE; 18705b261ecSmrg#endif 18805b261ecSmrg g_ScreenInfo[i].fRootless = FALSE; 18905b261ecSmrg#ifdef XWIN_MULTIWINDOW 19005b261ecSmrg g_ScreenInfo[i].fMultiWindow = FALSE; 19105b261ecSmrg#endif 19205b261ecSmrg#if defined(XWIN_MULTIWINDOW) || defined(XWIN_MULTIWINDOWEXTWM) 19305b261ecSmrg g_ScreenInfo[i].fMultiMonitorOverride = FALSE; 19405b261ecSmrg#endif 19505b261ecSmrg g_ScreenInfo[i].fMultipleMonitors = FALSE; 19605b261ecSmrg g_ScreenInfo[i].fLessPointer = FALSE; 19705b261ecSmrg g_ScreenInfo[i].fScrollbars = FALSE; 19805b261ecSmrg g_ScreenInfo[i].fNoTrayIcon = FALSE; 19905b261ecSmrg g_ScreenInfo[i].iE3BTimeout = WIN_E3B_OFF; 20005b261ecSmrg g_ScreenInfo[i].dwWidth_mm = (dwWidth / WIN_DEFAULT_DPI) 20105b261ecSmrg * 25.4; 20205b261ecSmrg g_ScreenInfo[i].dwHeight_mm = (dwHeight / WIN_DEFAULT_DPI) 20305b261ecSmrg * 25.4; 20405b261ecSmrg g_ScreenInfo[i].fUseWinKillKey = WIN_DEFAULT_WIN_KILL; 20505b261ecSmrg g_ScreenInfo[i].fUseUnixKillKey = WIN_DEFAULT_UNIX_KILL; 20605b261ecSmrg g_ScreenInfo[i].fIgnoreInput = FALSE; 20705b261ecSmrg g_ScreenInfo[i].fExplicitScreen = FALSE; 20805b261ecSmrg } 20905b261ecSmrg 21005b261ecSmrg /* Signal that the default screens have been initialized */ 21105b261ecSmrg g_fInitializedDefaultScreens = TRUE; 21205b261ecSmrg 21305b261ecSmrg winErrorFVerb (2, "winInitializeDefaultScreens - Returning\n"); 21405b261ecSmrg} 21505b261ecSmrg 21605b261ecSmrg/* See Porting Layer Definition - p. 57 */ 21705b261ecSmrg/* 21805b261ecSmrg * INPUT 21905b261ecSmrg * argv: pointer to an array of null-terminated strings, one for 22005b261ecSmrg * each token in the X Server command line; the first token 22105b261ecSmrg * is 'XWin.exe', or similar. 22205b261ecSmrg * argc: a count of the number of tokens stored in argv. 22305b261ecSmrg * i: a zero-based index into argv indicating the current token being 22405b261ecSmrg * processed. 22505b261ecSmrg * 22605b261ecSmrg * OUTPUT 22705b261ecSmrg * return: return the number of tokens processed correctly. 22805b261ecSmrg * 22905b261ecSmrg * NOTE 23005b261ecSmrg * When looking for n tokens, check that i + n is less than argc. Or, 23105b261ecSmrg * you may check if i is greater than or equal to argc, in which case 23205b261ecSmrg * you should display the UseMsg () and return 0. 23305b261ecSmrg */ 23405b261ecSmrg 23505b261ecSmrg/* Check if enough arguments are given for the option */ 23605b261ecSmrg#define CHECK_ARGS(count) if (i + count >= argc) { UseMsg (); return 0; } 23705b261ecSmrg 23805b261ecSmrg/* Compare the current option with the string. */ 23905b261ecSmrg#define IS_OPTION(name) (strcmp (argv[i], name) == 0) 24005b261ecSmrg 24105b261ecSmrgint 24205b261ecSmrgddxProcessArgument (int argc, char *argv[], int i) 24305b261ecSmrg{ 24405b261ecSmrg static Bool s_fBeenHere = FALSE; 24505b261ecSmrg 24605b261ecSmrg /* Initialize once */ 24705b261ecSmrg if (!s_fBeenHere) 24805b261ecSmrg { 24905b261ecSmrg#ifdef DDXOSVERRORF 25005b261ecSmrg /* 25105b261ecSmrg * This initialises our hook into VErrorF () for catching log messages 25205b261ecSmrg * that are generated before OsInit () is called. 25305b261ecSmrg */ 25405b261ecSmrg OsVendorVErrorFProc = OsVendorVErrorF; 25505b261ecSmrg#endif 25605b261ecSmrg 25705b261ecSmrg s_fBeenHere = TRUE; 25805b261ecSmrg 25905b261ecSmrg /* Initialize only if option is not -help */ 26005b261ecSmrg if (!IS_OPTION("-help") && !IS_OPTION("-h") && !IS_OPTION("--help") && 26105b261ecSmrg !IS_OPTION("-version") && !IS_OPTION("--version")) 26205b261ecSmrg { 26305b261ecSmrg 26405b261ecSmrg /* Log the version information */ 26505b261ecSmrg winLogVersionInfo (); 26605b261ecSmrg 26705b261ecSmrg /* Log the command line */ 26805b261ecSmrg winLogCommandLine (argc, argv); 26905b261ecSmrg 27005b261ecSmrg /* 27105b261ecSmrg * Initialize default screen settings. We have to do this before 27205b261ecSmrg * OsVendorInit () gets called, otherwise we will overwrite 27305b261ecSmrg * settings changed by parameters such as -fullscreen, etc. 27405b261ecSmrg */ 27505b261ecSmrg winErrorFVerb (2, "ddxProcessArgument - Initializing default " 27605b261ecSmrg "screens\n"); 27705b261ecSmrg winInitializeDefaultScreens (); 27805b261ecSmrg } 27905b261ecSmrg } 28005b261ecSmrg 28105b261ecSmrg#if CYGDEBUG 28205b261ecSmrg winDebug ("ddxProcessArgument - arg: %s\n", argv[i]); 28305b261ecSmrg#endif 28405b261ecSmrg 28505b261ecSmrg /* 28605b261ecSmrg * Look for the '-help' and similar options 28705b261ecSmrg */ 28805b261ecSmrg if (IS_OPTION ("-help") || IS_OPTION("-h") || IS_OPTION("--help")) 28905b261ecSmrg { 29005b261ecSmrg /* Reset logfile. We don't need that helpmessage in the logfile */ 29105b261ecSmrg g_pszLogFile = NULL; 29205b261ecSmrg g_fNoHelpMessageBox = TRUE; 29305b261ecSmrg UseMsg(); 29405b261ecSmrg exit (0); 29505b261ecSmrg return 1; 29605b261ecSmrg } 29705b261ecSmrg 29805b261ecSmrg if (IS_OPTION ("-version") || IS_OPTION("--version")) 29905b261ecSmrg { 30005b261ecSmrg /* Reset logfile. We don't need that versioninfo in the logfile */ 30105b261ecSmrg g_pszLogFile = NULL; 30205b261ecSmrg winLogVersionInfo (); 30305b261ecSmrg exit (0); 30405b261ecSmrg return 1; 30505b261ecSmrg } 30605b261ecSmrg 30705b261ecSmrg /* 30805b261ecSmrg * Look for the '-screen scr_num [width height]' argument 30905b261ecSmrg */ 31005b261ecSmrg if (IS_OPTION ("-screen")) 31105b261ecSmrg { 31205b261ecSmrg int iArgsProcessed = 1; 31305b261ecSmrg int nScreenNum; 31405b261ecSmrg int iWidth, iHeight, iX, iY; 31505b261ecSmrg int iMonitor; 31605b261ecSmrg 31705b261ecSmrg#if CYGDEBUG 31805b261ecSmrg winDebug ("ddxProcessArgument - screen - argc: %d i: %d\n", 31905b261ecSmrg argc, i); 32005b261ecSmrg#endif 32105b261ecSmrg 32205b261ecSmrg /* Display the usage message if the argument is malformed */ 32305b261ecSmrg if (i + 1 >= argc) 32405b261ecSmrg { 32505b261ecSmrg return 0; 32605b261ecSmrg } 32705b261ecSmrg 32805b261ecSmrg /* Grab screen number */ 32905b261ecSmrg nScreenNum = atoi (argv[i + 1]); 33005b261ecSmrg 33105b261ecSmrg /* Validate the specified screen number */ 33205b261ecSmrg if (nScreenNum < 0 || nScreenNum >= MAXSCREENS) 33305b261ecSmrg { 33405b261ecSmrg ErrorF ("ddxProcessArgument - screen - Invalid screen number %d\n", 33505b261ecSmrg nScreenNum); 33605b261ecSmrg UseMsg (); 33705b261ecSmrg return 0; 33805b261ecSmrg } 33905b261ecSmrg 34005b261ecSmrg /* look for @m where m is monitor number */ 34105b261ecSmrg if (i + 2 < argc 34205b261ecSmrg && 1 == sscanf(argv[i + 2], "@%d", (int *) &iMonitor)) 34305b261ecSmrg { 34405b261ecSmrg struct GetMonitorInfoData data; 34505b261ecSmrg if (!QueryMonitor(iMonitor, &data)) 34605b261ecSmrg { 34705b261ecSmrg ErrorF ("ddxProcessArgument - screen - " 34805b261ecSmrg "Querying monitors is not supported on NT4 and Win95\n"); 34905b261ecSmrg } else if (data.bMonitorSpecifiedExists == TRUE) 35005b261ecSmrg { 35105b261ecSmrg winErrorFVerb(2, "ddxProcessArgument - screen - Found Valid ``@Monitor'' = %d arg\n", iMonitor); 35205b261ecSmrg iArgsProcessed = 3; 35305b261ecSmrg g_ScreenInfo[nScreenNum].fUserGaveHeightAndWidth = FALSE; 35405b261ecSmrg g_ScreenInfo[nScreenNum].fUserGavePosition = TRUE; 35505b261ecSmrg g_ScreenInfo[nScreenNum].dwWidth = data.monitorWidth; 35605b261ecSmrg g_ScreenInfo[nScreenNum].dwHeight = data.monitorHeight; 35705b261ecSmrg g_ScreenInfo[nScreenNum].dwUserWidth = data.monitorWidth; 35805b261ecSmrg g_ScreenInfo[nScreenNum].dwUserHeight = data.monitorHeight; 35905b261ecSmrg g_ScreenInfo[nScreenNum].dwInitialX = data.monitorOffsetX; 36005b261ecSmrg g_ScreenInfo[nScreenNum].dwInitialY = data.monitorOffsetY; 36105b261ecSmrg } 36205b261ecSmrg else 36305b261ecSmrg { 36405b261ecSmrg /* monitor does not exist, error out */ 36505b261ecSmrg ErrorF ("ddxProcessArgument - screen - Invalid monitor number %d\n", 36605b261ecSmrg iMonitor); 36705b261ecSmrg UseMsg (); 36805b261ecSmrg exit (0); 36905b261ecSmrg return 0; 37005b261ecSmrg } 37105b261ecSmrg } 37205b261ecSmrg 37305b261ecSmrg /* Look for 'WxD' or 'W D' */ 37405b261ecSmrg else if (i + 2 < argc 37505b261ecSmrg && 2 == sscanf (argv[i + 2], "%dx%d", 37605b261ecSmrg (int *) &iWidth, 37705b261ecSmrg (int *) &iHeight)) 37805b261ecSmrg { 37905b261ecSmrg winErrorFVerb (2, "ddxProcessArgument - screen - Found ``WxD'' arg\n"); 38005b261ecSmrg iArgsProcessed = 3; 38105b261ecSmrg g_ScreenInfo[nScreenNum].fUserGaveHeightAndWidth = TRUE; 38205b261ecSmrg g_ScreenInfo[nScreenNum].dwWidth = iWidth; 38305b261ecSmrg g_ScreenInfo[nScreenNum].dwHeight = iHeight; 38405b261ecSmrg g_ScreenInfo[nScreenNum].dwUserWidth = iWidth; 38505b261ecSmrg g_ScreenInfo[nScreenNum].dwUserHeight = iHeight; 38605b261ecSmrg /* Look for WxD+X+Y */ 38705b261ecSmrg if (2 == sscanf (argv[i + 2], "%*dx%*d+%d+%d", 38805b261ecSmrg (int *) &iX, 38905b261ecSmrg (int *) &iY)) 39005b261ecSmrg { 39105b261ecSmrg winErrorFVerb (2, "ddxProcessArgument - screen - Found ``X+Y'' arg\n"); 39205b261ecSmrg g_ScreenInfo[nScreenNum].fUserGavePosition = TRUE; 39305b261ecSmrg g_ScreenInfo[nScreenNum].dwInitialX = iX; 39405b261ecSmrg g_ScreenInfo[nScreenNum].dwInitialY = iY; 39505b261ecSmrg 39605b261ecSmrg /* look for WxD+X+Y@m where m is monitor number. take X,Y to be offsets from monitor's root position */ 39705b261ecSmrg if (1 == sscanf (argv[i + 2], "%*dx%*d+%*d+%*d@%d", 39805b261ecSmrg (int *) &iMonitor)) 39905b261ecSmrg { 40005b261ecSmrg struct GetMonitorInfoData data; 40105b261ecSmrg if (!QueryMonitor(iMonitor, &data)) 40205b261ecSmrg { 40305b261ecSmrg ErrorF ("ddxProcessArgument - screen - " 40405b261ecSmrg "Querying monitors is not supported on NT4 and Win95\n"); 40505b261ecSmrg } else if (data.bMonitorSpecifiedExists == TRUE) 40605b261ecSmrg { 40705b261ecSmrg g_ScreenInfo[nScreenNum].dwInitialX += data.monitorOffsetX; 40805b261ecSmrg g_ScreenInfo[nScreenNum].dwInitialY += data.monitorOffsetY; 40905b261ecSmrg } 41005b261ecSmrg else 41105b261ecSmrg { 41205b261ecSmrg /* monitor does not exist, error out */ 41305b261ecSmrg ErrorF ("ddxProcessArgument - screen - Invalid monitor number %d\n", 41405b261ecSmrg iMonitor); 41505b261ecSmrg UseMsg (); 41605b261ecSmrg exit (0); 41705b261ecSmrg return 0; 41805b261ecSmrg } 41905b261ecSmrg 42005b261ecSmrg } 42105b261ecSmrg } 42205b261ecSmrg 42305b261ecSmrg /* look for WxD@m where m is monitor number */ 42405b261ecSmrg else if (1 == sscanf(argv[i + 2], "%*dx%*d@%d", 42505b261ecSmrg (int *) &iMonitor)) 42605b261ecSmrg { 42705b261ecSmrg struct GetMonitorInfoData data; 42805b261ecSmrg if (!QueryMonitor(iMonitor, &data)) 42905b261ecSmrg { 43005b261ecSmrg ErrorF ("ddxProcessArgument - screen - " 43105b261ecSmrg "Querying monitors is not supported on NT4 and Win95\n"); 43205b261ecSmrg } else if (data.bMonitorSpecifiedExists == TRUE) 43305b261ecSmrg { 43405b261ecSmrg winErrorFVerb (2, "ddxProcessArgument - screen - Found Valid ``@Monitor'' = %d arg\n", iMonitor); 43505b261ecSmrg g_ScreenInfo[nScreenNum].fUserGavePosition = TRUE; 43605b261ecSmrg g_ScreenInfo[nScreenNum].dwInitialX = data.monitorOffsetX; 43705b261ecSmrg g_ScreenInfo[nScreenNum].dwInitialY = data.monitorOffsetY; 43805b261ecSmrg } 43905b261ecSmrg else 44005b261ecSmrg { 44105b261ecSmrg /* monitor does not exist, error out */ 44205b261ecSmrg ErrorF ("ddxProcessArgument - screen - Invalid monitor number %d\n", 44305b261ecSmrg iMonitor); 44405b261ecSmrg UseMsg (); 44505b261ecSmrg exit (0); 44605b261ecSmrg return 0; 44705b261ecSmrg } 44805b261ecSmrg 44905b261ecSmrg } 45005b261ecSmrg } 45105b261ecSmrg else if (i + 3 < argc 45205b261ecSmrg && 1 == sscanf (argv[i + 2], "%d", 45305b261ecSmrg (int *) &iWidth) 45405b261ecSmrg && 1 == sscanf (argv[i + 3], "%d", 45505b261ecSmrg (int *) &iHeight)) 45605b261ecSmrg { 45705b261ecSmrg winErrorFVerb (2, "ddxProcessArgument - screen - Found ``W D'' arg\n"); 45805b261ecSmrg iArgsProcessed = 4; 45905b261ecSmrg g_ScreenInfo[nScreenNum].fUserGaveHeightAndWidth = TRUE; 46005b261ecSmrg g_ScreenInfo[nScreenNum].dwWidth = iWidth; 46105b261ecSmrg g_ScreenInfo[nScreenNum].dwHeight = iHeight; 46205b261ecSmrg g_ScreenInfo[nScreenNum].dwUserWidth = iWidth; 46305b261ecSmrg g_ScreenInfo[nScreenNum].dwUserHeight = iHeight; 46405b261ecSmrg if (i + 5 < argc 46505b261ecSmrg && 1 == sscanf (argv[i + 4], "%d", 46605b261ecSmrg (int *) &iX) 46705b261ecSmrg && 1 == sscanf (argv[i + 5], "%d", 46805b261ecSmrg (int *) &iY)) 46905b261ecSmrg { 47005b261ecSmrg winErrorFVerb (2, "ddxProcessArgument - screen - Found ``X Y'' arg\n"); 47105b261ecSmrg iArgsProcessed = 6; 47205b261ecSmrg g_ScreenInfo[nScreenNum].fUserGavePosition = TRUE; 47305b261ecSmrg g_ScreenInfo[nScreenNum].dwInitialX = iX; 47405b261ecSmrg g_ScreenInfo[nScreenNum].dwInitialY = iY; 47505b261ecSmrg } 47605b261ecSmrg } 47705b261ecSmrg else 47805b261ecSmrg { 47905b261ecSmrg winErrorFVerb (2, "ddxProcessArgument - screen - Did not find size arg. " 48005b261ecSmrg "dwWidth: %d dwHeight: %d\n", 48105b261ecSmrg (int) g_ScreenInfo[nScreenNum].dwWidth, 48205b261ecSmrg (int) g_ScreenInfo[nScreenNum].dwHeight); 48305b261ecSmrg iArgsProcessed = 2; 48405b261ecSmrg g_ScreenInfo[nScreenNum].fUserGaveHeightAndWidth = FALSE; 48505b261ecSmrg } 48605b261ecSmrg 48705b261ecSmrg /* Calculate the screen width and height in millimeters */ 48805b261ecSmrg if (g_ScreenInfo[nScreenNum].fUserGaveHeightAndWidth) 48905b261ecSmrg { 49005b261ecSmrg g_ScreenInfo[nScreenNum].dwWidth_mm 49105b261ecSmrg = (g_ScreenInfo[nScreenNum].dwWidth 49205b261ecSmrg / monitorResolution) * 25.4; 49305b261ecSmrg g_ScreenInfo[nScreenNum].dwHeight_mm 49405b261ecSmrg = (g_ScreenInfo[nScreenNum].dwHeight 49505b261ecSmrg / monitorResolution) * 25.4; 49605b261ecSmrg } 49705b261ecSmrg 49805b261ecSmrg /* Flag that this screen was explicity specified by the user */ 49905b261ecSmrg g_ScreenInfo[nScreenNum].fExplicitScreen = TRUE; 50005b261ecSmrg 50105b261ecSmrg /* 50205b261ecSmrg * Keep track of the last screen number seen, as parameters seen 50305b261ecSmrg * before a screen number apply to all screens, whereas parameters 50405b261ecSmrg * seen after a screen number apply to that screen number only. 50505b261ecSmrg */ 50605b261ecSmrg g_iLastScreen = nScreenNum; 50705b261ecSmrg 50805b261ecSmrg /* Keep a count of the number of screens */ 50905b261ecSmrg ++g_iNumScreens; 51005b261ecSmrg 51105b261ecSmrg return iArgsProcessed; 51205b261ecSmrg } 51305b261ecSmrg 51405b261ecSmrg /* 51505b261ecSmrg * Look for the '-engine n' argument 51605b261ecSmrg */ 51705b261ecSmrg if (IS_OPTION ("-engine")) 51805b261ecSmrg { 51905b261ecSmrg DWORD dwEngine = 0; 52005b261ecSmrg CARD8 c8OnBits = 0; 52105b261ecSmrg 52205b261ecSmrg /* Display the usage message if the argument is malformed */ 52305b261ecSmrg if (++i >= argc) 52405b261ecSmrg { 52505b261ecSmrg UseMsg (); 52605b261ecSmrg return 0; 52705b261ecSmrg } 52805b261ecSmrg 52905b261ecSmrg /* Grab the argument */ 53005b261ecSmrg dwEngine = atoi (argv[i]); 53105b261ecSmrg 53205b261ecSmrg /* Count the one bits in the engine argument */ 53305b261ecSmrg c8OnBits = winCountBits (dwEngine); 53405b261ecSmrg 53505b261ecSmrg /* Argument should only have a single bit on */ 53605b261ecSmrg if (c8OnBits != 1) 53705b261ecSmrg { 53805b261ecSmrg UseMsg (); 53905b261ecSmrg return 0; 54005b261ecSmrg } 54105b261ecSmrg 54205b261ecSmrg /* Is this parameter attached to a screen or global? */ 54305b261ecSmrg if (-1 == g_iLastScreen) 54405b261ecSmrg { 54505b261ecSmrg int j; 54605b261ecSmrg 54705b261ecSmrg /* Parameter is for all screens */ 54805b261ecSmrg for (j = 0; j < MAXSCREENS; j++) 54905b261ecSmrg { 55005b261ecSmrg g_ScreenInfo[j].dwEnginePreferred = dwEngine; 55105b261ecSmrg } 55205b261ecSmrg } 55305b261ecSmrg else 55405b261ecSmrg { 55505b261ecSmrg /* Parameter is for a single screen */ 55605b261ecSmrg g_ScreenInfo[g_iLastScreen].dwEnginePreferred = dwEngine; 55705b261ecSmrg } 55805b261ecSmrg 55905b261ecSmrg /* Indicate that we have processed the argument */ 56005b261ecSmrg return 2; 56105b261ecSmrg } 56205b261ecSmrg 56305b261ecSmrg /* 56405b261ecSmrg * Look for the '-fullscreen' argument 56505b261ecSmrg */ 56605b261ecSmrg if (IS_OPTION ("-fullscreen")) 56705b261ecSmrg { 56805b261ecSmrg /* Is this parameter attached to a screen or is it global? */ 56905b261ecSmrg if (-1 == g_iLastScreen) 57005b261ecSmrg { 57105b261ecSmrg int j; 57205b261ecSmrg 57305b261ecSmrg /* Parameter is for all screens */ 57405b261ecSmrg for (j = 0; j < MAXSCREENS; j++) 57505b261ecSmrg { 57605b261ecSmrg#if defined(XWIN_MULTIWINDOW) || defined(XWIN_MULTIWINDOWEXTWM) 57705b261ecSmrg if (!g_ScreenInfo[j].fMultiMonitorOverride) 57805b261ecSmrg g_ScreenInfo[j].fMultipleMonitors = FALSE; 57905b261ecSmrg#endif 58005b261ecSmrg g_ScreenInfo[j].fFullScreen = TRUE; 58105b261ecSmrg } 58205b261ecSmrg } 58305b261ecSmrg else 58405b261ecSmrg { 58505b261ecSmrg /* Parameter is for a single screen */ 58605b261ecSmrg#if defined(XWIN_MULTIWINDOW) || defined(XWIN_MULTIWINDOWEXTWM) 58705b261ecSmrg if (!g_ScreenInfo[g_iLastScreen].fMultiMonitorOverride) 58805b261ecSmrg g_ScreenInfo[g_iLastScreen].fMultipleMonitors = FALSE; 58905b261ecSmrg#endif 59005b261ecSmrg g_ScreenInfo[g_iLastScreen].fFullScreen = TRUE; 59105b261ecSmrg } 59205b261ecSmrg 59305b261ecSmrg /* Indicate that we have processed this argument */ 59405b261ecSmrg return 1; 59505b261ecSmrg } 59605b261ecSmrg 59705b261ecSmrg /* 59805b261ecSmrg * Look for the '-lesspointer' argument 59905b261ecSmrg */ 60005b261ecSmrg if (IS_OPTION ("-lesspointer")) 60105b261ecSmrg { 60205b261ecSmrg /* Is this parameter attached to a screen or is it global? */ 60305b261ecSmrg if (-1 == g_iLastScreen) 60405b261ecSmrg { 60505b261ecSmrg int j; 60605b261ecSmrg 60705b261ecSmrg /* Parameter is for all screens */ 60805b261ecSmrg for (j = 0; j < MAXSCREENS; j++) 60905b261ecSmrg { 61005b261ecSmrg g_ScreenInfo[j].fLessPointer = TRUE; 61105b261ecSmrg } 61205b261ecSmrg } 61305b261ecSmrg else 61405b261ecSmrg { 61505b261ecSmrg /* Parameter is for a single screen */ 61605b261ecSmrg g_ScreenInfo[g_iLastScreen].fLessPointer = TRUE; 61705b261ecSmrg } 61805b261ecSmrg 61905b261ecSmrg /* Indicate that we have processed this argument */ 62005b261ecSmrg return 1; 62105b261ecSmrg } 62205b261ecSmrg 62305b261ecSmrg /* 62405b261ecSmrg * Look for the '-nodecoration' argument 62505b261ecSmrg */ 62605b261ecSmrg if (IS_OPTION ("-nodecoration")) 62705b261ecSmrg { 62805b261ecSmrg /* Is this parameter attached to a screen or is it global? */ 62905b261ecSmrg if (-1 == g_iLastScreen) 63005b261ecSmrg { 63105b261ecSmrg int j; 63205b261ecSmrg 63305b261ecSmrg /* Parameter is for all screens */ 63405b261ecSmrg for (j = 0; j < MAXSCREENS; j++) 63505b261ecSmrg { 63605b261ecSmrg#if defined(XWIN_MULTIWINDOW) || defined(XWIN_MULTIWINDOWEXTWM) 63705b261ecSmrg if (!g_ScreenInfo[j].fMultiMonitorOverride) 63805b261ecSmrg g_ScreenInfo[j].fMultipleMonitors = FALSE; 63905b261ecSmrg#endif 64005b261ecSmrg g_ScreenInfo[j].fDecoration = FALSE; 64105b261ecSmrg } 64205b261ecSmrg } 64305b261ecSmrg else 64405b261ecSmrg { 64505b261ecSmrg /* Parameter is for a single screen */ 64605b261ecSmrg#if defined(XWIN_MULTIWINDOW) || defined(XWIN_MULTIWINDOWEXTWM) 64705b261ecSmrg if (!g_ScreenInfo[g_iLastScreen].fMultiMonitorOverride) 64805b261ecSmrg g_ScreenInfo[g_iLastScreen].fMultipleMonitors = FALSE; 64905b261ecSmrg#endif 65005b261ecSmrg g_ScreenInfo[g_iLastScreen].fDecoration = FALSE; 65105b261ecSmrg } 65205b261ecSmrg 65305b261ecSmrg /* Indicate that we have processed this argument */ 65405b261ecSmrg return 1; 65505b261ecSmrg } 65605b261ecSmrg 65705b261ecSmrg#ifdef XWIN_MULTIWINDOWEXTWM 65805b261ecSmrg /* 65905b261ecSmrg * Look for the '-mwextwm' argument 66005b261ecSmrg */ 66105b261ecSmrg if (IS_OPTION ("-mwextwm")) 66205b261ecSmrg { 66305b261ecSmrg /* Is this parameter attached to a screen or is it global? */ 66405b261ecSmrg if (-1 == g_iLastScreen) 66505b261ecSmrg { 66605b261ecSmrg int j; 66705b261ecSmrg 66805b261ecSmrg /* Parameter is for all screens */ 66905b261ecSmrg for (j = 0; j < MAXSCREENS; j++) 67005b261ecSmrg { 67105b261ecSmrg if (!g_ScreenInfo[j].fMultiMonitorOverride) 67205b261ecSmrg g_ScreenInfo[j].fMultipleMonitors = TRUE; 67305b261ecSmrg g_ScreenInfo[j].fMWExtWM = TRUE; 67405b261ecSmrg } 67505b261ecSmrg } 67605b261ecSmrg else 67705b261ecSmrg { 67805b261ecSmrg /* Parameter is for a single screen */ 67905b261ecSmrg if (!g_ScreenInfo[g_iLastScreen].fMultiMonitorOverride) 68005b261ecSmrg g_ScreenInfo[g_iLastScreen].fMultipleMonitors = TRUE; 68105b261ecSmrg g_ScreenInfo[g_iLastScreen].fMWExtWM = TRUE; 68205b261ecSmrg } 68305b261ecSmrg 68405b261ecSmrg /* Indicate that we have processed this argument */ 68505b261ecSmrg return 1; 68605b261ecSmrg } 68705b261ecSmrg /* 68805b261ecSmrg * Look for the '-internalwm' argument 68905b261ecSmrg */ 69005b261ecSmrg if (IS_OPTION ("-internalwm")) 69105b261ecSmrg { 69205b261ecSmrg /* Is this parameter attached to a screen or is it global? */ 69305b261ecSmrg if (-1 == g_iLastScreen) 69405b261ecSmrg { 69505b261ecSmrg int j; 69605b261ecSmrg 69705b261ecSmrg /* Parameter is for all screens */ 69805b261ecSmrg for (j = 0; j < MAXSCREENS; j++) 69905b261ecSmrg { 70005b261ecSmrg if (!g_ScreenInfo[j].fMultiMonitorOverride) 70105b261ecSmrg g_ScreenInfo[j].fMultipleMonitors = TRUE; 70205b261ecSmrg g_ScreenInfo[j].fMWExtWM = TRUE; 70305b261ecSmrg g_ScreenInfo[j].fInternalWM = TRUE; 70405b261ecSmrg } 70505b261ecSmrg } 70605b261ecSmrg else 70705b261ecSmrg { 70805b261ecSmrg /* Parameter is for a single screen */ 70905b261ecSmrg if (!g_ScreenInfo[g_iLastScreen].fMultiMonitorOverride) 71005b261ecSmrg g_ScreenInfo[g_iLastScreen].fMultipleMonitors = TRUE; 71105b261ecSmrg g_ScreenInfo[g_iLastScreen].fMWExtWM = TRUE; 71205b261ecSmrg g_ScreenInfo[g_iLastScreen].fInternalWM = TRUE; 71305b261ecSmrg } 71405b261ecSmrg 71505b261ecSmrg /* Indicate that we have processed this argument */ 71605b261ecSmrg return 1; 71705b261ecSmrg } 71805b261ecSmrg#endif 71905b261ecSmrg 72005b261ecSmrg /* 72105b261ecSmrg * Look for the '-rootless' argument 72205b261ecSmrg */ 72305b261ecSmrg if (IS_OPTION ("-rootless")) 72405b261ecSmrg { 72505b261ecSmrg /* Is this parameter attached to a screen or is it global? */ 72605b261ecSmrg if (-1 == g_iLastScreen) 72705b261ecSmrg { 72805b261ecSmrg int j; 72905b261ecSmrg 73005b261ecSmrg /* Parameter is for all screens */ 73105b261ecSmrg for (j = 0; j < MAXSCREENS; j++) 73205b261ecSmrg { 73305b261ecSmrg#if defined(XWIN_MULTIWINDOW) || defined(XWIN_MULTIWINDOWEXTWM) 73405b261ecSmrg if (!g_ScreenInfo[j].fMultiMonitorOverride) 73505b261ecSmrg g_ScreenInfo[j].fMultipleMonitors = FALSE; 73605b261ecSmrg#endif 73705b261ecSmrg g_ScreenInfo[j].fRootless = TRUE; 73805b261ecSmrg } 73905b261ecSmrg } 74005b261ecSmrg else 74105b261ecSmrg { 74205b261ecSmrg /* Parameter is for a single screen */ 74305b261ecSmrg#if defined(XWIN_MULTIWINDOW) || defined(XWIN_MULTIWINDOWEXTWM) 74405b261ecSmrg if (!g_ScreenInfo[g_iLastScreen].fMultiMonitorOverride) 74505b261ecSmrg g_ScreenInfo[g_iLastScreen].fMultipleMonitors = FALSE; 74605b261ecSmrg#endif 74705b261ecSmrg g_ScreenInfo[g_iLastScreen].fRootless = TRUE; 74805b261ecSmrg } 74905b261ecSmrg 75005b261ecSmrg /* Indicate that we have processed this argument */ 75105b261ecSmrg return 1; 75205b261ecSmrg } 75305b261ecSmrg 75405b261ecSmrg#ifdef XWIN_MULTIWINDOW 75505b261ecSmrg /* 75605b261ecSmrg * Look for the '-multiwindow' argument 75705b261ecSmrg */ 75805b261ecSmrg if (IS_OPTION ("-multiwindow")) 75905b261ecSmrg { 76005b261ecSmrg /* Is this parameter attached to a screen or is it global? */ 76105b261ecSmrg if (-1 == g_iLastScreen) 76205b261ecSmrg { 76305b261ecSmrg int j; 76405b261ecSmrg 76505b261ecSmrg /* Parameter is for all screens */ 76605b261ecSmrg for (j = 0; j < MAXSCREENS; j++) 76705b261ecSmrg { 76805b261ecSmrg#if defined(XWIN_MULTIWINDOW) || defined(XWIN_MULTIWINDOWEXTWM) 76905b261ecSmrg if (!g_ScreenInfo[j].fMultiMonitorOverride) 77005b261ecSmrg g_ScreenInfo[j].fMultipleMonitors = TRUE; 77105b261ecSmrg#endif 77205b261ecSmrg g_ScreenInfo[j].fMultiWindow = TRUE; 77305b261ecSmrg } 77405b261ecSmrg } 77505b261ecSmrg else 77605b261ecSmrg { 77705b261ecSmrg /* Parameter is for a single screen */ 77805b261ecSmrg#if defined(XWIN_MULTIWINDOW) || defined(XWIN_MULTIWINDOWEXTWM) 77905b261ecSmrg if (!g_ScreenInfo[g_iLastScreen].fMultiMonitorOverride) 78005b261ecSmrg g_ScreenInfo[g_iLastScreen].fMultipleMonitors = TRUE; 78105b261ecSmrg#endif 78205b261ecSmrg g_ScreenInfo[g_iLastScreen].fMultiWindow = TRUE; 78305b261ecSmrg } 78405b261ecSmrg 78505b261ecSmrg /* Indicate that we have processed this argument */ 78605b261ecSmrg return 1; 78705b261ecSmrg } 78805b261ecSmrg#endif 78905b261ecSmrg 79005b261ecSmrg /* 79105b261ecSmrg * Look for the '-multiplemonitors' argument 79205b261ecSmrg */ 79305b261ecSmrg if (IS_OPTION ("-multiplemonitors") 79405b261ecSmrg || IS_OPTION ("-multimonitors")) 79505b261ecSmrg { 79605b261ecSmrg /* Is this parameter attached to a screen or is it global? */ 79705b261ecSmrg if (-1 == g_iLastScreen) 79805b261ecSmrg { 79905b261ecSmrg int j; 80005b261ecSmrg 80105b261ecSmrg /* Parameter is for all screens */ 80205b261ecSmrg for (j = 0; j < MAXSCREENS; j++) 80305b261ecSmrg { 80405b261ecSmrg#if defined(XWIN_MULTIWINDOW) || defined(XWIN_MULTIWINDOWEXTWM) 80505b261ecSmrg g_ScreenInfo[j].fMultiMonitorOverride = TRUE; 80605b261ecSmrg#endif 80705b261ecSmrg g_ScreenInfo[j].fMultipleMonitors = TRUE; 80805b261ecSmrg } 80905b261ecSmrg } 81005b261ecSmrg else 81105b261ecSmrg { 81205b261ecSmrg /* Parameter is for a single screen */ 81305b261ecSmrg#if defined(XWIN_MULTIWINDOW) || defined(XWIN_MULTIWINDOWEXTWM) 81405b261ecSmrg g_ScreenInfo[g_iLastScreen].fMultiMonitorOverride = TRUE; 81505b261ecSmrg#endif 81605b261ecSmrg g_ScreenInfo[g_iLastScreen].fMultipleMonitors = TRUE; 81705b261ecSmrg } 81805b261ecSmrg 81905b261ecSmrg /* Indicate that we have processed this argument */ 82005b261ecSmrg return 1; 82105b261ecSmrg } 82205b261ecSmrg 82305b261ecSmrg /* 82405b261ecSmrg * Look for the '-nomultiplemonitors' argument 82505b261ecSmrg */ 82605b261ecSmrg if (IS_OPTION ("-nomultiplemonitors") 82705b261ecSmrg || IS_OPTION ("-nomultimonitors")) 82805b261ecSmrg { 82905b261ecSmrg /* Is this parameter attached to a screen or is it global? */ 83005b261ecSmrg if (-1 == g_iLastScreen) 83105b261ecSmrg { 83205b261ecSmrg int j; 83305b261ecSmrg 83405b261ecSmrg /* Parameter is for all screens */ 83505b261ecSmrg for (j = 0; j < MAXSCREENS; j++) 83605b261ecSmrg { 83705b261ecSmrg#if defined(XWIN_MULTIWINDOW) || defined(XWIN_MULTIWINDOWEXTWM) 83805b261ecSmrg g_ScreenInfo[j].fMultiMonitorOverride = TRUE; 83905b261ecSmrg#endif 84005b261ecSmrg g_ScreenInfo[j].fMultipleMonitors = FALSE; 84105b261ecSmrg } 84205b261ecSmrg } 84305b261ecSmrg else 84405b261ecSmrg { 84505b261ecSmrg /* Parameter is for a single screen */ 84605b261ecSmrg#if defined(XWIN_MULTIWINDOW) || defined(XWIN_MULTIWINDOWEXTWM) 84705b261ecSmrg g_ScreenInfo[g_iLastScreen].fMultiMonitorOverride = TRUE; 84805b261ecSmrg#endif 84905b261ecSmrg g_ScreenInfo[g_iLastScreen].fMultipleMonitors = FALSE; 85005b261ecSmrg } 85105b261ecSmrg 85205b261ecSmrg /* Indicate that we have processed this argument */ 85305b261ecSmrg return 1; 85405b261ecSmrg } 85505b261ecSmrg 85605b261ecSmrg 85705b261ecSmrg /* 85805b261ecSmrg * Look for the '-scrollbars' argument 85905b261ecSmrg */ 86005b261ecSmrg if (IS_OPTION ("-scrollbars")) 86105b261ecSmrg { 86205b261ecSmrg /* Is this parameter attached to a screen or is it global? */ 86305b261ecSmrg if (-1 == g_iLastScreen) 86405b261ecSmrg { 86505b261ecSmrg int j; 86605b261ecSmrg 86705b261ecSmrg /* Parameter is for all screens */ 86805b261ecSmrg for (j = 0; j < MAXSCREENS; j++) 86905b261ecSmrg { 87005b261ecSmrg g_ScreenInfo[j].fScrollbars = TRUE; 87105b261ecSmrg } 87205b261ecSmrg } 87305b261ecSmrg else 87405b261ecSmrg { 87505b261ecSmrg /* Parameter is for a single screen */ 87605b261ecSmrg g_ScreenInfo[g_iLastScreen].fScrollbars = TRUE; 87705b261ecSmrg } 87805b261ecSmrg 87905b261ecSmrg /* Indicate that we have processed this argument */ 88005b261ecSmrg return 1; 88105b261ecSmrg } 88205b261ecSmrg 88305b261ecSmrg 88405b261ecSmrg#ifdef XWIN_CLIPBOARD 88505b261ecSmrg /* 88605b261ecSmrg * Look for the '-clipboard' argument 88705b261ecSmrg */ 88805b261ecSmrg if (IS_OPTION ("-clipboard")) 88905b261ecSmrg { 89005b261ecSmrg g_fClipboard = TRUE; 89105b261ecSmrg 89205b261ecSmrg /* Indicate that we have processed this argument */ 89305b261ecSmrg return 1; 89405b261ecSmrg } 89505b261ecSmrg#endif 89605b261ecSmrg 89705b261ecSmrg 89805b261ecSmrg /* 89905b261ecSmrg * Look for the '-ignoreinput' argument 90005b261ecSmrg */ 90105b261ecSmrg if (IS_OPTION ("-ignoreinput")) 90205b261ecSmrg { 90305b261ecSmrg /* Is this parameter attached to a screen or is it global? */ 90405b261ecSmrg if (-1 == g_iLastScreen) 90505b261ecSmrg { 90605b261ecSmrg int j; 90705b261ecSmrg 90805b261ecSmrg /* Parameter is for all screens */ 90905b261ecSmrg for (j = 0; j < MAXSCREENS; j++) 91005b261ecSmrg { 91105b261ecSmrg g_ScreenInfo[j].fIgnoreInput = TRUE; 91205b261ecSmrg } 91305b261ecSmrg } 91405b261ecSmrg else 91505b261ecSmrg { 91605b261ecSmrg /* Parameter is for a single screen */ 91705b261ecSmrg g_ScreenInfo[g_iLastScreen].fIgnoreInput = TRUE; 91805b261ecSmrg } 91905b261ecSmrg 92005b261ecSmrg /* Indicate that we have processed this argument */ 92105b261ecSmrg return 1; 92205b261ecSmrg } 92305b261ecSmrg 92405b261ecSmrg /* 92505b261ecSmrg * Look for the '-emulate3buttons' argument 92605b261ecSmrg */ 92705b261ecSmrg if (IS_OPTION ("-emulate3buttons")) 92805b261ecSmrg { 92905b261ecSmrg int iArgsProcessed = 1; 93005b261ecSmrg int iE3BTimeout = WIN_DEFAULT_E3B_TIME; 93105b261ecSmrg 93205b261ecSmrg /* Grab the optional timeout value */ 93305b261ecSmrg if (i + 1 < argc 93405b261ecSmrg && 1 == sscanf (argv[i + 1], "%d", 93505b261ecSmrg &iE3BTimeout)) 93605b261ecSmrg { 93705b261ecSmrg /* Indicate that we have processed the next argument */ 93805b261ecSmrg iArgsProcessed++; 93905b261ecSmrg } 94005b261ecSmrg else 94105b261ecSmrg { 94205b261ecSmrg /* 94305b261ecSmrg * sscanf () won't modify iE3BTimeout if it doesn't find 94405b261ecSmrg * the specified format; however, I want to be explicit 94505b261ecSmrg * about setting the default timeout in such cases to 94605b261ecSmrg * prevent some programs (me) from getting confused. 94705b261ecSmrg */ 94805b261ecSmrg iE3BTimeout = WIN_DEFAULT_E3B_TIME; 94905b261ecSmrg } 95005b261ecSmrg 95105b261ecSmrg /* Is this parameter attached to a screen or is it global? */ 95205b261ecSmrg if (-1 == g_iLastScreen) 95305b261ecSmrg { 95405b261ecSmrg int j; 95505b261ecSmrg 95605b261ecSmrg /* Parameter is for all screens */ 95705b261ecSmrg for (j = 0; j < MAXSCREENS; j++) 95805b261ecSmrg { 95905b261ecSmrg g_ScreenInfo[j].iE3BTimeout = iE3BTimeout; 96005b261ecSmrg } 96105b261ecSmrg } 96205b261ecSmrg else 96305b261ecSmrg { 96405b261ecSmrg /* Parameter is for a single screen */ 96505b261ecSmrg g_ScreenInfo[g_iLastScreen].iE3BTimeout = iE3BTimeout; 96605b261ecSmrg } 96705b261ecSmrg 96805b261ecSmrg /* Indicate that we have processed this argument */ 96905b261ecSmrg return iArgsProcessed; 97005b261ecSmrg } 97105b261ecSmrg 97205b261ecSmrg /* 97305b261ecSmrg * Look for the '-depth n' argument 97405b261ecSmrg */ 97505b261ecSmrg if (IS_OPTION ("-depth")) 97605b261ecSmrg { 97705b261ecSmrg DWORD dwBPP = 0; 97805b261ecSmrg 97905b261ecSmrg /* Display the usage message if the argument is malformed */ 98005b261ecSmrg if (++i >= argc) 98105b261ecSmrg { 98205b261ecSmrg UseMsg (); 98305b261ecSmrg return 0; 98405b261ecSmrg } 98505b261ecSmrg 98605b261ecSmrg /* Grab the argument */ 98705b261ecSmrg dwBPP = atoi (argv[i]); 98805b261ecSmrg 98905b261ecSmrg /* Is this parameter attached to a screen or global? */ 99005b261ecSmrg if (-1 == g_iLastScreen) 99105b261ecSmrg { 99205b261ecSmrg int j; 99305b261ecSmrg 99405b261ecSmrg /* Parameter is for all screens */ 99505b261ecSmrg for (j = 0; j < MAXSCREENS; j++) 99605b261ecSmrg { 99705b261ecSmrg g_ScreenInfo[j].dwBPP = dwBPP; 99805b261ecSmrg } 99905b261ecSmrg } 100005b261ecSmrg else 100105b261ecSmrg { 100205b261ecSmrg /* Parameter is for a single screen */ 100305b261ecSmrg g_ScreenInfo[g_iLastScreen].dwBPP = dwBPP; 100405b261ecSmrg } 100505b261ecSmrg 100605b261ecSmrg /* Indicate that we have processed the argument */ 100705b261ecSmrg return 2; 100805b261ecSmrg } 100905b261ecSmrg 101005b261ecSmrg /* 101105b261ecSmrg * Look for the '-refresh n' argument 101205b261ecSmrg */ 101305b261ecSmrg if (IS_OPTION ("-refresh")) 101405b261ecSmrg { 101505b261ecSmrg DWORD dwRefreshRate = 0; 101605b261ecSmrg 101705b261ecSmrg /* Display the usage message if the argument is malformed */ 101805b261ecSmrg if (++i >= argc) 101905b261ecSmrg { 102005b261ecSmrg UseMsg (); 102105b261ecSmrg return 0; 102205b261ecSmrg } 102305b261ecSmrg 102405b261ecSmrg /* Grab the argument */ 102505b261ecSmrg dwRefreshRate = atoi (argv[i]); 102605b261ecSmrg 102705b261ecSmrg /* Is this parameter attached to a screen or global? */ 102805b261ecSmrg if (-1 == g_iLastScreen) 102905b261ecSmrg { 103005b261ecSmrg int j; 103105b261ecSmrg 103205b261ecSmrg /* Parameter is for all screens */ 103305b261ecSmrg for (j = 0; j < MAXSCREENS; j++) 103405b261ecSmrg { 103505b261ecSmrg g_ScreenInfo[j].dwRefreshRate = dwRefreshRate; 103605b261ecSmrg } 103705b261ecSmrg } 103805b261ecSmrg else 103905b261ecSmrg { 104005b261ecSmrg /* Parameter is for a single screen */ 104105b261ecSmrg g_ScreenInfo[g_iLastScreen].dwRefreshRate = dwRefreshRate; 104205b261ecSmrg } 104305b261ecSmrg 104405b261ecSmrg /* Indicate that we have processed the argument */ 104505b261ecSmrg return 2; 104605b261ecSmrg } 104705b261ecSmrg 104805b261ecSmrg /* 104905b261ecSmrg * Look for the '-clipupdates num_boxes' argument 105005b261ecSmrg */ 105105b261ecSmrg if (IS_OPTION ("-clipupdates")) 105205b261ecSmrg { 105305b261ecSmrg DWORD dwNumBoxes = 0; 105405b261ecSmrg 105505b261ecSmrg /* Display the usage message if the argument is malformed */ 105605b261ecSmrg if (++i >= argc) 105705b261ecSmrg { 105805b261ecSmrg UseMsg (); 105905b261ecSmrg return 0; 106005b261ecSmrg } 106105b261ecSmrg 106205b261ecSmrg /* Grab the argument */ 106305b261ecSmrg dwNumBoxes = atoi (argv[i]); 106405b261ecSmrg 106505b261ecSmrg /* Is this parameter attached to a screen or global? */ 106605b261ecSmrg if (-1 == g_iLastScreen) 106705b261ecSmrg { 106805b261ecSmrg int j; 106905b261ecSmrg 107005b261ecSmrg /* Parameter is for all screens */ 107105b261ecSmrg for (j = 0; j < MAXSCREENS; j++) 107205b261ecSmrg { 107305b261ecSmrg g_ScreenInfo[j].dwClipUpdatesNBoxes = dwNumBoxes; 107405b261ecSmrg } 107505b261ecSmrg } 107605b261ecSmrg else 107705b261ecSmrg { 107805b261ecSmrg /* Parameter is for a single screen */ 107905b261ecSmrg g_ScreenInfo[g_iLastScreen].dwClipUpdatesNBoxes = dwNumBoxes; 108005b261ecSmrg } 108105b261ecSmrg 108205b261ecSmrg /* Indicate that we have processed the argument */ 108305b261ecSmrg return 2; 108405b261ecSmrg } 108505b261ecSmrg 108605b261ecSmrg#ifdef XWIN_EMULATEPSEUDO 108705b261ecSmrg /* 108805b261ecSmrg * Look for the '-emulatepseudo' argument 108905b261ecSmrg */ 109005b261ecSmrg if (IS_OPTION ("-emulatepseudo")) 109105b261ecSmrg { 109205b261ecSmrg /* Is this parameter attached to a screen or is it global? */ 109305b261ecSmrg if (-1 == g_iLastScreen) 109405b261ecSmrg { 109505b261ecSmrg int j; 109605b261ecSmrg 109705b261ecSmrg /* Parameter is for all screens */ 109805b261ecSmrg for (j = 0; j < MAXSCREENS; j++) 109905b261ecSmrg { 110005b261ecSmrg g_ScreenInfo[j].fEmulatePseudo = TRUE; 110105b261ecSmrg } 110205b261ecSmrg } 110305b261ecSmrg else 110405b261ecSmrg { 110505b261ecSmrg /* Parameter is for a single screen */ 110605b261ecSmrg g_ScreenInfo[g_iLastScreen].fEmulatePseudo = TRUE; 110705b261ecSmrg } 110805b261ecSmrg 110905b261ecSmrg /* Indicate that we have processed this argument */ 111005b261ecSmrg return 1; 111105b261ecSmrg } 111205b261ecSmrg#endif 111305b261ecSmrg 111405b261ecSmrg /* 111505b261ecSmrg * Look for the '-nowinkill' argument 111605b261ecSmrg */ 111705b261ecSmrg if (IS_OPTION ("-nowinkill")) 111805b261ecSmrg { 111905b261ecSmrg /* Is this parameter attached to a screen or is it global? */ 112005b261ecSmrg if (-1 == g_iLastScreen) 112105b261ecSmrg { 112205b261ecSmrg int j; 112305b261ecSmrg 112405b261ecSmrg /* Parameter is for all screens */ 112505b261ecSmrg for (j = 0; j < MAXSCREENS; j++) 112605b261ecSmrg { 112705b261ecSmrg g_ScreenInfo[j].fUseWinKillKey = FALSE; 112805b261ecSmrg } 112905b261ecSmrg } 113005b261ecSmrg else 113105b261ecSmrg { 113205b261ecSmrg /* Parameter is for a single screen */ 113305b261ecSmrg g_ScreenInfo[g_iLastScreen].fUseWinKillKey = FALSE; 113405b261ecSmrg } 113505b261ecSmrg 113605b261ecSmrg /* Indicate that we have processed this argument */ 113705b261ecSmrg return 1; 113805b261ecSmrg } 113905b261ecSmrg 114005b261ecSmrg /* 114105b261ecSmrg * Look for the '-winkill' argument 114205b261ecSmrg */ 114305b261ecSmrg if (IS_OPTION ("-winkill")) 114405b261ecSmrg { 114505b261ecSmrg /* Is this parameter attached to a screen or is it global? */ 114605b261ecSmrg if (-1 == g_iLastScreen) 114705b261ecSmrg { 114805b261ecSmrg int j; 114905b261ecSmrg 115005b261ecSmrg /* Parameter is for all screens */ 115105b261ecSmrg for (j = 0; j < MAXSCREENS; j++) 115205b261ecSmrg { 115305b261ecSmrg g_ScreenInfo[j].fUseWinKillKey = TRUE; 115405b261ecSmrg } 115505b261ecSmrg } 115605b261ecSmrg else 115705b261ecSmrg { 115805b261ecSmrg /* Parameter is for a single screen */ 115905b261ecSmrg g_ScreenInfo[g_iLastScreen].fUseWinKillKey = TRUE; 116005b261ecSmrg } 116105b261ecSmrg 116205b261ecSmrg /* Indicate that we have processed this argument */ 116305b261ecSmrg return 1; 116405b261ecSmrg } 116505b261ecSmrg 116605b261ecSmrg /* 116705b261ecSmrg * Look for the '-nounixkill' argument 116805b261ecSmrg */ 116905b261ecSmrg if (IS_OPTION ("-nounixkill")) 117005b261ecSmrg { 117105b261ecSmrg /* Is this parameter attached to a screen or is it global? */ 117205b261ecSmrg if (-1 == g_iLastScreen) 117305b261ecSmrg { 117405b261ecSmrg int j; 117505b261ecSmrg 117605b261ecSmrg /* Parameter is for all screens */ 117705b261ecSmrg for (j = 0; j < MAXSCREENS; j++) 117805b261ecSmrg { 117905b261ecSmrg g_ScreenInfo[j].fUseUnixKillKey = FALSE; 118005b261ecSmrg } 118105b261ecSmrg } 118205b261ecSmrg else 118305b261ecSmrg { 118405b261ecSmrg /* Parameter is for a single screen */ 118505b261ecSmrg g_ScreenInfo[g_iLastScreen].fUseUnixKillKey = FALSE; 118605b261ecSmrg } 118705b261ecSmrg 118805b261ecSmrg /* Indicate that we have processed this argument */ 118905b261ecSmrg return 1; 119005b261ecSmrg } 119105b261ecSmrg 119205b261ecSmrg /* 119305b261ecSmrg * Look for the '-unixkill' argument 119405b261ecSmrg */ 119505b261ecSmrg if (IS_OPTION ("-unixkill")) 119605b261ecSmrg { 119705b261ecSmrg /* Is this parameter attached to a screen or is it global? */ 119805b261ecSmrg if (-1 == g_iLastScreen) 119905b261ecSmrg { 120005b261ecSmrg int j; 120105b261ecSmrg 120205b261ecSmrg /* Parameter is for all screens */ 120305b261ecSmrg for (j = 0; j < MAXSCREENS; j++) 120405b261ecSmrg { 120505b261ecSmrg g_ScreenInfo[j].fUseUnixKillKey = TRUE; 120605b261ecSmrg } 120705b261ecSmrg } 120805b261ecSmrg else 120905b261ecSmrg { 121005b261ecSmrg /* Parameter is for a single screen */ 121105b261ecSmrg g_ScreenInfo[g_iLastScreen].fUseUnixKillKey = TRUE; 121205b261ecSmrg } 121305b261ecSmrg 121405b261ecSmrg /* Indicate that we have processed this argument */ 121505b261ecSmrg return 1; 121605b261ecSmrg } 121705b261ecSmrg 121805b261ecSmrg /* 121905b261ecSmrg * Look for the '-notrayicon' argument 122005b261ecSmrg */ 122105b261ecSmrg if (IS_OPTION ("-notrayicon")) 122205b261ecSmrg { 122305b261ecSmrg /* Is this parameter attached to a screen or is it global? */ 122405b261ecSmrg if (-1 == g_iLastScreen) 122505b261ecSmrg { 122605b261ecSmrg int j; 122705b261ecSmrg 122805b261ecSmrg /* Parameter is for all screens */ 122905b261ecSmrg for (j = 0; j < MAXSCREENS; j++) 123005b261ecSmrg { 123105b261ecSmrg g_ScreenInfo[j].fNoTrayIcon = TRUE; 123205b261ecSmrg } 123305b261ecSmrg } 123405b261ecSmrg else 123505b261ecSmrg { 123605b261ecSmrg /* Parameter is for a single screen */ 123705b261ecSmrg g_ScreenInfo[g_iLastScreen].fNoTrayIcon = TRUE; 123805b261ecSmrg } 123905b261ecSmrg 124005b261ecSmrg /* Indicate that we have processed this argument */ 124105b261ecSmrg return 1; 124205b261ecSmrg } 124305b261ecSmrg 124405b261ecSmrg /* 124505b261ecSmrg * Look for the '-trayicon' argument 124605b261ecSmrg */ 124705b261ecSmrg if (IS_OPTION ("-trayicon")) 124805b261ecSmrg { 124905b261ecSmrg /* Is this parameter attached to a screen or is it global? */ 125005b261ecSmrg if (-1 == g_iLastScreen) 125105b261ecSmrg { 125205b261ecSmrg int j; 125305b261ecSmrg 125405b261ecSmrg /* Parameter is for all screens */ 125505b261ecSmrg for (j = 0; j < MAXSCREENS; j++) 125605b261ecSmrg { 125705b261ecSmrg g_ScreenInfo[j].fNoTrayIcon = FALSE; 125805b261ecSmrg } 125905b261ecSmrg } 126005b261ecSmrg else 126105b261ecSmrg { 126205b261ecSmrg /* Parameter is for a single screen */ 126305b261ecSmrg g_ScreenInfo[g_iLastScreen].fNoTrayIcon = FALSE; 126405b261ecSmrg } 126505b261ecSmrg 126605b261ecSmrg /* Indicate that we have processed this argument */ 126705b261ecSmrg return 1; 126805b261ecSmrg } 126905b261ecSmrg 127005b261ecSmrg /* 127105b261ecSmrg * Look for the '-fp' argument 127205b261ecSmrg */ 127305b261ecSmrg if (IS_OPTION ("-fp")) 127405b261ecSmrg { 127505b261ecSmrg CHECK_ARGS (1); 127605b261ecSmrg g_cmdline.fontPath = argv[++i]; 127705b261ecSmrg return 0; /* Let DIX parse this again */ 127805b261ecSmrg } 127905b261ecSmrg 128005b261ecSmrg /* 128105b261ecSmrg * Look for the '-co' argument 128205b261ecSmrg */ 128305b261ecSmrg if (IS_OPTION ("-co")) 128405b261ecSmrg { 128505b261ecSmrg CHECK_ARGS (1); 128605b261ecSmrg g_cmdline.rgbPath = argv[++i]; 128705b261ecSmrg return 0; /* Let DIX parse this again */ 128805b261ecSmrg } 128905b261ecSmrg 129005b261ecSmrg /* 129105b261ecSmrg * Look for the '-query' argument 129205b261ecSmrg */ 129305b261ecSmrg if (IS_OPTION ("-query")) 129405b261ecSmrg { 129505b261ecSmrg CHECK_ARGS (1); 129605b261ecSmrg g_fXdmcpEnabled = TRUE; 129705b261ecSmrg g_pszQueryHost = argv[++i]; 129805b261ecSmrg return 0; /* Let DIX parse this again */ 129905b261ecSmrg } 130005b261ecSmrg 130105b261ecSmrg /* 130205b261ecSmrg * Look for the '-indirect' or '-broadcast' arguments 130305b261ecSmrg */ 130405b261ecSmrg if (IS_OPTION ("-indirect") 130505b261ecSmrg || IS_OPTION ("-broadcast")) 130605b261ecSmrg { 130705b261ecSmrg g_fXdmcpEnabled = TRUE; 130805b261ecSmrg return 0; /* Let DIX parse this again */ 130905b261ecSmrg } 131005b261ecSmrg 131105b261ecSmrg /* 131205b261ecSmrg * Look for the '-config' argument 131305b261ecSmrg */ 131405b261ecSmrg if (IS_OPTION ("-config") 131505b261ecSmrg || IS_OPTION ("-xf86config")) 131605b261ecSmrg { 131705b261ecSmrg CHECK_ARGS (1); 131805b261ecSmrg#ifdef XWIN_XF86CONFIG 131905b261ecSmrg g_cmdline.configFile = argv[++i]; 132005b261ecSmrg#else 132105b261ecSmrg winMessageBoxF ("The %s option is not supported in this " 132205b261ecSmrg "release.\n" 132305b261ecSmrg "Ignoring this option and continuing.\n", 132405b261ecSmrg MB_ICONINFORMATION, 132505b261ecSmrg argv[i]); 132605b261ecSmrg#endif 132705b261ecSmrg return 2; 132805b261ecSmrg } 132905b261ecSmrg 133005b261ecSmrg /* 133105b261ecSmrg * Look for the '-keyboard' argument 133205b261ecSmrg */ 133305b261ecSmrg if (IS_OPTION ("-keyboard")) 133405b261ecSmrg { 133505b261ecSmrg#ifdef XWIN_XF86CONFIG 133605b261ecSmrg CHECK_ARGS (1); 133705b261ecSmrg g_cmdline.keyboard = argv[++i]; 133805b261ecSmrg#else 133905b261ecSmrg winMessageBoxF ("The -keyboard option is not supported in this " 134005b261ecSmrg "release.\n" 134105b261ecSmrg "Ignoring this option and continuing.\n", 134205b261ecSmrg MB_ICONINFORMATION); 134305b261ecSmrg#endif 134405b261ecSmrg return 2; 134505b261ecSmrg } 134605b261ecSmrg 134705b261ecSmrg /* 134805b261ecSmrg * Look for the '-logfile' argument 134905b261ecSmrg */ 135005b261ecSmrg if (IS_OPTION ("-logfile")) 135105b261ecSmrg { 135205b261ecSmrg CHECK_ARGS (1); 135305b261ecSmrg g_pszLogFile = argv[++i]; 135405b261ecSmrg#ifdef RELOCATE_PROJECTROOT 135505b261ecSmrg g_fLogFileChanged = TRUE; 135605b261ecSmrg#endif 135705b261ecSmrg return 2; 135805b261ecSmrg } 135905b261ecSmrg 136005b261ecSmrg /* 136105b261ecSmrg * Look for the '-logverbose' argument 136205b261ecSmrg */ 136305b261ecSmrg if (IS_OPTION ("-logverbose")) 136405b261ecSmrg { 136505b261ecSmrg CHECK_ARGS (1); 136605b261ecSmrg g_iLogVerbose = atoi(argv[++i]); 136705b261ecSmrg return 2; 136805b261ecSmrg } 136905b261ecSmrg 137005b261ecSmrg#ifdef XWIN_CLIPBOARD 137105b261ecSmrg /* 137205b261ecSmrg * Look for the '-nounicodeclipboard' argument 137305b261ecSmrg */ 137405b261ecSmrg if (IS_OPTION ("-nounicodeclipboard")) 137505b261ecSmrg { 137605b261ecSmrg g_fUnicodeClipboard = FALSE; 137705b261ecSmrg /* Indicate that we have processed the argument */ 137805b261ecSmrg return 1; 137905b261ecSmrg } 138005b261ecSmrg#endif 138105b261ecSmrg 138205b261ecSmrg#ifdef XKB 138305b261ecSmrg /* 138405b261ecSmrg * Look for the '-kb' argument 138505b261ecSmrg */ 138605b261ecSmrg if (IS_OPTION ("-kb")) 138705b261ecSmrg { 138805b261ecSmrg g_cmdline.noXkbExtension = TRUE; 138905b261ecSmrg return 0; /* Let DIX parse this again */ 139005b261ecSmrg } 139105b261ecSmrg 139205b261ecSmrg if (IS_OPTION ("-xkbrules")) 139305b261ecSmrg { 139405b261ecSmrg CHECK_ARGS (1); 139505b261ecSmrg g_cmdline.xkbRules = argv[++i]; 139605b261ecSmrg return 2; 139705b261ecSmrg } 139805b261ecSmrg if (IS_OPTION ("-xkbmodel")) 139905b261ecSmrg { 140005b261ecSmrg CHECK_ARGS (1); 140105b261ecSmrg g_cmdline.xkbModel = argv[++i]; 140205b261ecSmrg return 2; 140305b261ecSmrg } 140405b261ecSmrg if (IS_OPTION ("-xkblayout")) 140505b261ecSmrg { 140605b261ecSmrg CHECK_ARGS (1); 140705b261ecSmrg g_cmdline.xkbLayout = argv[++i]; 140805b261ecSmrg return 2; 140905b261ecSmrg } 141005b261ecSmrg if (IS_OPTION ("-xkbvariant")) 141105b261ecSmrg { 141205b261ecSmrg CHECK_ARGS (1); 141305b261ecSmrg g_cmdline.xkbVariant = argv[++i]; 141405b261ecSmrg return 2; 141505b261ecSmrg } 141605b261ecSmrg if (IS_OPTION ("-xkboptions")) 141705b261ecSmrg { 141805b261ecSmrg CHECK_ARGS (1); 141905b261ecSmrg g_cmdline.xkbOptions = argv[++i]; 142005b261ecSmrg return 2; 142105b261ecSmrg } 142205b261ecSmrg#endif 142305b261ecSmrg 142405b261ecSmrg if (IS_OPTION ("-keyhook")) 142505b261ecSmrg { 142605b261ecSmrg g_fKeyboardHookLL = TRUE; 142705b261ecSmrg return 1; 142805b261ecSmrg } 142905b261ecSmrg 143005b261ecSmrg if (IS_OPTION ("-nokeyhook")) 143105b261ecSmrg { 143205b261ecSmrg g_fKeyboardHookLL = FALSE; 143305b261ecSmrg return 1; 143405b261ecSmrg } 143505b261ecSmrg 143605b261ecSmrg if (IS_OPTION ("-swcursor")) 143705b261ecSmrg { 143805b261ecSmrg g_fSoftwareCursor = TRUE; 143905b261ecSmrg return 1; 144005b261ecSmrg } 144105b261ecSmrg 144205b261ecSmrg if (IS_OPTION ("-silent-dup-error")) 144305b261ecSmrg { 144405b261ecSmrg g_fSilentDupError = TRUE; 144505b261ecSmrg return 1; 144605b261ecSmrg } 144705b261ecSmrg return 0; 144805b261ecSmrg} 144905b261ecSmrg 145005b261ecSmrg 145105b261ecSmrg/* 145205b261ecSmrg * winLogCommandLine - Write entire command line to the log file 145305b261ecSmrg */ 145405b261ecSmrg 145505b261ecSmrgvoid 145605b261ecSmrgwinLogCommandLine (int argc, char *argv[]) 145705b261ecSmrg{ 145805b261ecSmrg int i; 145905b261ecSmrg int iSize = 0; 146005b261ecSmrg int iCurrLen = 0; 146105b261ecSmrg 146205b261ecSmrg#define CHARS_PER_LINE 60 146305b261ecSmrg 146405b261ecSmrg /* Bail if command line has already been logged */ 146505b261ecSmrg if (g_pszCommandLine) 146605b261ecSmrg return; 146705b261ecSmrg 146805b261ecSmrg /* Count how much memory is needed for concatenated command line */ 146905b261ecSmrg for (i = 0, iCurrLen = 0; i < argc; ++i) 147005b261ecSmrg if (argv[i]) 147105b261ecSmrg { 147205b261ecSmrg /* Add a character for lines that overflow */ 147305b261ecSmrg if ((strlen (argv[i]) < CHARS_PER_LINE 147405b261ecSmrg && iCurrLen + strlen (argv[i]) > CHARS_PER_LINE) 147505b261ecSmrg || strlen (argv[i]) > CHARS_PER_LINE) 147605b261ecSmrg { 147705b261ecSmrg iCurrLen = 0; 147805b261ecSmrg ++iSize; 147905b261ecSmrg } 148005b261ecSmrg 148105b261ecSmrg /* Add space for item and trailing space */ 148205b261ecSmrg iSize += strlen (argv[i]) + 1; 148305b261ecSmrg 148405b261ecSmrg /* Update current line length */ 148505b261ecSmrg iCurrLen += strlen (argv[i]); 148605b261ecSmrg } 148705b261ecSmrg 148805b261ecSmrg /* Allocate memory for concatenated command line */ 148905b261ecSmrg g_pszCommandLine = malloc (iSize + 1); 149005b261ecSmrg if (!g_pszCommandLine) 149105b261ecSmrg FatalError ("winLogCommandLine - Could not allocate memory for " 149205b261ecSmrg "command line string. Exiting.\n"); 149305b261ecSmrg 149405b261ecSmrg /* Set first character to concatenated command line to null */ 149505b261ecSmrg g_pszCommandLine[0] = '\0'; 149605b261ecSmrg 149705b261ecSmrg /* Loop through all args */ 149805b261ecSmrg for (i = 0, iCurrLen = 0; i < argc; ++i) 149905b261ecSmrg { 150005b261ecSmrg /* Add a character for lines that overflow */ 150105b261ecSmrg if ((strlen (argv[i]) < CHARS_PER_LINE 150205b261ecSmrg && iCurrLen + strlen (argv[i]) > CHARS_PER_LINE) 150305b261ecSmrg || strlen (argv[i]) > CHARS_PER_LINE) 150405b261ecSmrg { 150505b261ecSmrg iCurrLen = 0; 150605b261ecSmrg 150705b261ecSmrg /* Add line break if it fits */ 150805b261ecSmrg strncat (g_pszCommandLine, "\n", iSize - strlen (g_pszCommandLine)); 150905b261ecSmrg } 151005b261ecSmrg 151105b261ecSmrg strncat (g_pszCommandLine, argv[i], iSize - strlen (g_pszCommandLine)); 151205b261ecSmrg strncat (g_pszCommandLine, " ", iSize - strlen (g_pszCommandLine)); 151305b261ecSmrg 151405b261ecSmrg /* Save new line length */ 151505b261ecSmrg iCurrLen += strlen (argv[i]); 151605b261ecSmrg } 151705b261ecSmrg 151805b261ecSmrg ErrorF ("XWin was started with the following command line:\n\n" 151905b261ecSmrg "%s\n\n", g_pszCommandLine); 152005b261ecSmrg} 152105b261ecSmrg 152205b261ecSmrg 152305b261ecSmrg/* 152405b261ecSmrg * winLogVersionInfo - Log Cygwin/X version information 152505b261ecSmrg */ 152605b261ecSmrg 152705b261ecSmrgvoid 152805b261ecSmrgwinLogVersionInfo (void) 152905b261ecSmrg{ 153005b261ecSmrg static Bool s_fBeenHere = FALSE; 153105b261ecSmrg 153205b261ecSmrg if (s_fBeenHere) 153305b261ecSmrg return; 153405b261ecSmrg s_fBeenHere = TRUE; 153505b261ecSmrg 153605b261ecSmrg ErrorF ("Welcome to the XWin X Server\n"); 153705b261ecSmrg ErrorF ("Vendor: %s\n", VENDOR_STRING); 153805b261ecSmrg ErrorF ("Release: %s\n\n", VERSION_STRING); 153905b261ecSmrg ErrorF ("Contact: %s\n\n", VENDOR_CONTACT); 154005b261ecSmrg} 154105b261ecSmrg 154205b261ecSmrg/* 154305b261ecSmrg * getMonitorInfo - callback function used to return information from the enumeration of monitors attached 154405b261ecSmrg */ 154505b261ecSmrg 154605b261ecSmrgwBOOL CALLBACK getMonitorInfo(HMONITOR hMonitor, HDC hdc, LPRECT rect, LPARAM _data) 154705b261ecSmrg{ 154805b261ecSmrg struct GetMonitorInfoData* data = (struct GetMonitorInfoData*)_data; 154905b261ecSmrg // only get data for monitor number specified in <data> 155005b261ecSmrg data->monitorNum++; 155105b261ecSmrg if (data->monitorNum == data->requestedMonitor) 155205b261ecSmrg { 155305b261ecSmrg data->bMonitorSpecifiedExists = TRUE; 155405b261ecSmrg data->monitorOffsetX = rect->left; 155505b261ecSmrg data->monitorOffsetY = rect->top; 155605b261ecSmrg data->monitorHeight = rect->bottom - rect->top; 155705b261ecSmrg data->monitorWidth = rect->right - rect->left; 155805b261ecSmrg return FALSE; 155905b261ecSmrg } 156005b261ecSmrg return TRUE; 156105b261ecSmrg} 1562