Skip to content

Conversation

@docwilco
Copy link

With a WindowPadding of 0 and with a nested panel, the ContainerWidth can end up being 0, which causes scaleFactor to be infinity, and that contaminates all sorts of values to be NaN.

I think there might be better fixes architecturally, but I don't quite grasp how it all fits together, and this fixes things for me at least. 😇

Fixes #423

@veselink1
Copy link
Collaborator

Thanks for your PR! I think this is a very interesting and surprising observation.

I expected that ContainerWidth will never be 0 in the first place. It is initialised to 1, and then modified by SetContainerWidth. I tried various combinations of WindowPadding=0 and changing between lower/higher resolutions with various number of windows, including Firefox, but could see it ever being set to 0.

I think a more preferrable fix might be to handle the case of SetContainerWidth < 1 and therefore prevent ContainerWidth from ever being 0 in this code. I've added some code in af22059 which will hopefully throw an exception earlier and likely trigger auto-floating when the layout is unsatisfiable before constrains get messed up.

However, I've still not managed to repro the exact case of the ContainerWidth being 0 in the first place to test this.

I was wondering if the very high horizontal resolution triggers something else, so I also increased the epsilon value used for floating comparisons in the code 3d7f334.

Let's hold on to this change for now, I'd like to ideally prevent the need for this special case here.

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.

Windows get shoved into a very narrow left part of my screen

2 participants