Skip to content

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

Merged
msiglreith merged 8 commits intorust-windowing:masterfrom
msiglreith:win-maximized-undecorated
Jan 28, 2023
Merged

On Windows, fix window size for maximized, undecorated windows#2584
msiglreith merged 8 commits intorust-windowing:masterfrom
msiglreith:win-maximized-undecorated

Conversation

@msiglreith
Copy link
Copy Markdown
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

Co-authored-by: Amr Bashir <amr.bashir2015@gmail.com>
@msiglreith msiglreith added the DS - win32 Affects the Win32/Windows backend label Dec 6, 2022
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Member

@msiglreith is this good to go?

@msiglreith
Copy link
Copy Markdown
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 - win32 Affects the Win32/Windows backend

Development

Successfully merging this pull request may close these issues.

Windows maximize size incorrect on Windows without decorations

3 participants