diff options
Diffstat (limited to 'src/plugins/platforms/wasm/qwasmwindowstack.h')
-rw-r--r-- | src/plugins/platforms/wasm/qwasmwindowstack.h | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/src/plugins/platforms/wasm/qwasmwindowstack.h b/src/plugins/platforms/wasm/qwasmwindowstack.h index 68ce4a51b7..c75001157a 100644 --- a/src/plugins/platforms/wasm/qwasmwindowstack.h +++ b/src/plugins/platforms/wasm/qwasmwindowstack.h @@ -21,10 +21,10 @@ class QWasmWindow; // Access to the top element is facilitated by |topWindow|. // Changes to the top element are signaled via the |topWindowChangedCallback| supplied at // construction. -Q_AUTOTEST_EXPORT class QWasmWasmWindowStack +class Q_AUTOTEST_EXPORT QWasmWindowStack { public: - using TopWindowChangedCallbackType = std::function<void(QWasmWindow *window)>; + using WindowOrderChangedCallbackType = std::function<void()>; using StorageType = QList<QWasmWindow *>; @@ -32,13 +32,20 @@ public: using const_iterator = StorageType::const_reverse_iterator; using const_reverse_iterator = StorageType::const_iterator; - explicit QWasmWasmWindowStack(TopWindowChangedCallbackType topWindowChangedCallback); - ~QWasmWasmWindowStack(); + enum class PositionPreference { + StayOnBottom, + Regular, + StayOnTop, + }; - void pushWindow(QWasmWindow *window); + explicit QWasmWindowStack(WindowOrderChangedCallbackType topWindowChangedCallback); + ~QWasmWindowStack(); + + void pushWindow(QWasmWindow *window, PositionPreference position); void removeWindow(QWasmWindow *window); void raise(QWasmWindow *window); void lower(QWasmWindow *window); + void windowPositionPreferenceChanged(QWasmWindow *window, PositionPreference position); // Iterates top-to-bottom iterator begin(); @@ -55,14 +62,12 @@ public: QWasmWindow *topWindow() const; private: - enum class FirstWindowTreatment { AlwaysAtBottom, Regular }; - - QWasmWindow *rootWindow() const; - StorageType::iterator regularWindowsBegin(); + PositionPreference getWindowPositionPreference(StorageType::iterator windowIt) const; - TopWindowChangedCallbackType m_topWindowChangedCallback; + WindowOrderChangedCallbackType m_windowOrderChangedCallback; QList<QWasmWindow *> m_windowStack; - FirstWindowTreatment m_firstWindowTreatment = FirstWindowTreatment::AlwaysAtBottom; + StorageType::iterator m_regularWindowsBegin; + StorageType::iterator m_alwaysOnTopWindowsBegin; }; QT_END_NAMESPACE |