Fix assertion when moving out of a floating container.

This commit is contained in:
Fernando Tarlá Cardoso Lemos 2011-01-27 22:06:47 -02:00 committed by Michael Stapelberg
parent f465b3c11d
commit 8be40932f2
1 changed files with 5 additions and 3 deletions

View File

@ -448,6 +448,7 @@ void tree_move(char way, orientation_t orientation) {
con_detach(focused); con_detach(focused);
con_fix_percent(focused->parent); con_fix_percent(focused->parent);
focused->parent = parent; focused->parent = parent;
fix_percent = true;
TAILQ_INSERT_HEAD(&(parent->nodes_head), focused, nodes); TAILQ_INSERT_HEAD(&(parent->nodes_head), focused, nodes);
TAILQ_INSERT_HEAD(&(parent->focus_head), focused, focused); TAILQ_INSERT_HEAD(&(parent->focus_head), focused, focused);
@ -526,12 +527,13 @@ void tree_move(char way, orientation_t orientation) {
/* fix the percentages in the container we moved to */ /* fix the percentages in the container we moved to */
if (fix_percent) { if (fix_percent) {
int children = con_num_children(focused->parent); int children = con_num_children(focused->parent);
if (children == 1) if (children == 1) {
focused->percent = 1.0; focused->percent = 1.0;
else } else {
focused->percent = 1.0 / (children - 1); focused->percent = 1.0 / (children - 1);
con_fix_percent(focused->parent); con_fix_percent(focused->parent);
} }
}
/* We need to call con_focus() to fix the focus stack "above" the container /* We need to call con_focus() to fix the focus stack "above" the container
* we just inserted the focused container into (otherwise, the parent * we just inserted the focused container into (otherwise, the parent