From f3df759b67db8036878fe771addea13cb1aad592 Mon Sep 17 00:00:00 2001 From: Yuhang Zhao <2546789017@qq.com> Date: Sat, 30 Oct 2021 22:12:11 +0800 Subject: [PATCH] qtbase: remove last piece of DwmIsCompositionEnabled DWM composition is always enabled and can't be disabled since Windows 8 [1]. As a drive-by, remove an old workaround for MSVC 2012, which is not supported by Qt6. [1] https://docs.microsoft.com/en-us/windows/win32/api/dwmapi/nf-dwmapi-dwmiscompositionenabled Change-Id: I2ec055d794c91d69c141dca7cec80beb9468628c Reviewed-by: Oliver Wolff (cherry picked from commit 2962e27441c3870120a0d37cd7dc472953b356e7) --- src/widgets/dialogs/qwizard_win.cpp | 22 ++-------------------- 1 file changed, 2 insertions(+), 20 deletions(-) diff --git a/src/widgets/dialogs/qwizard_win.cpp b/src/widgets/dialogs/qwizard_win.cpp index 24aa24de20d..de180adba12 100644 --- a/src/widgets/dialogs/qwizard_win.cpp +++ b/src/widgets/dialogs/qwizard_win.cpp @@ -187,8 +187,7 @@ void QVistaHelper::updateCustomMargins(bool vistaMargins) bool QVistaHelper::isCompositionEnabled() { - BOOL bEnabled; - return SUCCEEDED(DwmIsCompositionEnabled(&bEnabled)) && bEnabled; + return true; } bool QVistaHelper::isThemeActive() @@ -669,26 +668,9 @@ bool QVistaHelper::drawBlackRect(const QRect &rect, HDC hdc) return value; } -#ifndef Q_CC_MSVC -static inline int getWindowBottomMargin() -{ - return GetSystemMetrics(SM_CYSIZEFRAME); -} -#else -// QTBUG-36192, GetSystemMetrics(SM_CYSIZEFRAME) returns bogus values -// for MSVC2012 which leads to the custom margin having no effect since -// that only works when removing the entire margin. -static inline int getWindowBottomMargin() -{ - RECT rect = {0, 0, 0, 0}; - AdjustWindowRectEx(&rect, WS_POPUP | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_THICKFRAME | WS_DLGFRAME, FALSE, 0); - return qAbs(rect.bottom); -} -#endif // Q_CC_MSVC - int QVistaHelper::frameSizeDp() { - return getWindowBottomMargin(); + return GetSystemMetrics(SM_CYSIZEFRAME); } int QVistaHelper::captionSizeDp()