diff options
author | Jason Ekstrand <jason@jlekstrand.net> | 2013-06-27 20:17:02 -0500 |
---|---|---|
committer | Kristian Høgsberg <krh@bitplanet.net> | 2013-07-03 14:52:06 -0400 |
commit | a85118c1b85df6fbf8f896dca971a5b79a94da71 (patch) | |
tree | 30390d8883a0e823d62a1c7dc9872b33b7e8e111 /src/text-backend.c | |
parent | d27cb096adf71139734b434d60cbb28bd4a510b1 (diff) | |
download | weston-a85118c1b85df6fbf8f896dca971a5b79a94da71.tar.gz |
Use wl_resource_create() for creating resources
This commit sets the version numbers for all added/created objects. The
wl_compositor.create_surface implementation was altered to create a surface
with the same version as the underlying wl_compositor. Since no other
"child interfaces" have version greater than 1, they were all hard-coded to
version 1.
Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
Diffstat (limited to 'src/text-backend.c')
-rw-r--r-- | src/text-backend.c | 49 |
1 files changed, 26 insertions, 23 deletions
diff --git a/src/text-backend.c b/src/text-backend.c index 38728e93..b7a1a40c 100644 --- a/src/text-backend.c +++ b/src/text-backend.c @@ -358,11 +358,11 @@ static void text_input_manager_create_text_input(struct wl_client *client, text_input = calloc(1, sizeof *text_input); - text_input->resource = wl_client_add_object(client, - &wl_text_input_interface, - &text_input_implementation, - id, text_input); - wl_resource_set_destructor(text_input->resource, destroy_text_input); + text_input->resource = + wl_resource_create(client, &wl_text_input_interface, 1, id); + wl_resource_set_implementation(text_input->resource, + &text_input_implementation, + text_input, destroy_text_input); text_input->ec = text_input_manager->ec; @@ -380,12 +380,16 @@ bind_text_input_manager(struct wl_client *client, uint32_t id) { struct text_input_manager *text_input_manager = data; + struct wl_resource *resource; - /* No checking for duplicate binding necessary. - * No events have to be sent, so we don't need the return value. */ - wl_client_add_object(client, &wl_text_input_manager_interface, - &text_input_manager_implementation, - id, text_input_manager); + /* No checking for duplicate binding necessary. */ + resource = + wl_resource_create(client, + &wl_text_input_manager_interface, 1, id); + if (resource) + wl_resource_set_implementation(resource, + &text_input_manager_implementation, + text_input_manager, NULL); } static void @@ -582,9 +586,8 @@ input_method_context_grab_keyboard(struct wl_client *client, struct weston_seat *seat = context->input_method->seat; struct weston_keyboard *keyboard = seat->keyboard; - cr = wl_client_add_object(client, &wl_keyboard_interface, - NULL, id, context); - wl_resource_set_destructor(cr, unbind_keyboard); + cr = wl_resource_create(client, &wl_keyboard_interface, 1, id); + wl_resource_set_implementation(cr, NULL, context, unbind_keyboard); context->keyboard = cr; @@ -703,12 +706,12 @@ input_method_context_create(struct text_input *model, return; binding = input_method->input_method_binding; - context->resource = wl_client_new_object(wl_resource_get_client(binding), - &wl_input_method_context_interface, - &input_method_context_implementation, - context); - wl_resource_set_destructor(context->resource, - destroy_input_method_context); + context->resource = + wl_resource_create(wl_resource_get_client(binding), + &wl_input_method_context_interface, 1, 0); + wl_resource_set_implementation(context->resource, + &input_method_context_implementation, + context, destroy_input_method_context); context->model = model; context->input_method = input_method; @@ -756,9 +759,8 @@ bind_input_method(struct wl_client *client, struct text_backend *text_backend = input_method->text_backend; struct wl_resource *resource; - resource = wl_client_add_object(client, &wl_input_method_interface, - NULL, - id, input_method); + resource = + wl_resource_create(client, &wl_input_method_interface, 1, id); if (input_method->input_method_binding != NULL) { wl_resource_post_error(resource, WL_DISPLAY_ERROR_INVALID_OBJECT, @@ -774,7 +776,8 @@ bind_input_method(struct wl_client *client, return; } - wl_resource_set_destructor(resource, unbind_input_method); + wl_resource_set_implementation(resource, NULL, input_method, + unbind_input_method); input_method->input_method_binding = resource; text_backend->input_method.binding = resource; |