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

Window decoration resizing broken on linux (multi-screen setup only) #632

Closed
Pablete1234 opened this issue Dec 30, 2022 · 1 comment
Closed
Milestone

Comments

@Pablete1234
Copy link

When resizing towards the right, on a multi-screen setup, the logic that limits resizing is wrong for multi-screen setups:

https://github.com/JFormDesigner/FlatLaf/blob/main/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatWindowResizer.java#L627 reads as follows:

int parentWidth = getParentBounds().width;
if( newBounds.x + newBounds.width > parentWidth )
    newBounds.width = parentWidth - newBounds.x;

So the issue here is subtle, but getParentBounds() is returning a rectangle that does not necessarily have it's corner on 0,0, however only the width is used to limit, not x + width for what the "maximum x" you're allowed to resize to.

Actual example

Setup: Left monitor is 1280px wide, Right monitor is 2560px wide

When your app is on the right monitor, and you try to resize, the rectangle has x=1280, and width 2560, your mouse x location can be anywhere between 1280 and 3840, but any value above 2560 will not be allowed, so roughly half the screen is the maximum the app can be resized to.

Resizing towards the left does not have this bug, i haven't confirmed if resizing up/down has it as my monitor setup wouldn't cause that.

@DevCharly
Copy link
Collaborator

Thanks for reporting and for the details. 👍

Fixed in latest 3.1-SNAPSHOT: https://github.com/JFormDesigner/FlatLaf#snapshots

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

No branches or pull requests

2 participants