diff options
| author | Even Oscar Andersen <[email protected]> | 2025-05-23 12:37:25 +0200 |
|---|---|---|
| committer | Even Oscar Andersen <[email protected]> | 2025-05-26 13:27:17 +0200 |
| commit | e48c19449e3856661f4fe2ccd30d94ba9d61301f (patch) | |
| tree | 91ca8efd1b4072dcdfc55c83eca67095a7b50de5 /src/plugins/platforms/wasm/qwasmwindow.h | |
| parent | 3ad9d5777fe0771d14e89bb5601d602f2451bd49 (diff) | |
wasm: Fix stacking order problem for transient parent windows
Windows with a transient parent does not reflect the relationship
in the stacking order. Essentially AboveTransientParent is missing
as a configuration choice.
What makes this slightly convoluted is that the window stack
does not depend on the window (for testability).
We solve this problem by making the stack and treenode templates,
and provide test class as arguments when testing.
QWasmWindow and QWasmScreen are not templated as before.
There is also a new order type StayAboveTransientParent. Which
means that we can no longer use order type to get to the
group location (Since StayAboveTransientParent can map to either
of the three types).
The window stack tests have been updated to handle the
StayAboveTransientParent type.
Finally, we do not do anything with a normal parent
child relationship as this should already work
correctly.
Fixes: QTBUG-131699
Change-Id: Ie08e18f9e0a2339175c4a09da0a831f031df71e1
Reviewed-by: Lorn Potter <[email protected]>
Diffstat (limited to 'src/plugins/platforms/wasm/qwasmwindow.h')
| -rw-r--r-- | src/plugins/platforms/wasm/qwasmwindow.h | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/src/plugins/platforms/wasm/qwasmwindow.h b/src/plugins/platforms/wasm/qwasmwindow.h index 67a3e8ea293..904e736a7e7 100644 --- a/src/plugins/platforms/wasm/qwasmwindow.h +++ b/src/plugins/platforms/wasm/qwasmwindow.h @@ -37,7 +37,7 @@ struct WheelEvent; Q_DECLARE_LOGGING_CATEGORY(qLcQpaWasmInputContext) class QWasmWindow final : public QPlatformWindow, - public QWasmWindowTreeNode, + public QWasmWindowTreeNode<>, public QNativeInterface::Private::QWasmWindow { public: @@ -46,6 +46,9 @@ public: ~QWasmWindow() final; static QWasmWindow *fromWindow(const QWindow *window); + QWasmWindow *transientParent() const; + Qt::WindowFlags windowFlags() const; + bool isModal() const; QSurfaceFormat format() const override; void registerEventHandlers(); @@ -106,15 +109,23 @@ public: emscripten::val containerElement() final; QWasmWindowTreeNode *parentNode() final; +public slots: + void onTransientParentChanged(QWindow *newTransientParent); + void onModalityChanged(); + private: friend class QWasmScreen; static constexpr auto defaultWindowSize = 160; + QMetaObject::Connection m_transientWindowChangedConnection; + QMetaObject::Connection m_modalityChangedConnection; + // QWasmWindowTreeNode: QWasmWindow *asWasmWindow() final; void onParentChanged(QWasmWindowTreeNode *previous, QWasmWindowTreeNode *current, - QWasmWindowStack::PositionPreference positionPreference) final; + QWasmWindowStack<>::PositionPreference positionPreference) final; + void shutdown(); void invalidate(); bool hasFrame() const; bool hasTitleBar() const; @@ -134,6 +145,9 @@ private: bool deliverPointerEvent(const PointerEvent &event); void handleWheelEvent(const emscripten::val &event); bool processWheel(const WheelEvent &event); + Qt::WindowFlags fixTopLevelWindowFlags(Qt::WindowFlags) const; + bool shouldBeAboveTransientParentFlags(Qt::WindowFlags flags) const; + QWasmWindowStack<>::PositionPreference positionPreferenceFromWindowFlags(Qt::WindowFlags) const; QWasmCompositor *m_compositor = nullptr; QWasmBackingStore *m_backingStore = nullptr; |
