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 <oliver.wolff@qt.io>
This commit is contained in:
Yuhang Zhao 2021-10-30 22:12:11 +08:00
parent 859f2ca1a6
commit 2962e27441

View File

@ -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()