From a8ff2e3e8bff4fc1997f89c7b94a0e2d1cc5e60d Mon Sep 17 00:00:00 2001 From: kleuter Date: Thu, 2 Nov 2023 20:47:38 +0100 Subject: [PATCH] 6.6.0 - windows 7 compatibility works --- src/plugins/platforms/windows/qwindowscontext.cpp | 8 ++++---- src/plugins/platforms/windows/qwindowscontext.h | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/plugins/platforms/windows/qwindowscontext.cpp b/src/plugins/platforms/windows/qwindowscontext.cpp index 89b1ebd1..9447fcfc 100644 --- a/src/plugins/platforms/windows/qwindowscontext.cpp +++ b/src/plugins/platforms/windows/qwindowscontext.cpp @@ -459,7 +459,7 @@ QtWindows::DpiAwareness QWindowsContext::windowDpiAwareness(HWND hwnd) if (QWindowsContext::user32dll.getWindowDpiAwarenessContext) { - const auto context = GetWindowDpiAwarenessContext(hwnd); + const auto context = QWindowsContext::user32dll.getWindowDpiAwarenessContext(hwnd); return dpiAwarenessContextToQtDpiAwareness(context); } @@ -477,7 +477,7 @@ QtWindows::DpiAwareness QWindowsContext::processDpiAwareness() // return the default DPI_AWARENESS_CONTEXT for the process if // SetThreadDpiAwarenessContext() was never called. So we can use // it as an equivalent. - const auto context = GetThreadDpiAwarenessContext(); + const auto context = QWindowsContext::user32dll.getThreadDpiAwarenessContext(); return dpiAwarenessContextToQtDpiAwareness(context); } @@ -990,8 +990,8 @@ void QWindowsContext::forceNcCalcSize(HWND hwnd) bool QWindowsContext::systemParametersInfo(unsigned action, unsigned param, void *out, unsigned dpi) { - const BOOL result = dpi != 0 - ? SystemParametersInfoForDpi(action, param, out, 0, dpi) + const BOOL result = (QWindowsContext::user32dll.systemParametersInfoForDpi != nullptr && dpi != 0) + ? QWindowsContext::user32dll.systemParametersInfoForDpi(action, param, out, 0, dpi) : SystemParametersInfo(action, param, out, 0); return result == TRUE; } diff --git a/src/plugins/platforms/windows/qwindowscontext.h b/src/plugins/platforms/windows/qwindowscontext.h index d859e00f..d35c58de 100644 --- a/src/plugins/platforms/windows/qwindowscontext.h +++ b/src/plugins/platforms/windows/qwindowscontext.h @@ -68,13 +68,13 @@ struct QWindowsUser32DLL typedef BOOL (WINAPI *SetDisplayAutoRotationPreferences)(DWORD); typedef BOOL (WINAPI *AdjustWindowRectExForDpi)(LPRECT,DWORD,BOOL,DWORD,UINT); typedef BOOL (WINAPI *EnableNonClientDpiScaling)(HWND); - typedef int (WINAPI *GetWindowDpiAwarenessContext)(HWND); - typedef int (WINAPI *GetAwarenessFromDpiAwarenessContext)(int); + typedef DPI_AWARENESS_CONTEXT (WINAPI *GetWindowDpiAwarenessContext)(HWND); + typedef DPI_AWARENESS (WINAPI *GetAwarenessFromDpiAwarenessContext)(int); typedef BOOL (WINAPI *SystemParametersInfoForDpi)(UINT, UINT, PVOID, UINT, UINT); typedef int (WINAPI *GetDpiForWindow)(HWND); typedef BOOL (WINAPI *GetSystemMetricsForDpi)(INT, UINT); typedef BOOL (WINAPI *AreDpiAwarenessContextsEqual)(DPI_AWARENESS_CONTEXT, DPI_AWARENESS_CONTEXT); - typedef int (WINAPI *GetThreadDpiAwarenessContext)(); + typedef DPI_AWARENESS_CONTEXT (WINAPI *GetThreadDpiAwarenessContext)(); typedef BOOL (WINAPI *IsValidDpiAwarenessContext)(DPI_AWARENESS_CONTEXT); // Windows pointer functions (Windows 8 or later).