Skip to content

Commit

Permalink
A wee bit cleaner
Browse files Browse the repository at this point in the history
  • Loading branch information
zadjii-msft committed Mar 29, 2022
1 parent e59afac commit 43ecfb7
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 16 deletions.
13 changes: 12 additions & 1 deletion src/cascadia/TerminalControl/ControlCore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1696,9 +1696,20 @@ namespace winrt::Microsoft::Terminal::Control::implementation
}
}

// Method Description:
// - Notifies the attached PTY that the window has changed visibility state
// - NOTE: Most VT commands are generated in `TerminalDispatch` and sent to this
// class as the target for transmission. But since this message isn't
// coming in via VT parsing (and rather from a window state transition)
// we generate and send it here.
// Arguments:
// - visible: True for visible; false for not visible.
// Return Value:
// - <none>
void ControlCore::WindowVisibilityChanged(const bool showOrHide)
{
_terminal->UpdateVisibility(showOrHide);
// show is true, hide is false
_connection.WriteInput(showOrHide ? L"\x1b[1t" : L"\x1b[2t");
}

bool ControlCore::_isBackgroundTransparent()
Expand Down
28 changes: 14 additions & 14 deletions src/cascadia/TerminalCore/Terminal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -221,20 +221,20 @@ void Terminal::UpdateAppearance(const ICoreAppearance& appearance)
_defaultCursorShape = cursorShape;
}

// Method Description:
// - Notifies the attached PTY that the window has changed visibility state
// - NOTE: Most VT commands are generated in `TerminalDispatch` and sent to this
// class as the target for transmission. But since this message isn't
// coming in via VT parsing (and rather from a window state transition)
// we generate and send it here.
// Arguments:
// - visible: True for visible; false for not visible.
// Return Value:
// - <none>
void Terminal::UpdateVisibility(const bool visible)
{
ReturnResponse(visible ? L"\x1b[1t" : L"\x1b[2t");
}
// // Method Description:
// // - Notifies the attached PTY that the window has changed visibility state
// // - NOTE: Most VT commands are generated in `TerminalDispatch` and sent to this
// // class as the target for transmission. But since this message isn't
// // coming in via VT parsing (and rather from a window state transition)
// // we generate and send it here.
// // Arguments:
// // - visible: True for visible; false for not visible.
// // Return Value:
// // - <none>
// void Terminal::UpdateVisibility(const bool visible)
// {
// ReturnResponse(visible ? L"\x1b[1t" : L"\x1b[2t");
// }

// Method Description:
// - Resize the terminal as the result of some user interaction.
Expand Down
2 changes: 1 addition & 1 deletion src/cascadia/TerminalCore/Terminal.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ class Microsoft::Terminal::Core::Terminal final :

void UpdateSettings(winrt::Microsoft::Terminal::Core::ICoreSettings settings);
void UpdateAppearance(const winrt::Microsoft::Terminal::Core::ICoreAppearance& appearance);
void UpdateVisibility(const bool visible);
// void UpdateVisibility(const bool visible);
void SetFontInfo(const FontInfo& fontInfo);

// Write comes from the PTY and goes to our parser to be stored in the output buffer
Expand Down

0 comments on commit 43ecfb7

Please sign in to comment.