From 12955f5ec724f15b6f5c740aef58eeb434b6639f Mon Sep 17 00:00:00 2001 From: Jan Arne Petersen Date: Thu, 22 Aug 2013 23:22:24 +0200 Subject: Use QMultiMap instead of wl_list for resources Change generated code in qtwaylandscanner to generate resourceMap() methods returning a QMultiMap. Adapt code using resource lists to use the map instead. Remove Compositor::resourceForSurface(). Change-Id: Id41a1712f9c2477c1a1af843bba2795dd90391e5 Reviewed-by: Andy Nichols Reviewed-by: Andrew Knight --- tests/auto/client/mockinput.cpp | 22 ++-------------------- 1 file changed, 2 insertions(+), 20 deletions(-) (limited to 'tests/auto/client') diff --git a/tests/auto/client/mockinput.cpp b/tests/auto/client/mockinput.cpp index ac2b666b4..40b01317f 100644 --- a/tests/auto/client/mockinput.cpp +++ b/tests/auto/client/mockinput.cpp @@ -137,22 +137,6 @@ Keyboard::~Keyboard() { } -static wl_resource *resourceForSurface(wl_list *resourceList, Surface *surface) -{ - if (!surface) - return 0; - - wl_resource *r; - wl_client *surfaceClient = surface->resource()->client(); - - wl_list_for_each(r, resourceList, link) { - if (r->client == surfaceClient) - return r; - } - - return 0; -} - void Keyboard::setFocus(Surface *surface) { if (m_focusResource && m_focus != surface) { @@ -160,8 +144,7 @@ void Keyboard::setFocus(Surface *surface) send_leave(m_focusResource->handle, serial, m_focus->resource()->handle); } - struct ::wl_resource *r = resourceForSurface(resourceList(), surface); - Resource *resource = r ? Resource::fromResource(r) : 0; + Resource *resource = surface ? resourceMap().value(surface->resource()->client()) : 0; if (resource && (m_focus != surface || m_focusResource != resource)) { uint32_t serial = m_compositor->nextSerial(); @@ -199,8 +182,7 @@ void Pointer::setFocus(Surface *surface, const QPoint &pos) send_leave(m_focusResource->handle, serial, m_focus->resource()->handle); } - struct ::wl_resource *r = resourceForSurface(resourceList(), surface); - Resource *resource = r ? Resource::fromResource(r) : 0; + Resource *resource = surface ? resourceMap().value(surface->resource()->client()) : 0; if (resource && (m_focus != surface || resource != m_focusResource)) { uint32_t serial = m_compositor->nextSerial(); -- cgit v1.2.3