enum { CT_ROOT = 0, CT_OUTPUT = 1, CT_CON = 2, CT_FLOATING_CON = 3, CT_WORKSPACE = 4 } type;
orientation_t orientation;
struct Con *parent;
- /* parent before setting it to floating */
- struct Con *old_parent;
struct Rect rect;
struct Rect window_rect;
TAILQ_INSERT_TAIL(&(nc->parent->focus_head), nc, focused);
/* 3: attach the child to the new parent container */
- con->old_parent = con->parent;
con->parent = nc;
con->floating = FLOATING_USER_ON;
return;
}
- assert(con->old_parent != NULL);
-
/* 1: detach from parent container */
TAILQ_REMOVE(&(con->parent->nodes_head), con, nodes);
TAILQ_REMOVE(&(con->parent->focus_head), con, focused);
tree_close(con->parent, false, false);
/* 3: re-attach to previous parent */
- con->parent = con->old_parent;
+ con->parent = con_get_workspace(con);
TAILQ_INSERT_TAIL(&(con->parent->nodes_head), con, nodes);
TAILQ_INSERT_TAIL(&(con->parent->focus_head), con, focused);
return new;
}
-/*
- * vanishing is the container that is about to be closed (so any floating
- * client which has old_parent == vanishing needs to be "re-parented").
- *
- */
-static void fix_floating_parent(Con *con, Con *vanishing) {
- Con *child;
-
- if (con->old_parent == vanishing) {
- LOG("Fixing vanishing old_parent (%p) of container %p to be %p\n",
- vanishing, con, vanishing->parent);
- con->old_parent = vanishing->parent;
- }
-
- TAILQ_FOREACH(child, &(con->floating_head), floating_windows)
- fix_floating_parent(child, vanishing);
-
- TAILQ_FOREACH(child, &(con->nodes_head), nodes)
- fix_floating_parent(child, vanishing);
-}
-
static bool _is_con_mapped(Con *con) {
Con *child;
was_mapped = _is_con_mapped(con);
}
- /* check floating clients and adjust old_parent if necessary */
- fix_floating_parent(croot, con);
-
/* Get the container which is next focused */
Con *next = con_next_focused(con);
DLOG("next = %p, focused = %p\n", next, focused);