Skip to content

Commit

Permalink
close event
Browse files Browse the repository at this point in the history
  • Loading branch information
zadjii-msft committed Jul 17, 2023
1 parent 5b3aa54 commit 84df819
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 4 deletions.
2 changes: 2 additions & 0 deletions src/cascadia/TerminalApp/IPaneContent.idl
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,7 @@ namespace TerminalApp
void Close();
// event CloseRequested(...);

event Windows.Foundation.TypedEventHandler<Object, Object> CloseRequested;

};
}
5 changes: 3 additions & 2 deletions src/cascadia/TerminalApp/TerminalPaneContent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ namespace winrt::TerminalApp::implementation
_bellPlayer = nullptr;
_bellPlayerCreated = false;
}

CloseRequested.raise(*this, nullptr);
}

NewTerminalArgs TerminalPaneContent::GetNewTerminalArgs(const bool asContent) const
Expand Down Expand Up @@ -164,8 +166,7 @@ namespace winrt::TerminalApp::implementation
if ((mode == CloseOnExitMode::Always) ||
((mode == CloseOnExitMode::Graceful || mode == CloseOnExitMode::Automatic) && newConnectionState == ConnectionState::Closed))
{
// TODO! ask the Pane to close
// Close();
Close();
}
}
}
Expand Down
1 change: 1 addition & 0 deletions src/cascadia/TerminalApp/TerminalPaneContent.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ namespace winrt::TerminalApp::implementation
bool ReadOnly() { return _control.ReadOnly(); }

til::typed_event<TerminalApp::TerminalPaneContent, winrt::Windows::Foundation::IInspectable> RestartTerminalRequested;
til::typed_event<> CloseRequested;

private:
winrt::Microsoft::Terminal::Control::TermControl _control{ nullptr };
Expand Down
1 change: 0 additions & 1 deletion src/cascadia/TerminalApp/TerminalPaneContent.idl
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ namespace TerminalApp

Microsoft.Terminal.Settings.Model.Profile GetProfile();


event Windows.Foundation.TypedEventHandler<TerminalPaneContent, Object> RestartTerminalRequested;
}
}
2 changes: 1 addition & 1 deletion src/inc/til/winrt.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ namespace til // Terminal Implementation Library. Also: "Today I Learned"
winrt::event<ArgsT> _handlers;
};

template<typename SenderT, typename ArgsT>
template<typename SenderT = winrt::Windows::Foundation::IInspectable, typename ArgsT = winrt::Windows::Foundation::IInspectable>
struct typed_event
{
typed_event<SenderT, ArgsT>() = default;
Expand Down

0 comments on commit 84df819

Please sign in to comment.