6.6.0 - windows 7 compatibility works

This commit is contained in:
kleuter 2023-11-02 20:47:38 +01:00
parent 5cf9645728
commit a8ff2e3e8b
2 changed files with 7 additions and 7 deletions

View File

@ -459,7 +459,7 @@ QtWindows::DpiAwareness QWindowsContext::windowDpiAwareness(HWND hwnd)
if (QWindowsContext::user32dll.getWindowDpiAwarenessContext) if (QWindowsContext::user32dll.getWindowDpiAwarenessContext)
{ {
const auto context = GetWindowDpiAwarenessContext(hwnd); const auto context = QWindowsContext::user32dll.getWindowDpiAwarenessContext(hwnd);
return dpiAwarenessContextToQtDpiAwareness(context); return dpiAwarenessContextToQtDpiAwareness(context);
} }
@ -477,7 +477,7 @@ QtWindows::DpiAwareness QWindowsContext::processDpiAwareness()
// return the default DPI_AWARENESS_CONTEXT for the process if // return the default DPI_AWARENESS_CONTEXT for the process if
// SetThreadDpiAwarenessContext() was never called. So we can use // SetThreadDpiAwarenessContext() was never called. So we can use
// it as an equivalent. // it as an equivalent.
const auto context = GetThreadDpiAwarenessContext(); const auto context = QWindowsContext::user32dll.getThreadDpiAwarenessContext();
return dpiAwarenessContextToQtDpiAwareness(context); return dpiAwarenessContextToQtDpiAwareness(context);
} }
@ -990,8 +990,8 @@ void QWindowsContext::forceNcCalcSize(HWND hwnd)
bool QWindowsContext::systemParametersInfo(unsigned action, unsigned param, void *out, bool QWindowsContext::systemParametersInfo(unsigned action, unsigned param, void *out,
unsigned dpi) unsigned dpi)
{ {
const BOOL result = dpi != 0 const BOOL result = (QWindowsContext::user32dll.systemParametersInfoForDpi != nullptr && dpi != 0)
? SystemParametersInfoForDpi(action, param, out, 0, dpi) ? QWindowsContext::user32dll.systemParametersInfoForDpi(action, param, out, 0, dpi)
: SystemParametersInfo(action, param, out, 0); : SystemParametersInfo(action, param, out, 0);
return result == TRUE; return result == TRUE;
} }

View File

@ -68,13 +68,13 @@ struct QWindowsUser32DLL
typedef BOOL (WINAPI *SetDisplayAutoRotationPreferences)(DWORD); typedef BOOL (WINAPI *SetDisplayAutoRotationPreferences)(DWORD);
typedef BOOL (WINAPI *AdjustWindowRectExForDpi)(LPRECT,DWORD,BOOL,DWORD,UINT); typedef BOOL (WINAPI *AdjustWindowRectExForDpi)(LPRECT,DWORD,BOOL,DWORD,UINT);
typedef BOOL (WINAPI *EnableNonClientDpiScaling)(HWND); typedef BOOL (WINAPI *EnableNonClientDpiScaling)(HWND);
typedef int (WINAPI *GetWindowDpiAwarenessContext)(HWND); typedef DPI_AWARENESS_CONTEXT (WINAPI *GetWindowDpiAwarenessContext)(HWND);
typedef int (WINAPI *GetAwarenessFromDpiAwarenessContext)(int); typedef DPI_AWARENESS (WINAPI *GetAwarenessFromDpiAwarenessContext)(int);
typedef BOOL (WINAPI *SystemParametersInfoForDpi)(UINT, UINT, PVOID, UINT, UINT); typedef BOOL (WINAPI *SystemParametersInfoForDpi)(UINT, UINT, PVOID, UINT, UINT);
typedef int (WINAPI *GetDpiForWindow)(HWND); typedef int (WINAPI *GetDpiForWindow)(HWND);
typedef BOOL (WINAPI *GetSystemMetricsForDpi)(INT, UINT); typedef BOOL (WINAPI *GetSystemMetricsForDpi)(INT, UINT);
typedef BOOL (WINAPI *AreDpiAwarenessContextsEqual)(DPI_AWARENESS_CONTEXT, DPI_AWARENESS_CONTEXT); 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); typedef BOOL (WINAPI *IsValidDpiAwarenessContext)(DPI_AWARENESS_CONTEXT);
// Windows pointer functions (Windows 8 or later). // Windows pointer functions (Windows 8 or later).