From 6dc1ae802bb8cf1c272dc48c68fb42e3d548e812 Mon Sep 17 00:00:00 2001
From: taiyu <taiyu.len@gmail.com>
Date: Tue, 18 Aug 2015 22:20:31 -0700
Subject: [PATCH] focus to only child

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

diff --git a/sway/layout.c b/sway/layout.c
index 2f8027a8e..e2e129019 100644
--- a/sway/layout.c
+++ b/sway/layout.c
@@ -33,6 +33,9 @@ void add_child(swayc_t *parent, swayc_t *child) {
 		child->width, child->height, parent, parent->type, parent->width, parent->height);
 	list_add(parent->children, child);
 	child->parent = parent;
+	if (parent->children->length == 1) {
+		parent->focused = child;
+	}
 }
 
 swayc_t *add_sibling(swayc_t *sibling, swayc_t *child) {