summaryrefslogtreecommitdiff
path: root/src/plugins/platforms/windows/qwindowscontext.cpp
diff options
context:
space:
mode:
authorOswald Buddenhagen <oswald.buddenhagen@digia.com>2013-04-11 16:57:34 +0200
committerOswald Buddenhagen <oswald.buddenhagen@digia.com>2013-04-11 17:04:02 +0200
commitc51d26b6ec7869641441d01597c3e7acc643f93f (patch)
tree69ee279e12be73ae385e087c9d89ce7bc8480446 /src/plugins/platforms/windows/qwindowscontext.cpp
parent0646d1131b4bc65cdd9af29f4ce00fdd2398a3df (diff)
parent967c18d29694fdeab858691a80cb8400fd02ec33 (diff)
downloadqtbase-old/5.0.tar.gz
Merge branch 'release' into old/5.0old/5.0
Conflicts: tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp Change-Id: Id635e0c27df5d8e3852d12bd6433c6463bf4eadc
Diffstat (limited to 'src/plugins/platforms/windows/qwindowscontext.cpp')
-rw-r--r--src/plugins/platforms/windows/qwindowscontext.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/plugins/platforms/windows/qwindowscontext.cpp b/src/plugins/platforms/windows/qwindowscontext.cpp
index 1ea660d944..febf25baea 100644
--- a/src/plugins/platforms/windows/qwindowscontext.cpp
+++ b/src/plugins/platforms/windows/qwindowscontext.cpp
@@ -172,7 +172,7 @@ QWindowsUser32DLL::QWindowsUser32DLL() :
updateLayeredWindowIndirect(0),
isHungAppWindow(0),
registerTouchWindow(0), unregisterTouchWindow(0),
- getTouchInputInfo(0), closeTouchInputHandle(0)
+ getTouchInputInfo(0), closeTouchInputHandle(0), setProcessDPIAware(0)
{
}
@@ -187,6 +187,7 @@ void QWindowsUser32DLL::init()
updateLayeredWindowIndirect = (UpdateLayeredWindowIndirect)(library.resolve("UpdateLayeredWindowIndirect"));
isHungAppWindow = (IsHungAppWindow)library.resolve("IsHungAppWindow");
+ setProcessDPIAware = (SetProcessDPIAware)library.resolve("SetProcessDPIAware");
}
bool QWindowsUser32DLL::initTouch()
@@ -252,7 +253,7 @@ struct QWindowsContextPrivate {
QSet<QString> m_registeredWindowClassNames;
HandleBaseWindowHash m_windows;
HDC m_displayContext;
- const int m_defaultDPI;
+ int m_defaultDPI;
QWindowsKeyMapper m_keyMapper;
QWindowsMouseHandler m_mouseHandler;
QWindowsMimeConverter m_mimeConverter;
@@ -266,8 +267,6 @@ struct QWindowsContextPrivate {
QWindowsContextPrivate::QWindowsContextPrivate() :
m_systemInfo(0),
- m_displayContext(GetDC(0)),
- m_defaultDPI(GetDeviceCaps(m_displayContext,LOGPIXELSY)),
m_oleInitializeResult(OleInitialize(NULL)),
m_eventType(QByteArrayLiteral("windows_generic_MSG")),
m_lastActiveWindow(0), m_asyncExpose(0)
@@ -276,6 +275,11 @@ QWindowsContextPrivate::QWindowsContextPrivate() :
QWindowsContext::user32dll.init();
QWindowsContext::shell32dll.init();
#endif
+ // Ensure metrics functions report correct data, QTBUG-30063.
+ if (QWindowsContext::user32dll.setProcessDPIAware)
+ QWindowsContext::user32dll.setProcessDPIAware();
+ m_displayContext = GetDC(0);
+ m_defaultDPI = GetDeviceCaps(m_displayContext, LOGPIXELSY);
const QSysInfo::WinVersion ver = QSysInfo::windowsVersion();
#ifndef Q_OS_WINCE