From 750dd068e5e513d349250fb5a115f19ab48d6d29 Mon Sep 17 00:00:00 2001 From: Benjamin Port Date: Tue, 21 Apr 2020 16:52:20 +0200 Subject: [PATCH] [Wayland] Send stacking order event through plasma window management protocol Summary: Depends on: D29054 Reviewers: zzag, davidedmundson, meven Reviewed By: davidedmundson, meven Subscribers: kwin Tags: #kwin Differential Revision: https://phabricator.kde.org/D29055 --- abstract_client.h | 11 +++++++---- wayland_server.cpp | 16 +++++++++++++++- 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/abstract_client.h b/abstract_client.h index cbde9b1482..96f9dde4c2 100644 --- a/abstract_client.h +++ b/abstract_client.h @@ -864,6 +864,13 @@ public: */ 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 @@ protected: 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 index 495b4e89cb..f617ecc7a6 100644 --- a/wayland_server.cpp +++ b/wayland_server.cpp @@ -404,7 +404,6 @@ bool WaylandServer::init(const QByteArray &socketName, InitializationFlags flags } ); - m_virtualDesktopManagement = m_display->createPlasmaVirtualDesktopManagement(m_display); m_virtualDesktopManagement->create(); m_windowManagement->setPlasmaVirtualDesktopManagementInterface(m_virtualDesktopManagement); @@ -490,6 +489,21 @@ void WaylandServer::initWorkspace() ); } ); + + 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()) {