summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/wasm/qwasmwindowstack.h
diff options
context:
space:
mode:
authorMikolaj Boc <mikolaj.boc@qt.io>2023-01-26 18:38:21 +0100
committerMikolaj Boc <mikolaj.boc@qt.io>2023-02-22 18:07:35 +0100
commita596ea0fe278416b4827ddbb0fffd9c497bd4d88 (patch)
treea1cd4d50ecf318ba8cb03ebec1c42b50a52be6bd /src/plugins/platforms/wasm/qwasmwindowstack.h
parent96e031edd74e8e1eaea79d95320637eb27e8e2ba (diff)
Support always on top/bottom window flags on WASM
The window stack will now upkeep three groups of windows, always on bottom (1), regular (2), always on top (3). Windows belonging to (3) will always appear on top of (2) and (1), and windows from (2) will always appear on top of (1). The first window created in the application gets the (1) status, which is in line with the root window mechanism used before. Activation has now been decoupled from the top position on the window stack as a window in (1) or (2) may be active, in spite of the top window belonging to a higher group. Fixes: QTBUG-110098 Change-Id: I51f4d2d47163fab26ce5ef28f7a4f23a522c7f91 Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
Diffstat (limited to 'src/plugins/platforms/wasm/qwasmwindowstack.h')
-rw-r--r--src/plugins/platforms/wasm/qwasmwindowstack.h23
1 files changed, 14 insertions, 9 deletions
diff --git a/src/plugins/platforms/wasm/qwasmwindowstack.h b/src/plugins/platforms/wasm/qwasmwindowstack.h
index 2eb48b08659..c75001157a0 100644
--- a/src/plugins/platforms/wasm/qwasmwindowstack.h
+++ b/src/plugins/platforms/wasm/qwasmwindowstack.h
@@ -24,7 +24,7 @@ class QWasmWindow;
class Q_AUTOTEST_EXPORT QWasmWindowStack
{
public:
- using TopWindowChangedCallbackType = std::function<void()>;
+ 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 QWasmWindowStack(TopWindowChangedCallbackType topWindowChangedCallback);
+ enum class PositionPreference {
+ StayOnBottom,
+ Regular,
+ StayOnTop,
+ };
+
+ explicit QWasmWindowStack(WindowOrderChangedCallbackType topWindowChangedCallback);
~QWasmWindowStack();
- void pushWindow(QWasmWindow *window);
+ 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