|
6 | 6 | #include "TerminalPage.h" |
7 | 7 |
|
8 | 8 | #include <LibraryResources.h> |
| 9 | +#include <TerminalCore/ControlKeyStates.hpp> |
9 | 10 | #include <TerminalThemeHelpers.h> |
| 11 | +#include <til/hash.h> |
10 | 12 | #include <Utils.h> |
11 | | -#include <TerminalCore/ControlKeyStates.hpp> |
12 | 13 |
|
13 | 14 | #include "../../types/inc/ColorFix.hpp" |
14 | 15 | #include "../../types/inc/utils.hpp" |
@@ -2571,7 +2572,7 @@ namespace winrt::TerminalApp::implementation |
2571 | 2572 | auto startupActions = tab->BuildStartupActions(BuildStartupKind::Content); |
2572 | 2573 | _DetachTabFromWindow(tab); |
2573 | 2574 | _MoveContent(std::move(startupActions), windowId, 0); |
2574 | | - _RemoveTab(*tab); |
| 2575 | + tab.Close(); |
2575 | 2576 | if (auto autoPeer = Automation::Peers::FrameworkElementAutomationPeer::FromElement(*this)) |
2576 | 2577 | { |
2577 | 2578 | const auto tabTitle = tab->Title(); |
@@ -3614,7 +3615,7 @@ namespace winrt::TerminalApp::implementation |
3614 | 3615 | { |
3615 | 3616 | if (!_tmuxControl) |
3616 | 3617 | { |
3617 | | - _tmuxControl = std::make_unique<TmuxControl>(*this); |
| 3618 | + _tmuxControl = std::make_shared<TmuxControl>(*this); |
3618 | 3619 | } |
3619 | 3620 |
|
3620 | 3621 | control.EnterTmuxControl([tmuxControl = _tmuxControl.get()](auto&& sender, auto&& args) { |
@@ -5049,9 +5050,10 @@ namespace winrt::TerminalApp::implementation |
5049 | 5050 | void TerminalPage::_adjustProcessPriority() const |
5050 | 5051 | { |
5051 | 5052 | // Windowing is single-threaded, so this will not cause a race condition. |
5052 | | - static bool supported{ true }; |
| 5053 | + static uint64_t s_lastUpdateHash{ 0 }; |
| 5054 | + static bool s_supported{ true }; |
5053 | 5055 |
|
5054 | | - if (!supported || !_hostingHwnd.has_value()) |
| 5056 | + if (!s_supported || !_hostingHwnd.has_value()) |
5055 | 5057 | { |
5056 | 5058 | return; |
5057 | 5059 | } |
@@ -5115,11 +5117,20 @@ namespace winrt::TerminalApp::implementation |
5115 | 5117 | } |
5116 | 5118 |
|
5117 | 5119 | const auto count{ gsl::narrow_cast<DWORD>(it - processes.begin()) }; |
| 5120 | + const auto hash = til::hash((void*)processes.data(), count * sizeof(HANDLE)); |
| 5121 | + |
| 5122 | + if (hash == s_lastUpdateHash) |
| 5123 | + { |
| 5124 | + return; |
| 5125 | + } |
| 5126 | + |
| 5127 | + s_lastUpdateHash = hash; |
5118 | 5128 | const auto hr = TerminalTrySetWindowAssociatedProcesses(_hostingHwnd.value(), count, count ? processes.data() : nullptr); |
| 5129 | + |
5119 | 5130 | if (S_FALSE == hr) |
5120 | 5131 | { |
5121 | 5132 | // Don't bother trying again or logging. The wrapper tells us it's unsupported. |
5122 | | - supported = false; |
| 5133 | + s_supported = false; |
5123 | 5134 | return; |
5124 | 5135 | } |
5125 | 5136 |
|
@@ -5705,7 +5716,7 @@ namespace winrt::TerminalApp::implementation |
5705 | 5716 |
|
5706 | 5717 | _MoveContent(std::move(startupActions), windowId, tabIndex, dragPoint); |
5707 | 5718 | // _RemoveTab will make sure to null out the _stashed.draggedTab |
5708 | | - _RemoveTab(*_stashed.draggedTab); |
| 5719 | + _stashed.draggedTab.Close(); |
5709 | 5720 | } |
5710 | 5721 |
|
5711 | 5722 | /// <summary> |
|
0 commit comments