diff --git a/src/wayland/clientconnection.cpp b/src/wayland/clientconnection.cpp index 1ea7d38db3..2b01a0a5e1 100644 --- a/src/wayland/clientconnection.cpp +++ b/src/wayland/clientconnection.cpp @@ -99,7 +99,7 @@ void ClientConnection::destroy() wl_client_destroy(d->client); } -wl_resource *ClientConnection::getResource(quint32 id) +wl_resource *ClientConnection::getResource(quint32 id) const { if (!d->client) { return nullptr; diff --git a/src/wayland/clientconnection.h b/src/wayland/clientconnection.h index 290b3db2e7..6e4e6a1d6a 100644 --- a/src/wayland/clientconnection.h +++ b/src/wayland/clientconnection.h @@ -42,7 +42,7 @@ public: /** * Get the wl_resource associated with the given @p id. */ - wl_resource *getResource(quint32 id); + wl_resource *getResource(quint32 id) const; /** * @returns the native wl_client this ClientConnection represents. diff --git a/src/wayland/surface_interface.cpp b/src/wayland/surface_interface.cpp index 10b95b65a7..2729cd3572 100644 --- a/src/wayland/surface_interface.cpp +++ b/src/wayland/surface_interface.cpp @@ -23,8 +23,6 @@ namespace KWaylandServer { -QList SurfaceInterfacePrivate::surfaces; - KWaylandFrameCallback::KWaylandFrameCallback(wl_resource *resource, SurfaceInterface *surface) : QtWaylandServer::wl_callback(resource) , surface(surface) @@ -50,7 +48,6 @@ void KWaylandFrameCallback::callback_destroy_resource(Resource *) SurfaceInterfacePrivate::SurfaceInterfacePrivate(SurfaceInterface *q) : q(q) { - surfaces.append(q); } SurfaceInterfacePrivate::~SurfaceInterfacePrivate() @@ -74,7 +71,6 @@ SurfaceInterfacePrivate::~SurfaceInterfacePrivate() if (current.buffer) { current.buffer->unref(); } - surfaces.removeOne(q); } void SurfaceInterfacePrivate::addChild(SubSurfaceInterface *child) @@ -385,11 +381,6 @@ CompositorInterface *SurfaceInterface::compositor() const return d->compositor; } -QList SurfaceInterface::surfaces() -{ - return SurfaceInterfacePrivate::surfaces; -} - void SurfaceInterface::frameRendered(quint32 msec) { // notify all callbacks @@ -764,11 +755,8 @@ SurfaceInterface *SurfaceInterface::get(wl_resource *native) SurfaceInterface *SurfaceInterface::get(quint32 id, const ClientConnection *client) { - const QList candidates = surfaces(); - for (SurfaceInterface *surface : candidates) { - if (surface->client() == client && surface->id() == id) { - return surface; - } + if (client) { + return get(client->getResource(id)); } return nullptr; } diff --git a/src/wayland/surface_interface.h b/src/wayland/surface_interface.h index ed9743bc8d..91aaf70e5a 100644 --- a/src/wayland/surface_interface.h +++ b/src/wayland/surface_interface.h @@ -92,11 +92,6 @@ public: */ CompositorInterface *compositor() const; - /** - * Returns a list with all created Wayland surfaces. - */ - static QList surfaces(); - /** * Maps the specified @a point from the surface-local coordinates to buffer pixel coordinates. * diff --git a/src/wayland/surface_interface_p.h b/src/wayland/surface_interface_p.h index c588aeca3f..117cb2bbe0 100644 --- a/src/wayland/surface_interface_p.h +++ b/src/wayland/surface_interface_p.h @@ -132,9 +132,6 @@ public: QVector idleInhibitors; ViewportInterface *viewportExtension = nullptr; SurfaceInterface *dataProxy = nullptr; - - static QList surfaces; - ClientConnection *client = nullptr; protected: