From b2189acfc142397e8f3f547b0affdfc0b233fbb2 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Morten=20Johan=20S=C3=B8rvig?= Date: Fri, 2 Nov 2012 09:03:21 +0100 Subject: [PATCH] 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 Reviewed-by: Richard Moe Gustavsen --- src/plugins/platforms/cocoa/qcocoaintegration.mm | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/plugins/platforms/cocoa/qcocoaintegration.mm b/src/plugins/platforms/cocoa/qcocoaintegration.mm index 481055a..f17e97c 100644 --- a/src/plugins/platforms/cocoa/qcocoaintegration.mm +++ b/src/plugins/platforms/cocoa/qcocoaintegration.mm @@ -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()); } -- 2.7.4