diff --git a/abstract_client.h b/abstract_client.h --- a/abstract_client.h +++ b/abstract_client.h @@ -864,6 +864,16 @@ */ virtual bool supportsWindowRules() const; + /** + * Returns true if client is associated with a window management interface + */ + bool hasWindowManagementInterface() const; + + /** + * Returns windowInternalId from window management interface. If window management interface don't exist yet return 0 + */ + quint32 windowInternalId() const; + public Q_SLOTS: virtual void closeWindow() = 0; diff --git a/abstract_client.cpp b/abstract_client.cpp --- a/abstract_client.cpp +++ b/abstract_client.cpp @@ -3299,4 +3299,17 @@ Q_UNUSED(adjust) } +bool AbstractClient::hasWindowManagementInterface() const +{ + return m_windowManagementInterface ? true : false; +} + +quint32 AbstractClient::windowInternalId() const +{ + if (!m_windowManagementInterface) { + return 0; + } + return m_windowManagementInterface->internalId(); +} + } 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,24 @@ ); } ); + + connect(workspace(), &Workspace::workspaceInitialized, this, [this] { + auto f = [this] () { + QVector ids; + if (!workspace()) { + return; + } + for (auto c: workspace()->stackingOrder()) { + auto *client = qobject_cast(c); + if (client && client->hasWindowManagementInterface()) { + ids << client->windowInternalId(); + } + } + m_windowManagement->setStackingOrder(ids); + }; + f(); + connect(workspace(), &Workspace::stackingOrderChanged, this, f); + }); } if (hasScreenLockerIntegration()) {