From 835e769f97eda4ff3ecc16ddca6d36c5496dc50d Mon Sep 17 00:00:00 2001 From: Zhao Yuhang <2546789017@qq.com> Date: ćšć, 06 3æ 2025 18:32:04 +0800 Subject: [PATCH] fix build with old win-sdk --- src/core/shared/qwkwindowsextra_p.h | 45 ++++++++++++++++++++++++++++++++++++++------- src/core/qwindowkit_windows.h | 8 ++++++++ src/core/contexts/win32windowcontext.cpp | 4 ++++ 3 files changed, 50 insertions(+), 7 deletions(-) diff --git a/src/core/contexts/win32windowcontext.cpp b/src/core/contexts/win32windowcontext.cpp index f8a4f67..0d70129 100644 --- a/src/core/contexts/win32windowcontext.cpp +++ b/src/core/contexts/win32windowcontext.cpp @@ -37,6 +37,10 @@ # error Current Qt version has a critical bug which will break QWK functionality. Please upgrade to > 6.6.1 or downgrade to < 6.6.0 #endif +#ifndef DWM_BB_ENABLE +# define DWM_BB_ENABLE 0x00000001 +#endif + namespace QWK { enum IconButtonClickLevelFlag { diff --git a/src/core/qwindowkit_windows.h b/src/core/qwindowkit_windows.h index 7e9b8a7..aad3775 100644 --- a/src/core/qwindowkit_windows.h +++ b/src/core/qwindowkit_windows.h @@ -5,6 +5,14 @@ #ifndef QWINDOWKIT_WINDOWS_H #define QWINDOWKIT_WINDOWS_H +#ifndef _USER32_ +# define _USER32_ +#endif + +#ifndef _DWMAPI_ +# define _DWMAPI_ +#endif + #include <QtCore/qt_windows.h> #include <QtCore/qglobal.h> diff --git a/src/core/shared/qwkwindowsextra_p.h b/src/core/shared/qwkwindowsextra_p.h index 8fdc86e..3bd086e 100644 --- a/src/core/shared/qwkwindowsextra_p.h +++ b/src/core/shared/qwkwindowsextra_p.h @@ -14,10 +14,6 @@ // version without notice, or may even be removed. // -#include <shellscalingapi.h> -#include <dwmapi.h> -#include <timeapi.h> - #include <QWKCore/qwindowkit_windows.h> #include <QtCore/QtMath> @@ -28,6 +24,41 @@ #include <QtCore/private/qsystemlibrary_p.h> // Don't include this header in any header files. + +typedef struct _MARGINS +{ + int cxLeftWidth; + int cxRightWidth; + int cyTopHeight; + int cyBottomHeight; +} MARGINS, *PMARGINS; + +typedef enum MONITOR_DPI_TYPE { + MDT_EFFECTIVE_DPI = 0, + MDT_ANGULAR_DPI = 1, + MDT_RAW_DPI = 2, + MDT_DEFAULT = MDT_EFFECTIVE_DPI +} MONITOR_DPI_TYPE; + +typedef struct _DWM_BLURBEHIND +{ + DWORD dwFlags; + BOOL fEnable; + HRGN hRgnBlur; + BOOL fTransitionOnMaximized; +} DWM_BLURBEHIND, *PDWM_BLURBEHIND; + +extern "C" { + UINT WINAPI GetDpiForWindow(HWND); + int WINAPI GetSystemMetricsForDpi(int, UINT); + HRESULT WINAPI GetDpiForMonitor(HMONITOR, MONITOR_DPI_TYPE, UINT *, UINT *); + HRESULT WINAPI DwmFlush(); + HRESULT WINAPI DwmIsCompositionEnabled(BOOL*); + HRESULT WINAPI DwmGetWindowAttribute(HWND, DWORD, PVOID, DWORD); + HRESULT WINAPI DwmSetWindowAttribute(HWND, DWORD, LPCVOID, DWORD); + HRESULT WINAPI DwmExtendFrameIntoClientArea(HWND, const MARGINS*); + HRESULT WINAPI DwmEnableBlurBehindWindow(HWND, const DWM_BLURBEHIND*); +} // extern "C" namespace QWK { @@ -160,7 +191,7 @@ namespace { struct DynamicApis { - static const DynamicApis &instance() { + static inline const DynamicApis &instance() { static const DynamicApis inst; return inst; } @@ -188,7 +219,7 @@ SetPreferredAppModePtr pSetPreferredAppMode = nullptr; private: - DynamicApis() { + inline DynamicApis() { #define DYNAMIC_API_RESOLVE(DLL, NAME) \ p##NAME = reinterpret_cast<decltype(p##NAME)>(DLL.resolve(#NAME)) @@ -224,7 +255,7 @@ #undef UNDOC_API_RESOLVE } - ~DynamicApis() = default; + inline ~DynamicApis() = default; Q_DISABLE_COPY(DynamicApis) }; -- Gitblit v1.9.1