diff options
author | Harish Krupo <harishkrupo@gmail.com> | 2019-04-19 01:53:27 +0530 |
---|---|---|
committer | Simon Ser <contact@emersion.fr> | 2019-06-19 07:44:51 +0000 |
commit | 48e1c4278442ef2d59696d996f921cc23b13d539 (patch) | |
tree | 4b0bcd198a1e190c2eac68bbb3a4661594c9ddd6 | |
parent | 3e7a9c94eb9fb5bb26d7eca0349f8092525f154d (diff) | |
download | weston-48e1c4278442ef2d59696d996f921cc23b13d539.tar.gz |
window.c: Don't assume registry advertisement order
The toytoolkit assumes that wl_seats are advertised after
wl_data_device_manager and creates a data_device during wl_seat
registry binding. This patch removes this assumption by creating
data_devices for all the wl_seats created up until then.
Fixes: https://gitlab.freedesktop.org/wayland/weston/issues/201
Signed-off-by: Harish Krupo <harishkrupo@gmail.com>
(cherry picked from commit ee4c7a24dd8e2f52edc3ee4a9245f316e8261367)
-rw-r--r-- | clients/window.c | 29 |
1 files changed, 24 insertions, 5 deletions
diff --git a/clients/window.c b/clients/window.c index bb9c708f..49549f62 100644 --- a/clients/window.c +++ b/clients/window.c @@ -5829,6 +5829,29 @@ display_add_input(struct display *d, uint32_t id, int display_seat_version) } static void +display_add_data_device(struct display *d, uint32_t id, int ddm_version) +{ + struct input *input; + + d->data_device_manager_version = MIN(ddm_version, 3); + d->data_device_manager = + wl_registry_bind(d->registry, id, + &wl_data_device_manager_interface, + d->data_device_manager_version); + + wl_list_for_each(input, &d->input_list, link) { + if (!input->data_device) { + input->data_device = + wl_data_device_manager_get_data_device(d->data_device_manager, + input->seat); + wl_data_device_add_listener(input->data_device, + &data_device_listener, + input); + } + } +} + +static void input_destroy(struct input *input) { input_remove_keyboard_focus(input); @@ -5932,11 +5955,7 @@ registry_handle_global(void *data, struct wl_registry *registry, uint32_t id, d->shm = wl_registry_bind(registry, id, &wl_shm_interface, 1); wl_shm_add_listener(d->shm, &shm_listener, d); } else if (strcmp(interface, "wl_data_device_manager") == 0) { - d->data_device_manager_version = MIN(version, 3); - d->data_device_manager = - wl_registry_bind(registry, id, - &wl_data_device_manager_interface, - d->data_device_manager_version); + display_add_data_device(d, id, version); } else if (strcmp(interface, "xdg_wm_base") == 0) { d->xdg_shell = wl_registry_bind(registry, id, &xdg_wm_base_interface, 1); |