diff --git a/abstract_client.h b/abstract_client.h --- a/abstract_client.h +++ b/abstract_client.h @@ -864,6 +864,13 @@ */ virtual bool supportsWindowRules() const; + /** + * Return window management interface + */ + KWayland::Server::PlasmaWindowInterface *windowManagementInterface() const { + return m_windowManagementInterface; + } + public Q_SLOTS: virtual void closeWindow() = 0; @@ -998,10 +1005,6 @@ m_quickTileMode = newMode; } - KWayland::Server::PlasmaWindowInterface *windowManagementInterface() const { - return m_windowManagementInterface; - } - // geometry handling void checkOffscreenPosition(QRect *geom, const QRect &screenArea); int borderLeft() const; diff --git a/wayland_server.cpp b/wayland_server.cpp --- a/wayland_server.cpp +++ b/wayland_server.cpp @@ -404,7 +404,6 @@ } ); - m_virtualDesktopManagement = m_display->createPlasmaVirtualDesktopManagement(m_display); m_virtualDesktopManagement->create(); m_windowManagement->setPlasmaVirtualDesktopManagementInterface(m_virtualDesktopManagement); @@ -490,6 +489,21 @@ ); } ); + + connect(workspace(), &Workspace::workspaceInitialized, this, [this] { + auto f = [this] () { + QVector ids; + for (Toplevel *toplevel : workspace()->stackingOrder()) { + auto *client = qobject_cast(toplevel); + if (client && client->windowManagementInterface()) { + ids << client->windowManagementInterface()->internalId(); + } + } + m_windowManagement->setStackingOrder(ids); + }; + f(); + connect(workspace(), &Workspace::stackingOrderChanged, this, f); + }); } if (hasScreenLockerIntegration()) {