mirror of
https://gitlab.freedesktop.org/wayland/weston
synced 2024-10-04 23:12:54 +00:00
ivi-shell: Properly handle seat hotplugging
Add to handle seet hotplugging so that seats are properly picked up by ivi-shell when they are dynamically created. Signed-off-by: Tomohito Esaki <etom@igel.co.jp>
This commit is contained in:
parent
e3a509236b
commit
ec3e2d2d36
|
@ -95,6 +95,13 @@ struct ivi_input_panel_surface
|
|||
struct wl_list link;
|
||||
};
|
||||
|
||||
struct ivi_shell_seat {
|
||||
struct weston_seat *seat;
|
||||
struct wl_listener seat_destroy_listener;
|
||||
|
||||
struct wl_list link; /** ivi_shell::seat_list */
|
||||
};
|
||||
|
||||
/*
|
||||
* Implementation of ivi_surface
|
||||
*/
|
||||
|
@ -357,6 +364,44 @@ bind_ivi_application(struct wl_client *client,
|
|||
shell, NULL);
|
||||
}
|
||||
|
||||
/*
|
||||
* ivi_shell_seat
|
||||
*/
|
||||
static void
|
||||
ivi_shell_seat_destroy(struct ivi_shell_seat *shseat)
|
||||
{
|
||||
wl_list_remove(&shseat->seat_destroy_listener.link);
|
||||
wl_list_remove(&shseat->link);
|
||||
free(shseat);
|
||||
}
|
||||
|
||||
static void
|
||||
ivi_shell_seat_handle_destroy(struct wl_listener *listener, void *data)
|
||||
{
|
||||
struct ivi_shell_seat *shseat = container_of(listener,
|
||||
struct ivi_shell_seat,
|
||||
seat_destroy_listener);
|
||||
|
||||
ivi_shell_seat_destroy(shseat);
|
||||
}
|
||||
|
||||
static struct ivi_shell_seat *
|
||||
ivi_shell_seat_create(struct ivi_shell *shell, struct weston_seat *seat)
|
||||
{
|
||||
struct ivi_shell_seat *shseat;
|
||||
|
||||
shseat = xzalloc(sizeof *shseat);
|
||||
|
||||
shseat->seat = seat;
|
||||
|
||||
shseat->seat_destroy_listener.notify = ivi_shell_seat_handle_destroy;
|
||||
wl_signal_add(&seat->destroy_signal, &shseat->seat_destroy_listener);
|
||||
|
||||
wl_list_insert(&shell->seat_list, &shseat->link);
|
||||
|
||||
return shseat;
|
||||
}
|
||||
|
||||
void
|
||||
input_panel_destroy(struct ivi_shell *shell);
|
||||
|
||||
|
@ -369,11 +414,13 @@ shell_destroy(struct wl_listener *listener, void *data)
|
|||
struct ivi_shell *shell =
|
||||
container_of(listener, struct ivi_shell, destroy_listener);
|
||||
struct ivi_shell_surface *ivisurf, *next;
|
||||
struct ivi_shell_seat *shseat, *shseat_next;
|
||||
|
||||
ivi_layout_ivi_shell_destroy();
|
||||
|
||||
wl_list_remove(&shell->destroy_listener.link);
|
||||
wl_list_remove(&shell->wake_listener.link);
|
||||
wl_list_remove(&shell->seat_created_listener.link);
|
||||
|
||||
if (shell->text_backend) {
|
||||
text_backend_destroy(shell->text_backend);
|
||||
|
@ -387,6 +434,9 @@ shell_destroy(struct wl_listener *listener, void *data)
|
|||
free(ivisurf);
|
||||
}
|
||||
|
||||
wl_list_for_each_safe(shseat, shseat_next, &shell->seat_list, link)
|
||||
ivi_shell_seat_destroy(shseat);
|
||||
|
||||
ivi_layout_fini();
|
||||
|
||||
weston_desktop_destroy(shell->desktop);
|
||||
|
@ -706,6 +756,16 @@ static const struct weston_desktop_api shell_desktop_api = {
|
|||
.set_xwayland_position = desktop_surface_set_xwayland_position,
|
||||
};
|
||||
|
||||
static void
|
||||
ivi_shell_handle_seat_created(struct wl_listener *listener, void *data)
|
||||
{
|
||||
struct weston_seat *seat = data;
|
||||
struct ivi_shell *shell =
|
||||
container_of(listener, struct ivi_shell, seat_created_listener);
|
||||
|
||||
ivi_shell_seat_create(shell, seat);
|
||||
}
|
||||
|
||||
/*
|
||||
* end of libweston-desktop
|
||||
*/
|
||||
|
@ -1044,6 +1104,7 @@ wet_shell_init(struct weston_compositor *compositor,
|
|||
int *argc, char *argv[])
|
||||
{
|
||||
struct ivi_shell *shell;
|
||||
struct weston_seat *seat;
|
||||
|
||||
shell = xzalloc(sizeof *shell);
|
||||
|
||||
|
@ -1068,6 +1129,13 @@ wet_shell_init(struct weston_compositor *compositor,
|
|||
shell, bind_ivi_application) == NULL)
|
||||
goto err_desktop;
|
||||
|
||||
wl_list_init(&shell->seat_list);
|
||||
wl_list_for_each(seat, &compositor->seat_list, link)
|
||||
ivi_shell_seat_create(shell, seat);
|
||||
shell->seat_created_listener.notify = ivi_shell_handle_seat_created;
|
||||
wl_signal_add(&compositor->seat_created_signal,
|
||||
&shell->seat_created_listener);
|
||||
|
||||
ivi_layout_init(compositor, shell);
|
||||
|
||||
screenshooter_create(compositor);
|
||||
|
|
|
@ -39,6 +39,7 @@ struct ivi_shell
|
|||
struct wl_listener show_input_panel_listener;
|
||||
struct wl_listener hide_input_panel_listener;
|
||||
struct wl_listener update_input_panel_listener;
|
||||
struct wl_listener seat_created_listener;
|
||||
|
||||
struct weston_compositor *compositor;
|
||||
|
||||
|
@ -52,6 +53,8 @@ struct ivi_shell
|
|||
struct wl_resource *binding;
|
||||
struct wl_list surfaces;
|
||||
} input_panel;
|
||||
|
||||
struct wl_list seat_list;
|
||||
};
|
||||
|
||||
void
|
||||
|
|
Loading…
Reference in a new issue