From 25ac3b504574b5e177c8f92eb02b83fdcc31d624 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Fri, 13 May 2016 12:52:09 +0200 Subject: Don't use deprecated wl_client_add_object and wl_display_add_global Use wl_global_create, wl_resource_create and wl_resource_set_implementation instead. Change-Id: I8b1812df3daa2f4fe2ef8e850aa93ab125dadcf8 Reviewed-by: Pier Luigi Fiorini --- tests/auto/client/mockcompositor.cpp | 10 +++++----- tests/auto/client/mockoutput.cpp | 4 +--- tests/auto/client/mockshell.cpp | 9 +++++---- tests/auto/client/mocksurface.cpp | 2 +- 4 files changed, 12 insertions(+), 13 deletions(-) (limited to 'tests') diff --git a/tests/auto/client/mockcompositor.cpp b/tests/auto/client/mockcompositor.cpp index 9fe02629d..4cea75ea2 100644 --- a/tests/auto/client/mockcompositor.cpp +++ b/tests/auto/client/mockcompositor.cpp @@ -194,7 +194,7 @@ Compositor::Compositor() exit(EXIT_FAILURE); } - wl_display_add_global(m_display, &wl_compositor_interface, this, bindCompositor); + wl_global_create(m_display, &wl_compositor_interface, 1, this, bindCompositor); m_data_device_manager.reset(new DataDeviceManager(this, m_display)); @@ -204,8 +204,8 @@ Compositor::Compositor() m_pointer = m_seat->pointer(); m_keyboard = m_seat->keyboard(); - wl_display_add_global(m_display, &wl_output_interface, this, bindOutput); - wl_display_add_global(m_display, &wl_shell_interface, this, bindShell); + wl_global_create(m_display, &wl_output_interface, 1, this, bindOutput); + wl_global_create(m_display, &wl_shell_interface, 1, this, bindShell); m_loop = wl_display_get_event_loop(m_display); m_fd = wl_event_loop_get_fd(m_loop); @@ -242,8 +242,8 @@ void Compositor::bindCompositor(wl_client *client, void *compositorData, uint32_ compositor_create_region }; - Q_UNUSED(version); - wl_client_add_object(client, &wl_compositor_interface, &compositorInterface, id, compositorData); + wl_resource *resource = wl_resource_create(client, &wl_compositor_interface, static_cast(version), id); + wl_resource_set_implementation(resource, &compositorInterface, compositorData, nullptr); } static void unregisterResourceCallback(wl_listener *listener, void *data) diff --git a/tests/auto/client/mockoutput.cpp b/tests/auto/client/mockoutput.cpp index 057387160..86561976f 100644 --- a/tests/auto/client/mockoutput.cpp +++ b/tests/auto/client/mockoutput.cpp @@ -32,9 +32,7 @@ namespace Impl { void Compositor::bindOutput(wl_client *client, void *compositorData, uint32_t version, uint32_t id) { - Q_UNUSED(version); - - wl_resource *resource = wl_client_add_object(client, &wl_output_interface, 0, id, compositorData); + wl_resource *resource = wl_resource_create(client, &wl_output_interface, static_cast(version), id); Compositor *compositor = static_cast(compositorData); registerResource(&compositor->m_outputResources, resource); diff --git a/tests/auto/client/mockshell.cpp b/tests/auto/client/mockshell.cpp index 2ce5965a3..d5eede22e 100644 --- a/tests/auto/client/mockshell.cpp +++ b/tests/auto/client/mockshell.cpp @@ -159,8 +159,9 @@ static void get_shell_surface(wl_client *client, wl_resource *compositorResource shell_surface_set_class }; - Q_UNUSED(compositorResource); - wl_client_add_object(client, &wl_shell_surface_interface, &shellSurfaceInterface, id, surfaceResource->data); + int version = wl_resource_get_version(compositorResource); + wl_resource *shellSurface = wl_resource_create(client, &wl_shell_surface_interface, version, id); + wl_resource_set_implementation(shellSurface, &shellSurfaceInterface, surfaceResource->data, nullptr); Surface *surf = Surface::fromResource(surfaceResource); surf->map(); } @@ -171,8 +172,8 @@ void Compositor::bindShell(wl_client *client, void *compositorData, uint32_t ver get_shell_surface }; - Q_UNUSED(version); - wl_client_add_object(client, &wl_shell_interface, &shellInterface, id, compositorData); + wl_resource *resource = wl_resource_create(client, &wl_shell_interface, static_cast(version), id); + wl_resource_set_implementation(resource, &shellInterface, compositorData, nullptr); } } diff --git a/tests/auto/client/mocksurface.cpp b/tests/auto/client/mocksurface.cpp index 749a1470d..55712af11 100644 --- a/tests/auto/client/mocksurface.cpp +++ b/tests/auto/client/mocksurface.cpp @@ -96,7 +96,7 @@ void Surface::surface_damage(Resource *resource, void Surface::surface_frame(Resource *resource, uint32_t callback) { - wl_resource *frameCallback = wl_client_add_object(resource->client(), &wl_callback_interface, 0, callback, this); + wl_resource *frameCallback = wl_resource_create(resource->client(), &wl_callback_interface, 1, callback); m_frameCallbackList << frameCallback; } -- cgit v1.2.3