Commit ee4c7a24 authored by Harish Krupo's avatar Harish Krupo Committed by Daniel Stone
Browse files

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: #201

Signed-off-by: Harish Krupo's avatarHarish Krupo <harishkrupo@gmail.com>
parent 81475a5c
Pipeline #32021 passed with stages
in 1 minute and 1 second
......@@ -5828,6 +5828,29 @@ display_add_input(struct display *d, uint32_t id, int display_seat_version)
keyboard_repeat_func);
}
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)
{
......@@ -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);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment