Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Windows not equal sizes after leaving fullscreen. #3547

Closed
cedws opened this issue Jan 31, 2019 · 2 comments · Fixed by #4293
Closed

Windows not equal sizes after leaving fullscreen. #3547

cedws opened this issue Jan 31, 2019 · 2 comments · Fixed by #4293

Comments

@cedws
Copy link
Contributor

cedws commented Jan 31, 2019

Similar to #2866.

image

Steps to produce:

  1. Move to an empty workspace
  2. Spawn one window and fullscreen it ($mod+F)
  3. Spawn two more windows whilst in fullscreen
  4. Leave fullscreen ($mod+F)
  5. Observe that one of the windows is larger than the other two

On i3, the windows would be of equal size.

@athrungithub
Copy link
Contributor

it swaybar?.
for my it's ok

@pedrocr
Copy link
Contributor

pedrocr commented Jun 23, 2019

Had a look at the code to try and see what was happening. It seems the sequence of events is something like this:

  1. The window is fullscreen so now has the full width as it's size
  2. New windows are opened and get 0 width
  3. When fullscreen is finally exited then apply_horiz_layout() is finally called with a full-width size for the first window and 0 for all the others. This creates the uneven layout

Fixing this requires either not keeping the fullscreen width/height in the container width/height or changing the layout calculations to operate on saved_width and saved_height when fullscreen. The first option seems less of a hack but may require deeper surgery in the display code.

pedrocr added a commit to pedrocr/sway that referenced this issue Jun 23, 2019
If there is more than one new window layout correctly by calculating the
default size of the new windows using the information of how many of
them there are in total.

This helps with issue swaywm#3547 but doesn't fix it in all situations. Things
now work correctly if the first layout of new windows happens after
leaving fullscreen. But if for some reason an arrange_container() gets
called while we are fullscreen the windows will still be incorrectly
sized after saved_width/save_height get used to restore the first
window's size before going fullscreen.
pedrocr added a commit to pedrocr/sway that referenced this issue Jun 23, 2019
If there is more than one new window layout correctly by calculating the
default size of the new windows using the information of how many of
them there are in total.

This helps with issue swaywm#3547 but doesn't fix it in all situations. Things
now work correctly if the first layout of new windows happens after
leaving fullscreen. But if for some reason an arrange_container() gets
called while we are fullscreen the windows will still be incorrectly
sized after saved_width/saved_height get used to restore the first
window's size before going fullscreen.
pedrocr added a commit to pedrocr/sway that referenced this issue Jun 23, 2019
In fullscreen mode position/dimensions of the fullscreen container were
being changed and then restored on unfullscreen. This would break things
that manipulated those dimensions while the window was fullscreen.
Instead have the rendering code handle the positioning directly and
leave the container information alone.

Fixes swaywm#3547
pedrocr added a commit to pedrocr/sway that referenced this issue Jun 25, 2019
In fullscreen mode position/dimensions of the fullscreen container were
being changed and then restored on unfullscreen. This would break things
that manipulated those dimensions while the window was fullscreen.
Instead have the rendering code handle the positioning directly and
leave the container information alone.

Fixes swaywm#3547
pedrocr added a commit to pedrocr/sway that referenced this issue Jun 25, 2019
If there is more than one new window layout correctly by calculating the
default size of the new windows using the information of how many of
them there are in total.

This helps with issue swaywm#3547 but doesn't fix it in all situations. Things
now work correctly if the first layout of new windows happens after
leaving fullscreen. But if for some reason an arrange_container() gets
called while we are fullscreen the windows will still be incorrectly
sized after saved_width/saved_height get used to restore the first
window's size before going fullscreen.
pedrocr added a commit to pedrocr/sway that referenced this issue Jun 27, 2019
When a container that includes a child that's fullscreen gets
re-arranged also adjust the saved width/height of the fullscreen window
so that on fullscreen exit the layout is correct.

Fixes swaywm#3547
pedrocr added a commit to pedrocr/sway that referenced this issue Jun 27, 2019
When a container that includes a child that's fullscreen gets
re-arranged also adjust the saved width/height of the fullscreen window
so that on fullscreen exit the layout is correct.

Fixes swaywm#3547
pedrocr added a commit to pedrocr/sway that referenced this issue Jun 28, 2019
If there is more than one new window layout correctly by calculating the
default size of the new windows using the information of how many of
them there are in total.

This helps with issue swaywm#3547 but doesn't fix it in all situations. Things
now work correctly if the first layout of new windows happens after
leaving fullscreen. But if for some reason an arrange_container() gets
called while we are fullscreen the windows will still be incorrectly
sized after saved_width/saved_height get used to restore the first
window's size before going fullscreen.
pedrocr added a commit to pedrocr/sway that referenced this issue Jun 28, 2019
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.

Fixes swaywm#3547
pedrocr added a commit to pedrocr/sway that referenced this issue Jun 28, 2019
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.

Fixes swaywm#3547
pedrocr added a commit to pedrocr/sway that referenced this issue Jun 30, 2019
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.

Fixes swaywm#3547
pedrocr added a commit to pedrocr/sway that referenced this issue Jun 30, 2019
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. It also avoids accumulating error from the last window being
given any leftover space in the container.

Fixes swaywm#3547
Fixes swaywm#4297
pedrocr added a commit to pedrocr/sway that referenced this issue Jul 5, 2019
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.

Fixes swaywm#3547
Fixes swaywm#4297
pedrocr added a commit to pedrocr/sway that referenced this issue Jul 6, 2019
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.

Fixes swaywm#3547
Fixes swaywm#4297
pedrocr added a commit to pedrocr/sway that referenced this issue Jul 11, 2019
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.

Fixes swaywm#3547
Fixes swaywm#4297
pedrocr added a commit to pedrocr/sway that referenced this issue Jul 11, 2019
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.

Fixes swaywm#3547
Fixes swaywm#4297
pedrocr added a commit to pedrocr/sway that referenced this issue Jul 14, 2019
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 swaywm#3547
Fixes swaywm#4297
RedSoxFan pushed a commit that referenced this issue Jul 14, 2019
If there is more than one new window layout correctly by calculating the
default size of the new windows using the information of how many of
them there are in total.

This helps with issue #3547 but doesn't fix it in all situations. Things
now work correctly if the first layout of new windows happens after
leaving fullscreen. But if for some reason an arrange_container() gets
called while we are fullscreen the windows will still be incorrectly
sized after saved_width/saved_height get used to restore the first
window's size before going fullscreen.
RedSoxFan pushed a commit that referenced this issue Jul 14, 2019
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants