|
5 | 5 | #include "pch.h" |
6 | 6 | #include "TerminalPage.h" |
7 | 7 |
|
| 8 | +#include <TerminalCore/ControlKeyStates.hpp> |
8 | 9 | #include <TerminalThemeHelpers.h> |
| 10 | +#include <til/hash.h> |
9 | 11 | #include <Utils.h> |
10 | | -#include <TerminalCore/ControlKeyStates.hpp> |
11 | 12 |
|
| 13 | +#include "../../types/inc/ColorFix.hpp" |
| 14 | +#include "../../types/inc/utils.hpp" |
| 15 | +#include "../TerminalSettingsAppAdapterLib/TerminalSettings.h" |
12 | 16 | #include "App.h" |
13 | 17 | #include "DebugTapConnection.h" |
14 | 18 | #include "MarkdownPaneContent.h" |
|
18 | 22 | #include "SnippetsPaneContent.h" |
19 | 23 | #include "TabRowControl.h" |
20 | 24 | #include "TerminalSettingsCache.h" |
21 | | -#include "../../types/inc/ColorFix.hpp" |
22 | | -#include "../../types/inc/utils.hpp" |
23 | | -#include "../TerminalSettingsAppAdapterLib/TerminalSettings.h" |
24 | 25 |
|
25 | 26 | #include "LaunchPositionRequest.g.cpp" |
26 | 27 | #include "RenameWindowRequestedArgs.g.cpp" |
@@ -5000,9 +5001,10 @@ namespace winrt::TerminalApp::implementation |
5000 | 5001 | void TerminalPage::_adjustProcessPriority() const |
5001 | 5002 | { |
5002 | 5003 | // Windowing is single-threaded, so this will not cause a race condition. |
5003 | | - static bool supported{ true }; |
| 5004 | + static uint64_t s_lastUpdateHash{ 0 }; |
| 5005 | + static bool s_supported{ true }; |
5004 | 5006 |
|
5005 | | - if (!supported || !_hostingHwnd.has_value()) |
| 5007 | + if (!s_supported || !_hostingHwnd.has_value()) |
5006 | 5008 | { |
5007 | 5009 | return; |
5008 | 5010 | } |
@@ -5066,11 +5068,20 @@ namespace winrt::TerminalApp::implementation |
5066 | 5068 | } |
5067 | 5069 |
|
5068 | 5070 | const auto count{ gsl::narrow_cast<DWORD>(it - processes.begin()) }; |
| 5071 | + const auto hash = til::hash((void*)processes.data(), count * sizeof(HANDLE)); |
| 5072 | + |
| 5073 | + if (hash == s_lastUpdateHash) |
| 5074 | + { |
| 5075 | + return; |
| 5076 | + } |
| 5077 | + |
| 5078 | + s_lastUpdateHash = hash; |
5069 | 5079 | const auto hr = TerminalTrySetWindowAssociatedProcesses(_hostingHwnd.value(), count, count ? processes.data() : nullptr); |
| 5080 | + |
5070 | 5081 | if (S_FALSE == hr) |
5071 | 5082 | { |
5072 | 5083 | // Don't bother trying again or logging. The wrapper tells us it's unsupported. |
5073 | | - supported = false; |
| 5084 | + s_supported = false; |
5074 | 5085 | return; |
5075 | 5086 | } |
5076 | 5087 |
|
|
0 commit comments