From c8be7bfc1e0c65730a5bf713e61105cd38bf9f4f Mon Sep 17 00:00:00 2001
From: Drew DeVault <sir@cmpwn.com>
Date: Fri, 6 Apr 2018 13:57:04 -0400
Subject: Fix another of @orestisf1993's issues

---
 sway/tree/layout.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

(limited to 'sway/tree')

diff --git a/sway/tree/layout.c b/sway/tree/layout.c
index f4049c71..b03b80d9 100644
--- a/sway/tree/layout.c
+++ b/sway/tree/layout.c
@@ -364,8 +364,8 @@ void container_move(struct sway_container *container,
 						return;
 					}
 				} else {
-					wlr_log(L_DEBUG, "Selecting sibling");
 					sibling = parent->children->items[index + offs];
+					wlr_log(L_DEBUG, "Selecting sibling id:%zd", sibling->id);
 				}
 			} else {
 				wlr_log(L_DEBUG, "Moving up to find a parallel container");
@@ -419,9 +419,12 @@ void container_move(struct sway_container *container,
 				container_remove_child(container);
 				struct sway_container *focus_inactive = seat_get_focus_inactive(
 						config->handler_context.seat, sibling);
-				wlr_log(L_DEBUG, "Focus inactive: %zd", focus_inactive ?
-						focus_inactive->id : 0);
 				if (focus_inactive) {
+					while (focus_inactive->parent != sibling) {
+						focus_inactive = focus_inactive->parent;
+					}
+					wlr_log(L_DEBUG, "Focus inactive: id:%zd",
+							focus_inactive->id);
 					sibling = focus_inactive;
 					continue;
 				} else if (sibling->children->length) {
-- 
cgit v1.2.3