From 8405c7a6972a869736f2bed2357435402a77e31f Mon Sep 17 00:00:00 2001 From: "Dustin L. Howett" Date: Mon, 4 Apr 2022 16:49:50 -0500 Subject: [PATCH] Autocomplete keyframe animations when occluded on Windows 11 (#12820) On certain builds of Windows, when Terminal is set as the default it will accumulate an unbounded amount of queued animations while the screen is off and it is servicing window management for console applications. This results in Terminal hanging when left overnight, as it has millions of animations to process. The new call into TerminalThemeHelpers will tell our compositor to automatically complete animations that are scheduled while the screen is off. Fixes MSFT-38506980 --- dep/nuget/packages.config | 2 +- src/cascadia/WindowsTerminal/AppHost.cpp | 11 +++++++++++ src/common.nugetversions.targets | 4 ++-- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/dep/nuget/packages.config b/dep/nuget/packages.config index 5d0f1f2e637..7b532a860bf 100644 --- a/dep/nuget/packages.config +++ b/dep/nuget/packages.config @@ -8,7 +8,7 @@ - + diff --git a/src/cascadia/WindowsTerminal/AppHost.cpp b/src/cascadia/WindowsTerminal/AppHost.cpp index a12f1f1ca6a..929ee07838e 100644 --- a/src/cascadia/WindowsTerminal/AppHost.cpp +++ b/src/cascadia/WindowsTerminal/AppHost.cpp @@ -11,6 +11,8 @@ #include "VirtualDesktopUtils.h" #include "icon.h" +#include + using namespace winrt::Windows::UI; using namespace winrt::Windows::UI::Composition; using namespace winrt::Windows::UI::Xaml; @@ -399,6 +401,15 @@ void AppHost::Initialize() _revokers.OpenSystemMenu = _logic.OpenSystemMenu(winrt::auto_revoke, { this, &AppHost::_OpenSystemMenu }); _revokers.QuitRequested = _logic.QuitRequested(winrt::auto_revoke, { this, &AppHost::_RequestQuitAll }); + // BODGY + // On certain builds of Windows, when Terminal is set as the default + // it will accumulate an unbounded amount of queued animations while + // the screen is off and it is servicing window management for console + // applications. This call into TerminalThemeHelpers will tell our + // compositor to automatically complete animations that are scheduled + // while the screen is off. + TerminalTrySetAutoCompleteAnimationsWhenOccluded(static_cast<::IUnknown*>(winrt::get_abi(_logic.GetRoot())), true); + _window->UpdateTitle(_logic.Title()); // Set up the content of the application. If the app has a custom titlebar, diff --git a/src/common.nugetversions.targets b/src/common.nugetversions.targets index 70621262600..9c902f4b7b9 100644 --- a/src/common.nugetversions.targets +++ b/src/common.nugetversions.targets @@ -53,7 +53,7 @@ - + @@ -90,7 +90,7 @@ - +