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

Fix resize border blocking interactions when maximized #15

Merged
merged 2 commits into from
Jan 4, 2021

Conversation

ArinFaraj
Copy link
Contributor

Fix for #14
Previously when the window was maximized it was still hit testing borders for resizing and it was blocking buttons that are close to edges like the close button...

now it ignores the resize border when the cursor is close to the edge and the window is maximized.
also to be able to hit the close button when the cursor is exactly at the top-right corner I added a -1 to the window margin and now if you don't use the border widget in the flutter app's widget tree, you can hit the close button right in the corner.

so you can have a condition for the border widget (to not have it when the app is maximized) but I don't think it's necessary to be in this package.

@ArinFaraj
Copy link
Contributor Author

I've tested it on different DPIs and its working fine

Not sure that -1 would work for all DPIs so I changed the window margin to exclude the resizeBorder when the window is maximized.
@bitsdojo bitsdojo merged commit 513ea73 into bitsdojo:master Jan 4, 2021
@bitsdojo
Copy link
Owner

bitsdojo commented Jan 4, 2021

Thank you for your contribution, Arin!

I think the WindowBorder widget can be further improved to automatically get the system border size by default (without requiring a width to be set) but I will leave that for a future commit.

@ArinFaraj
Copy link
Contributor Author

So I did some testing with the final commit and it turns out that excluding resizeBorder or borderPadding in the resize margin will result in a weird margin that hides 3-4 pixels all around the window when maximized
also tested it with different dpi settings
image

so we do need both of them to get an accurate window margin even in maximized window state
and that will fix the border problem but to be able to hit the close button when the cursor is at the TR position we need a better solution, for me the -1 I added before worked pretty well on different DPIs but I'm not an expert and it does sound wrong subtracting from a margin but that's the only solution I can think of now

@bitsdojo
Copy link
Owner

bitsdojo commented Jan 6, 2021

I believe this should be fixed in the WindowBorder widget as the default border size should be based on the system border size and the DPI.

Also, maybe it would be cleaner to simply not show the border when window is maximized.

Regarding the window pixels being hidden when maximized, you will see this is default Windows behavior (check the space above the minimize/maximize/close buttons for any standard Windows application e.g Notepad and you will see it).

However, I am not sure I want to keep mirroring this behavior so I might revert to old window margin and improve the logic in the WindowBorder widget.

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