diff options
author | Morten Johan Sørvig <morten.sorvig@qt.io> | 2020-12-01 15:24:23 +0100 |
---|---|---|
committer | Morten Johan Sørvig <morten.sorvig@qt.io> | 2021-02-08 08:13:56 +0100 |
commit | c35643dba3efabaf3fa036895f152bf5b8725f5e (patch) | |
tree | eb3ab567e951cc9f9f0089562694d7db71cd5044 /src/plugins/platforms/windows/qwindowscontext.h | |
parent | d9a7d1a89caa754b4b6b61c1d0712f978d7f2114 (diff) |
Windows: Add support for PerMonitorV2 DPI awareness
Add support for opting in to PerMonitorV2 DPI awareness
on the command line:
-platform windows:dpiawareness=3
This mode is supported on Windows 10 and up. Setting it
requires using the new SetProcessDpiAwarenessContext
API, which can be resolved from user32.dll.
Task-number: QTBUG-68712
Change-Id: I37821e27a67e08c2e9fef25e494cfd7abed13314
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Diffstat (limited to 'src/plugins/platforms/windows/qwindowscontext.h')
-rw-r--r-- | src/plugins/platforms/windows/qwindowscontext.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/plugins/platforms/windows/qwindowscontext.h b/src/plugins/platforms/windows/qwindowscontext.h index aacdafebb6..99b4bb6c77 100644 --- a/src/plugins/platforms/windows/qwindowscontext.h +++ b/src/plugins/platforms/windows/qwindowscontext.h @@ -98,6 +98,7 @@ struct QWindowsUser32DLL typedef BOOL (WINAPI *GetPointerPenInfoHistory)(UINT32, UINT32 *, PVOID); typedef BOOL (WINAPI *SkipPointerFrameMessages)(UINT32); typedef BOOL (WINAPI *SetProcessDPIAware)(); + typedef BOOL (WINAPI *SetProcessDpiAwarenessContext)(HANDLE); typedef BOOL (WINAPI *AddClipboardFormatListener)(HWND); typedef BOOL (WINAPI *RemoveClipboardFormatListener)(HWND); typedef BOOL (WINAPI *GetDisplayAutoRotationPreferences)(DWORD *); @@ -123,6 +124,9 @@ struct QWindowsUser32DLL // Windows Vista onwards SetProcessDPIAware setProcessDPIAware = nullptr; + // Windows 10 version 1703 onwards + SetProcessDpiAwarenessContext setProcessDpiAwarenessContext = nullptr; + // Clipboard listeners are present on Windows Vista onwards // but missing in MinGW 4.9 stub libs. Can be removed in MinGW 5. AddClipboardFormatListener addClipboardFormatListener = nullptr; @@ -227,6 +231,7 @@ public: static void setTabletAbsoluteRange(int a); void setProcessDpiAwareness(QtWindows::ProcessDpiAwareness dpiAwareness); static int processDpiAwareness(); + void setProcessDpiV2Awareness(); static bool isDarkMode(); |