summaryrefslogtreecommitdiff
path: root/sway/tree/layout.c
diff options
context:
space:
mode:
authorDrew DeVault <[email protected]>2017-11-25 16:30:15 -0500
committerDrew DeVault <[email protected]>2017-11-25 16:30:15 -0500
commit8caabe59c2e6f6174678e6c28be3381a7dabff10 (patch)
tree5425efb1f3b68e9b275d8429bba70a2b132b72c9 /sway/tree/layout.c
parenta57d46292694e388d74add7b0869bcafdb42b2bd (diff)
Handle view destruction properly
Diffstat (limited to 'sway/tree/layout.c')
-rw-r--r--sway/tree/layout.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/sway/tree/layout.c b/sway/tree/layout.c
index 6e2586a7..ea7bb8bb 100644
--- a/sway/tree/layout.c
+++ b/sway/tree/layout.c
@@ -40,6 +40,19 @@ void add_child(swayc_t *parent, swayc_t *child) {
*/
}
+swayc_t *remove_child(swayc_t *child) {
+ int i;
+ swayc_t *parent = child->parent;
+ for (i = 0; i < parent->children->length; ++i) {
+ if (parent->children->items[i] == child) {
+ list_del(parent->children, i);
+ break;
+ }
+ }
+ child->parent = NULL;
+ return parent;
+}
+
enum swayc_layouts default_layout(swayc_t *output) {
/* TODO WLR
if (config->default_layout != L_NONE) {