From e62ccf179afa98bb29cc35d8c83aea1c37f41409 Mon Sep 17 00:00:00 2001 From: Marius Vlad Date: Sat, 27 Feb 2021 23:41:39 +0200 Subject: [PATCH] kiosk-shell: Give keyboard focus when mapping the surface Doing it when the surface is being added would cause clients that wait for frame callbacks to wait indefinitely as the surface being activated is not yet, committed. Fixes: #473 Signed-off-by: Marius Vlad --- kiosk-shell/kiosk-shell.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/kiosk-shell/kiosk-shell.c b/kiosk-shell/kiosk-shell.c index 24989ee2..c25d139e 100644 --- a/kiosk-shell/kiosk-shell.c +++ b/kiosk-shell/kiosk-shell.c @@ -556,16 +556,12 @@ desktop_surface_added(struct weston_desktop_surface *desktop_surface, { struct kiosk_shell *shell = data; struct kiosk_shell_surface *shsurf; - struct weston_seat *seat; shsurf = kiosk_shell_surface_create(shell, desktop_surface); if (!shsurf) return; kiosk_shell_surface_set_fullscreen(shsurf, NULL); - - wl_list_for_each(seat, &shell->compositor->seat_list, link) - weston_view_activate(shsurf->view, seat, 0); } /* Return the view that should gain focus after the specified shsurf is @@ -671,10 +667,15 @@ desktop_surface_committed(struct weston_desktop_surface *desktop_surface, } if (!weston_surface_is_mapped(surface)) { + struct weston_seat *seat; + weston_layer_entry_insert(&shsurf->shell->normal_layer.view_list, &shsurf->view->layer_link); shsurf->view->is_mapped = true; surface->is_mapped = true; + + wl_list_for_each(seat, &shsurf->shell->compositor->seat_list, link) + weston_view_activate(shsurf->view, seat, 0); } if (!is_fullscreen && (sx != 0 || sy != 0)) {