From 417bb463526d3ec3d80d66b029c1064fde88391f Mon Sep 17 00:00:00 2001 From: Yuhang Zhao <2546789017@qq.com> Date: Wed, 15 Jun 2022 14:02:55 +0800 Subject: [PATCH] Windows QPA: Add MSWindowsNoRedirectionBitmap flag MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This flag will be useful for windows that only use 3D graphics API to do the rendering, such as Qt Quick applications. As a drive-by, fix a typo in the above line. Pick-to: 6.4 Change-Id: Ic6edcb7610055693734a5d5aff5e906991d4b911 Reviewed-by: André de la Rocha --- src/corelib/global/qnamespace.h | 1 + src/corelib/global/qnamespace.qdoc | 8 ++++++++ src/plugins/platforms/windows/qwindowswindow.cpp | 5 ++++- 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/corelib/global/qnamespace.h b/src/corelib/global/qnamespace.h index dd70e91a8f..4da4e4ab0e 100644 --- a/src/corelib/global/qnamespace.h +++ b/src/corelib/global/qnamespace.h @@ -228,6 +228,7 @@ namespace Qt { WindowOverridesSystemGestures = 0x00100000, WindowDoesNotAcceptFocus = 0x00200000, MaximizeUsingFullscreenGeometryHint = 0x00400000, + MSWindowsNoRedirectionBitmap = 0x00800000, CustomizeWindowHint = 0x02000000, WindowStaysOnBottomHint = 0x04000000, diff --git a/src/corelib/global/qnamespace.qdoc b/src/corelib/global/qnamespace.qdoc index 000001c1bf..34640107b0 100644 --- a/src/corelib/global/qnamespace.qdoc +++ b/src/corelib/global/qnamespace.qdoc @@ -2190,6 +2190,14 @@ \value MSWindowsOwnDC Gives the window its own display context on Windows. + \value MSWindowsNoRedirectionBitmap This flag is useful to windows that + only use 3D graphics API to do the rendering, such as D3D11. + This flag was introduced in Qt 6.4 + + \note Changing this flag after the native window has been created will + have no effect. You can only enable it before the native window is + actually created. + \value BypassWindowManagerHint This flag can be used to indicate to the platform plugin that "all" window manager protocols should be disabled. This flag will behave different depending on what operating system the application is running on and diff --git a/src/plugins/platforms/windows/qwindowswindow.cpp b/src/plugins/platforms/windows/qwindowswindow.cpp index 929e468115..1ace82c5c7 100644 --- a/src/plugins/platforms/windows/qwindowswindow.cpp +++ b/src/plugins/platforms/windows/qwindowswindow.cpp @@ -841,8 +841,11 @@ void WindowCreationData::fromWindow(const QWindow *w, const Qt::WindowFlags flag // make mouse events fall through this window // NOTE: WS_EX_TRANSPARENT flag can make mouse inputs fall through a layered window - if (flagsIn & Qt::WindowTransparentForInput) + if (flags & Qt::WindowTransparentForInput) exStyle |= WS_EX_LAYERED | WS_EX_TRANSPARENT; + + if (flags & Qt::MSWindowsNoRedirectionBitmap) + exStyle |= WS_EX_NOREDIRECTIONBITMAP; } }