[PATCH weston 3/3] Add version arguments to wl_client_add/new_object calls
Jason Ekstrand
jason at jlekstrand.net
Wed Jun 26 20:20:32 PDT 2013
This commit sets the version numbers in all calls to wl_client_add_object
and wl_client_new_object. 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 1.
Signed-off-by: Jason Ekstrand <jason at jlekstrand.net>
---
src/compositor.c | 16 +++++++++-------
src/data-device.c | 8 ++++----
src/input.c | 10 ++++++++--
src/screenshooter.c | 2 +-
src/shell.c | 12 +++++++-----
src/tablet-shell.c | 3 ++-
src/text-backend.c | 9 +++++----
src/xwayland/launcher.c | 2 +-
src/zoom.c | 2 +-
tests/weston-test.c | 2 +-
10 files changed, 39 insertions(+), 27 deletions(-)
diff --git a/src/compositor.c b/src/compositor.c
index 43d8965..d37e943 100644
--- a/src/compositor.c
+++ b/src/compositor.c
@@ -1489,7 +1489,7 @@ surface_frame(struct wl_client *client,
return;
}
- cb->resource = wl_client_add_object(client, &wl_callback_interface,
+ cb->resource = wl_client_add_object(client, &wl_callback_interface, 1,
NULL, callback, cb);
wl_resource_set_destructor(cb->resource, destroy_frame_callback);
@@ -1689,6 +1689,7 @@ compositor_create_surface(struct wl_client *client,
}
surface->resource = wl_client_add_object(client, &wl_surface_interface,
+ wl_resource_get_version(resource),
&surface_interface,
id, surface);
wl_resource_set_destructor(surface->resource, destroy_surface);
@@ -1751,7 +1752,7 @@ compositor_create_region(struct wl_client *client,
pixman_region32_init(®ion->region);
- region->resource = wl_client_add_object(client, &wl_region_interface,
+ region->resource = wl_client_add_object(client, &wl_region_interface, 1,
®ion_interface, id, region);
wl_resource_set_destructor(region->resource, destroy_region);
}
@@ -2289,7 +2290,7 @@ weston_subsurface_create(uint32_t id, struct weston_surface *surface,
return NULL;
sub->resource = wl_client_add_object(client,
- &wl_subsurface_interface,
+ &wl_subsurface_interface, 1,
&subsurface_implementation,
id, sub);
if (!sub->resource) {
@@ -2409,7 +2410,7 @@ bind_subcompositor(struct wl_client *client,
{
struct weston_compositor *compositor = data;
- wl_client_add_object(client, &wl_subcompositor_interface,
+ wl_client_add_object(client, &wl_subcompositor_interface, 1,
&subcompositor_interface, id, compositor);
}
@@ -2522,8 +2523,9 @@ bind_output(struct wl_client *client,
struct weston_mode *mode;
struct wl_resource *resource;
- resource = wl_client_add_object(client,
- &wl_output_interface, NULL, id, data);
+ resource = wl_client_add_object(client, &wl_output_interface,
+ MIN(version, 2),
+ NULL, id, data);
wl_list_insert(&output->resource_list, wl_resource_get_link(resource));
wl_resource_set_destructor(resource, unbind_resource);
@@ -2743,7 +2745,7 @@ compositor_bind(struct wl_client *client,
{
struct weston_compositor *compositor = data;
- wl_client_add_object(client, &wl_compositor_interface,
+ wl_client_add_object(client, &wl_compositor_interface, MIN(version, 3),
&compositor_interface, id, compositor);
}
diff --git a/src/data-device.c b/src/data-device.c
index 5627884..2cf643c 100644
--- a/src/data-device.c
+++ b/src/data-device.c
@@ -118,7 +118,7 @@ wl_data_source_send_offer(struct wl_data_source *source,
return NULL;
offer->resource = wl_client_new_object(wl_resource_get_client(target),
- &wl_data_offer_interface,
+ &wl_data_offer_interface, 1,
&data_offer_interface, offer);
wl_resource_set_destructor(offer->resource, destroy_data_offer);
@@ -546,7 +546,7 @@ create_data_source(struct wl_client *client,
wl_array_init(&source->mime_types);
source->resource = wl_client_add_object(client,
- &wl_data_source_interface,
+ &wl_data_source_interface, 1,
&data_source_interface,
id, source);
wl_resource_set_destructor(source->resource, destroy_data_source);
@@ -565,7 +565,7 @@ get_data_device(struct wl_client *client,
struct weston_seat *seat = wl_resource_get_user_data(seat_resource);
struct wl_resource *resource;
- resource = wl_client_add_object(client, &wl_data_device_interface,
+ resource = wl_client_add_object(client, &wl_data_device_interface, 1,
&data_device_interface, id,
seat);
@@ -582,7 +582,7 @@ static void
bind_manager(struct wl_client *client,
void *data, uint32_t version, uint32_t id)
{
- wl_client_add_object(client, &wl_data_device_manager_interface,
+ wl_client_add_object(client, &wl_data_device_manager_interface, 1,
&manager_interface, id, NULL);
}
diff --git a/src/input.c b/src/input.c
index 004d063..4601264 100644
--- a/src/input.c
+++ b/src/input.c
@@ -1164,6 +1164,7 @@ seat_get_pointer(struct wl_client *client, struct wl_resource *resource,
return;
cr = wl_client_add_object(client, &wl_pointer_interface,
+ wl_resource_get_version(resource),
&pointer_interface, id, seat->pointer);
wl_list_insert(&seat->pointer->resource_list, wl_resource_get_link(cr));
wl_resource_set_destructor(cr, unbind_resource);
@@ -1196,7 +1197,9 @@ seat_get_keyboard(struct wl_client *client, struct wl_resource *resource,
if (!seat->keyboard)
return;
- cr = wl_client_add_object(client, &wl_keyboard_interface, NULL, id,
+ cr = wl_client_add_object(client, &wl_keyboard_interface,
+ wl_resource_get_version(resource),
+ NULL, id,
seat);
wl_list_insert(&seat->keyboard->resource_list, wl_resource_get_link(cr));
wl_resource_set_destructor(cr, unbind_resource);
@@ -1223,7 +1226,9 @@ seat_get_touch(struct wl_client *client, struct wl_resource *resource,
if (!seat->touch)
return;
- cr = wl_client_add_object(client, &wl_touch_interface, NULL, id, seat);
+ cr = wl_client_add_object(client, &wl_touch_interface,
+ wl_resource_get_version(resource),
+ NULL, id, seat);
wl_list_insert(&seat->touch->resource_list, wl_resource_get_link(cr));
wl_resource_set_destructor(cr, unbind_resource);
}
@@ -1242,6 +1247,7 @@ bind_seat(struct wl_client *client, void *data, uint32_t version, uint32_t id)
enum wl_seat_capability caps = 0;
resource = wl_client_add_object(client, &wl_seat_interface,
+ MIN(version, 2),
&seat_interface, id, data);
wl_list_insert(&seat->base_resource_list, wl_resource_get_link(resource));
wl_resource_set_destructor(resource, unbind_resource);
diff --git a/src/screenshooter.c b/src/screenshooter.c
index 8143202..02f204a 100644
--- a/src/screenshooter.c
+++ b/src/screenshooter.c
@@ -217,7 +217,7 @@ bind_shooter(struct wl_client *client,
struct screenshooter *shooter = data;
struct wl_resource *resource;
- resource = wl_client_add_object(client, &screenshooter_interface,
+ resource = wl_client_add_object(client, &screenshooter_interface, 1,
&screenshooter_implementation, id, data);
if (client != shooter->client) {
diff --git a/src/shell.c b/src/shell.c
index 9869db5..ad5d844 100644
--- a/src/shell.c
+++ b/src/shell.c
@@ -1015,7 +1015,7 @@ bind_workspace_manager(struct wl_client *client,
struct desktop_shell *shell = data;
struct wl_resource *resource;
- resource = wl_client_add_object(client, &workspace_manager_interface,
+ resource = wl_client_add_object(client, &workspace_manager_interface, 1,
&workspace_manager_implementation,
id, shell);
@@ -2333,7 +2333,7 @@ shell_get_shell_surface(struct wl_client *client,
}
shsurf->resource = wl_client_add_object(client,
- &wl_shell_surface_interface,
+ &wl_shell_surface_interface, 1,
&shell_surface_implementation,
id, shsurf);
wl_resource_set_destructor(shsurf->resource,
@@ -3599,7 +3599,7 @@ bind_shell(struct wl_client *client, void *data, uint32_t version, uint32_t id)
{
struct desktop_shell *shell = data;
- wl_client_add_object(client, &wl_shell_interface,
+ wl_client_add_object(client, &wl_shell_interface, 1,
&shell_implementation, id, shell);
}
@@ -3623,6 +3623,7 @@ bind_desktop_shell(struct wl_client *client,
struct wl_resource *resource;
resource = wl_client_add_object(client, &desktop_shell_interface,
+ MIN(version, 2),
&desktop_shell_implementation,
id, shell);
@@ -3700,7 +3701,7 @@ bind_screensaver(struct wl_client *client,
struct desktop_shell *shell = data;
struct wl_resource *resource;
- resource = wl_client_add_object(client, &screensaver_interface,
+ resource = wl_client_add_object(client, &screensaver_interface, 1,
&screensaver_implementation,
id, shell);
@@ -3896,6 +3897,7 @@ input_panel_get_input_panel_surface(struct wl_client *client,
ipsurf->resource = wl_client_add_object(client,
&wl_input_panel_surface_interface,
+ 1,
&input_panel_surface_implementation,
id, ipsurf);
@@ -3922,7 +3924,7 @@ bind_input_panel(struct wl_client *client,
struct desktop_shell *shell = data;
struct wl_resource *resource;
- resource = wl_client_add_object(client, &wl_input_panel_interface,
+ resource = wl_client_add_object(client, &wl_input_panel_interface, 1,
&input_panel_implementation,
id, shell);
diff --git a/src/tablet-shell.c b/src/tablet-shell.c
index 91e5110..3813499 100644
--- a/src/tablet-shell.c
+++ b/src/tablet-shell.c
@@ -352,6 +352,7 @@ tablet_shell_create_client(struct wl_client *client,
tablet_client->resource = wl_client_add_object(client,
&tablet_client_interface,
+ 1,
&tablet_client_implementation,
id, tablet_client);
wl_resource_set_destructor(tablet_client->resource,
@@ -499,7 +500,7 @@ bind_tablet_shell(struct wl_client *client, void *data, uint32_t version,
return;
shell->resource = wl_client_add_object(client,
- &tablet_shell_interface,
+ &tablet_shell_interface, 1,
&tablet_shell_implementation,
id, shell);
wl_resource_set_destructor(shell->resource, destroy_tablet_shell);
diff --git a/src/text-backend.c b/src/text-backend.c
index 38728e9..fc0d296 100644
--- a/src/text-backend.c
+++ b/src/text-backend.c
@@ -359,7 +359,7 @@ 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,
+ &wl_text_input_interface, 1,
&text_input_implementation,
id, text_input);
wl_resource_set_destructor(text_input->resource, destroy_text_input);
@@ -383,7 +383,7 @@ bind_text_input_manager(struct wl_client *client,
/* 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,
+ wl_client_add_object(client, &wl_text_input_manager_interface, 1,
&text_input_manager_implementation,
id, text_input_manager);
}
@@ -582,7 +582,7 @@ 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,
+ cr = wl_client_add_object(client, &wl_keyboard_interface, 1,
NULL, id, context);
wl_resource_set_destructor(cr, unbind_keyboard);
@@ -705,6 +705,7 @@ input_method_context_create(struct text_input *model,
binding = input_method->input_method_binding;
context->resource = wl_client_new_object(wl_resource_get_client(binding),
&wl_input_method_context_interface,
+ 1,
&input_method_context_implementation,
context);
wl_resource_set_destructor(context->resource,
@@ -756,7 +757,7 @@ 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,
+ resource = wl_client_add_object(client, &wl_input_method_interface, 1,
NULL,
id, input_method);
diff --git a/src/xwayland/launcher.c b/src/xwayland/launcher.c
index 7048131..d9f2e25 100644
--- a/src/xwayland/launcher.c
+++ b/src/xwayland/launcher.c
@@ -159,7 +159,7 @@ bind_xserver(struct wl_client *client,
return;
wxs->resource =
- wl_client_add_object(client, &xserver_interface,
+ wl_client_add_object(client, &xserver_interface, 1,
&xserver_implementation, id, wxs);
wxs->wm = weston_wm_create(wxs);
diff --git a/src/zoom.c b/src/zoom.c
index 267ff31..4ec2457 100644
--- a/src/zoom.c
+++ b/src/zoom.c
@@ -53,7 +53,7 @@ static void
bind_text_cursor_position(struct wl_client *client,
void *data, uint32_t version, uint32_t id)
{
- wl_client_add_object(client, &text_cursor_position_interface,
+ wl_client_add_object(client, &text_cursor_position_interface, 1,
&text_cursor_position_implementation, id, data);
}
diff --git a/tests/weston-test.c b/tests/weston-test.c
index 214296e..877e7ce 100644
--- a/tests/weston-test.c
+++ b/tests/weston-test.c
@@ -191,7 +191,7 @@ bind_test(struct wl_client *client, void *data, uint32_t version, uint32_t id)
struct weston_test *test = data;
struct wl_resource *resource;
- resource = wl_client_add_object(client, &wl_test_interface,
+ resource = wl_client_add_object(client, &wl_test_interface, 1,
&test_implementation, id, test);
notify_pointer_position(test, resource);
--
1.8.2.1
More information about the wayland-devel
mailing list