Account for the window borders when restoring from fullscreen#10737
Conversation
| // We want to make sure the window is restored within the bounds of the | ||
| // monitor we're on, but it's totally fine if the invisible borders are | ||
| // outside the monitor. | ||
| rcWorkAdjusted.left -= ncSize.width<long>() / 2; |
There was a problem hiding this comment.
The optimizer will probably catch it... but I'm not a huge fan of doing the division twice...
There was a problem hiding this comment.
I mean whatever. I'm not your mom.
| if (rcRestore.left < rcWorkAdjusted.left) | ||
| { | ||
| OffsetRect(&rcRestore, rcWork.left - rcRestore.left, 0); | ||
| OffsetRect(&rcRestore, rcWorkAdjusted.left - rcRestore.left, 0); |
There was a problem hiding this comment.
This fails to work properly if rcRestore covers a larger area than rcWorkAdjusted doesn't it? Is that alright?
There was a problem hiding this comment.
I don't think so... I think the way it already was, the whole point was clipping rcRestore inside of rcWork. So I think it only ever did something when rcWork was smaller than rcRestore.
Now we're just making rcWork a little bigger, so we can keep the invisible borders off the monitor
|
No automerge so Mike can decide whether I am or am not his mom and also respond to Leonard's comment. |
|
Hello @zadjii-msft! Because this pull request has the p.s. you can customize the way I help with merging this pull request, such as holding this pull request until a specific person approves. Simply @mention me (
|
## Summary of the Pull Request When we're restoring from fullscreen, we do a little adjustment to make sure to clamp the window bounds within the bounds of the active monitor. We unfortunately didn't account for the size of the non-client area (the invisible borders around our 1px border). This didn't matter most of the time, but if the window was within ~8px of the side of the monitor (any side), then restoring from fullscreen would actually move it to the wrong place. As it turns out, the `_quake` window is within ~8px of the edges of the monitor _very often_. ## References * regressed in #9737 ## PR Checklist * [x] Closes #10199 * [x] I work here * [ ] Tests added/passed * [n/a] Requires documentation to be updated ## Validation Steps Performed The repro in the bug was fairly straightforward. It doesn't happen anymore.
|
🎉 Handy links: |
|
🎉 Handy links: |
Summary of the Pull Request
When we're restoring from fullscreen, we do a little adjustment to make sure to clamp the window bounds within the bounds of the active monitor. We unfortunately didn't account for the size of the non-client area (the invisible borders around our 1px border). This didn't matter most of the time, but if the window was within ~8px of the side of the monitor (any side), then restoring from fullscreen would actually move it to the wrong place.
As it turns out, the
_quakewindow is within ~8px of the edges of the monitor very often.References
PR Checklist
Validation Steps Performed
The repro in the bug was fairly straightforward. It doesn't happen anymore.