diff options
author | Wang Chuan <ouchuanm@outlook.com> | 2024-01-22 20:41:31 +0800 |
---|---|---|
committer | Wang Chuan <ouchuanm@outlook.com> | 2024-01-26 04:16:34 +0000 |
commit | 466f0038653b746845c45b35691dd49b61e6a9c8 (patch) | |
tree | b5f5e979c8359c188c31437388e4e99f3c07b8c5 | |
parent | ec849cd269815993e9b5b0f949453844b4f68d3c (diff) |
rhi: d3d: Ensure dcomp content does not obscure child windows
According to the documentation for DirectComposition, there are four layers
associated with each window:
1. The contents drawn directly to the window handle (this is the bottommost layer).
2. An optional DirectComposition visual tree.
3. The contents of all child windows, if any.
4. Another optional DirectComposition visual tree (this is the topmost layer).
Creating an IDCompositionTarget as the topmost layer can cause the DirectComposition
content to cover all child windows. This results in child windows becoming invisible,
which is particularly problematic when a user embeds an external window into a
QML-created round rectangle window.
Fixes: QTBUG-121403
Change-Id: I6807ea578276a9518b57afea1c21ca89239deeaf
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
-rw-r--r-- | src/gui/rhi/qrhid3d11.cpp | 2 | ||||
-rw-r--r-- | src/gui/rhi/qrhid3d12.cpp | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/src/gui/rhi/qrhid3d11.cpp b/src/gui/rhi/qrhid3d11.cpp index 54e94bf2f3..d10303316c 100644 --- a/src/gui/rhi/qrhid3d11.cpp +++ b/src/gui/rhi/qrhid3d11.cpp @@ -5051,7 +5051,7 @@ bool QD3D11SwapChain::createOrResize() if (m_flags.testFlag(SurfaceHasPreMulAlpha) || m_flags.testFlag(SurfaceHasNonPreMulAlpha)) { if (!rhiD->useLegacySwapchainModel && rhiD->ensureDirectCompositionDevice()) { if (!dcompTarget) { - hr = rhiD->dcompDevice->CreateTargetForHwnd(hwnd, true, &dcompTarget); + hr = rhiD->dcompDevice->CreateTargetForHwnd(hwnd, false, &dcompTarget); if (FAILED(hr)) { qWarning("Failed to create Direct Compsition target for the window: %s", qPrintable(QSystemError::windowsComString(hr))); diff --git a/src/gui/rhi/qrhid3d12.cpp b/src/gui/rhi/qrhid3d12.cpp index 745e55d76e..2909152d4a 100644 --- a/src/gui/rhi/qrhid3d12.cpp +++ b/src/gui/rhi/qrhid3d12.cpp @@ -6229,7 +6229,7 @@ bool QD3D12SwapChain::createOrResize() if (m_flags.testFlag(SurfaceHasPreMulAlpha) || m_flags.testFlag(SurfaceHasNonPreMulAlpha)) { if (rhiD->ensureDirectCompositionDevice()) { if (!dcompTarget) { - hr = rhiD->dcompDevice->CreateTargetForHwnd(hwnd, true, &dcompTarget); + hr = rhiD->dcompDevice->CreateTargetForHwnd(hwnd, false, &dcompTarget); if (FAILED(hr)) { qWarning("Failed to create Direct Compsition target for the window: %s", qPrintable(QSystemError::windowsComString(hr))); |