summaryrefslogtreecommitdiff
path: root/sway/layout.c
diff options
context:
space:
mode:
authortaiyu <[email protected]>2015-08-18 02:46:14 -0700
committertaiyu <[email protected]>2015-08-18 02:46:14 -0700
commit63bc0d3b5451f4668186c98a1f283f3e0a104cfe (patch)
treef86f88dc446e95702380687a48bba808029d7e1b /sway/layout.c
parent4606fb1ee3102dcaeab005d64eeead5842a5cd3e (diff)
more changes
Diffstat (limited to 'sway/layout.c')
-rw-r--r--sway/layout.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/sway/layout.c b/sway/layout.c
index de7ef370..8ff5c4b7 100644
--- a/sway/layout.c
+++ b/sway/layout.c
@@ -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;
}