[PATCH weston 4/4] Use the versioned wl_global api and properly advertise versions
Jason Ekstrand
jason at jlekstrand.net
Thu Jun 27 18:17:03 PDT 2013
Signed-off-by: Jason Ekstrand <jason at jlekstrand.net>
---
src/compositor.c | 16 +++++++++-------
src/data-device.c | 6 +++---
src/input.c | 4 ++--
src/screenshooter.c | 7 ++++---
src/shell.c | 27 ++++++++++++++++-----------
src/tablet-shell.c | 5 +++--
src/text-backend.c | 13 +++++++------
src/xwayland/launcher.c | 3 ++-
src/zoom.c | 6 ++++--
tests/weston-test.c | 4 ++--
10 files changed, 52 insertions(+), 39 deletions(-)
diff --git a/src/compositor.c b/src/compositor.c
index 6fd6086..bc17218 100644
--- a/src/compositor.c
+++ b/src/compositor.c
@@ -2737,9 +2737,10 @@ weston_output_init(struct weston_output *output, struct weston_compositor *c,
output->id = ffs(~output->compositor->output_id_pool) - 1;
output->compositor->output_id_pool |= 1 << output->id;
- output->global =
- wl_display_add_global(c->wl_display, &wl_output_interface,
- output, bind_output);
+ output->global = wl_display_add_versioned_global(c->wl_display,
+ &wl_output_interface,
+ 2, output,
+ bind_output);
wl_signal_emit(&c->output_created_signal, output);
}
@@ -2815,12 +2816,13 @@ weston_compositor_init(struct weston_compositor *ec,
ec->output_id_pool = 0;
- if (!wl_display_add_global(display, &wl_compositor_interface,
- ec, compositor_bind))
+ if (!wl_display_add_versioned_global(display, &wl_compositor_interface,
+ 3, ec, compositor_bind))
return -1;
- if (!wl_display_add_global(display, &wl_subcompositor_interface,
- ec, bind_subcompositor))
+ if (!wl_display_add_versioned_global(display,
+ &wl_subcompositor_interface, 1,
+ ec, bind_subcompositor))
return -1;
wl_list_init(&ec->surface_list);
diff --git a/src/data-device.c b/src/data-device.c
index 86789c5..e87c2b6 100644
--- a/src/data-device.c
+++ b/src/data-device.c
@@ -618,9 +618,9 @@ wl_data_device_set_keyboard_focus(struct weston_seat *seat)
WL_EXPORT int
wl_data_device_manager_init(struct wl_display *display)
{
- if (wl_display_add_global(display,
- &wl_data_device_manager_interface,
- NULL, bind_manager) == NULL)
+ if (wl_display_add_versioned_global(display,
+ &wl_data_device_manager_interface,
+ 1, NULL, bind_manager) == NULL)
return -1;
return 0;
diff --git a/src/input.c b/src/input.c
index 663badf..5d3cafa 100644
--- a/src/input.c
+++ b/src/input.c
@@ -1487,8 +1487,8 @@ weston_seat_init(struct weston_seat *seat, struct weston_compositor *ec,
wl_list_init(&seat->drag_resource_list);
wl_signal_init(&seat->destroy_signal);
- wl_display_add_global(ec->wl_display, &wl_seat_interface, seat,
- bind_seat);
+ wl_display_add_versioned_global(ec->wl_display, &wl_seat_interface, 2,
+ seat, bind_seat);
seat->compositor = ec;
seat->modifier_state = 0;
diff --git a/src/screenshooter.c b/src/screenshooter.c
index 27348f2..4edfe9a 100644
--- a/src/screenshooter.c
+++ b/src/screenshooter.c
@@ -574,9 +574,10 @@ screenshooter_create(struct weston_compositor *ec)
shooter->ec = ec;
shooter->client = NULL;
- shooter->global = wl_display_add_global(ec->wl_display,
- &screenshooter_interface,
- shooter, bind_shooter);
+ shooter->global = wl_display_add_versioned_global(ec->wl_display,
+ &screenshooter_interface,
+ 1, shooter,
+ bind_shooter);
weston_compositor_add_key_binding(ec, KEY_S, MODIFIER_SUPER,
screenshooter_binding, shooter);
weston_compositor_add_key_binding(ec, KEY_R, MODIFIER_SUPER,
diff --git a/src/shell.c b/src/shell.c
index 660580f..665cee7 100644
--- a/src/shell.c
+++ b/src/shell.c
@@ -4502,25 +4502,30 @@ module_init(struct weston_compositor *ec,
wl_list_init(&shell->workspaces.animation.link);
shell->workspaces.animation.frame = animate_workspace_change_frame;
- if (wl_display_add_global(ec->wl_display, &wl_shell_interface,
- shell, bind_shell) == NULL)
+ if (wl_display_add_versioned_global(ec->wl_display,
+ &wl_shell_interface, 1,
+ shell, bind_shell) == NULL)
return -1;
- if (wl_display_add_global(ec->wl_display,
- &desktop_shell_interface,
- shell, bind_desktop_shell) == NULL)
+ if (wl_display_add_versioned_global(ec->wl_display,
+ &desktop_shell_interface, 2,
+ shell, bind_desktop_shell) == NULL)
return -1;
- if (wl_display_add_global(ec->wl_display, &screensaver_interface,
- shell, bind_screensaver) == NULL)
+ if (wl_display_add_versioned_global(ec->wl_display,
+ &screensaver_interface, 1,
+ shell, bind_screensaver) == NULL)
return -1;
- if (wl_display_add_global(ec->wl_display, &wl_input_panel_interface,
- shell, bind_input_panel) == NULL)
+ if (wl_display_add_versioned_global(ec->wl_display,
+ &wl_input_panel_interface, 1,
+ shell, bind_input_panel) == NULL)
return -1;
- if (wl_display_add_global(ec->wl_display, &workspace_manager_interface,
- shell, bind_workspace_manager) == NULL)
+ if (wl_display_add_versioned_global(ec->wl_display,
+ &workspace_manager_interface,
+ 1, shell,
+ bind_workspace_manager) == NULL)
return -1;
shell->child.deathstamp = weston_compositor_get_time();
diff --git a/src/tablet-shell.c b/src/tablet-shell.c
index 1619f79..6be5bb8 100644
--- a/src/tablet-shell.c
+++ b/src/tablet-shell.c
@@ -545,8 +545,9 @@ module_init(struct weston_compositor *compositor,
wl_signal_add(&compositor->wake_signal, &shell->unlock_listener);
/* FIXME: This will make the object available to all clients. */
- wl_display_add_global(compositor->wl_display, &tablet_shell_interface,
- shell, bind_tablet_shell);
+ wl_display_add_versioned_global(compositor->wl_display,
+ &tablet_shell_interface, 1,
+ shell, bind_tablet_shell);
loop = wl_display_get_event_loop(compositor->wl_display);
shell->long_press_source =
diff --git a/src/text-backend.c b/src/text-backend.c
index 05560b3..69034c9 100644
--- a/src/text-backend.c
+++ b/src/text-backend.c
@@ -412,9 +412,10 @@ text_input_manager_create(struct weston_compositor *ec)
text_input_manager->ec = ec;
text_input_manager->text_input_manager_global =
- wl_display_add_global(ec->wl_display,
- &wl_text_input_manager_interface,
- text_input_manager, bind_text_input_manager);
+ wl_display_add_versioned_global(ec->wl_display,
+ &wl_text_input_manager_interface,
+ 1, text_input_manager,
+ bind_text_input_manager);
text_input_manager->destroy_listener.notify = text_input_manager_notifier_destroy;
wl_signal_add(&ec->destroy_signal, &text_input_manager->destroy_listener);
@@ -900,9 +901,9 @@ handle_seat_created(struct wl_listener *listener,
input_method->text_backend = text_backend;
input_method->input_method_global =
- wl_display_add_global(ec->wl_display,
- &wl_input_method_interface,
- input_method, bind_input_method);
+ wl_display_add_versioned_global(ec->wl_display,
+ &wl_input_method_interface, 1,
+ input_method, bind_input_method);
input_method->destroy_listener.notify = input_method_notifier_destroy;
wl_signal_add(&seat->destroy_signal, &input_method->destroy_listener);
diff --git a/src/xwayland/launcher.c b/src/xwayland/launcher.c
index 3cde8b3..2d9ccdf 100644
--- a/src/xwayland/launcher.c
+++ b/src/xwayland/launcher.c
@@ -374,7 +374,8 @@ module_init(struct weston_compositor *compositor,
WL_EVENT_READABLE,
weston_xserver_handle_event, wxs);
- wl_display_add_global(display, &xserver_interface, wxs, bind_xserver);
+ wl_display_add_versioned_global(display, &xserver_interface, 1,
+ wxs, bind_xserver);
wxs->destroy_listener.notify = weston_xserver_destroy;
wl_signal_add(&compositor->destroy_signal, &wxs->destroy_listener);
diff --git a/src/zoom.c b/src/zoom.c
index 1164dd3..29bfde9 100644
--- a/src/zoom.c
+++ b/src/zoom.c
@@ -79,9 +79,11 @@ text_cursor_position_notifier_create(struct weston_compositor *ec)
text_cursor_position->ec = ec;
- text_cursor_position->global = wl_display_add_global(ec->wl_display,
+ text_cursor_position->global =
+ wl_display_add_versioned_global(ec->wl_display,
&text_cursor_position_interface,
- text_cursor_position, bind_text_cursor_position);
+ 1, text_cursor_position,
+ bind_text_cursor_position);
text_cursor_position->destroy_listener.notify = text_cursor_position_notifier_destroy;
wl_signal_add(&ec->destroy_signal, &text_cursor_position->destroy_listener);
diff --git a/tests/weston-test.c b/tests/weston-test.c
index 9822be9..fd61819 100644
--- a/tests/weston-test.c
+++ b/tests/weston-test.c
@@ -239,8 +239,8 @@ module_init(struct weston_compositor *ec,
test->compositor = ec;
weston_layer_init(&test->layer, &ec->cursor_layer.link);
- if (wl_display_add_global(ec->wl_display, &wl_test_interface,
- test, bind_test) == NULL)
+ if (wl_display_add_versioned_global(ec->wl_display, &wl_test_interface,
+ 1, test, bind_test) == NULL)
return -1;
loop = wl_display_get_event_loop(ec->wl_display);
--
1.8.2.1
More information about the wayland-devel
mailing list