1
-
1
+ ShowWindowChanged
2
2
// Copyright (c) Microsoft Corporation.
3
3
// Licensed under the MIT license.
4
4
24
24
#include " TabRowControl.h"
25
25
#include " Utils.h"
26
26
27
- using namespace winrt ;
27
+ using namespace winrt ;
28
28
using namespace winrt ::Microsoft::Terminal::Control;
29
29
using namespace winrt ::Microsoft::Terminal::Settings::Model;
30
30
using namespace winrt ::Microsoft::Terminal::TerminalConnection;
@@ -3568,7 +3568,7 @@ namespace winrt::TerminalApp::implementation
3568
3568
3569
3569
// Method Description:
3570
3570
// - Asks the window to change its maximized state.
3571
- void TerminalPage::RequestSetMaximized (bool newMaximized)
3571
+ void TerminalPage::_RequestSetMaximized (bool newMaximized)
3572
3572
{
3573
3573
if (_isMaximized == newMaximized)
3574
3574
{
@@ -3578,6 +3578,20 @@ namespace winrt::TerminalApp::implementation
3578
3578
_ChangeMaximizeRequestedHandlers (*this , nullptr );
3579
3579
}
3580
3580
3581
+ // Set the window to be minimized. This will bubble it up to the window
3582
+ // layer, and propogate down to the term controls. This should only be used
3583
+ // for an INITIAL defterm connection. We don't really want a `start /min
3584
+ // cmd` to glom to an existing wt and minimize it.
3585
+ void TerminalPage::_RequestSetMinimized ()
3586
+ {
3587
+ // Two parts here:
3588
+ // * We need to tell the window layer to minimize the window
3589
+ // * We need to inform the control that we want it to act like it's minimized
3590
+ Microsoft::Terminal::Control::ShowWindowArgs args (false /* show */ );
3591
+ _ShowWindowChangedHandlers (*this , args);
3592
+ WindowVisibilityChanged (false );
3593
+ }
3594
+
3581
3595
HRESULT TerminalPage::_OnNewConnection (const ConptyConnection& connection)
3582
3596
{
3583
3597
_newConnectionRevoker.revoke ();
@@ -3634,9 +3648,16 @@ namespace winrt::TerminalApp::implementation
3634
3648
// Make sure that there were no other tabs already existing (in
3635
3649
// the case that we are in glomming mode), because we don't want
3636
3650
// to be maximizing other existing sessions that did not ask for it.
3637
- if (_tabs.Size () == 1 && connection. ShowWindow () == SW_SHOWMAXIMIZED )
3651
+ if (_tabs.Size ())
3638
3652
{
3639
- RequestSetMaximized (true );
3653
+ if (connection.ShowWindow () == SW_SHOWMAXIMIZED)
3654
+ {
3655
+ _RequestSetMaximized (true );
3656
+ }
3657
+ else if (connection.ShowWindow () == SW_SHOWMINIMIZED)
3658
+ {
3659
+ _RequestSetMinimized ();
3660
+ }
3640
3661
}
3641
3662
return S_OK;
3642
3663
}
0 commit comments