Fix some resizing issues (thanks mseed).
This commit is contained in:
parent
36e20a93a0
commit
5f4123f842
33
src/tree.c
33
src/tree.c
@ -420,7 +420,6 @@ void tree_move(char way, orientation_t orientation) {
|
|||||||
con_attach(new, parent, false);
|
con_attach(new, parent, false);
|
||||||
|
|
||||||
/* 6: fix the percentages */
|
/* 6: fix the percentages */
|
||||||
con_fix_percent(new);
|
|
||||||
con_fix_percent(parent);
|
con_fix_percent(parent);
|
||||||
|
|
||||||
if (old_focused)
|
if (old_focused)
|
||||||
@ -439,6 +438,7 @@ void tree_move(char way, orientation_t orientation) {
|
|||||||
/* If we have no tiling cons (when moving a window out of a floating con to
|
/* If we have no tiling cons (when moving a window out of a floating con to
|
||||||
* an otherwise empty workspace for example), we just attach the window to
|
* an otherwise empty workspace for example), we just attach the window to
|
||||||
* the workspace. */
|
* the workspace. */
|
||||||
|
bool fix_percent = 0;
|
||||||
if (TAILQ_EMPTY(&(parent->nodes_head))) {
|
if (TAILQ_EMPTY(&(parent->nodes_head))) {
|
||||||
con_detach(focused);
|
con_detach(focused);
|
||||||
con_fix_percent(focused->parent);
|
con_fix_percent(focused->parent);
|
||||||
@ -470,8 +470,11 @@ void tree_move(char way, orientation_t orientation) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
con_detach(focused);
|
con_detach(focused);
|
||||||
con_fix_percent(focused->parent);
|
if (focused->parent != next->parent) {
|
||||||
focused->parent = next->parent;
|
con_fix_percent(focused->parent);
|
||||||
|
focused->parent = next->parent;
|
||||||
|
fix_percent = 1;
|
||||||
|
}
|
||||||
|
|
||||||
TAILQ_INSERT_AFTER(&(next->parent->nodes_head), next, focused, nodes);
|
TAILQ_INSERT_AFTER(&(next->parent->nodes_head), next, focused, nodes);
|
||||||
TAILQ_INSERT_HEAD(&(next->parent->focus_head), focused, focused);
|
TAILQ_INSERT_HEAD(&(next->parent->focus_head), focused, focused);
|
||||||
@ -497,8 +500,11 @@ void tree_move(char way, orientation_t orientation) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
con_detach(focused);
|
con_detach(focused);
|
||||||
con_fix_percent(focused);
|
if (focused->parent != next->parent) {
|
||||||
focused->parent = next->parent;
|
con_fix_percent(focused->parent);
|
||||||
|
focused->parent = next->parent;
|
||||||
|
fix_percent = 1;
|
||||||
|
}
|
||||||
|
|
||||||
/* After going down in the tree, we insert the container *after*
|
/* After going down in the tree, we insert the container *after*
|
||||||
* the currently focused one even though the command used "before".
|
* the currently focused one even though the command used "before".
|
||||||
@ -513,12 +519,14 @@ 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 */
|
||||||
int children = con_num_children(focused->parent);
|
if (fix_percent) {
|
||||||
if (children == 1)
|
int children = con_num_children(focused->parent);
|
||||||
focused->percent = 1.0;
|
if (children == 1)
|
||||||
else
|
focused->percent = 1.0;
|
||||||
focused->percent = 1.0 / (children - 1);
|
else
|
||||||
con_fix_percent(focused->parent);
|
focused->percent = 1.0 / (children - 1);
|
||||||
|
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
|
||||||
@ -528,8 +536,7 @@ void tree_move(char way, orientation_t orientation) {
|
|||||||
if (con_num_children(old_parent) == 0) {
|
if (con_num_children(old_parent) == 0) {
|
||||||
DLOG("Old container empty after moving. Let's close it\n");
|
DLOG("Old container empty after moving. Let's close it\n");
|
||||||
tree_close(old_parent, false, false);
|
tree_close(old_parent, false, false);
|
||||||
}
|
} else if (level_changed) {
|
||||||
else {
|
|
||||||
/* fix the percentages in the container we moved from */
|
/* fix the percentages in the container we moved from */
|
||||||
con_fix_percent(old_parent);
|
con_fix_percent(old_parent);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user