diff options
author | Andy Nichols <andy.nichols@digia.com> | 2012-11-03 18:56:12 +0100 |
---|---|---|
committer | Andy Nichols <andy.nichols@digia.com> | 2013-01-29 10:46:18 +0100 |
commit | a6d969abf59ff3a9634910f9b9b7cb588eeea7c6 (patch) | |
tree | b62ca89fe5240214089c0ff43736f48de542c851 /tests | |
parent | 3f8c8e0f5c9828634621238c145c7e62298a66ba (diff) | |
download | qtwayland-a6d969abf59ff3a9634910f9b9b7cb588eeea7c6.tar.gz |
Update tests to build with wayland 1.0.0
We still fail the same compositor tests, and
seg fault at the begining of the client test,
but this is the same behavior as with 0.95
Change-Id: I2c1af65be4239663f99848b1574d9cc88b4a5d97
Reviewed-by: Jørgen Lind <jorgen.lind@gmail.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/compositor/mockclient.cpp | 28 | ||||
-rw-r--r-- | tests/auto/compositor/mockclient.h | 5 |
2 files changed, 20 insertions, 13 deletions
diff --git a/tests/auto/compositor/mockclient.cpp b/tests/auto/compositor/mockclient.cpp index 03113c9f..4204e393 100644 --- a/tests/auto/compositor/mockclient.cpp +++ b/tests/auto/compositor/mockclient.cpp @@ -52,18 +52,23 @@ #include <errno.h> #include <sys/mman.h> +const struct wl_registry_listener MockClient::registryListener = { + MockClient::handleGlobal +}; MockClient::MockClient() : display(wl_display_connect(0)) , compositor(0) , output(0) + , registry(0) { if (!display) qFatal("MockClient(): wl_display_connect() failed"); - wl_display_add_global_listener(display, handleGlobal, this); + registry = wl_display_get_registry(display); + wl_registry_add_listener(registry, ®istryListener, this); - fd = wl_display_get_fd(display, 0, 0); + fd = wl_display_get_fd(display); QSocketNotifier *readNotifier = new QSocketNotifier(fd, QSocketNotifier::Read, this); connect(readNotifier, SIGNAL(activated(int)), this, SLOT(readEvents())); @@ -91,11 +96,6 @@ MockClient::~MockClient() wl_display_disconnect(display); } -void MockClient::handleGlobal(wl_display *, uint32_t id, const char *interface, uint32_t, void *data) -{ - resolve(data)->handleGlobal(id, QByteArray(interface)); -} - void MockClient::outputGeometryEvent(void *data, wl_output *, int32_t x, int32_t y, int32_t width, int32_t height, @@ -112,23 +112,29 @@ void MockClient::outputModeEvent(void *, wl_output *, uint32_t, void MockClient::readEvents() { - wl_display_iterate(display, WL_DISPLAY_READABLE); + wl_display_dispatch(display); } void MockClient::flushDisplay() { + wl_display_dispatch_pending(display); wl_display_flush(display); } +void MockClient::handleGlobal(void *data, wl_registry *registry, uint32_t id, const char *interface, uint32_t version) +{ + resolve(data)->handleGlobal(id, QByteArray(interface)); +} + void MockClient::handleGlobal(uint32_t id, const QByteArray &interface) { if (interface == "wl_compositor") { - compositor = static_cast<wl_compositor *>(wl_display_bind(display, id, &wl_compositor_interface)); + compositor = static_cast<wl_compositor *>(wl_registry_bind(registry, id, &wl_compositor_interface, 1)); } else if (interface == "wl_output") { - output = static_cast<wl_output *>(wl_display_bind(display, id, &wl_output_interface)); + output = static_cast<wl_output *>(wl_registry_bind(registry, id, &wl_output_interface, 1)); wl_output_add_listener(output, &outputListener, this); } else if (interface == "wl_shm") { - shm = static_cast<wl_shm *>(wl_display_bind(display, id, &wl_shm_interface)); + shm = static_cast<wl_shm *>(wl_registry_bind(registry, id, &wl_shm_interface, 1)); } } diff --git a/tests/auto/compositor/mockclient.h b/tests/auto/compositor/mockclient.h index 3253c7ed..fa7c28a8 100644 --- a/tests/auto/compositor/mockclient.h +++ b/tests/auto/compositor/mockclient.h @@ -70,6 +70,7 @@ public: wl_compositor *compositor; wl_output *output; wl_shm *shm; + wl_registry *registry; QRect geometry; @@ -81,8 +82,8 @@ private slots: private: static MockClient *resolve(void *data) { return static_cast<MockClient *>(data); } - - static void handleGlobal(wl_display *display, uint32_t id, const char *interface, uint32_t, void *data); + static const struct wl_registry_listener registryListener; + static void handleGlobal(void *data, struct wl_registry *registry, uint32_t id, const char *interface, uint32_t version); static int sourceUpdate(uint32_t mask, void *data); static void outputGeometryEvent(void *data, |