sway

i3-compatible Wayland compositor
git clone https://git.awy.one/sway
Log | Files | Refs | README | LICENSE

commit fb9b0f7a08e472aa99f7f2ac446815f649f33300
parent 3133d0c03c3daa8c25155c0fe29bb3bb22962c9d
Author: Ryan Dwyer <ryandwyer1@gmail.com>
Date:   Sat,  1 Sep 2018 07:57:07 +1000

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.

Diffstat:
Msway/input/seat.c | 16+++++++---------
1 file changed, 7 insertions(+), 9 deletions(-)

diff --git 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); }