From d55bb43f47eaa9d987470ca20a239b26bf7e660e Mon Sep 17 00:00:00 2001 From: Mike Griese Date: Thu, 16 Mar 2023 10:33:40 -0500 Subject: [PATCH] [ainulindale] windows should get activated when they're created --- src/cascadia/WindowsTerminal/WindowEmperor.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/cascadia/WindowsTerminal/WindowEmperor.cpp b/src/cascadia/WindowsTerminal/WindowEmperor.cpp index bf2f3fc742..170c2c9f72 100644 --- a/src/cascadia/WindowsTerminal/WindowEmperor.cpp +++ b/src/cascadia/WindowsTerminal/WindowEmperor.cpp @@ -151,6 +151,19 @@ void WindowEmperor::_windowStartedHandler(const std::shared_ptr& s sender->Logic().IsQuakeWindowChanged({ this, &WindowEmperor::_windowIsQuakeWindowChanged }); sender->UpdateSettingsRequested({ this, &WindowEmperor::_windowRequestUpdateSettings }); + // Summon the window to the foreground, since we might not _currently_ be in + // the foreground, but we should act like the new window is. + // + // TODO: GH#14957 - use AllowSetForeground from the original wt.exe instead + Remoting::SummonWindowSelectionArgs args{}; + args.OnCurrentDesktop(false); + args.WindowID(sender->Peasant().GetID()); + args.SummonBehavior().MoveToCurrentDesktop(false); + args.SummonBehavior().ToggleVisibility(false); + args.SummonBehavior().DropdownDuration(0); + args.SummonBehavior().ToMonitor(Remoting::MonitorBehavior::InPlace); + _manager.SummonWindow(args); + // Now that the window is ready to go, we can add it to our list of windows, // because we know it will be well behaved. //