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

On Windows, fix window size for maximized, undecorated windows #2584

Merged

Conversation

msiglreith
Copy link
Member

Mostly takes the relevant pieces from #1891 regarding max window handling which haven't been included so far.
Attributed @amrbashir in the commit accordingly, I hope that's fine!

Fixes #2568

  • Tested on all platforms changed
  • Added an entry to CHANGELOG.md if knowledge of this change could be valuable to users
  • Updated documentation to reflect any user-facing changes, including notes of platform-specific behavior
  • Created or updated an example program if it would help users understand this functionality
  • Updated feature matrix, if new features were added or implemented

Copy link
Contributor

@amrbashir amrbashir left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the attribution, unfortunately a bug with this code came to light since then, see below.

if util::is_maximized(window) {
// Limit the window size when maximized to the current monitor.
// Otherwise it would include the non-existent decorations.
let monitor = monitor::current_monitor(window);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

using monitor::current_monitor which uses MonitorFromWindow and MONITOR_DEFAULTTONEAREST is unreliable in this situation, see MicrosoftEdge/WebView2Feedback#2549 (comment), instead, MonitorFromRect should be used

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for mentioning this! I will adjust it accordingly

@msiglreith msiglreith added the C - waiting on author Waiting for a response or another PR label Dec 6, 2022
@kchibisov kchibisov added this to the Version 0.28 milestone Dec 24, 2022
@msiglreith msiglreith mentioned this pull request Jan 25, 2023
11 tasks
@kchibisov
Copy link
Member

@msiglreith is this good to go?

@msiglreith
Copy link
Member Author

not yet, I will update it today

@msiglreith msiglreith merged commit 23b8212 into rust-windowing:master Jan 28, 2023
@msiglreith msiglreith deleted the win-maximized-undecorated branch January 28, 2023 13:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C - waiting on author Waiting for a response or another PR DS - windows
Development

Successfully merging this pull request may close these issues.

Windows maximize size incorrect on Windows without decorations
3 participants