Add a WaylandServer::findClient which takes a QWindow
Of course only works with internal clients.
This commit is contained in:
parent
f76c18bfb8
commit
9272d01a2d
2 changed files with 17 additions and 0 deletions
|
@ -422,6 +422,22 @@ ShellClient *WaylandServer::findClient(SurfaceInterface *surface) const
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
ShellClient *WaylandServer::findClient(QWindow *w) const
|
||||
{
|
||||
if (!w) {
|
||||
return nullptr;
|
||||
}
|
||||
auto it = std::find_if(m_internalClients.constBegin(), m_internalClients.constEnd(),
|
||||
[w] (const ShellClient *c) {
|
||||
return c->internalWindow() == w;
|
||||
}
|
||||
);
|
||||
if (it != m_internalClients.constEnd()) {
|
||||
return *it;
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
quint32 WaylandServer::createWindowId(SurfaceInterface *surface)
|
||||
{
|
||||
auto it = m_clientIds.constFind(surface->client());
|
||||
|
|
|
@ -90,6 +90,7 @@ public:
|
|||
void removeClient(ShellClient *c);
|
||||
ShellClient *findClient(quint32 id) const;
|
||||
ShellClient *findClient(KWayland::Server::SurfaceInterface *surface) const;
|
||||
ShellClient *findClient(QWindow *w) const;
|
||||
|
||||
AbstractBackend *backend() const {
|
||||
return m_backend;
|
||||
|
|
Loading…
Reference in a new issue