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
Layout correctly with several new windows #4283
Conversation
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.
71d219d
to
e1a6c5e
Compare
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
2e60b6a
to
89ce6a8
Compare
When doing the layout of a container that includes a fullscreen child also layout new windows correctly if gaps are being used. This is done by also adjusting the saved versions x/y/width/height by the gaps so that the layout adjustments take them into account.
I wonder if it would be worth changing the approach to one which stores width/height weighting values in each container rather than doing it by pixels. So each new container would default to weighting values of 1. If you had 3 siblings with weights 2, 1, 1 then the sizes would be 50%, 25%, 25%. This would mean the fullscreen container would retain the weighting of 1, the siblings would also have weighting 1, and everything would size equally when exiting fullscreen. You wouldn't need to track the saved width or saved height. The resize command would need to be changed to set the weighting instead of the width and height. I don't think it would be too difficult. |
I don't think that changes the problem really. You'd just be replacing |
Nevermind, I think I see what you mean. I'll try a version with that. |
New pull request sent as #4293. The code does look a bit better and should be less brittle. @RyanDwyer could you please review that one? |
This PR adds a significant amount of complexity to fix the problem. I'd be happy to approve the first commit only, but I understand it doesn't fix all the cases. If the first commit were merged, what would the steps be to reproduce the remaining issue? Just trying to understand what the latter commits are solving. |
To reproduce the issue after the first commit:
I'm pretty sure this PR can be abandoned in favor of #4293 though. The weights calculation can probably be made simpler but the solution is just much more robust. |
Closed in favor of #4293 |
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 aftersaved_width
/saved_height
get used to restore the first window's size before going fullscreen.