mirror of
https://github.com/swaywm/sway.git
synced 2025-10-29 05:40:18 -04:00
Layout tiled using a width/height fraction
Instead of using container->width/height as both the input and output of the layout calculation have container->width_fraction/height_fraction as the share of the parent this container occupies and calculate the layout based on that. That way the container arrangement can always be recalculated even if width/height have been altered by things like fullscreen. To do this several parts are reworked: - The vertical and horizontal arrangement code is ajusted to work with fractions instead of directly with width/height - The resize code is then changed to manipulate the fractions when working on tiled containers. - Finally the places that manipulated width/height are adjusted to match. The adjusted parts are container split, swap, and the input seat code. It's possible that some parts of the code are now adjusting width and height only for those to be immediately recalculated. That's harmless and since non-tiled containers are still sized with width/height directly it may avoid breaking other corner cases. Fixes #3547 Fixes #4297
This commit is contained in:
parent
1312b5bb9f
commit
e3a3917d3a
7 changed files with 85 additions and 37 deletions
|
|
@ -88,6 +88,10 @@ struct sway_container {
|
|||
double saved_x, saved_y;
|
||||
double saved_width, saved_height;
|
||||
|
||||
// The share of the space of parent container this container occupies
|
||||
double width_fraction;
|
||||
double height_fraction;
|
||||
|
||||
// These are in layout coordinates.
|
||||
double content_x, content_y;
|
||||
int content_width, content_height;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue