Windows: Fix reported screen metrics.
A call to SetProcessDPIAware() is required in some cases. Task-number: QTBUG-30063 Change-Id: Iba0203d76c8e7068bf9fd4581770c1aca76a4708 Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com> Reviewed-by: Oliver Wolff <oliver.wolff@digia.com>
This commit is contained in:
parent
d8406d0e09
commit
11e9f1368b
@ -172,7 +172,7 @@ QWindowsUser32DLL::QWindowsUser32DLL() :
|
|||||||
updateLayeredWindowIndirect(0),
|
updateLayeredWindowIndirect(0),
|
||||||
isHungAppWindow(0),
|
isHungAppWindow(0),
|
||||||
registerTouchWindow(0), unregisterTouchWindow(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"));
|
updateLayeredWindowIndirect = (UpdateLayeredWindowIndirect)(library.resolve("UpdateLayeredWindowIndirect"));
|
||||||
isHungAppWindow = (IsHungAppWindow)library.resolve("IsHungAppWindow");
|
isHungAppWindow = (IsHungAppWindow)library.resolve("IsHungAppWindow");
|
||||||
|
setProcessDPIAware = (SetProcessDPIAware)library.resolve("SetProcessDPIAware");
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QWindowsUser32DLL::initTouch()
|
bool QWindowsUser32DLL::initTouch()
|
||||||
@ -252,7 +253,7 @@ struct QWindowsContextPrivate {
|
|||||||
QSet<QString> m_registeredWindowClassNames;
|
QSet<QString> m_registeredWindowClassNames;
|
||||||
HandleBaseWindowHash m_windows;
|
HandleBaseWindowHash m_windows;
|
||||||
HDC m_displayContext;
|
HDC m_displayContext;
|
||||||
const int m_defaultDPI;
|
int m_defaultDPI;
|
||||||
QWindowsKeyMapper m_keyMapper;
|
QWindowsKeyMapper m_keyMapper;
|
||||||
QWindowsMouseHandler m_mouseHandler;
|
QWindowsMouseHandler m_mouseHandler;
|
||||||
QWindowsMimeConverter m_mimeConverter;
|
QWindowsMimeConverter m_mimeConverter;
|
||||||
@ -266,8 +267,6 @@ struct QWindowsContextPrivate {
|
|||||||
|
|
||||||
QWindowsContextPrivate::QWindowsContextPrivate() :
|
QWindowsContextPrivate::QWindowsContextPrivate() :
|
||||||
m_systemInfo(0),
|
m_systemInfo(0),
|
||||||
m_displayContext(GetDC(0)),
|
|
||||||
m_defaultDPI(GetDeviceCaps(m_displayContext,LOGPIXELSY)),
|
|
||||||
m_oleInitializeResult(OleInitialize(NULL)),
|
m_oleInitializeResult(OleInitialize(NULL)),
|
||||||
m_eventType(QByteArrayLiteral("windows_generic_MSG")),
|
m_eventType(QByteArrayLiteral("windows_generic_MSG")),
|
||||||
m_lastActiveWindow(0), m_asyncExpose(0)
|
m_lastActiveWindow(0), m_asyncExpose(0)
|
||||||
@ -276,6 +275,11 @@ QWindowsContextPrivate::QWindowsContextPrivate() :
|
|||||||
QWindowsContext::user32dll.init();
|
QWindowsContext::user32dll.init();
|
||||||
QWindowsContext::shell32dll.init();
|
QWindowsContext::shell32dll.init();
|
||||||
#endif
|
#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();
|
const QSysInfo::WinVersion ver = QSysInfo::windowsVersion();
|
||||||
#ifndef Q_OS_WINCE
|
#ifndef Q_OS_WINCE
|
||||||
|
@ -80,6 +80,7 @@ struct QWindowsUser32DLL
|
|||||||
const BLENDFUNCTION *, DWORD);
|
const BLENDFUNCTION *, DWORD);
|
||||||
typedef BOOL (WINAPI *UpdateLayeredWindowIndirect)(HWND, const UPDATELAYEREDWINDOWINFO *);
|
typedef BOOL (WINAPI *UpdateLayeredWindowIndirect)(HWND, const UPDATELAYEREDWINDOWINFO *);
|
||||||
typedef BOOL (WINAPI *IsHungAppWindow)(HWND);
|
typedef BOOL (WINAPI *IsHungAppWindow)(HWND);
|
||||||
|
typedef BOOL (WINAPI *SetProcessDPIAware)();
|
||||||
|
|
||||||
// Functions missing in Q_CC_GNU stub libraries.
|
// Functions missing in Q_CC_GNU stub libraries.
|
||||||
SetLayeredWindowAttributes setLayeredWindowAttributes;
|
SetLayeredWindowAttributes setLayeredWindowAttributes;
|
||||||
@ -94,6 +95,9 @@ struct QWindowsUser32DLL
|
|||||||
UnregisterTouchWindow unregisterTouchWindow;
|
UnregisterTouchWindow unregisterTouchWindow;
|
||||||
GetTouchInputInfo getTouchInputInfo;
|
GetTouchInputInfo getTouchInputInfo;
|
||||||
CloseTouchInputHandle closeTouchInputHandle;
|
CloseTouchInputHandle closeTouchInputHandle;
|
||||||
|
|
||||||
|
// Windows Vista onwards
|
||||||
|
SetProcessDPIAware setProcessDPIAware;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct QWindowsShell32DLL
|
struct QWindowsShell32DLL
|
||||||
|
Loading…
x
Reference in New Issue
Block a user