From c67614ad9da3679d05e7d9d090f18130a7725988 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Thu, 18 Jun 2015 00:10:52 +0200 Subject: [PATCH] [server] Expose PlasmaWindowInterface::unmap Sends an umap to the client and destroys the resource afterwards. The PlasmaWindowInterface gets automatically destroyed once there are no more resources bound to it. --- .../plasmawindowmanagement_interface.cpp | 17 +++++++++++++++++ src/wayland/plasmawindowmanagement_interface.h | 2 ++ 2 files changed, 19 insertions(+) diff --git a/src/wayland/plasmawindowmanagement_interface.cpp b/src/wayland/plasmawindowmanagement_interface.cpp index e6e0b90870..ade38402f4 100644 --- a/src/wayland/plasmawindowmanagement_interface.cpp +++ b/src/wayland/plasmawindowmanagement_interface.cpp @@ -66,6 +66,7 @@ public: void setTitle(const QString &title); void setAppId(const QString &appId); void setVirtualDesktop(quint32 desktop); + void unmap(); struct WindowResource { wl_resource *resource; @@ -228,6 +229,9 @@ void PlasmaWindowInterface::Private::unbind(wl_resource *resource) it++; } } + if (p->resources.isEmpty()) { + p->q->deleteLater(); + } } void PlasmaWindowInterface::Private::destroyListenerCallback(wl_listener *listener, void *data) @@ -299,6 +303,14 @@ void PlasmaWindowInterface::Private::setVirtualDesktop(quint32 desktop) } } +void PlasmaWindowInterface::Private::unmap() +{ + for (auto it = resources.constBegin(); it != resources.constEnd(); ++it) { + org_kde_plasma_window_send_unmapped((*it).resource); + wl_resource_destroy((*it).resource); + } +} + PlasmaWindowInterface::PlasmaWindowInterface(PlasmaWindowManagementInterface *wm, QObject *parent) : QObject(parent) , d(new Private(wm, this)) @@ -322,5 +334,10 @@ void PlasmaWindowInterface::setVirtualDesktop(quint32 desktop) d->setVirtualDesktop(desktop); } +void PlasmaWindowInterface::unmap() +{ + d->unmap(); +} + } } diff --git a/src/wayland/plasmawindowmanagement_interface.h b/src/wayland/plasmawindowmanagement_interface.h index 559beb26ff..563b5a6085 100644 --- a/src/wayland/plasmawindowmanagement_interface.h +++ b/src/wayland/plasmawindowmanagement_interface.h @@ -71,6 +71,8 @@ public: void setAppId(const QString &appId); void setVirtualDesktop(quint32 desktop); + void unmap(); + private: friend class PlasmaWindowManagementInterface; explicit PlasmaWindowInterface(PlasmaWindowManagementInterface *wm, QObject *parent);