diff options
author | Frederik Gladhorn <frederik.gladhorn@digia.com> | 2013-04-03 17:42:03 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-04-03 17:42:03 +0200 |
commit | 8b99445755bac9c1bc1c2ce84a6e21edadca1f11 (patch) | |
tree | 8a0f4f4fb3ec2837a23b7d6a3b9774d1ab9458d6 /src/plugins/platforms | |
parent | b2d7168313a5d64ff1cf0061e94f9b2eba074af4 (diff) | |
parent | a4121a21c010d8b9d3a80d9c4cfe5e5c72f5f0fa (diff) |
Merge "Merge remote-tracking branch 'origin/release' into stable" into refs/staging/stable
Diffstat (limited to 'src/plugins/platforms')
-rw-r--r-- | src/plugins/platforms/windows/qwindowscontext.cpp | 12 | ||||
-rw-r--r-- | src/plugins/platforms/windows/qwindowscontext.h | 4 |
2 files changed, 12 insertions, 4 deletions
diff --git a/src/plugins/platforms/windows/qwindowscontext.cpp b/src/plugins/platforms/windows/qwindowscontext.cpp index 7e6b55dead..545484de8d 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 diff --git a/src/plugins/platforms/windows/qwindowscontext.h b/src/plugins/platforms/windows/qwindowscontext.h index 1fe71e3aff..d60b632beb 100644 --- a/src/plugins/platforms/windows/qwindowscontext.h +++ b/src/plugins/platforms/windows/qwindowscontext.h @@ -80,6 +80,7 @@ struct QWindowsUser32DLL const BLENDFUNCTION *, DWORD); typedef BOOL (WINAPI *UpdateLayeredWindowIndirect)(HWND, const UPDATELAYEREDWINDOWINFO *); typedef BOOL (WINAPI *IsHungAppWindow)(HWND); + typedef BOOL (WINAPI *SetProcessDPIAware)(); // Functions missing in Q_CC_GNU stub libraries. SetLayeredWindowAttributes setLayeredWindowAttributes; @@ -94,6 +95,9 @@ struct QWindowsUser32DLL UnregisterTouchWindow unregisterTouchWindow; GetTouchInputInfo getTouchInputInfo; CloseTouchInputHandle closeTouchInputHandle; + + // Windows Vista onwards + SetProcessDPIAware setProcessDPIAware; }; struct QWindowsShell32DLL |