diff options
author | Yuhang Zhao <2546789017@qq.com> | 2021-07-29 13:57:54 +0800 |
---|---|---|
committer | Yuhang Zhao <2546789017@qq.com> | 2021-07-30 01:08:15 +0000 |
commit | 2c6bc06267b2599d491d5c84b29a368e6a922bc1 (patch) | |
tree | 5b281a7d4385628996990ac408408e136a6314eb /src/plugins/platforms/windows | |
parent | f9170f56c7a0937547fc5dd60e90c52d72260ef8 (diff) |
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>
Diffstat (limited to 'src/plugins/platforms/windows')
-rw-r--r-- | src/plugins/platforms/windows/qwindowswindow.cpp | 34 |
1 files changed, 5 insertions, 29 deletions
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. |