TAILQ_REMOVE(&(con->parent->nodes_head), con, nodes);
TAILQ_REMOVE(&(con->parent->focus_head), con, focused);
- con_fix_percent(con->parent, WINDOW_REMOVE);
+ con_fix_percent(con->parent);
/* 2: create a new container to render the decoration on, add
* it as a floating window to the workspace */
/* 3: attach the child to the new parent container */
con->parent = nc;
+ con->percent = 1.0;
con->floating = FLOATING_USER_ON;
/* Some clients (like GIMP’s color picker window) get mapped
TAILQ_REMOVE(&(con->parent->parent->focus_head), con->parent, focused);
tree_close(con->parent, false, false);
- /* 3: re-attach to previous parent */
- con->parent = con_get_workspace(con);
+ /* 3: re-attach to the parent of the currently focused con on the workspace
+ * this floating con was on */
+ Con *focused = con_descend_focused(con_get_workspace(con));
+ con->parent = focused->parent;
+
+ /* XXX: We adjust the percentage value to start with a fair value. Floating
+ * cons always have 1.0 as percent which doesn’t work so well when
+ * re-inserting (the formerly floating con would get 50% of the target
+ * con). */
+ con->percent = (1.0 / con_num_children(con->parent));
+
TAILQ_INSERT_TAIL(&(con->parent->nodes_head), con, nodes);
TAILQ_INSERT_TAIL(&(con->parent->focus_head), con, focused);
con->floating = FLOATING_USER_OFF;
- con_fix_percent(con->parent, WINDOW_ADD);
+ con_fix_percent(con->parent);
// TODO: don’t influence focus handling when Con was not focused before.
con_focus(con);
}
void drag_pointer(Con *con, xcb_button_press_event_t *event, xcb_window_t
confine_to, border_t border, callback_t callback, void *extra)
{
- xcb_window_t root = xcb_setup_roots_iterator(xcb_get_setup(conn)).data->root;
uint32_t new_x, new_y;
Rect old_rect;
if (con != NULL)