diff options
Diffstat (limited to 'sway')
| -rw-r--r-- | sway/container.c | 1 | ||||
| -rw-r--r-- | sway/layout.c | 7 | 
2 files changed, 5 insertions, 3 deletions
| diff --git a/sway/container.c b/sway/container.c index 0a89f634..0a75643d 100644 --- a/sway/container.c +++ b/sway/container.c @@ -150,6 +150,7 @@ swayc_t *new_container(swayc_t *child, enum swayc_layouts layout) {  		// give them proper layouts  		cont->layout = workspace->layout;  		workspace->layout = layout; +		set_focused_container_for(workspace, get_focused_view(workspace));  	} else { // Or is built around container  		swayc_t *parent = replace_child(child, cont);  		if (parent) { diff --git a/sway/layout.c b/sway/layout.c index 7125ffc3..eb8391ce 100644 --- a/sway/layout.c +++ b/sway/layout.c @@ -33,8 +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; +	//set focus for this container  	if (parent->children->length == 1) { -		parent->focused = child; +		set_focused_container_for(parent, child);  	}  } @@ -45,7 +46,7 @@ void add_floating(swayc_t *ws, swayc_t *child) {  	child->parent = ws;  	child->is_floating = true;  	if (!ws->focused) { -		ws->focused = child; +		set_focused_container_for(ws, child);  	}  } @@ -70,7 +71,7 @@ swayc_t *replace_child(swayc_t *child, swayc_t *new_child) {  	new_child->parent = child->parent;  	if (child->parent->focused == child) { -		child->parent->focused = new_child; +		set_focused_container_for(child->parent, new_child);  	}  	child->parent = NULL;  	return parent; | 
