From b5b11650081f7adb4866fcacd216d3bd83da5024 Mon Sep 17 00:00:00 2001 From: Kristian Høgsberg Date: Tue, 2 Jul 2013 14:34:42 -0400 Subject: wayland-server: Mark wl_client_add/new_object as deprecated --- src/wayland-server.c | 105 +++++++++++++++++++++++++++++---------------------- src/wayland-server.h | 19 ++++++---- 2 files changed, 70 insertions(+), 54 deletions(-) diff --git a/src/wayland-server.c b/src/wayland-server.c index 0933337..33fdb20 100644 --- a/src/wayland-server.c +++ b/src/wayland-server.c @@ -398,33 +398,6 @@ wl_client_get_credentials(struct wl_client *client, *gid = client->ucred.gid; } -uint32_t -wl_client_add_resource(struct wl_client *client, - struct wl_resource *resource) WL_DEPRECATED; - -WL_EXPORT uint32_t -wl_client_add_resource(struct wl_client *client, - struct wl_resource *resource) -{ - if (resource->object.id == 0) { - resource->object.id = - wl_map_insert_new(&client->objects, - WL_MAP_ENTRY_LEGACY, resource); - } else if (wl_map_insert_at(&client->objects, WL_MAP_ENTRY_LEGACY, - resource->object.id, resource) < 0) { - wl_resource_post_error(client->display_resource, - WL_DISPLAY_ERROR_INVALID_OBJECT, - "invalid new id %d", - resource->object.id); - return 0; - } - - resource->client = client; - wl_signal_init(&resource->destroy_signal); - - return resource->object.id; -} - WL_EXPORT struct wl_resource * wl_client_get_object(struct wl_client *client, uint32_t id) { @@ -1015,19 +988,6 @@ wl_display_get_destroy_listener(struct wl_display *display, return wl_signal_get(&display->destroy_signal, notify); } -WL_EXPORT struct wl_resource * -wl_client_add_object(struct wl_client *client, - const struct wl_interface *interface, - const void *implementation, uint32_t id, void *data) -{ - struct wl_resource *resource; - - resource = wl_resource_create(client, interface, -1, id); - wl_resource_set_implementation(resource, implementation, data, NULL); - - return resource; -} - WL_EXPORT void wl_resource_set_implementation(struct wl_resource *resource, const void *implementation, @@ -1078,21 +1038,74 @@ wl_resource_create(struct wl_client *client, return resource; } +WL_EXPORT void +wl_log_set_handler_server(wl_log_func_t handler) +{ + wl_log_handler = handler; +} + +/* Deprecated functions below. */ + +uint32_t +wl_client_add_resource(struct wl_client *client, + struct wl_resource *resource) WL_DEPRECATED; + +WL_EXPORT uint32_t +wl_client_add_resource(struct wl_client *client, + struct wl_resource *resource) +{ + if (resource->object.id == 0) { + resource->object.id = + wl_map_insert_new(&client->objects, + WL_MAP_ENTRY_LEGACY, resource); + } else if (wl_map_insert_at(&client->objects, WL_MAP_ENTRY_LEGACY, + resource->object.id, resource) < 0) { + wl_resource_post_error(client->display_resource, + WL_DISPLAY_ERROR_INVALID_OBJECT, + "invalid new id %d", + resource->object.id); + return 0; + } + + resource->client = client; + wl_signal_init(&resource->destroy_signal); + + return resource->object.id; +} + +struct wl_resource * +wl_client_add_object(struct wl_client *client, + const struct wl_interface *interface, + const void *implementation, + uint32_t id, void *data) WL_DEPRECATED; + WL_EXPORT struct wl_resource * -wl_client_new_object(struct wl_client *client, +wl_client_add_object(struct wl_client *client, const struct wl_interface *interface, - const void *implementation, void *data) + const void *implementation, uint32_t id, void *data) { struct wl_resource *resource; - resource = wl_resource_create(client, interface, -1, 0); + resource = wl_resource_create(client, interface, -1, id); wl_resource_set_implementation(resource, implementation, data, NULL); return resource; } -WL_EXPORT void -wl_log_set_handler_server(wl_log_func_t handler) +struct wl_resource * +wl_client_new_object(struct wl_client *client, + const struct wl_interface *interface, + const void *implementation, void *data) WL_DEPRECATED; + +WL_EXPORT struct wl_resource * +wl_client_new_object(struct wl_client *client, + const struct wl_interface *interface, + const void *implementation, void *data) { - wl_log_handler = handler; + struct wl_resource *resource; + + resource = wl_resource_create(client, interface, -1, 0); + wl_resource_set_implementation(resource, implementation, data, NULL); + + return resource; } diff --git a/src/wayland-server.h b/src/wayland-server.h index e20ade5..4378983 100644 --- a/src/wayland-server.h +++ b/src/wayland-server.h @@ -127,14 +127,6 @@ struct wl_listener *wl_client_get_destroy_listener(struct wl_client *client, wl_notify_func_t notify); struct wl_resource * -wl_client_add_object(struct wl_client *client, - const struct wl_interface *interface, - const void *implementation, uint32_t id, void *data); -struct wl_resource * -wl_client_new_object(struct wl_client *client, - const struct wl_interface *interface, - const void *implementation, void *data); -struct wl_resource * wl_client_get_object(struct wl_client *client, uint32_t id); struct wl_listener { @@ -204,10 +196,21 @@ struct wl_buffer { uint32_t busy_count; } WL_DEPRECATED; + uint32_t wl_client_add_resource(struct wl_client *client, struct wl_resource *resource) WL_DEPRECATED; +struct wl_resource * +wl_client_add_object(struct wl_client *client, + const struct wl_interface *interface, + const void *implementation, + uint32_t id, void *data) WL_DEPRECATED; +struct wl_resource * +wl_client_new_object(struct wl_client *client, + const struct wl_interface *interface, + const void *implementation, void *data) WL_DEPRECATED; + #endif /* -- cgit v1.2.3