From 0b00af25dc57a181703c86507538b2f35c823754 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Tue, 16 Jun 2015 06:50:22 +0200 Subject: [PATCH] [wayland] Announce AbstractClient to PlasmaWindowManagement interface Creates a PlasmaWindowInterface for each AbstractClient and so far passes caption and virtual desktop through. --- wayland_server.cpp | 19 +++++++++++++++++++ wayland_server.h | 2 ++ 2 files changed, 21 insertions(+) diff --git a/wayland_server.cpp b/wayland_server.cpp index cdbac2f651..0f4bda2ebd 100644 --- a/wayland_server.cpp +++ b/wayland_server.cpp @@ -18,6 +18,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . *********************************************************************/ #include "wayland_server.h" +#include "client.h" #include "abstract_backend.h" #include "composite.h" #include "screens.h" @@ -197,9 +198,27 @@ void WaylandServer::initWorkspace() ); } ); + connect(workspace(), &Workspace::clientAdded, this, &WaylandServer::announceClientToWindowManagement); + connect(this, &WaylandServer::shellClientAdded, this, &WaylandServer::announceClientToWindowManagement); } } +void WaylandServer::announceClientToWindowManagement(AbstractClient *c) +{ + auto w = m_windowManagement->createWindow(c); + w->setTitle(c->caption()); + w->setVirtualDesktop(c->isOnAllDesktops() ? 0 : c->desktop() - 1); + connect(c, &AbstractClient::captionChanged, w, [w, c] { w->setTitle(c->caption()); }); + connect(c, &AbstractClient::desktopChanged, w, + [w, c] { + if (c->isOnAllDesktops()) { + return; + } + w->setVirtualDesktop(c->desktop() - 1); + } + ); +} + void WaylandServer::initOutputs() { if (m_backend && m_backend->handlesOutputs()) { diff --git a/wayland_server.h b/wayland_server.h index 011c924dab..69d00d25fc 100644 --- a/wayland_server.h +++ b/wayland_server.h @@ -54,6 +54,7 @@ namespace KWin class ShellClient; class AbstractBackend; +class AbstractClient; class KWIN_EXPORT WaylandServer : public QObject { @@ -137,6 +138,7 @@ Q_SIGNALS: private: void fakeDummyQtWindowInput(); quint16 createClientId(KWayland::Server::ClientConnection *c); + void announceClientToWindowManagement(AbstractClient *c); KWayland::Server::Display *m_display = nullptr; KWayland::Server::CompositorInterface *m_compositor = nullptr; KWayland::Server::SeatInterface *m_seat = nullptr;