terminal icon indicating copy to clipboard operation
terminal copied to clipboard

Ensure we are in the foreground when closed with multiple tabs open

Open jamespack opened this issue 2 years ago • 7 comments

Summary of the Pull Request

  • Adds an event to the TerminalPage and TerminalWindow that can be raised when the terminal is closed with multiple tabs opened. This event can be handled in the AppHost by 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)

jamespack avatar Jul 14 '23 22:07 jamespack

@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 :)

jamespack avatar Jul 15 '23 19:07 jamespack

@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 :)

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.

jamespack avatar Jul 15 '23 19:07 jamespack

Maybe I am miss understanding what ToCurrent is meant to do :|

jamespack avatar Jul 15 '23 21:07 jamespack

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.

jamespack avatar Jul 16 '23 21:07 jamespack

(I'm gonna convert this to a draft while you work on it)


Maybe I am miss understanding what ToCurrent is 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

zadjii-msft avatar Jul 19 '23 16:07 zadjii-msft

Thanks 😁

jamespack avatar Jul 19 '23 22:07 jamespack

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?

DHowett avatar Apr 25 '25 23:04 DHowett

Oh boy. I completely lost sight of this thing. It should be closed.

jamespack avatar May 22 '25 23:05 jamespack

@DHowett is the new windowing architecture documented somewhere?

jamespack avatar May 25 '25 03:05 jamespack

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!

DHowett avatar May 28 '25 21:05 DHowett