more changes

This commit is contained in:
taiyu 2015-08-18 02:46:14 -07:00
parent 4606fb1ee3
commit 63bc0d3b54
5 changed files with 19 additions and 13 deletions

View file

@ -60,8 +60,9 @@ swayc_t *replace_child(swayc_t *child, swayc_t *new_child) {
return parent;
}
swayc_t *remove_child(swayc_t *parent, swayc_t *child) {
swayc_t *remove_child(swayc_t *child) {
int i;
swayc_t *parent = child->parent;
// Special case for floating views
if (child->is_floating) {
for (i = 0; i < parent->floating->length; ++i) {
@ -79,7 +80,11 @@ swayc_t *remove_child(swayc_t *parent, swayc_t *child) {
}
}
if (parent->focused == child) {
parent->focused = NULL;
if (parent->children->length > 0) {
parent->focused = parent->children->items[i?i-1:0];
} else {
parent->focused = NULL;
}
}
return parent;
}