From 76fedd74500860c1a9ef190ab9f37415ec727b1a Mon Sep 17 00:00:00 2001 From: Isaac Freund Date: Fri, 17 Apr 2020 13:22:23 +0200 Subject: [PATCH] Fix focus handling of newly mapped Views --- src/view.zig | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/view.zig b/src/view.zig index 08b168f..6af7fe2 100644 --- a/src/view.zig +++ b/src/view.zig @@ -148,8 +148,14 @@ pub const View = struct { c.wl_signal_add(&view.wlr_xdg_surface.surface.*.events.commit, &view.listen_commit); view.mapped = true; - // TODO: remove this hack - root.server.input_manager.seats.first.?.data.focus(view); + + // Focus the newly mapped view. Note: if a seat is focusing a different output + // it will continue to do so. + var it = root.server.input_manager.seats.first; + while (it) |seat_node| : (it = seat_node.next) { + seat_node.data.focus(view); + } + view.output.root.arrange(); }