aboutsummaryrefslogtreecommitdiffstats
path: root/sway/input/seat.c
diff options
context:
space:
mode:
authorLibravatar Ryan Dwyer <ryandwyer1@gmail.com>2018-09-01 07:57:07 +1000
committerLibravatar Ryan Dwyer <ryandwyer1@gmail.com>2018-09-05 18:01:43 +1000
commitfb9b0f7a08e472aa99f7f2ac446815f649f33300 (patch)
tree387ed10e341111cc196889435da7401cd95a5328 /sway/input/seat.c
parentFix swaybars with no defined output (diff)
downloadsway-fb9b0f7a08e472aa99f7f2ac446815f649f33300.tar.gz
sway-fb9b0f7a08e472aa99f7f2ac446815f649f33300.tar.zst
sway-fb9b0f7a08e472aa99f7f2ac446815f649f33300.zip
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 (limited to 'sway/input/seat.c')
-rw-r--r--sway/input/seat.c16
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,
614 new_output_last_ws = output_get_active_workspace(new_output); 614 new_output_last_ws = output_get_active_workspace(new_output);
615 } 615 }
616 616
617 // Unfocus the previous focus
618 if (last_focus) {
619 seat_send_unfocus(last_focus, seat);
620 node_set_dirty(last_focus);
621 node_set_dirty(node_get_parent(last_focus));
622 }
623
617 // Put the container parents on the focus stack, then the workspace, then 624 // Put the container parents on the focus stack, then the workspace, then
618 // the focused container. 625 // the focused container.
619 if (container) { 626 if (container) {
@@ -640,15 +647,6 @@ void seat_set_focus_warp(struct sway_seat *seat, struct sway_node *node,
640 wl_list_remove(&seat_node->link); 647 wl_list_remove(&seat_node->link);
641 wl_list_insert(&seat->focus_stack, &seat_node->link); 648 wl_list_insert(&seat->focus_stack, &seat_node->link);
642 node_set_dirty(&container->node); 649 node_set_dirty(&container->node);
643
644 if (last_focus) {
645 seat_send_unfocus(last_focus, seat);
646 node_set_dirty(last_focus);
647 struct sway_node *last_parent = node_get_parent(last_focus);
648 if (last_parent) {
649 node_set_dirty(last_parent);
650 }
651 }
652 seat_send_focus(&container->node, seat); 650 seat_send_focus(&container->node, seat);
653 } 651 }
654 652