Ensure we are in the foreground when closed with multiple tabs open
Summary of the Pull Request
- Adds an event to the
TerminalPageandTerminalWindowthat can be raised when the terminal is closed with multiple tabs opened. This event can be handled in theAppHostby summoning the window.
References and Relevant Issues
#12605
Detailed Description of the Pull Request / Additional comments
I initially implemented this as a WINRT_CALLBACK but it kind of stuck out in the host layer so I decided to switch it to a TypedEvent. This will also allow for information passing if so desired in the future.
Validation Steps Performed
Validated that the window is brought to the foreground when multiple tabs are open so that the Confirm dialog is seen. Window is not summoned if only a single tab is open.
PR Checklist
- [ ] Closes #12605
- [ ] Tests added/passed
- [ ] Documentation updated
- If checked, please file a pull request on our docs repo and link it here: #xxx
- [ ] Schema updated (if necessary)
@zadjii-msft Im struggling with the edge case. Works fine if you SummonWindow InPlace. But as soon as you try to ToCurrent the dialog closes. Ive tried using deferrable event args to "wait" for the window to finish moving but doesnt seem to make a difference. This PR as is works without moving the terminal window to the current monitor.
Open to suggestions :)
@zadjii-msft Im struggling with the edge case. Works fine if you
SummonWindowInPlace. But as soon as you try toToCurrentthe dialog closes. Ive tried using deferrable event args to "wait" for the window to finish moving but doesnt seem to make a difference. This PR as is works without moving the terminal window to the current monitor.Open to suggestions :)
Actually, I found something that works though not for a Maximized terminal window. I dont think anything I did would have broken that though. Will try to confirm if that is already broken and if so open an issue.
Maybe I am miss understanding what ToCurrent is meant to do :|
I think I may see what the issue is. When you hover over the icon on the taskbar to click the x a new window is created to show the preview and that is what is given as the oldForegroundWindow. But after clicking the x that window goes away. We are then trying to show that Window again that is where it blows up. Interesting....
Needless to say this PR is not ready yet.
(I'm gonna convert this to a draft while you work on it)
Maybe I am miss understanding what
ToCurrentis meant to do :|
ToMonitor: ToCurrent will attempt to move the terminal to the display with the HWND that's the current FG window.
Alternatively, MonitorBehavior::InPlace will just leave the window where it started
Thanks 😁
We got a big windowing rearchitecture in between when this PR was filed and I realized it was sitting in the draft queue (Today!)
Really sorry about the atrociously slow review speed 😦
What should we do with it?
Oh boy. I completely lost sight of this thing. It should be closed.
@DHowett is the new windowing architecture documented somewhere?
Hmm. I think it's mostly written up in the description for #18215. If you need more than what's written there (which would not come as a surprise; it is rather sparse), please don't hesitate to ask!