From 2c6bc06267b2599d491d5c84b29a368e6a922bc1 Mon Sep 17 00:00:00 2001 From: Yuhang Zhao <2546789017@qq.com> Date: Thu, 29 Jul 2021 13:57:54 +0800 Subject: Windows QPA: Remove DwmIsCompositionEnabled() usages MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- src/plugins/platforms/windows/qwindowswindow.cpp | 34 ++++-------------------- 1 file changed, 5 insertions(+), 29 deletions(-) (limited to 'src/plugins') diff --git a/src/plugins/platforms/windows/qwindowswindow.cpp b/src/plugins/platforms/windows/qwindowswindow.cpp index a282f7c238..3e291f310d 100644 --- a/src/plugins/platforms/windows/qwindowswindow.cpp +++ b/src/plugins/platforms/windows/qwindowswindow.cpp @@ -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. -- cgit v1.2.3