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

clamp ratio instead of resetting when overstepping #1416

Closed

Conversation

antoineCharpentier-19
Copy link

@antoineCharpentier-19 antoineCharpentier-19 commented Sep 15, 2022

Related Issue : #1401

This is in order to avoid sudden layout shifts when trying to push unimportant windows out of the way.
If trying to resize a window below 10% or above 90%, the ratio will clamp instead of going back to 50%.

Maybe there is a reason to want the reset to 50%, in which case this would need to be optional, I just could not think of one.

Before :

Sans.titre.09.02.56.mov

After :

Sans.titre.mov

@antoineCharpentier-19
Copy link
Author

antoineCharpentier-19 commented Sep 15, 2022

Apparently this code is also used in the insertion of new windows. When inserting a window or when activating a tiled layout, the ratio is initially set to 0, then corrected here. Thus, clamping blindly negated the default split ratio and always ended up with 0.1.

I do not know if there is any check to differentiate an insertion from a resizing at this point in the code, so I added a check for 0.

The behaviour is then to still reset to the default split ratio if squishing a window completely, which is easily avoidable. For every other case, it clamps to 0.1 / 0.9.

Please disregard the messy PR history..

@koekeishiya
Copy link
Owner

Fixed in a different way; see linked issue for the commit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants