summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms
diff options
context:
space:
mode:
authorGunnar Sletta <gunnar.sletta@digia.com>2013-02-14 11:33:47 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-02-18 16:21:27 +0100
commitffecaf85e8cd8adb5a18e4ce50b2a8f5f2b0e4b0 (patch)
tree422be8a29c7fbfdcfd5e2df6f396aa6b12f64098 /src/plugins/platforms
parent7c33ae6a7bbbd42ce70acf77aa55c1bc2a23c8ec (diff)
QScreen::refreshRate would return 0 on Mac OS X
The function we use to get the actual vsync on cocoa is documented to return 0 if the monitor is not a CRT monitor. A refreshrate of 0 means we have vsync deltas of 1000/0 which cause problems elsewhere. It is better to use the "default" value in this case as it will be closer to correct than 0. Change-Id: Id08007e40a9af5e42f13a07628fcad5fd3a7d0dc Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com> Reviewed-by: Samuel Rødal <samuel.rodal@digia.com>
Diffstat (limited to 'src/plugins/platforms')
-rw-r--r--src/plugins/platforms/cocoa/qcocoaintegration.mm4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoaintegration.mm b/src/plugins/platforms/cocoa/qcocoaintegration.mm
index 7fcdab4d97..f33d4cb68b 100644
--- a/src/plugins/platforms/cocoa/qcocoaintegration.mm
+++ b/src/plugins/platforms/cocoa/qcocoaintegration.mm
@@ -105,7 +105,9 @@ void QCocoaScreen::updateGeometry()
m_physicalSize = QSizeF(size.width, size.height);
m_logicalDpi.first = 72;
m_logicalDpi.second = 72;
- m_refreshRate = CGDisplayModeGetRefreshRate(CGDisplayCopyDisplayMode(dpy));
+ float refresh = CGDisplayModeGetRefreshRate(CGDisplayCopyDisplayMode(dpy));
+ if (refresh > 0)
+ m_refreshRate = refresh;
// Get m_name (brand/model of the monitor)
NSDictionary *deviceInfo = (NSDictionary *)IODisplayCreateInfoDictionary(CGDisplayIOServicePort(dpy), kIODisplayOnlyPreferredName);