diff options
author | Johan Klokkhammer Helsing <johan.helsing@qt.io> | 2017-10-26 16:50:53 +0200 |
---|---|---|
committer | Johan Helsing <johan.helsing@qt.io> | 2017-10-27 07:43:19 +0000 |
commit | c2b272ac73617a8d5ff25151534feda95ace63ee (patch) | |
tree | 4ab37dff6f86c93152a3eaee9b930210cfefab02 /tests/auto/compositor | |
parent | 063299d8520ca5c944a596723e63e7654e712955 (diff) | |
download | qtwayland-c2b272ac73617a8d5ff25151534feda95ace63ee.tar.gz |
Compositor tests: Don't assume global numeric name == wayland object id
Throughout the code we consistently and confusingly use the term, "id", instead
of "numeric name" for Wayland globals. This is confusing because it's not the
same as thing as wl_proxy_get_id returns, although the values frequently are
the same because we typically bind to all globals in the order they are
announced.
So in this patch we turn m_outputs into a map with the numeric name and compare
it with the numeric name we get in handleGlobalRemove.
Change-Id: I0716bf66e12dbbf7b05b9ca5faa5d2beba297af5
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
Diffstat (limited to 'tests/auto/compositor')
-rw-r--r-- | tests/auto/compositor/compositor/mockclient.cpp | 9 | ||||
-rw-r--r-- | tests/auto/compositor/compositor/mockclient.h | 2 |
2 files changed, 4 insertions, 7 deletions
diff --git a/tests/auto/compositor/compositor/mockclient.cpp b/tests/auto/compositor/compositor/mockclient.cpp index 85a89f04..bdc2b3b9 100644 --- a/tests/auto/compositor/compositor/mockclient.cpp +++ b/tests/auto/compositor/compositor/mockclient.cpp @@ -167,6 +167,7 @@ void MockClient::handleGlobal(void *data, wl_registry *registry, uint32_t id, co void MockClient::handleGlobalRemove(void *data, wl_registry *wl_registry, uint32_t id) { + Q_UNUSED(wl_registry); resolve(data)->handleGlobalRemove(id); } @@ -176,7 +177,7 @@ void MockClient::handleGlobal(uint32_t id, const QByteArray &interface) compositor = static_cast<wl_compositor *>(wl_registry_bind(registry, id, &wl_compositor_interface, 1)); } else if (interface == "wl_output") { auto output = static_cast<wl_output *>(wl_registry_bind(registry, id, &wl_output_interface, 2)); - m_outputs.append(output); + m_outputs.insert(id, output); wl_output_add_listener(output, &outputListener, this); } else if (interface == "wl_shm") { shm = static_cast<wl_shm *>(wl_registry_bind(registry, id, &wl_shm_interface, 1)); @@ -194,11 +195,7 @@ void MockClient::handleGlobal(uint32_t id, const QByteArray &interface) void MockClient::handleGlobalRemove(uint32_t id) { - for (auto output : m_outputs) { - auto outputId = wl_proxy_get_id(reinterpret_cast<wl_proxy *>(output)); - if (outputId == id) - m_outputs.removeAll(output); - } + m_outputs.remove(id); } wl_surface *MockClient::createSurface() diff --git a/tests/auto/compositor/compositor/mockclient.h b/tests/auto/compositor/compositor/mockclient.h index 7aa6a3b7..dd50f9a2 100644 --- a/tests/auto/compositor/compositor/mockclient.h +++ b/tests/auto/compositor/compositor/mockclient.h @@ -64,7 +64,7 @@ public: wl_display *display; wl_compositor *compositor; - QVector<wl_output *> m_outputs; + QMap<uint, wl_output *> m_outputs; wl_shm *shm; wl_registry *registry; wl_shell *wlshell; |