From a6d969abf59ff3a9634910f9b9b7cb588eeea7c6 Mon Sep 17 00:00:00 2001 From: Andy Nichols Date: Sat, 3 Nov 2012 18:56:12 +0100 Subject: Update tests to build with wayland 1.0.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- tests/auto/compositor/mockclient.cpp | 28 +++++++++++++++++----------- tests/auto/compositor/mockclient.h | 5 +++-- 2 files changed, 20 insertions(+), 13 deletions(-) (limited to 'tests') diff --git a/tests/auto/compositor/mockclient.cpp b/tests/auto/compositor/mockclient.cpp index 03113c9f0..4204e3936 100644 --- a/tests/auto/compositor/mockclient.cpp +++ b/tests/auto/compositor/mockclient.cpp @@ -52,18 +52,23 @@ #include #include +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_display_bind(display, id, &wl_compositor_interface)); + compositor = static_cast(wl_registry_bind(registry, id, &wl_compositor_interface, 1)); } else if (interface == "wl_output") { - output = static_cast(wl_display_bind(display, id, &wl_output_interface)); + output = static_cast(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_display_bind(display, id, &wl_shm_interface)); + shm = static_cast(wl_registry_bind(registry, id, &wl_shm_interface, 1)); } } diff --git a/tests/auto/compositor/mockclient.h b/tests/auto/compositor/mockclient.h index 3253c7ed1..fa7c28a81 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(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, -- cgit v1.2.3