mirror of
https://github.com/microsoft/terminal.git
synced 2025-12-19 18:11:39 -05:00
Clear the system menu when we refrigerate a window (#16225)
As in the title. Also fixes a crash for refrigeration with the rainbow
border.
Closes #16211
Tested by manually forcing us into Windows 10 mode (to refrigerate the
window). That immediately repros the bug, which was simple enough to
fix.
(cherry picked from commit d8c7719bfb)
Service-Card-Id: 90928407
Service-Version: 1.18
This commit is contained in:
committed by
Dustin L. Howett
parent
8261d52f56
commit
dc0cbf8275
@@ -470,7 +470,7 @@ void AppHost::_revokeWindowCallbacks()
|
||||
// I suspect WinUI wouldn't like that very much. As such unregister all event handlers first.
|
||||
_revokers = {};
|
||||
_showHideWindowThrottler.reset();
|
||||
|
||||
_stopFrameTimer();
|
||||
_revokeWindowCallbacks();
|
||||
|
||||
// DO NOT CLOSE THE WINDOW
|
||||
|
||||
@@ -73,6 +73,8 @@ void IslandWindow::Refrigerate() noexcept
|
||||
// This pointer will get re-set in _warmInitialize
|
||||
SetWindowLongPtr(_window.get(), GWLP_USERDATA, 0);
|
||||
|
||||
_resetSystemMenu();
|
||||
|
||||
_pfnCreateCallback = nullptr;
|
||||
_pfnSnapDimensionCallback = nullptr;
|
||||
|
||||
@@ -1917,6 +1919,12 @@ void IslandWindow::RemoveFromSystemMenu(const winrt::hstring& itemLabel)
|
||||
_systemMenuItems.erase(it->first);
|
||||
}
|
||||
|
||||
void IslandWindow::_resetSystemMenu()
|
||||
{
|
||||
// GetSystemMenu(..., true) will revert the menu to the default state.
|
||||
GetSystemMenu(_window.get(), TRUE);
|
||||
}
|
||||
|
||||
void IslandWindow::UseDarkTheme(const bool v)
|
||||
{
|
||||
const BOOL attribute = v ? TRUE : FALSE;
|
||||
|
||||
@@ -159,6 +159,7 @@ protected:
|
||||
|
||||
std::unordered_map<UINT, SystemMenuItemInfo> _systemMenuItems;
|
||||
UINT _systemMenuNextItemId;
|
||||
void _resetSystemMenu();
|
||||
|
||||
private:
|
||||
// This minimum width allows for width the tabs fit
|
||||
|
||||
Reference in New Issue
Block a user