summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/wasm/qwasmwindowtreenode.h
diff options
context:
space:
mode:
authorEven Oscar Andersen <even.oscar.andersen@qt.io>2025-05-23 12:37:25 +0200
committerEven Oscar Andersen <even.oscar.andersen@qt.io>2025-05-26 13:27:17 +0200
commite48c19449e3856661f4fe2ccd30d94ba9d61301f (patch)
tree91ca8efd1b4072dcdfc55c83eca67095a7b50de5 /src/plugins/platforms/wasm/qwasmwindowtreenode.h
parent3ad9d5777fe0771d14e89bb5601d602f2451bd49 (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 <lorn.potter@qt.io>
Diffstat (limited to 'src/plugins/platforms/wasm/qwasmwindowtreenode.h')
-rw-r--r--src/plugins/platforms/wasm/qwasmwindowtreenode.h37
1 files changed, 23 insertions, 14 deletions
diff --git a/src/plugins/platforms/wasm/qwasmwindowtreenode.h b/src/plugins/platforms/wasm/qwasmwindowtreenode.h
index 170d777f02a..c955cd21740 100644
--- a/src/plugins/platforms/wasm/qwasmwindowtreenode.h
+++ b/src/plugins/platforms/wasm/qwasmwindowtreenode.h
@@ -6,6 +6,8 @@
#include "qwasmwindowstack.h"
+#include <QVariant>
+
namespace emscripten {
class val;
}
@@ -17,7 +19,14 @@ enum class QWasmWindowTreeNodeChangeType {
NodeRemoval,
};
-class QWasmWindowTreeNode
+class QWasmWindowTreeNodeBase
+{
+protected:
+ static uint64_t s_nextActiveIndex;
+};
+
+template<class Window = QWasmWindow>
+class QWasmWindowTreeNode : public QWasmWindowTreeNodeBase
{
public:
QWasmWindowTreeNode();
@@ -28,20 +37,20 @@ public:
protected:
virtual void onParentChanged(QWasmWindowTreeNode *previous, QWasmWindowTreeNode *current,
- QWasmWindowStack::PositionPreference positionPreference);
- virtual QWasmWindow *asWasmWindow();
+ typename QWasmWindowStack<Window>::PositionPreference positionPreference);
+ virtual Window *asWasmWindow();
virtual void onSubtreeChanged(QWasmWindowTreeNodeChangeType changeType,
- QWasmWindowTreeNode *parent, QWasmWindow *child);
- virtual void setWindowZOrder(QWasmWindow *window, int z);
+ QWasmWindowTreeNode *parent, Window *child);
+ virtual void setWindowZOrder(Window *window, int z);
- void onPositionPreferenceChanged(QWasmWindowStack::PositionPreference positionPreference);
+ void onPositionPreferenceChanged(typename QWasmWindowStack<Window>::PositionPreference positionPreference);
void setAsActiveNode();
void bringToTop();
void sendToBottom();
- void shutdown();
- const QWasmWindowStack &childStack() const { return m_childStack; }
- QWasmWindow *activeChild() const { return m_activeChild; }
+ const QWasmWindowStack<Window> &childStack() const { return m_childStack; }
+ QWasmWindowStack<Window> &childStack() { return m_childStack; }
+ Window *activeChild() const { return m_activeChild; }
uint64_t getActiveIndex() const {
return m_activeIndex;
@@ -49,13 +58,13 @@ protected:
private:
void onTopWindowChanged();
- void setActiveChildNode(QWasmWindow *activeChild);
+ void setActiveChildNode(Window *activeChild);
uint64_t m_activeIndex = 0;
- static uint64_t s_nextActiveIndex;
- QWasmWindowStack m_childStack;
- QWasmWindow *m_activeChild = nullptr;
+ QWasmWindowStack<Window> m_childStack;
+ Window *m_activeChild = nullptr;
};
+#endif
-#endif // QWASMWINDOWTREENODE_H
+#include "qwasmwindowtreenode.inc"