hw/xwin: Stop pretending we work on NT4

We already link directly to some functions not available in NT4, so stop
pretending we will work on NT4 and link directly to EnumDisplayMonitors()
and SHGetFolderPath()

Also remove mentions of NT4 & Win95 from error messages

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Reviewed-by: Colin Harrison <colin.harrison@virgin.net>
This commit is contained in:
Jon TURNEY 2011-07-03 19:10:52 +01:00
parent f6529a05a2
commit 3ead1d810b
3 changed files with 11 additions and 57 deletions

View File

@ -588,34 +588,17 @@ winFixupPaths (void)
}
if (getenv("HOME") == NULL)
{
HMODULE shfolder;
SHGETFOLDERPATHPROC shgetfolderpath = NULL;
char buffer[MAX_PATH + 5];
strncpy(buffer, "HOME=", 5);
/* Try to load SHGetFolderPath from shfolder.dll and shell32.dll */
shfolder = LoadLibrary("shfolder.dll");
/* fallback to shell32.dll */
if (shfolder == NULL)
shfolder = LoadLibrary("shell32.dll");
/* resolve SHGetFolderPath */
if (shfolder != NULL)
shgetfolderpath = (SHGETFOLDERPATHPROC)GetProcAddress(shfolder, "SHGetFolderPathA");
/* query appdata directory */
if (shgetfolderpath &&
shgetfolderpath(NULL, CSIDL_APPDATA|CSIDL_FLAG_CREATE, NULL, 0,
buffer + 5) == 0)
{
if (SHGetFolderPathA(NULL, CSIDL_APPDATA|CSIDL_FLAG_CREATE, NULL, 0, buffer + 5) == 0)
{
putenv(buffer);
} else
{
winMsg (X_ERROR, "Can not determine HOME directory\n");
}
if (shfolder != NULL)
FreeLibrary(shfolder);
}
}
if (!g_fLogFileChanged) {
static char buffer[MAX_PATH];
@ -825,10 +808,10 @@ winUseMsg (void)
"\theight and initial position for that screen. Additionally\n"
"\ta monitor number can be specified to start the server on,\n"
"\tat which point, all coordinates become relative to that\n"
"\tmonitor (Not for Windows NT4 and 95). Examples:\n"
"\t -screen 0 800x600+100+100@2 ; 2nd monitor offset 100,100 size 800x600\n"
"\t -screen 0 1024x768@3 ; 3rd monitor size 1024x768\n"
"\t -screen 0 @1 ; on 1st monitor using its full resolution (the default)\n");
"\tmonitor. Examples:\n"
"\t -screen 0 800x600+100+100@2 ; 2nd monitor offset 100,100 size 800x600\n"
"\t -screen 0 1024x768@3 ; 3rd monitor size 1024x768\n"
"\t -screen 0 @1 ; on 1st monitor using its full resolution (the default)\n");
ErrorF ("-silent-dup-error\n"
"\tIf another instance of " EXECUTABLE_NAME " with the same display number is running\n"

View File

@ -53,30 +53,8 @@ wBOOL CALLBACK getMonitorInfo(HMONITOR hMonitor, HDC hdc, LPRECT rect, LPARAM _d
return TRUE;
}
typedef WINAPI wBOOL (*ENUMDISPLAYMONITORSPROC)(HDC,LPCRECT,MONITORENUMPROC,LPARAM);
ENUMDISPLAYMONITORSPROC _EnumDisplayMonitors;
wBOOL CALLBACK getMonitorInfo(HMONITOR hMonitor, HDC hdc, LPRECT rect, LPARAM _data);
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;
@ -84,9 +62,5 @@ Bool QueryMonitor(int index, struct GetMonitorInfoData *data)
data->requestedMonitor = index;
/* query information */
_EnumDisplayMonitors(NULL, NULL, getMonitorInfo, (LPARAM) data);
/* cleanup */
FreeLibrary(user32);
return TRUE;
return EnumDisplayMonitors(NULL, NULL, getMonitorInfo, (LPARAM) data);
}

View File

@ -326,8 +326,7 @@ ddxProcessArgument (int argc, char *argv[], int i)
struct GetMonitorInfoData data;
if (!QueryMonitor(iMonitor, &data))
{
ErrorF ("ddxProcessArgument - screen - "
"Querying monitors is not supported on NT4 and Win95\n");
ErrorF ("ddxProcessArgument - screen - Querying monitors failed\n");
} else if (data.bMonitorSpecifiedExists == TRUE)
{
winErrorFVerb(2, "ddxProcessArgument - screen - Found Valid ``@Monitor'' = %d arg\n", iMonitor);
@ -383,8 +382,7 @@ ddxProcessArgument (int argc, char *argv[], int i)
struct GetMonitorInfoData data;
if (!QueryMonitor(iMonitor, &data))
{
ErrorF ("ddxProcessArgument - screen - "
"Querying monitors is not supported on NT4 and Win95\n");
ErrorF ("ddxProcessArgument - screen - Querying monitors failed\n");
} else if (data.bMonitorSpecifiedExists == TRUE)
{
g_ScreenInfo[nScreenNum].iMonitor = iMonitor;
@ -411,8 +409,7 @@ ddxProcessArgument (int argc, char *argv[], int i)
struct GetMonitorInfoData data;
if (!QueryMonitor(iMonitor, &data))
{
ErrorF ("ddxProcessArgument - screen - "
"Querying monitors is not supported on NT4 and Win95\n");
ErrorF ("ddxProcessArgument - screen - Querying monitors failed\n");
} else if (data.bMonitorSpecifiedExists == TRUE)
{
winErrorFVerb (2, "ddxProcessArgument - screen - Found Valid ``@Monitor'' = %d arg\n", iMonitor);