diff options
author | Ryan Dwyer <ryandwyer1@gmail.com> | 2018-09-01 07:57:07 +1000 |
---|---|---|
committer | Ryan Dwyer <ryandwyer1@gmail.com> | 2018-09-05 18:01:43 +1000 |
commit | fb9b0f7a08e472aa99f7f2ac446815f649f33300 (patch) | |
tree | 387ed10e341111cc196889435da7401cd95a5328 | |
parent | 3133d0c03c3daa8c25155c0fe29bb3bb22962c9d (diff) |
Fix focus bug
When changing focus from a view in one workspace to an empty workspace
using `focus <direction>`, 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.
-rw-r--r-- | sway/input/seat.c | 16 |
1 files 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); } |