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

@ -27,10 +27,7 @@ static void free_swayc(swayc_t *c) {
list_free(c->children);
}
if (c->parent) {
if (c->parent->focused == c) {
c->parent->focused = NULL;
}
remove_child(c->parent, c);
remove_child(c);
}
if (c->name) {
free(c->name);
@ -118,6 +115,11 @@ swayc_t *new_container(swayc_t *child, enum swayc_layouts layout) {
//reorder focus
cont->focused = workspace->focused;
workspace->focused = cont;
//set all children focu to container
int i;
for (i = 0; i < workspace->children->length; ++i) {
((swayc_t *)workspace->children->items[i])->parent = cont;
}
//Swap children
list_t *tmp_list = workspace->children;
workspace->children = cont->children;
@ -204,7 +206,7 @@ swayc_t *destroy_output(swayc_t *output) {
if (output->children->length == 0) {
//TODO move workspaces to other outputs
}
sway_log(L_DEBUG, "OUTPUT: Destroying output '%u'", (unsigned int)output->handle);
sway_log(L_DEBUG, "OUTPUT: Destroying output '%lu'", output->handle);
free_swayc(output);
return &root_container;
}
@ -246,7 +248,6 @@ swayc_t *destroy_view(swayc_t *view) {
if (parent->type == C_CONTAINER) {
return destroy_container(parent);
}
return parent;
}