From fb9b0f7a08e472aa99f7f2ac446815f649f33300 Mon Sep 17 00:00:00 2001 From: Ryan Dwyer Date: Sat, 1 Sep 2018 07:57:07 +1000 Subject: [PATCH] Fix focus bug When changing focus from a view in one workspace to an empty workspace using `focus `, the view in the previous workspace would keep focused styling. This is because the check to unfocus it was only done in the container case and not workspace case, so it's been moved out of both. --- sway/input/seat.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/sway/input/seat.c b/sway/input/seat.c index feb98cd4..502ed5ac 100644 --- a/sway/input/seat.c +++ b/sway/input/seat.c @@ -614,6 +614,13 @@ void seat_set_focus_warp(struct sway_seat *seat, struct sway_node *node, new_output_last_ws = output_get_active_workspace(new_output); } + // Unfocus the previous focus + if (last_focus) { + seat_send_unfocus(last_focus, seat); + node_set_dirty(last_focus); + node_set_dirty(node_get_parent(last_focus)); + } + // Put the container parents on the focus stack, then the workspace, then // the focused container. if (container) { @@ -640,15 +647,6 @@ void seat_set_focus_warp(struct sway_seat *seat, struct sway_node *node, wl_list_remove(&seat_node->link); wl_list_insert(&seat->focus_stack, &seat_node->link); node_set_dirty(&container->node); - - if (last_focus) { - seat_send_unfocus(last_focus, seat); - node_set_dirty(last_focus); - struct sway_node *last_parent = node_get_parent(last_focus); - if (last_parent) { - node_set_dirty(last_parent); - } - } seat_send_focus(&container->node, seat); }