-
Notifications
You must be signed in to change notification settings - Fork 8.5k
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
Correct position on startup when window is out of screen #5671
Conversation
81ab6cb
to
008f88b
Compare
008f88b
to
de0d146
Compare
Whoops, sorry about that! I didn't get a notification when this was marked ready for review. Tsk, github! Our hatches are battened for v1, so we may be in a bit of a time crunch, but we'll review this as soon as we can. |
What happens if multiple windows are (partially) offscreen at startup? (or is that not possible?) |
@jsoref I think all the window should all be top-left, because if we do a cascaded windows, it is possible that some of the windows will be pushed offscreen if there are many windows at startup. |
Classically, Windows had a strategy for that cascade overflow which handled that by staggering to another location (it was fun playing with this ...) |
Oh that would make sense then, thanks for mentioning the cascade overflow handler, gotta try it out. |
|
||
const auto adjustedPos = Viewport::FromDimensions(origin, dimensions); | ||
|
||
// We need to check if all corners of the window is within any screen |
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.
perhaps it'd be better to GetMonitorInfo(MonitorFromWindow()) and check each side of the proposed rect with the work area edge (nudging back onscreen).
Woah hey there @dynahcatq - I dunno what happened. This must have gotten lost in the crunch for //Build last year. Jeez, that feels bad. Would you still be interested in merging this in? There's probably a decent amount of merge conflicts - sorry about that. If not, then I can always drive another PR with the same changelist. Sorry again! |
This pull request has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 7 days. It will be closed if no further activity occurs within 7 days of this comment. |
Summary of the Pull Request
If the terminal window appears to be off-screen at startup or appears to be partially behind the task bar, reset its position to the top left corner of the screen. Manually tested by giving
References
#4681
PR Checklist
Detailed Description of the Pull Request / Additional comments
Validation Steps Performed
This will reset the window to top-left because the window is partially behind the taskbar:

This will reset the window to top-left because the left side of the window is off the screen:

This will reset the window to top-left because the window is partially off the screen:

For multi-monitor:
Note that this will also reset the window to top-left because the window can fit in a single screen but the window is outside of the screen's work area:

This will reset the window to top-left because the window can fit in a single screen but the window is outside of the screen's work area:

This will reset the window to top-left because the window is partially off the screen:

Note that this will NOT reset the window position to top-left because the window is entirely visible.
