-
Notifications
You must be signed in to change notification settings - Fork 8.4k
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 wrong maximized window offset on non primary monitors #1921
Fix wrong maximized window offset on non primary monitors #1921
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems reasonable to me. I was poking around at this just recently, but hadn't identified that this was the real issue here. Good work on the find!
Even with my other nonclient changes, I think this will still work as the right fix.
@dsafa (also make sure to |
Whoops, thanks for the reminder. I've read up on the tools now and ran runformat. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
@msftbot merge this in 2 hours |
Hello @DHowett-MSFT! Because you've given me some instructions on how to help merge this pull request, I'll be modifying my merge approach. Here's how I understand your requirements for merging this pull request:
If this doesn't seem right to you, you can tell me to cancel these instructions and use the auto-merge policy that has been configured for this repository. Try telling me "forget everything I just told you". |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Beautiful. Thank you.
…1921) The overhang of a maximized window is currently calculated with this: ```cpp auto offset = 0; if (rcMaximum.left == 0) { offset = windowPos->x; } else if (rcMaximum.top == 0) { offset = windowPos->y; } ``` This always works on the primary monitor but on a non primary monitor, it isn't always the case that `left` or `top` can be 0. Examples are when you offset a monitor. In those cases, `offset` will be 0 and the window will be cut off. Instead I've changed the calculation to calculate the width of the windows frame which is how much it would overhang. Admittedly, the old calculation could be kept and take into consideration the current monitor.
🎉 Handy links: |
Summary of the Pull Request
Fixes the calculation of the margins when the non client island window is maximized on non primary monitors
References
#1055
PR Checklist
Detailed Description of the Pull Request / Additional comments
The overhang of a maximized window is currently calculated with this:
This always works on the primary monitor but on a non primary monitor, it isn't always the case that
left
ortop
can be 0. Examples are when you offset a monitor. In those cases,offset
will be 0 and the window will be cut off.Instead I've changed the calculation to calculate the width of the windows frame which is how much it would overhang. Admittedly, the old calculation could be kept and take into consideration the current monitor.
Also I see a lot of work on the non client window so maybe we won't even need to do this later?
Validation Steps Performed
Manually tested on primary and non primary monitors and the same offset is given: 8 pixels on all sides at 100% scaling. Also tested with different dpi and the margins are the same as using the old method.