Cocoa: Fix fonts on retina displays.

Hardcode logical dpi to 72 again. NSDeviceResolution
gives us the physical dpi (144) and results in double-
sized fonts in Qt. QPlatformScreen does not currently
have a physicalDpi virtual, perhaps this can be added
later on.

Unfortunately the usefulness of a per-screen correct 
DPI metric seems questionable to me:
1) The value returned by the system is not correct,
   pixels per inch on the rMBP is around 220.
2) Qt always uses the dpi for the main screen, via
   qt_defaltDpiX/Y.

Change-Id: Ia35804be62ee7f1c623bad854f65d744dc9075d4
Reviewed-by: Jens Bache-Wiig <jens.bache-wiig@digia.com>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@digia.com>
This commit is contained in:
Morten Johan Sørvig 2012-11-02 09:03:21 +01:00 committed by The Qt Project
parent 324a41db45
commit b2189acfc1

View File

@ -97,9 +97,8 @@ void QCocoaScreen::updateGeometry()
CGDirectDisplayID dpy = [[devDesc objectForKey:@"NSScreenNumber"] unsignedIntValue];
CGSize size = CGDisplayScreenSize(dpy);
m_physicalSize = QSizeF(size.width, size.height);
NSSize resolution = [[devDesc valueForKey:NSDeviceResolution] sizeValue];
m_logicalDpi.first = resolution.width;
m_logicalDpi.second = resolution.height;
m_logicalDpi.first = 72;
m_logicalDpi.second = 72;
m_refreshRate = CGDisplayModeGetRefreshRate(CGDisplayCopyDisplayMode(dpy));
// Get m_name (brand/model of the monitor)
@ -110,7 +109,7 @@ void QCocoaScreen::updateGeometry()
[deviceInfo release];
QWindowSystemInterface::handleScreenGeometryChange(screen(), geometry());
QWindowSystemInterface::handleScreenLogicalDotsPerInchChange(screen(), resolution.width, resolution.height);
QWindowSystemInterface::handleScreenLogicalDotsPerInchChange(screen(), m_logicalDpi.first, m_logicalDpi.second);
QWindowSystemInterface::handleScreenRefreshRateChange(screen(), m_refreshRate);
QWindowSystemInterface::handleScreenAvailableGeometryChange(screen(), availableGeometry());
}