summaryrefslogtreecommitdiffstats
path: root/sway/input/seat.c
diff options
context:
space:
mode:
Diffstat (limited to 'sway/input/seat.c')
-rw-r--r--sway/input/seat.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/sway/input/seat.c b/sway/input/seat.c
index d35cbeef..071ef020 100644
--- a/sway/input/seat.c
+++ b/sway/input/seat.c
@@ -658,7 +658,8 @@ void seat_set_focus_layer(struct sway_seat *seat,
658 struct wlr_layer_surface *layer) { 658 struct wlr_layer_surface *layer) {
659 if (!layer && seat->focused_layer) { 659 if (!layer && seat->focused_layer) {
660 seat->focused_layer = NULL; 660 seat->focused_layer = NULL;
661 struct sway_container *previous = seat_get_focus(seat); 661 struct sway_container *previous =
662 seat_get_focus_inactive(seat, &root_container);
662 if (previous) { 663 if (previous) {
663 wlr_log(L_DEBUG, "Returning focus to %p %s '%s'", previous, 664 wlr_log(L_DEBUG, "Returning focus to %p %s '%s'", previous,
664 container_type_to_str(previous->type), previous->name); 665 container_type_to_str(previous->type), previous->name);
@@ -728,14 +729,14 @@ struct sway_container *seat_get_focus_inactive(struct sway_seat *seat,
728 729
729struct sway_container *seat_get_active_child(struct sway_seat *seat, 730struct sway_container *seat_get_active_child(struct sway_seat *seat,
730 struct sway_container *container) { 731 struct sway_container *container) {
731 struct sway_container *focus = seat_get_focus_inactive(seat, container); 732 struct sway_seat_container *current = NULL;
732 if (!focus) { 733 wl_list_for_each(current, &seat->focus_stack, link) {
733 return NULL; 734 if (current->container->parent == container &&
734 } 735 current->container->layout != L_FLOATING) {
735 while (focus->parent != container) { 736 return current->container;
736 focus = focus->parent; 737 }
737 } 738 }
738 return focus; 739 return NULL;
739} 740}
740 741
741struct sway_container *seat_get_focus(struct sway_seat *seat) { 742struct sway_container *seat_get_focus(struct sway_seat *seat) {