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 <pierluigi.fiorini@gmail.com>
This commit is contained in:
Johan Klokkhammer Helsing 2016-05-13 12:52:09 +02:00 committed by Johan Helsing
parent c1efd6fa2a
commit f3df72594e
4 changed files with 12 additions and 13 deletions

View File

@ -194,7 +194,7 @@ Compositor::Compositor()
exit(EXIT_FAILURE); 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)); m_data_device_manager.reset(new DataDeviceManager(this, m_display));
@ -204,8 +204,8 @@ Compositor::Compositor()
m_pointer = m_seat->pointer(); m_pointer = m_seat->pointer();
m_keyboard = m_seat->keyboard(); m_keyboard = m_seat->keyboard();
wl_display_add_global(m_display, &wl_output_interface, this, bindOutput); wl_global_create(m_display, &wl_output_interface, 1, this, bindOutput);
wl_display_add_global(m_display, &wl_shell_interface, this, bindShell); wl_global_create(m_display, &wl_shell_interface, 1, this, bindShell);
m_loop = wl_display_get_event_loop(m_display); m_loop = wl_display_get_event_loop(m_display);
m_fd = wl_event_loop_get_fd(m_loop); 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 compositor_create_region
}; };
Q_UNUSED(version); wl_resource *resource = wl_resource_create(client, &wl_compositor_interface, static_cast<int>(version), id);
wl_client_add_object(client, &wl_compositor_interface, &compositorInterface, id, compositorData); wl_resource_set_implementation(resource, &compositorInterface, compositorData, nullptr);
} }
static void unregisterResourceCallback(wl_listener *listener, void *data) static void unregisterResourceCallback(wl_listener *listener, void *data)

View File

@ -32,9 +32,7 @@ namespace Impl {
void Compositor::bindOutput(wl_client *client, void *compositorData, uint32_t version, uint32_t id) void Compositor::bindOutput(wl_client *client, void *compositorData, uint32_t version, uint32_t id)
{ {
Q_UNUSED(version); wl_resource *resource = wl_resource_create(client, &wl_output_interface, static_cast<int>(version), id);
wl_resource *resource = wl_client_add_object(client, &wl_output_interface, 0, id, compositorData);
Compositor *compositor = static_cast<Compositor *>(compositorData); Compositor *compositor = static_cast<Compositor *>(compositorData);
registerResource(&compositor->m_outputResources, resource); registerResource(&compositor->m_outputResources, resource);

View File

@ -159,8 +159,9 @@ static void get_shell_surface(wl_client *client, wl_resource *compositorResource
shell_surface_set_class shell_surface_set_class
}; };
Q_UNUSED(compositorResource); int version = wl_resource_get_version(compositorResource);
wl_client_add_object(client, &wl_shell_surface_interface, &shellSurfaceInterface, id, surfaceResource->data); 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); Surface *surf = Surface::fromResource(surfaceResource);
surf->map(); surf->map();
} }
@ -171,8 +172,8 @@ void Compositor::bindShell(wl_client *client, void *compositorData, uint32_t ver
get_shell_surface get_shell_surface
}; };
Q_UNUSED(version); wl_resource *resource = wl_resource_create(client, &wl_shell_interface, static_cast<int>(version), id);
wl_client_add_object(client, &wl_shell_interface, &shellInterface, id, compositorData); wl_resource_set_implementation(resource, &shellInterface, compositorData, nullptr);
} }
} }

View File

@ -96,7 +96,7 @@ void Surface::surface_damage(Resource *resource,
void Surface::surface_frame(Resource *resource, void Surface::surface_frame(Resource *resource,
uint32_t callback) 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; m_frameCallbackList << frameCallback;
} }