mirror of
https://gitlab.freedesktop.org/wayland/weston
synced 2024-07-08 20:05:52 +00:00
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>
This commit is contained in:
parent
81475a5c15
commit
ee4c7a24dd
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue
Block a user