summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/windows/qwindowsscreen.cpp
diff options
context:
space:
mode:
authorSamuel Rødal <samuel.rodal@nokia.com>2012-05-04 13:10:41 +0200
committerQt by Nokia <qt-info@nokia.com>2012-05-08 22:30:10 +0200
commitf280efc6201adf8933c9d48a1d5b6983ee9fed9b (patch)
tree8ec0d8466b951272667d6c620959d51383902630 /src/plugins/platforms/windows/qwindowsscreen.cpp
parent4a58853aeae02677e6ee1a0f0ef8839578c32573 (diff)
Added QScreen::refreshRate() to get the vertical refresh rate.
To give applications that want it the option to use a fixed timestep for animations, and to avoid having values of 60 hard-coded (we have a couple of those in qtdeclarative/src/quick already), we need to know the refresh rates of the screens we are rendering to. Change-Id: Ife49162e830440ad7eab563a27e8aebbbafc5fc5 Reviewed-by: Girish Ramakrishnan <girish.1.ramakrishnan@nokia.com> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com> Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
Diffstat (limited to 'src/plugins/platforms/windows/qwindowsscreen.cpp')
-rw-r--r--src/plugins/platforms/windows/qwindowsscreen.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/plugins/platforms/windows/qwindowsscreen.cpp b/src/plugins/platforms/windows/qwindowsscreen.cpp
index 2476e15169..cc694fe0ea 100644
--- a/src/plugins/platforms/windows/qwindowsscreen.cpp
+++ b/src/plugins/platforms/windows/qwindowsscreen.cpp
@@ -59,7 +59,8 @@ QT_BEGIN_NAMESPACE
QWindowsScreenData::QWindowsScreenData() :
dpi(96, 96), depth(32), format(QImage::Format_ARGB32_Premultiplied),
- flags(VirtualDesktop), orientation(Qt::LandscapeOrientation)
+ flags(VirtualDesktop), orientation(Qt::LandscapeOrientation),
+ refreshRateHz(60)
{
}
@@ -103,6 +104,9 @@ BOOL QT_WIN_CALLBACK monitorEnumCallback(HMONITOR hMonitor, HDC, LPRECT, LPARAM
data.depth = GetDeviceCaps(hdc, BITSPIXEL);
data.format = data.depth == 16 ? QImage::Format_RGB16 : QImage::Format_RGB32;
data.physicalSizeMM = QSizeF(GetDeviceCaps(hdc, HORZSIZE), GetDeviceCaps(hdc, VERTSIZE));
+ const int refreshRate = GetDeviceCaps(hdc, VREFRESH);
+ if (refreshRate > 1) // 0,1 means heardware default.
+ data.refreshRateHz = refreshRate;
DeleteDC(hdc);
} else {
qWarning("%s: Unable to obtain handle for monitor '%s', defaulting to %g DPI.",