diff --git a/wayland_server.cpp b/wayland_server.cpp index 644bacbd1a..cd8c5a27ab 100644 --- a/wayland_server.cpp +++ b/wayland_server.cpp @@ -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()); diff --git a/wayland_server.h b/wayland_server.h index 2ac4dc888b..038f5a61e3 100644 --- a/wayland_server.h +++ b/wayland_server.h @@ -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;