mirror of
https://github.com/NickHu/sway
synced 2024-12-27 21:58:11 +01:00
commands/move: don't flatten on move; reap empty former parent instead
Some comparisons of current Sway versus i3 behavior: 1) T[T[T[app]]] + move left * Sway: T[app] * i3: T[T[app]] 2) H[V[H[V[app]]]] + move left * Sway: H[app] * i3: H[V[app]] After this commit, Sway behavior matches i3. The intermediate states are now: T[T[T[app]]] -> T[T[app T[]]] -> T[T[app]] H[V[H[V[app]]]] -> H[V[app H[V[]]]] -> H[V[app]]
This commit is contained in:
parent
d54c8e885b
commit
971aa90ccc
1 changed files with 8 additions and 10 deletions
|
@ -309,16 +309,6 @@ static bool container_move_in_direction(struct sway_container *container,
|
|||
return false;
|
||||
}
|
||||
|
||||
// If container is in a split container by itself, move out of the split
|
||||
if (container->parent) {
|
||||
struct sway_container *old_parent = container->parent;
|
||||
struct sway_container *new_parent =
|
||||
container_flatten(container->parent);
|
||||
if (new_parent != old_parent) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// Look for a suitable *container* sibling or parent.
|
||||
// The below loop stops once we hit the workspace because current->parent
|
||||
// is NULL for the topmost containers in a workspace.
|
||||
|
@ -721,12 +711,20 @@ static struct cmd_results *cmd_move_in_direction(
|
|||
return cmd_results_new(CMD_SUCCESS, NULL);
|
||||
}
|
||||
struct sway_workspace *old_ws = container->workspace;
|
||||
struct sway_container *old_parent = container->parent;
|
||||
|
||||
if (!container_move_in_direction(container, direction)) {
|
||||
// Container didn't move
|
||||
return cmd_results_new(CMD_SUCCESS, NULL);
|
||||
}
|
||||
|
||||
// clean-up, destroying parents if the container was the last child
|
||||
if (old_parent) {
|
||||
container_reap_empty(old_parent);
|
||||
} else if (old_ws) {
|
||||
workspace_consider_destroy(old_ws);
|
||||
}
|
||||
|
||||
struct sway_workspace *new_ws = container->workspace;
|
||||
|
||||
if (root->fullscreen_global) {
|
||||
|
|
Loading…
Reference in a new issue