mirror of
https://github.com/gnustep/libs-back.git
synced 2025-04-22 15:31:14 +00:00
* 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:
parent
81ac170311
commit
2c788e3701
3 changed files with 46 additions and 5 deletions
19
ChangeLog
19
ChangeLog
|
@ -1,3 +1,22 @@
|
|||
2011-07-30 Eric Wasylishen <ewasylishen@gmail.com>
|
||||
* 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.
|
||||
|
||||
2011-07-18 Eric Wasylishen <ewasylishen@gmail.com>
|
||||
|
||||
* Source/winlib/WIN32GState.m (GSCreateBitmap): Add support for
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -4550,6 +4550,20 @@ _computeDepth(int class, int bpp)
|
|||
|
||||
- (NSSize) resolutionForScreen: (int)screen_num
|
||||
{
|
||||
// NOTE:
|
||||
// -gui now trusts the return value of resolutionForScreen:,
|
||||
// so if it is not {72, 72} then the entire UI will be scaled.
|
||||
//
|
||||
// I commented out the implementation below because it may not
|
||||
// be safe to use the DPI value we get from the X server.
|
||||
// (i.e. I don't know if it will be a "fake" DPI like 72 or 96,
|
||||
// or a real measurement reported from the monitor's firmware
|
||||
// (possibly incorrect?))
|
||||
// More research needs to be done.
|
||||
|
||||
return NSMakeSize(72, 72);
|
||||
|
||||
/*
|
||||
int res_x, res_y;
|
||||
|
||||
if (screen_num < 0 || screen_num >= ScreenCount(dpy))
|
||||
|
@ -4564,6 +4578,7 @@ _computeDepth(int class, int bpp)
|
|||
(DisplayHeightMM(dpy, screen_num) / 25.4);
|
||||
|
||||
return NSMakeSize(res_x, res_y);
|
||||
*/
|
||||
}
|
||||
|
||||
- (NSRect) boundsForScreen: (int)screen
|
||||
|
|
Loading…
Reference in a new issue