diff options
Diffstat (limited to 'xorg-server/hw/xwin/winprocarg.c')
-rw-r--r-- | xorg-server/hw/xwin/winprocarg.c | 32 |
1 files changed, 22 insertions, 10 deletions
diff --git a/xorg-server/hw/xwin/winprocarg.c b/xorg-server/hw/xwin/winprocarg.c index 306dce79f..683605ad7 100644 --- a/xorg-server/hw/xwin/winprocarg.c +++ b/xorg-server/hw/xwin/winprocarg.c @@ -89,12 +89,27 @@ winInitializeScreenDefaults(void) dwWidth = GetSystemMetrics (SM_CXSCREEN); dwHeight = GetSystemMetrics (SM_CYSCREEN); - winDebug ("winInitializeScreenDefaults - w %d h %d\n", - (int) dwWidth, (int) dwHeight); + winDebug ("winInitializeScreenDefaults - primary monitor w %d h %d\n", (int) dwWidth, (int) dwHeight); - /* Set a default DPI, if no parameter was passed */ + /* Set a default DPI, if no '-dpi' option was used */ if (monitorResolution == 0) - monitorResolution = WIN_DEFAULT_DPI; + { + HDC hdc = GetDC(NULL); + if (hdc) + { + int dpiX = GetDeviceCaps(hdc, LOGPIXELSX); + int dpiY = GetDeviceCaps(hdc, LOGPIXELSY); + + winErrorFVerb(2, "winInitializeDefaultScreens - native DPI x %d y %d\n", dpiX, dpiY); + monitorResolution = dpiY; + ReleaseDC(NULL, hdc); + } + else + { + winErrorFVerb(1, "winInitializeDefaultScreens - Failed to retrieve native DPI, falling back to default of %d DPI\n", WIN_DEFAULT_DPI); + monitorResolution = WIN_DEFAULT_DPI; + } + } defaultScreenInfo.iMonitor = 1; defaultScreenInfo.dwWidth = dwWidth; @@ -310,8 +325,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) { winDebug("ddxProcessArgument - screen - Found Valid ``@Monitor'' = %d arg\n", iMonitor); @@ -367,8 +381,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; @@ -395,8 +408,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) { winDebug ("ddxProcessArgument - screen - Found Valid ``@Monitor'' = %d arg\n", iMonitor); |