diff options
Diffstat (limited to 'xorg-server/hw/xwin/winprocarg.c')
-rw-r--r-- | xorg-server/hw/xwin/winprocarg.c | 89 |
1 files changed, 45 insertions, 44 deletions
diff --git a/xorg-server/hw/xwin/winprocarg.c b/xorg-server/hw/xwin/winprocarg.c index f20598db9..995ed031e 100644 --- a/xorg-server/hw/xwin/winprocarg.c +++ b/xorg-server/hw/xwin/winprocarg.c @@ -1,6 +1,7 @@ /* Copyright 1993, 1998 The Open Group +Copyright (C) Colin Harrison 2005-2008 Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that @@ -38,7 +39,8 @@ from The Open Group. #include "winconfig.h" #include "winprefs.h" #include "winmsg.h" - +#define COMPILE_MULTIMON_STUBS +#include <multimon.h> /* * References to external symbols */ @@ -57,6 +59,7 @@ extern char * g_pszLogFile; extern Bool g_fLogFileChanged; #endif extern Bool g_fXdmcpEnabled; +extern Bool g_fAuthEnabled; extern char * g_pszCommandLine; extern Bool g_fKeyboardHookLL; extern Bool g_fNoHelpMessageBox; @@ -75,30 +78,10 @@ struct GetMonitorInfoData { int monitorWidth; }; -typedef wBOOL (*ENUMDISPLAYMONITORSPROC)(HDC,LPCRECT,MONITORENUMPROC,LPARAM); -ENUMDISPLAYMONITORSPROC _EnumDisplayMonitors; - wBOOL CALLBACK getMonitorInfo(HMONITOR hMonitor, HDC hdc, LPRECT rect, LPARAM _data); static Bool QueryMonitor(int index, struct GetMonitorInfoData *data) { - /* Load EnumDisplayMonitors from DLL */ - HMODULE user32; - FARPROC func; - user32 = LoadLibrary("user32.dll"); - if (user32 == NULL) - { - winW32Error(2, "Could not open user32.dll"); - return FALSE; - } - func = GetProcAddress(user32, "EnumDisplayMonitors"); - if (func == NULL) - { - winW32Error(2, "Could not resolve EnumDisplayMonitors: "); - return FALSE; - } - _EnumDisplayMonitors = (ENUMDISPLAYMONITORSPROC)func; - /* prepare data */ if (data == NULL) return FALSE; @@ -106,10 +89,8 @@ static Bool QueryMonitor(int index, struct GetMonitorInfoData *data) data->requestedMonitor = index; /* query information */ - _EnumDisplayMonitors(NULL, NULL, getMonitorInfo, (LPARAM) data); + xEnumDisplayMonitors(NULL, NULL, getMonitorInfo, (LPARAM) data); - /* cleanup */ - FreeLibrary(user32); return TRUE; } @@ -155,7 +136,7 @@ winInitializeDefaultScreens (void) dwWidth = GetSystemMetrics (SM_CXSCREEN); dwHeight = GetSystemMetrics (SM_CYSCREEN); - winErrorFVerb (2, "winInitializeDefaultScreens - w %d h %d\n", + winDebug ("winInitializeDefaultScreens - w %d h %d\n", (int) dwWidth, (int) dwHeight); /* Set a default DPI, if no parameter was passed */ @@ -210,7 +191,7 @@ winInitializeDefaultScreens (void) /* Signal that the default screens have been initialized */ g_fInitializedDefaultScreens = TRUE; - winErrorFVerb (2, "winInitializeDefaultScreens - Returning\n"); + winDebug ("winInitializeDefaultScreens - Returning\n"); } /* See Porting Layer Definition - p. 57 */ @@ -272,15 +253,13 @@ ddxProcessArgument (int argc, char *argv[], int i) * OsVendorInit () gets called, otherwise we will overwrite * settings changed by parameters such as -fullscreen, etc. */ - winErrorFVerb (2, "ddxProcessArgument - Initializing default " + winDebug ("ddxProcessArgument - Initializing default " "screens\n"); winInitializeDefaultScreens (); } } -#if CYGDEBUG winDebug ("ddxProcessArgument - arg: %s\n", argv[i]); -#endif /* * Look for the '-help' and similar options @@ -314,10 +293,8 @@ ddxProcessArgument (int argc, char *argv[], int i) int iWidth, iHeight, iX, iY; int iMonitor; -#if CYGDEBUG winDebug ("ddxProcessArgument - screen - argc: %d i: %d\n", argc, i); -#endif /* Display the usage message if the argument is malformed */ if (i + 1 >= argc) @@ -348,7 +325,7 @@ ddxProcessArgument (int argc, char *argv[], int i) "Querying monitors is not supported on NT4 and Win95\n"); } else if (data.bMonitorSpecifiedExists == TRUE) { - winErrorFVerb(2, "ddxProcessArgument - screen - Found Valid ``@Monitor'' = %d arg\n", iMonitor); + winDebug("ddxProcessArgument - screen - Found Valid ``@Monitor'' = %d arg\n", iMonitor); iArgsProcessed = 3; g_ScreenInfo[nScreenNum].fUserGaveHeightAndWidth = FALSE; g_ScreenInfo[nScreenNum].fUserGavePosition = TRUE; @@ -376,7 +353,7 @@ ddxProcessArgument (int argc, char *argv[], int i) (int *) &iWidth, (int *) &iHeight)) { - winErrorFVerb (2, "ddxProcessArgument - screen - Found ``WxD'' arg\n"); + winDebug ("ddxProcessArgument - screen - Found ``WxD'' arg\n"); iArgsProcessed = 3; g_ScreenInfo[nScreenNum].fUserGaveHeightAndWidth = TRUE; g_ScreenInfo[nScreenNum].dwWidth = iWidth; @@ -388,7 +365,7 @@ ddxProcessArgument (int argc, char *argv[], int i) (int *) &iX, (int *) &iY)) { - winErrorFVerb (2, "ddxProcessArgument - screen - Found ``X+Y'' arg\n"); + winDebug("ddxProcessArgument - screen - Found ``X+Y'' arg\n"); g_ScreenInfo[nScreenNum].fUserGavePosition = TRUE; g_ScreenInfo[nScreenNum].dwInitialX = iX; g_ScreenInfo[nScreenNum].dwInitialY = iY; @@ -431,7 +408,7 @@ ddxProcessArgument (int argc, char *argv[], int i) "Querying monitors is not supported on NT4 and Win95\n"); } else if (data.bMonitorSpecifiedExists == TRUE) { - winErrorFVerb (2, "ddxProcessArgument - screen - Found Valid ``@Monitor'' = %d arg\n", iMonitor); + winDebug ("ddxProcessArgument - screen - Found Valid ``@Monitor'' = %d arg\n", iMonitor); g_ScreenInfo[nScreenNum].fUserGavePosition = TRUE; g_ScreenInfo[nScreenNum].dwInitialX = data.monitorOffsetX; g_ScreenInfo[nScreenNum].dwInitialY = data.monitorOffsetY; @@ -454,7 +431,7 @@ ddxProcessArgument (int argc, char *argv[], int i) && 1 == sscanf (argv[i + 3], "%d", (int *) &iHeight)) { - winErrorFVerb (2, "ddxProcessArgument - screen - Found ``W D'' arg\n"); + winDebug ("ddxProcessArgument - screen - Found ``W D'' arg\n"); iArgsProcessed = 4; g_ScreenInfo[nScreenNum].fUserGaveHeightAndWidth = TRUE; g_ScreenInfo[nScreenNum].dwWidth = iWidth; @@ -467,7 +444,7 @@ ddxProcessArgument (int argc, char *argv[], int i) && 1 == sscanf (argv[i + 5], "%d", (int *) &iY)) { - winErrorFVerb (2, "ddxProcessArgument - screen - Found ``X Y'' arg\n"); + winDebug ("ddxProcessArgument - screen - Found ``X Y'' arg\n"); iArgsProcessed = 6; g_ScreenInfo[nScreenNum].fUserGavePosition = TRUE; g_ScreenInfo[nScreenNum].dwInitialX = iX; @@ -476,7 +453,7 @@ ddxProcessArgument (int argc, char *argv[], int i) } else { - winErrorFVerb (2, "ddxProcessArgument - screen - Did not find size arg. " + ErrorF ("ddxProcessArgument - screen - Did not find size arg. " "dwWidth: %d dwHeight: %d\n", (int) g_ScreenInfo[nScreenNum].dwWidth, (int) g_ScreenInfo[nScreenNum].dwHeight); @@ -1289,6 +1266,29 @@ ddxProcessArgument (int argc, char *argv[], int i) } /* + * Look for the '-auth' argument + */ + if (IS_OPTION ("-auth")) + { +#ifdef __MINGW32__ + HANDLE hFile; + char * pszFile; + CHECK_ARGS (1); + pszFile = argv[++i]; + hFile = CreateFile(pszFile,GENERIC_READ,FILE_SHARE_READ,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,NULL); + if (hFile == INVALID_HANDLE_VALUE) + winMessageBoxF ("This authorization file for the -auth option could not be opened...\n" + "\"%s\"\n" + "You should use an \"Xauthority\" file in your HOME directory.\n" + "\nIgnoring and continuing.\n", + MB_ICONINFORMATION, + pszFile); +#endif + g_fAuthEnabled = TRUE; + return 0; /* Let DIX parse this again */ + } + + /* * Look for the '-indirect' or '-broadcast' arguments */ if (IS_OPTION ("-indirect") @@ -1494,7 +1494,7 @@ winLogCommandLine (int argc, char *argv[]) iCurrLen += strlen (argv[i]); } - ErrorF ("XWin was started with the following command line:\n\n" + winDebug ("XWin was started with the following command line:\n\n" "%s\n\n", g_pszCommandLine); } @@ -1506,18 +1506,19 @@ winLogCommandLine (int argc, char *argv[]) void winLogVersionInfo (void) { +#ifdef WINDBG static Bool s_fBeenHere = FALSE; if (s_fBeenHere) return; s_fBeenHere = TRUE; - ErrorF ("Welcome to the XWin X Server\n"); - ErrorF ("Vendor: %s\n", VENDOR_STRING); - ErrorF ("Release: %d.%d.%d.%d (%d)\n\n", XORG_VERSION_MAJOR, XORG_VERSION_MINOR, XORG_VERSION_PATCH, XORG_VERSION_SNAP, XORG_VERSION_CURRENT); - ErrorF ("Contact: %s\n\n", VENDOR_CONTACT); + winDebug ("Welcome to the VcXsrv X Server\n"); + winDebug ("Vendor: %s\n", VENDOR_STRING); + winDebug ("Release: %d.%d.%d.%d (%d)\n\n", XORG_VERSION_MAJOR, XORG_VERSION_MINOR, XORG_VERSION_PATCH, XORG_VERSION_SNAP, XORG_VERSION_CURRENT); + winDebug ("Contact: %s\n\n", VENDOR_CONTACT); +#endif } - /* * getMonitorInfo - callback function used to return information from the enumeration of monitors attached */ |