diff --git a/src/cascadia/TerminalControl/TermControl.cpp b/src/cascadia/TerminalControl/TermControl.cpp index b8f2104c69c..51937ef8274 100644 --- a/src/cascadia/TerminalControl/TermControl.cpp +++ b/src/cascadia/TerminalControl/TermControl.cpp @@ -75,6 +75,31 @@ namespace winrt::Microsoft::Terminal::TerminalControl::implementation _EnsureStaticInitialization(); InitializeComponent(); + _terminal = std::make_unique<::Microsoft::Terminal::Core::Terminal>(); + + auto pfnTitleChanged = std::bind(&TermControl::_TerminalTitleChanged, this, std::placeholders::_1); + _terminal->SetTitleChangedCallback(pfnTitleChanged); + + auto pfnBackgroundColorChanged = std::bind(&TermControl::_BackgroundColorChanged, this, std::placeholders::_1); + _terminal->SetBackgroundCallback(pfnBackgroundColorChanged); + + auto pfnScrollPositionChanged = std::bind(&TermControl::_TerminalScrollPositionChanged, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3); + _terminal->SetScrollPositionChangedCallback(pfnScrollPositionChanged); + + // This event is explicitly revoked in the destructor: does not need weak_ref + auto onReceiveOutputFn = [this](const hstring str) { + _terminal->Write(str); + }; + _connectionOutputEventToken = _connection.TerminalOutput(onReceiveOutputFn); + + auto inputFn = std::bind(&TermControl::_SendInputToConnection, this, std::placeholders::_1); + _terminal->SetWriteInputCallback(inputFn); + + // Subscribe to the connection's disconnected event and call our connection closed handlers. + _connectionStateChangedRevoker = _connection.StateChanged(winrt::auto_revoke, [this](auto&& /*s*/, auto&& /*v*/) { + _ConnectionStateChangedHandlers(*this, nullptr); + }); + // Initialize the terminal only once the swapchainpanel is loaded - that // way, we'll be able to query the real pixel size it got on layout _layoutUpdatedRevoker = SwapChainPanel().LayoutUpdated(winrt::auto_revoke, [this](auto /*s*/, auto /*e*/) { @@ -90,10 +115,9 @@ namespace winrt::Microsoft::Terminal::TerminalControl::implementation } }); - // Subscribe to the connection's disconnected event and call our connection closed handlers. - _connectionStateChangedRevoker = _connection.StateChanged(winrt::auto_revoke, [this](auto&& /*s*/, auto&& /*v*/) { - _ConnectionStateChangedHandlers(*this, nullptr); - }); + static constexpr auto AutoScrollUpdateInterval = std::chrono::microseconds(static_cast(1.0 / 30.0 * 1000000)); + _autoScrollTimer.Interval(AutoScrollUpdateInterval); + _autoScrollTimer.Tick({ this, &TermControl::_UpdateAutoScroll }); _ApplyUISettings(); } @@ -126,7 +150,7 @@ namespace winrt::Microsoft::Terminal::TerminalControl::implementation // - void TermControl::_Search(const winrt::hstring& text, const bool goForward, const bool caseSensitive) { - if (text.size() == 0) + if (text.size() == 0 || _closing) { return; } @@ -183,6 +207,11 @@ namespace winrt::Microsoft::Terminal::TerminalControl::implementation // If 'weakThis' is locked, then we can safely work with 'this' if (auto control{ weakThis.get() }) { + if (_closing) + { + return; + } + // Update our control settings _ApplyUISettings(); @@ -412,7 +441,7 @@ namespace winrt::Microsoft::Terminal::TerminalControl::implementation Windows::UI::Xaml::Automation::Peers::AutomationPeer TermControl::OnCreateAutomationPeer() try { - if (GetUiaData()) + if (_initializedTerminal && !_closing) // only set up the automation peer if we're ready to go live { // create a custom automation peer with this code pattern: // (https://docs.microsoft.com/en-us/windows/uwp/design/accessibility/custom-automation-peers) @@ -450,11 +479,14 @@ namespace winrt::Microsoft::Terminal::TerminalControl::implementation return _connection.State(); } - winrt::fire_and_forget TermControl::SwapChainChanged() + winrt::fire_and_forget TermControl::RenderEngineSwapChainChanged() { - if (!_initializedTerminal) - { - return; + { // lock scope + auto terminalLock = _terminal->LockForReading(); + if (!_initializedTerminal) + { + return; + } } auto chain = _renderEngine->GetSwapChain(); @@ -462,186 +494,153 @@ namespace winrt::Microsoft::Terminal::TerminalControl::implementation co_await winrt::resume_foreground(Dispatcher()); - // If 'weakThis' is locked, then we can safely work with 'this' if (auto control{ weakThis.get() }) { - if (_terminal) - { - auto lock = _terminal->LockForWriting(); - auto nativePanel = SwapChainPanel().as(); - nativePanel->SetSwapChain(chain.Get()); - } + auto terminalLock = _terminal->LockForWriting(); + + _AttachDxgiSwapChainToXaml(chain.Get()); } } - winrt::fire_and_forget TermControl::_SwapChainRoutine() + void TermControl::_AttachDxgiSwapChainToXaml(IDXGISwapChain1* swapChain) { - auto chain = _renderEngine->GetSwapChain(); - auto weakThis{ get_weak() }; - - co_await winrt::resume_foreground(Dispatcher()); - - if (auto control{ weakThis.get() }) - { - if (_terminal) - { - auto lock = _terminal->LockForWriting(); - auto nativePanel = SwapChainPanel().as(); - nativePanel->SetSwapChain(chain.Get()); - } - } + auto nativePanel = SwapChainPanel().as(); + nativePanel->SetSwapChain(swapChain); } bool TermControl::_InitializeTerminal() { - if (_initializedTerminal) - { - return false; - } - - const auto windowWidth = SwapChainPanel().ActualWidth(); // Width() and Height() are NaN? - const auto windowHeight = SwapChainPanel().ActualHeight(); - - if (windowWidth == 0 || windowHeight == 0) - { - return false; - } + { // scope for terminalLock + auto terminalLock = _terminal->LockForWriting(); - _terminal = std::make_unique<::Microsoft::Terminal::Core::Terminal>(); + if (_initializedTerminal) + { + return false; + } - // First create the render thread. - // Then stash a local pointer to the render thread so we can initialize it and enable it - // to paint itself *after* we hand off its ownership to the renderer. - // We split up construction and initialization of the render thread object this way - // because the renderer and render thread have circular references to each other. - auto renderThread = std::make_unique<::Microsoft::Console::Render::RenderThread>(); - auto* const localPointerToThread = renderThread.get(); + const auto windowWidth = SwapChainPanel().ActualWidth(); // Width() and Height() are NaN? + const auto windowHeight = SwapChainPanel().ActualHeight(); - // Now create the renderer and initialize the render thread. - _renderer = std::make_unique<::Microsoft::Console::Render::Renderer>(_terminal.get(), nullptr, 0, std::move(renderThread)); - ::Microsoft::Console::Render::IRenderTarget& renderTarget = *_renderer; + if (windowWidth == 0 || windowHeight == 0) + { + return false; + } - THROW_IF_FAILED(localPointerToThread->Initialize(_renderer.get())); + // First create the render thread. + // Then stash a local pointer to the render thread so we can initialize it and enable it + // to paint itself *after* we hand off its ownership to the renderer. + // We split up construction and initialization of the render thread object this way + // because the renderer and render thread have circular references to each other. + auto renderThread = std::make_unique<::Microsoft::Console::Render::RenderThread>(); + auto* const localPointerToThread = renderThread.get(); - // Set up the DX Engine - auto dxEngine = std::make_unique<::Microsoft::Console::Render::DxEngine>(); - _renderer->AddRenderEngine(dxEngine.get()); + // Now create the renderer and initialize the render thread. + _renderer = std::make_unique<::Microsoft::Console::Render::Renderer>(_terminal.get(), nullptr, 0, std::move(renderThread)); + ::Microsoft::Console::Render::IRenderTarget& renderTarget = *_renderer; - // Initialize our font with the renderer - // We don't have to care about DPI. We'll get a change message immediately if it's not 96 - // and react accordingly. - _UpdateFont(true); + THROW_IF_FAILED(localPointerToThread->Initialize(_renderer.get())); - const COORD windowSize{ static_cast(windowWidth), static_cast(windowHeight) }; + // Set up the DX Engine + auto dxEngine = std::make_unique<::Microsoft::Console::Render::DxEngine>(); + _renderer->AddRenderEngine(dxEngine.get()); - // Fist set up the dx engine with the window size in pixels. - // Then, using the font, get the number of characters that can fit. - // Resize our terminal connection to match that size, and initialize the terminal with that size. - const auto viewInPixels = Viewport::FromDimensions({ 0, 0 }, windowSize); - THROW_IF_FAILED(dxEngine->SetWindowSize({ viewInPixels.Width(), viewInPixels.Height() })); + // Initialize our font with the renderer + // We don't have to care about DPI. We'll get a change message immediately if it's not 96 + // and react accordingly. + _UpdateFont(true); - // Update DxEngine's SelectionBackground - dxEngine->SetSelectionBackground(_settings.SelectionBackground()); + const COORD windowSize{ static_cast(windowWidth), static_cast(windowHeight) }; - const auto vp = dxEngine->GetViewportInCharacters(viewInPixels); - const auto width = vp.Width(); - const auto height = vp.Height(); - _connection.Resize(height, width); + // Fist set up the dx engine with the window size in pixels. + // Then, using the font, get the number of characters that can fit. + // Resize our terminal connection to match that size, and initialize the terminal with that size. + const auto viewInPixels = Viewport::FromDimensions({ 0, 0 }, windowSize); + THROW_IF_FAILED(dxEngine->SetWindowSize({ viewInPixels.Width(), viewInPixels.Height() })); - // Override the default width and height to match the size of the swapChainPanel - _settings.InitialCols(width); - _settings.InitialRows(height); - - _terminal->CreateFromSettings(_settings, renderTarget); + // Update DxEngine's SelectionBackground + dxEngine->SetSelectionBackground(_settings.SelectionBackground()); - // Tell the DX Engine to notify us when the swap chain changes. - dxEngine->SetCallback(std::bind(&TermControl::SwapChainChanged, this)); + const auto vp = dxEngine->GetViewportInCharacters(viewInPixels); + const auto width = vp.Width(); + const auto height = vp.Height(); + _connection.Resize(height, width); - // TODO:GH#3927 - Make it possible to hot-reload this setting. Right - // here, the setting will only be used when the Terminal is initialized. - dxEngine->SetRetroTerminalEffects(_settings.RetroTerminalEffect()); + // Override the default width and height to match the size of the swapChainPanel + _settings.InitialCols(width); + _settings.InitialRows(height); - // TODO:GH#3927 - hot-reload this one too - // Update DxEngine's AntialiasingMode - switch (_settings.AntialiasingMode()) - { - case TextAntialiasingMode::Cleartype: - dxEngine->SetAntialiasingMode(D2D1_TEXT_ANTIALIAS_MODE_CLEARTYPE); - break; - case TextAntialiasingMode::Aliased: - dxEngine->SetAntialiasingMode(D2D1_TEXT_ANTIALIAS_MODE_ALIASED); - break; - case TextAntialiasingMode::Grayscale: - default: - dxEngine->SetAntialiasingMode(D2D1_TEXT_ANTIALIAS_MODE_GRAYSCALE); - break; - } - - THROW_IF_FAILED(dxEngine->Enable()); - _renderEngine = std::move(dxEngine); - - // This event is explicitly revoked in the destructor: does not need weak_ref - auto onReceiveOutputFn = [this](const hstring str) { - _terminal->Write(str); - }; - _connectionOutputEventToken = _connection.TerminalOutput(onReceiveOutputFn); + _terminal->CreateFromSettings(_settings, renderTarget); - auto inputFn = std::bind(&TermControl::_SendInputToConnection, this, std::placeholders::_1); - _terminal->SetWriteInputCallback(inputFn); + // TODO:GH#3927 - Make it possible to hot-reload this setting. Right + // here, the setting will only be used when the Terminal is initialized. + dxEngine->SetRetroTerminalEffects(_settings.RetroTerminalEffect()); - _SwapChainRoutine(); + // TODO:GH#3927 - hot-reload this one too + // Update DxEngine's AntialiasingMode + switch (_settings.AntialiasingMode()) + { + case TextAntialiasingMode::Cleartype: + dxEngine->SetAntialiasingMode(D2D1_TEXT_ANTIALIAS_MODE_CLEARTYPE); + break; + case TextAntialiasingMode::Aliased: + dxEngine->SetAntialiasingMode(D2D1_TEXT_ANTIALIAS_MODE_ALIASED); + break; + case TextAntialiasingMode::Grayscale: + default: + dxEngine->SetAntialiasingMode(D2D1_TEXT_ANTIALIAS_MODE_GRAYSCALE); + break; + } - // Set up the height of the ScrollViewer and the grid we're using to fake our scrolling height - auto bottom = _terminal->GetViewport().BottomExclusive(); - auto bufferHeight = bottom; + THROW_IF_FAILED(dxEngine->Enable()); + _renderEngine = std::move(dxEngine); - ScrollBar().Maximum(bufferHeight - bufferHeight); - ScrollBar().Minimum(0); - ScrollBar().Value(0); - ScrollBar().ViewportSize(bufferHeight); + _AttachDxgiSwapChainToXaml(_renderEngine->GetSwapChain().Get()); - localPointerToThread->EnablePainting(); + // Tell the DX Engine to notify us when the swap chain changes. + // We do this after we initially set the swapchain so as to avoid unnecessary callbacks (and locking problems) + _renderEngine->SetCallback(std::bind(&TermControl::RenderEngineSwapChainChanged, this)); - auto pfnTitleChanged = std::bind(&TermControl::_TerminalTitleChanged, this, std::placeholders::_1); - _terminal->SetTitleChangedCallback(pfnTitleChanged); + auto bottom = _terminal->GetViewport().BottomExclusive(); + auto bufferHeight = bottom; - auto pfnBackgroundColorChanged = std::bind(&TermControl::_BackgroundColorChanged, this, std::placeholders::_1); - _terminal->SetBackgroundCallback(pfnBackgroundColorChanged); + ScrollBar().Maximum(bufferHeight - bufferHeight); + ScrollBar().Minimum(0); + ScrollBar().Value(0); + ScrollBar().ViewportSize(bufferHeight); - auto pfnScrollPositionChanged = std::bind(&TermControl::_TerminalScrollPositionChanged, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3); - _terminal->SetScrollPositionChangedCallback(pfnScrollPositionChanged); + localPointerToThread->EnablePainting(); - static constexpr auto AutoScrollUpdateInterval = std::chrono::microseconds(static_cast(1.0 / 30.0 * 1000000)); - _autoScrollTimer.Interval(AutoScrollUpdateInterval); - _autoScrollTimer.Tick({ get_weak(), &TermControl::_UpdateAutoScroll }); + // Set up blinking cursor + int blinkTime = GetCaretBlinkTime(); + if (blinkTime != INFINITE) + { + // Create a timer + DispatcherTimer cursorTimer; + cursorTimer.Interval(std::chrono::milliseconds(blinkTime)); + cursorTimer.Tick({ get_weak(), &TermControl::_CursorTimerTick }); + cursorTimer.Start(); + _cursorTimer.emplace(std::move(cursorTimer)); + } + else + { + // The user has disabled cursor blinking + _cursorTimer = std::nullopt; + } - // Set up blinking cursor - int blinkTime = GetCaretBlinkTime(); - if (blinkTime != INFINITE) - { - // Create a timer - _cursorTimer = std::make_optional(DispatcherTimer()); - _cursorTimer.value().Interval(std::chrono::milliseconds(blinkTime)); - _cursorTimer.value().Tick({ get_weak(), &TermControl::_BlinkCursor }); - _cursorTimer.value().Start(); - } - else - { - // The user has disabled cursor blinking - _cursorTimer = std::nullopt; - } + // import value from WinUser (convert from milli-seconds to micro-seconds) + _multiClickTimer = GetDoubleClickTime() * 1000; - // import value from WinUser (convert from milli-seconds to micro-seconds) - _multiClickTimer = GetDoubleClickTime() * 1000; + // Focus the control here. If we do it during control initialization, then + // focus won't actually get passed to us. I believe this is because + // we're not technically a part of the UI tree yet, so focusing us + // becomes a no-op. + this->Focus(FocusState::Programmatic); - // Focus the control here. If we do it during control initialization, then - // focus won't actually get passed to us. I believe this is because - // we're not technically a part of the UI tree yet, so focusing us - // becomes a no-op. - this->Focus(FocusState::Programmatic); + _connection.Start(); + _initializedTerminal = true; + } // scope for TerminalLock + // call this event dispatcher outside of lock - _connection.Start(); - _initializedTerminal = true; _InitializedHandlers(*this, nullptr); return true; } @@ -900,6 +899,11 @@ namespace winrt::Microsoft::Terminal::TerminalControl::implementation void TermControl::_PointerPressedHandler(Windows::Foundation::IInspectable const& sender, Input::PointerRoutedEventArgs const& args) { + if (_closing) + { + return; + } + _CapturePointer(sender, args); const auto ptr = args.Pointer(); @@ -1007,6 +1011,11 @@ namespace winrt::Microsoft::Terminal::TerminalControl::implementation void TermControl::_PointerMovedHandler(Windows::Foundation::IInspectable const& /*sender*/, Input::PointerRoutedEventArgs const& args) { + if (_closing) + { + return; + } + const auto ptr = args.Pointer(); const auto point = args.GetCurrentPoint(*this); @@ -1110,6 +1119,11 @@ namespace winrt::Microsoft::Terminal::TerminalControl::implementation void TermControl::_PointerReleasedHandler(Windows::Foundation::IInspectable const& sender, Input::PointerRoutedEventArgs const& args) { + if (_closing) + { + return; + } + const auto ptr = args.Pointer(); const auto point = args.GetCurrentPoint(*this); @@ -1160,6 +1174,11 @@ namespace winrt::Microsoft::Terminal::TerminalControl::implementation void TermControl::_MouseWheelHandler(Windows::Foundation::IInspectable const& /*sender*/, Input::PointerRoutedEventArgs const& args) { + if (_closing) + { + return; + } + const auto point = args.GetCurrentPoint(*this); if (_CanSendVTMouseInput()) @@ -1290,7 +1309,7 @@ namespace winrt::Microsoft::Terminal::TerminalControl::implementation void TermControl::_ScrollbarChangeHandler(Windows::Foundation::IInspectable const& /*sender*/, Controls::Primitives::RangeBaseValueChangedEventArgs const& args) { - if (_isTerminalInitiatedScroll) + if (_isTerminalInitiatedScroll || _closing) { return; } @@ -1475,6 +1494,7 @@ namespace winrt::Microsoft::Terminal::TerminalControl::implementation { return; } + _focused = false; if (_uiaEngine.get()) @@ -1546,8 +1566,6 @@ namespace winrt::Microsoft::Terminal::TerminalControl::implementation // concerned with initialization process. Value forwarded to event handler. void TermControl::_UpdateFont(const bool initialUpdate) { - auto lock = _terminal->LockForWriting(); - const int newDpi = static_cast(static_cast(USER_DEFAULT_SCREEN_DPI) * SwapChainPanel().CompositionScaleX()); // TODO: MSFT:20895307 If the font doesn't exist, this doesn't @@ -1574,11 +1592,12 @@ namespace winrt::Microsoft::Terminal::TerminalControl::implementation // Refresh our font with the renderer _UpdateFont(); + + auto lock = _terminal->LockForWriting(); // Resize the terminal's BUFFER to match the new font size. This does // NOT change the size of the window, because that can lead to more // problems (like what happens when you change the font size while the // window is maximized?) - auto lock = _terminal->LockForWriting(); _DoResize(SwapChainPanel().ActualWidth(), SwapChainPanel().ActualHeight()); } CATCH_LOG(); @@ -1592,7 +1611,7 @@ namespace winrt::Microsoft::Terminal::TerminalControl::implementation void TermControl::_SwapChainSizeChanged(winrt::Windows::Foundation::IInspectable const& /*sender*/, SizeChangedEventArgs const& e) { - if (!_initializedTerminal) + if (!_initializedTerminal || _closing) { return; } @@ -1623,8 +1642,8 @@ namespace winrt::Microsoft::Terminal::TerminalControl::implementation // Arguments: // - sender: not used // - e: not used - void TermControl::_BlinkCursor(Windows::Foundation::IInspectable const& /* sender */, - Windows::Foundation::IInspectable const& /* e */) + void TermControl::_CursorTimerTick(Windows::Foundation::IInspectable const& /* sender */, + Windows::Foundation::IInspectable const& /* e */) { if ((_closing) || (!_terminal->IsCursorBlinkingAllowed() && _terminal->IsCursorVisible())) { @@ -1776,10 +1795,7 @@ namespace winrt::Microsoft::Terminal::TerminalControl::implementation hstring TermControl::Title() { - if (!_initializedTerminal) - return L""; - - hstring hstr(_terminal->GetConsoleTitle()); + hstring hstr{ _terminal->GetConsoleTitle() }; return hstr; } @@ -1796,8 +1812,13 @@ namespace winrt::Microsoft::Terminal::TerminalControl::implementation // - collapseText: collapse all of the text to one line bool TermControl::CopySelectionToClipboard(bool collapseText) { + if (_closing) + { + return false; + } + // no selection --> nothing to copy - if (_terminal == nullptr || !_terminal->IsSelectionActive()) + if (!_terminal->IsSelectionActive()) { return false; } @@ -1864,6 +1885,7 @@ namespace winrt::Microsoft::Terminal::TerminalControl::implementation _connectionStateChangedRevoker.revoke(); TSFInputControl().Close(); // Disconnect the TSF input control so it doesn't receive EditContext events. + _autoScrollTimer.Stop(); if (auto localConnection{ std::exchange(_connection, nullptr) }) { @@ -1881,11 +1903,8 @@ namespace winrt::Microsoft::Terminal::TerminalControl::implementation // renderEngine is destroyed } - if (auto localTerminal{ std::exchange(_terminal, nullptr) }) - { - _initializedTerminal = false; - // terminal is destroyed. - } + // we don't destroy _terminal here; it now has the same lifetime as the + // control. } } @@ -2199,6 +2218,11 @@ namespace winrt::Microsoft::Terminal::TerminalControl::implementation // - void TermControl::_CompositionCompleted(winrt::hstring text) { + if (_closing) + { + return; + } + _connection.WriteInput(text); } @@ -2211,13 +2235,14 @@ namespace winrt::Microsoft::Terminal::TerminalControl::implementation // - void TermControl::_CurrentCursorPositionHandler(const IInspectable& /*sender*/, const CursorPositionEventArgs& eventArgs) { - // If we haven't initialized yet, just quick return. - if (!_terminal) + auto lock = _terminal->LockForReading(); + if (!_initializedTerminal) { // fake it eventArgs.CurrentPosition({ 0, 0 }); return; } + const COORD cursorPos = _terminal->GetCursorPosition(); Windows::Foundation::Point p = { gsl::narrow_cast(cursorPos.X), gsl::narrow_cast(cursorPos.Y) }; eventArgs.CurrentPosition(p); @@ -2287,8 +2312,14 @@ namespace winrt::Microsoft::Terminal::TerminalControl::implementation // - e: The DragEventArgs from the Drop event // Return Value: // - - winrt::fire_and_forget TermControl::_DoDragDrop(DragEventArgs const e) + winrt::fire_and_forget TermControl::_DragDropHandler(Windows::Foundation::IInspectable const& /*sender*/, + DragEventArgs const e) { + if (_closing) + { + return; + } + if (e.DataView().Contains(StandardDataFormats::StorageItems())) { auto items = co_await e.DataView().GetStorageItemsAsync(); @@ -2323,22 +2354,6 @@ namespace winrt::Microsoft::Terminal::TerminalControl::implementation } } - // Method Description: - // - Synchronous handler for the "Drop" event. We'll dispatch the async - // _DoDragDrop method to handle this, because getting information about - // the file that was potentially dropped onto us must be done off the UI - // thread. - // Arguments: - // - e: The DragEventArgs from the Drop event - // Return Value: - // - - void TermControl::_DragDropHandler(Windows::Foundation::IInspectable const& /*sender*/, - DragEventArgs const& e) - { - // Dispatch an async method to handle the drop event. - _DoDragDrop(e); - } - // Method Description: // - Handle the DragOver event. We'll signal that the drag operation we // support is the "copy" operation, and we'll also customize the @@ -2352,6 +2367,11 @@ namespace winrt::Microsoft::Terminal::TerminalControl::implementation void TermControl::_DragOverHandler(Windows::Foundation::IInspectable const& /*sender*/, DragEventArgs const& e) { + if (_closing) + { + return; + } + if (!e.DataView().Contains(StandardDataFormats::StorageItems())) { // We can't do anything for non-storageitems right now. diff --git a/src/cascadia/TerminalControl/TermControl.h b/src/cascadia/TerminalControl/TermControl.h index 9c4ab8fe666..9d365996ced 100644 --- a/src/cascadia/TerminalControl/TermControl.h +++ b/src/cascadia/TerminalControl/TermControl.h @@ -77,7 +77,8 @@ namespace winrt::Microsoft::Terminal::TerminalControl::implementation void AdjustFontSize(int fontSizeDelta); void ResetFontSize(); - winrt::fire_and_forget SwapChainChanged(); + winrt::fire_and_forget RenderEngineSwapChainChanged(); + void _AttachDxgiSwapChainToXaml(IDXGISwapChain1* swapChain); void CreateSearchBoxControl(); @@ -183,15 +184,13 @@ namespace winrt::Microsoft::Terminal::TerminalControl::implementation void _ScrollbarChangeHandler(Windows::Foundation::IInspectable const& sender, Windows::UI::Xaml::Controls::Primitives::RangeBaseValueChangedEventArgs const& e); void _GotFocusHandler(Windows::Foundation::IInspectable const& sender, Windows::UI::Xaml::RoutedEventArgs const& e); void _LostFocusHandler(Windows::Foundation::IInspectable const& sender, Windows::UI::Xaml::RoutedEventArgs const& e); - void _DragDropHandler(Windows::Foundation::IInspectable const& sender, Windows::UI::Xaml::DragEventArgs const& e); + winrt::fire_and_forget _DragDropHandler(Windows::Foundation::IInspectable const& sender, Windows::UI::Xaml::DragEventArgs const e); void _DragOverHandler(Windows::Foundation::IInspectable const& sender, Windows::UI::Xaml::DragEventArgs const& e); - winrt::fire_and_forget _DoDragDrop(Windows::UI::Xaml::DragEventArgs const e); - void _BlinkCursor(Windows::Foundation::IInspectable const& sender, Windows::Foundation::IInspectable const& e); + void _CursorTimerTick(Windows::Foundation::IInspectable const& sender, Windows::Foundation::IInspectable const& e); void _SetEndSelectionPointAtCursor(Windows::Foundation::Point const& cursorPosition); void _SendInputToConnection(const std::wstring& wstr); void _SendPastedTextToConnection(const std::wstring& wstr); - winrt::fire_and_forget _SwapChainRoutine(); void _SwapChainSizeChanged(Windows::Foundation::IInspectable const& sender, Windows::UI::Xaml::SizeChangedEventArgs const& e); void _SwapChainScaleChanged(Windows::UI::Xaml::Controls::SwapChainPanel const& sender, Windows::Foundation::IInspectable const& args); void _DoResize(const double newWidth, const double newHeight);