[PATCH weston] libinput: Restore keyboard focus after VT switch

Jamey Sharp jamey at minilop.net
Mon May 21 23:21:14 UTC 2018

Under Weston's drm-backend, after returning to Weston from another VT,
no window has focus.

There's already code in notify_keyboard_focus_out and
notify_keyboard_focus_in to save and restore focus, respectively; and
udev_input_enable eventually calls notify_keyboard_focus_in, by way of
evdev_notify_keyboard_focus. But udev_input_disable doesn't currently
call notify_keyboard_focus_out.

This patch makes udev_input_disable symmetric with udev_input_enable by
calling notify_keyboard_focus_out on every seat, to save focus before
suspending libinput. In my testing this successfully resolved my issue.
However, I don't have a multi-seat setup to verify that it works there

Signed-off-by: Jamey Sharp <jamey at minilop.net>
I'm not subscribed to the list, so please Cc me on replies.

 libweston/libinput-seat.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/libweston/libinput-seat.c b/libweston/libinput-seat.c
index ac1e8e99..ded6dd3c 100644
--- a/libweston/libinput-seat.c
+++ b/libweston/libinput-seat.c
@@ -158,9 +158,14 @@ udev_seat_remove_devices(struct udev_seat *seat)
 udev_input_disable(struct udev_input *input)
+	struct udev_seat *seat;
 	if (input->suspended)
+	wl_list_for_each(seat, &input->compositor->seat_list, base.link)
+		notify_keyboard_focus_out(&seat->base);
 	input->libinput_source = NULL;

More information about the wayland-devel mailing list