Fix fractions when promoting containers - #9249
Open
pablocpas wants to merge 1 commit into
Open
Conversation
Directional moves which promote a container currently retain the moved container's fraction from its former parent and invalidate the ancestor's fraction in the destination sibling list. This differs from i3 and from Sway's other reparenting paths. Reset the moved container's geometry and fractions before inserting it. Doing this before workspace_insert_tiling also ensures that a wrapper introduced by workspace_layout inherits an unknown fraction. Keep resetting the ancestor's cached geometry, but preserve its fractions because it remains in the same parent.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #9248
Summary
When a directional move promotes a container out of its immediate parent, Sway currently preserves the moved container's fractions and invalidates the ancestor's fractions.
The moved container's fractions were calculated relative to its former parent, while the ancestor remains in the same parent. This differs from i3 and from Sway's other directional reparenting path.
Reset the moved container's geometry and fractions before inserting it, and preserve the ancestor's fractions. Resetting before
workspace_insert_tiling()also ensures that a wrapper introduced byworkspace_layoutcannot inherit the stale fraction.Test plan
Create this layout with equal fractions:
Focus
Wand run:On master, moving through the outer workspace edge produces approximately:
With this patch, all four top-level entries receive:
This matches i3 and the existing Sway behavior when
Wis moved toward the other top-level windows instead of through the outer edge.Also verify:
Tests
meson setup build --buildtype=debug -Dman-pages=disabled -Dswaybar=false -Dswaynag=false -Dtray=disabled -Dgdk-pixbuf=disabledninja -C build