mirror of
https://github.com/microsoft/terminal.git
synced 2026-02-08 13:49:31 +00:00
sync initial state of windw with conpty
This commit is contained in:
@@ -2422,6 +2422,13 @@ namespace winrt::TerminalApp::implementation
|
||||
// create here.
|
||||
// TermControl will copy the settings out of the settings passed to it.
|
||||
TermControl term{ settings.DefaultSettings(), settings.UnfocusedSettings(), connection };
|
||||
|
||||
// GH#12515: ConPTY assumes it's hidden at the start. If we're not, let it know now.
|
||||
if (_visible)
|
||||
{
|
||||
term.WindowVisibilityChanged(_visible);
|
||||
}
|
||||
|
||||
return term;
|
||||
}
|
||||
|
||||
@@ -2797,6 +2804,7 @@ namespace winrt::TerminalApp::implementation
|
||||
// - <none>
|
||||
void TerminalPage::WindowVisibilityChanged(const bool showOrHide)
|
||||
{
|
||||
_visible = showOrHide;
|
||||
for (const auto& tab : _tabs)
|
||||
{
|
||||
if (auto terminalTab{ _GetTerminalTabImpl(tab) })
|
||||
|
||||
@@ -196,6 +196,7 @@ namespace winrt::TerminalApp::implementation
|
||||
std::optional<int> _rearrangeFrom{};
|
||||
std::optional<int> _rearrangeTo{};
|
||||
bool _removing{ false };
|
||||
bool _visible{ true };
|
||||
|
||||
std::vector<std::vector<Microsoft::Terminal::Settings::Model::ActionAndArgs>> _previouslyClosedPanesAndTabs{};
|
||||
|
||||
|
||||
@@ -310,6 +310,13 @@ namespace winrt::Microsoft::Terminal::TerminalConnection::implementation
|
||||
}
|
||||
|
||||
THROW_IF_FAILED(_CreatePseudoConsoleAndPipes(dimensions, flags, &_inPipe, &_outPipe, &_hPC));
|
||||
|
||||
// GH#12515: The conpty assumes it's hidden at the start. If we're visible, let it know now.
|
||||
if (_initialVisibility)
|
||||
{
|
||||
THROW_IF_FAILED(ConptyShowHidePseudoConsole(_hPC.get(), _initialVisibility));
|
||||
}
|
||||
|
||||
THROW_IF_FAILED(_LaunchAttachedClient());
|
||||
}
|
||||
// But if it was an inbound handoff... attempt to synchronize the size of it with what our connection
|
||||
@@ -484,11 +491,15 @@ namespace winrt::Microsoft::Terminal::TerminalConnection::implementation
|
||||
|
||||
void ConptyConnection::ShowHide(const bool show)
|
||||
{
|
||||
// If we haven't connected yet, then TODO!
|
||||
// If we haven't connected yet, then stash for when we do connect.
|
||||
if (_isConnected())
|
||||
{
|
||||
THROW_IF_FAILED(ConptyShowHidePseudoConsole(_hPC.get(), show));
|
||||
}
|
||||
else
|
||||
{
|
||||
_initialVisibility = show;
|
||||
}
|
||||
}
|
||||
|
||||
void ConptyConnection::Close() noexcept
|
||||
|
||||
@@ -69,6 +69,7 @@ namespace winrt::Microsoft::Terminal::TerminalConnection::implementation
|
||||
hstring _commandline{};
|
||||
hstring _startingDirectory{};
|
||||
hstring _startingTitle{};
|
||||
bool _initialVisibility{ false };
|
||||
Windows::Foundation::Collections::ValueSet _environment{ nullptr };
|
||||
guid _guid{}; // A unique session identifier for connected client
|
||||
hstring _clientName{}; // The name of the process hosted by this ConPTY connection (as of launch).
|
||||
|
||||
@@ -67,6 +67,10 @@ void PtySignalInputThread::ConnectConsole() noexcept
|
||||
{
|
||||
_DoResizeWindow(*_earlyResize);
|
||||
}
|
||||
if (_initialShowHide)
|
||||
{
|
||||
_DoShowHide(_initialShowHide->show);
|
||||
}
|
||||
}
|
||||
|
||||
// Method Description:
|
||||
@@ -83,8 +87,8 @@ void PtySignalInputThread::ConnectConsole() noexcept
|
||||
{
|
||||
case PtySignal::ShowHideWindow:
|
||||
{
|
||||
ShowHideData resizeMsg = { 0 };
|
||||
_GetData(&resizeMsg, sizeof(resizeMsg));
|
||||
ShowHideData msg = { 0 };
|
||||
_GetData(&msg, sizeof(msg));
|
||||
|
||||
LockConsole();
|
||||
auto Unlock = wil::scope_exit([&] { UnlockConsole(); });
|
||||
@@ -93,10 +97,11 @@ void PtySignalInputThread::ConnectConsole() noexcept
|
||||
if (!_consoleConnected)
|
||||
{
|
||||
// TODO!
|
||||
_initialShowHide = msg;
|
||||
}
|
||||
else
|
||||
{
|
||||
_DoShowHide(resizeMsg.show);
|
||||
_DoShowHide(msg.show);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -67,6 +67,7 @@ namespace Microsoft::Console
|
||||
DWORD _dwThreadId;
|
||||
bool _consoleConnected;
|
||||
std::optional<ResizeWindowData> _earlyResize;
|
||||
std::optional<ShowHideData> _initialShowHide;
|
||||
std::unique_ptr<Microsoft::Console::VirtualTerminal::ConGetSet> _pConApi;
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user