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

Recalculate quake window size when snapping across monitors #10744

Merged
10 commits merged into from
Aug 2, 2021

Conversation

zadjii-msft
Copy link
Member

Summary of the Pull Request

win+shift+arrows can be used to move windows to adjacent monitors. When that happens, we'll new re-calculate the size of the window for the new monitor.

References

PR Checklist

Detailed Description of the Pull Request / Additional comments

In WM_WINDOWPOSCHANGING, the OS says "hey, I'm about to do {something} to your window. You cool with that?". We handle that message by:

  1. checking if the window was moved as a part of this message
  2. getting the monitor that the window will be moved onto
  3. If that monitor is different than the monitor the window is currently on, then
  • calculate how big the quake window should be on that monitor
  • tell the OS that's where we'd like to be.

Validation Steps Performed

  • win+shift+arrows works right now
  • normal quake summoning still works right

@ghost ghost added Area-User Interface Issues pertaining to the user interface of the Console or Terminal Issue-Bug It either shouldn't be doing this or needs an investigation. Priority-2 A description (P2) Product-Terminal The new Windows Terminal. labels Jul 21, 2021
src/cascadia/WindowsTerminal/IslandWindow.cpp Outdated Show resolved Hide resolved
Co-authored-by: Dustin L. Howett <duhowett@microsoft.com>
@zadjii-msft zadjii-msft added AutoMerge Marked for automatic merge by the bot when requirements are met Needs-Second It's a PR that needs another sign-off labels Jul 22, 2021
@ghost
Copy link

ghost commented Jul 22, 2021

Hello @zadjii-msft!

Because this pull request has the AutoMerge label, I will be glad to assist with helping to merge this pull request once all check-in policies pass.

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 (@msftbot) and give me an instruction to get started! Learn more here.

src/cascadia/WindowsTerminal/IslandWindow.cpp Show resolved Hide resolved
src/cascadia/WindowsTerminal/IslandWindow.cpp Outdated Show resolved Hide resolved
src/cascadia/WindowsTerminal/IslandWindow.cpp Outdated Show resolved Hide resolved
Comment on lines 547 to 548
if (til::rectangle{ proposedInfo.rcMonitor } !=
til::rectangle{ currentInfo.rcMonitor })
Copy link
Member

Choose a reason for hiding this comment

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

I don't believe you have to wrap these structs first. You should be able to compare them directly.

Copy link
Member Author

Choose a reason for hiding this comment

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

Uhg, it doesn't let me do that 😕 I didn't really feel like manually comparing each of .left, .top, etc, and this isn't going to be a particularly hot path

Copy link
Member

Choose a reason for hiding this comment

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

Oh I just wrote it because I thought it might make the code simpler. ^^

@ghost ghost merged commit a151607 into main Aug 2, 2021
@ghost ghost deleted the dev/migrie/b/snapping-quake-window branch August 2, 2021 19:42
DHowett pushed a commit that referenced this pull request Aug 25, 2021
## Summary of the Pull Request

<kbd>win+shift+arrows</kbd> can be used to move windows to adjacent monitors. When that happens, we'll new re-calculate the size of the window for the new monitor.

## References
* megathread: #8888

## PR Checklist
* [x] Closes #10274
* [x] I work here
* [ ] Tests added/passed
* [n/a] Requires documentation to be updated

## Detailed Description of the Pull Request / Additional comments

In `WM_WINDOWPOSCHANGING`, the OS says "hey, I'm about to do {something} to your window. You cool with that?". We handle that message by:
1. checking if the window was _moved_ as a part of this message
2. getting the monitor that the window will be moved onto
3. If that monitor is different than the monitor the window is currently on, then
  * calculate how big the quake window should be on that monitor
  * tell the OS that's where we'd like to be.

## Validation Steps Performed

* <kbd>win+shift+arrows</kbd> works right now
* normal quake summoning still works right
@ghost
Copy link

ghost commented Aug 31, 2021

🎉Windows Terminal Preview v1.10.2383.0 has been released which incorporates this pull request.:tada:

Handy links:

@ghost ghost mentioned this pull request Aug 31, 2021
@ghost
Copy link

ghost commented Aug 31, 2021

🎉Windows Terminal Preview v1.11.2421.0 has been released which incorporates this pull request.:tada:

Handy links:

This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-User Interface Issues pertaining to the user interface of the Console or Terminal AutoMerge Marked for automatic merge by the bot when requirements are met Issue-Bug It either shouldn't be doing this or needs an investigation. Needs-Second It's a PR that needs another sign-off Priority-2 A description (P2) Product-Terminal The new Windows Terminal.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Quake Mode multi monitor setup
3 participants