Windows QPA: Remove DwmIsCompositionEnabled() usages

According to Microsoft Docs [1], DWM composition is always
enabled and can't be disabled since Windows 8. Now that
we are cleaning up pre-Windows 10 code, this apparently
needs to be removed as well.

[1] https://docs.microsoft.com/en-us/windows/win32/api/dwmapi/nf-dwmapi-dwmiscompositionenabled

Task-number: QTBUG-84432
Change-Id: I64dc049e0741600c8d0ae4db0e9e3bc98a211339
Reviewed-by: André de la Rocha <andre.rocha@qt.io>
bb10
Yuhang Zhao 2021-07-29 13:57:54 +08:00
parent f9170f56c7
commit 2c6bc06267
1 changed files with 5 additions and 29 deletions

View File

@ -360,20 +360,11 @@ static inline bool windowIsAccelerated(const QWindow *w)
static bool applyBlurBehindWindow(HWND hwnd)
{
BOOL compositionEnabled;
if (DwmIsCompositionEnabled(&compositionEnabled) != S_OK)
return false;
DWM_BLURBEHIND blurBehind = {0, 0, nullptr, 0};
if (compositionEnabled) {
blurBehind.dwFlags = DWM_BB_ENABLE | DWM_BB_BLURREGION;
blurBehind.fEnable = TRUE;
blurBehind.hRgnBlur = CreateRectRgn(0, 0, -1, -1);
} else {
blurBehind.dwFlags = DWM_BB_ENABLE;
blurBehind.fEnable = FALSE;
}
blurBehind.dwFlags = DWM_BB_ENABLE | DWM_BB_BLURREGION;
blurBehind.fEnable = TRUE;
blurBehind.hRgnBlur = CreateRectRgn(0, 0, -1, -1);
const bool result = DwmEnableBlurBehindWindow(hwnd, &blurBehind) == S_OK;
@ -2104,12 +2095,6 @@ void QWindowsWindow::releaseDC()
}
}
static inline bool dwmIsCompositionEnabled()
{
BOOL dWmCompositionEnabled = FALSE;
return SUCCEEDED(DwmIsCompositionEnabled(&dWmCompositionEnabled)) && dWmCompositionEnabled == TRUE;
}
static inline bool isSoftwareGl()
{
#if QT_CONFIG(dynamicgl)
@ -2133,22 +2118,13 @@ bool QWindowsWindow::handleWmPaint(HWND hwnd, UINT message,
return false;
PAINTSTRUCT ps;
// GL software rendering (QTBUG-58178) and Windows 7/Aero off with some AMD cards
// GL software rendering (QTBUG-58178) with some AMD cards
// (QTBUG-60527) need InvalidateRect() to suppress artifacts while resizing.
if (testFlag(OpenGLSurface) && (isSoftwareGl() || !dwmIsCompositionEnabled()))
if (testFlag(OpenGLSurface) && isSoftwareGl())
InvalidateRect(hwnd, nullptr, false);
BeginPaint(hwnd, &ps);
// Observed painting problems with Aero style disabled (QTBUG-7865).
if (Q_UNLIKELY(!dwmIsCompositionEnabled())
&& ((testFlag(OpenGLSurface) && testFlag(OpenGLDoubleBuffered))
|| testFlag(VulkanSurface)
|| testFlag(Direct3DSurface)))
{
SelectClipRgn(ps.hdc, nullptr);
}
// If the a window is obscured by another window (such as a child window)
// we still need to send isExposed=true, for compatibility.
// Our tests depend on it.