[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.
This commit is contained in:
Martin Gräßlin 2015-06-18 00:10:52 +02:00
parent d6f0ff55bd
commit c67614ad9d
2 changed files with 19 additions and 0 deletions

View file

@ -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();
}
}
}

View file

@ -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);