* Source/win32/WIN32Server.m (-resolutionForScreen:):

Scale the result by 0.75 so the Windows default of 96 DPI is
mapped to the GNUstep default of 72 DPI. While this sounds wrong,
72 and 96 are just "virtual" DPI's; both mean 1 point = 1 pixel,
so it's actually the right thing to do.
* Source/x11/XGServerWindow.m (-resolutionForScreen:):
Comment out the implementation and just return 72 for now,
because I'm not sure if we can trust the value the X server
gives us.

NOTE: Currently -gui ignores these methods and only looks at the
GSScaleFactor user default. I'm going to make -gui use the server
values now, because it's safe to do so on Windows (the system
DPI is set by the user, and affects all applications.)

NOTE: We might consider refactoring these methods to be called
scaleFactorForScreen: to make it clearer what they do.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/back/trunk@33658 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
ericwa 2011-07-30 20:39:10 +00:00
parent 81ac170311
commit 2c788e3701
3 changed files with 46 additions and 5 deletions

View file

@ -351,19 +351,26 @@ LRESULT CALLBACK MainWndProc(HWND hwnd, UINT uMsg,
return (int)hwnd;
}
// FIXME: The following methods wont work for multiple screens
// FIXME: The following methods wont work for multiple screens.
// However, GetDeviceCaps docs say that on a system with multiple screens,
// LOGPIXELSX/Y will be the same for all screens, so the following is OK.
/* Screen information */
- (NSSize) resolutionForScreen: (int)screen
{
int xres, yres;
int windowsXRes, windowsYRes;
NSSize gnustepRes;
HDC hdc;
hdc = GetDC(NULL);
xres = GetDeviceCaps(hdc, LOGPIXELSX);
yres = GetDeviceCaps(hdc, LOGPIXELSY);
windowsXRes = GetDeviceCaps(hdc, LOGPIXELSX);
windowsYRes = GetDeviceCaps(hdc, LOGPIXELSY);
ReleaseDC(NULL, hdc);
return NSMakeSize(xres, yres);
// We want to return 72 to indicate no scaling factor, but the default
// DPI on Windows is 96. So, multiply the result by (72/96) = 0.75
gnustepRes = NSMakeSize(0.75 * windowsXRes, 0.75 * windowsYRes);
return gnustepRes;
}
- (NSRect) boundsForScreen: (int)screen