diff options
author | Jan Arne Petersen <jan.petersen@kdab.com> | 2013-08-22 23:22:24 +0200 |
---|---|---|
committer | Andy Nichols <andy.nichols@digia.com> | 2013-08-28 12:55:38 +0200 |
commit | 12955f5ec724f15b6f5c740aef58eeb434b6639f (patch) | |
tree | c61d78a8a50af26b2aa337ec4bcf86dacad4b030 /tests/auto/client | |
parent | c4e89d992e746f8957ef6934f6ee51f620e07cf7 (diff) |
Use QMultiMap instead of wl_list for resources
Change generated code in qtwaylandscanner to generate resourceMap()
methods returning a QMultiMap<wl_client*, Resource*>. Adapt code using
resource lists to use the map instead.
Remove Compositor::resourceForSurface().
Change-Id: Id41a1712f9c2477c1a1af843bba2795dd90391e5
Reviewed-by: Andy Nichols <andy.nichols@digia.com>
Reviewed-by: Andrew Knight <andrew.knight@digia.com>
Diffstat (limited to 'tests/auto/client')
-rw-r--r-- | tests/auto/client/mockinput.cpp | 22 |
1 files changed, 2 insertions, 20 deletions
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(); |