Refrigerated window causes focus mode to show title bar #21060

Closed
opened 2026-01-31 07:31:58 +00:00 by claunia · 4 comments
Owner

Originally created by @e82eric on GitHub (Jan 6, 2024).

Windows Terminal version

63c3573a1

Windows build number

No response

Other Software

No response

Steps to reproduce

Set terminal to open in focus mode and the new instance behavior to create new winodw.
Open windows terminal.
Open new window using wt
Close newly created window
Open new window using wt

Expected Behavior

The newly created window will be created in focus mode without a title bar

Actual Behavior

The newly created window is created with a title title bar.
explorer_vCRXtCWDMD

Originally created by @e82eric on GitHub (Jan 6, 2024). ### Windows Terminal version 63c3573a1 ### Windows build number _No response_ ### Other Software _No response_ ### Steps to reproduce Set terminal to open in focus mode and the new instance behavior to create new winodw. Open windows terminal. Open new window using wt Close newly created window Open new window using wt ### Expected Behavior The newly created window will be created in focus mode without a title bar ### Actual Behavior The newly created window is created with a title title bar. ![explorer_vCRXtCWDMD](https://github.com/microsoft/terminal/assets/811029/8b39bc52-f3a8-4954-87db-76a6092316dd)
claunia added the Issue-BugIn-PRNeeds-Tag-FixProduct-TerminalArea-Windowing labels 2026-01-31 07:31:59 +00:00
Author
Owner

@e82eric commented on GitHub (Jan 6, 2024):

I think the cause of this is that when a Refrigerated window is restored this call to Controls::Grid::SetRow(_titlebar, 0); causes the _title bar to be visible.
63c3573a13/src/cascadia/WindowsTerminal/NonClientIslandWindow.cpp (L379)

And when the check to hide the titlebar happens it doesn't run because of the optimization to do nothing if the _borderless state is already set.

void IslandWindow::FocusModeChanged(const bool focusMode)
{
    // Do nothing if the value was unchanged.
    if (focusMode == _borderless)
    {
        return;
    }

    _SetIsBorderless(focusMode);
}

63c3573a13/src/cascadia/WindowsTerminal/IslandWindow.cpp (L919)

I removed the optimization and no longer saw the title bar.

@e82eric commented on GitHub (Jan 6, 2024): I think the cause of this is that when a Refrigerated window is restored this call to Controls::Grid::SetRow(_titlebar, 0); causes the _title bar to be visible. https://github.com/microsoft/terminal/blob/63c3573a13cc96bfa3d655f0f1898ae250e2fe35/src/cascadia/WindowsTerminal/NonClientIslandWindow.cpp#L379 And when the check to hide the titlebar happens it doesn't run because of the optimization to do nothing if the _borderless state is already set. ``` void IslandWindow::FocusModeChanged(const bool focusMode) { // Do nothing if the value was unchanged. if (focusMode == _borderless) { return; } _SetIsBorderless(focusMode); } ``` https://github.com/microsoft/terminal/blob/63c3573a13cc96bfa3d655f0f1898ae250e2fe35/src/cascadia/WindowsTerminal/IslandWindow.cpp#L919 I removed the optimization and no longer saw the title bar.
Author
Owner

@lhecker commented on GitHub (Jan 8, 2024):

Where is the FocusModeChanged call coming from? Should that caller just call _SetIsBorderless directly?

@lhecker commented on GitHub (Jan 8, 2024): Where is the `FocusModeChanged` call coming from? Should that caller just call `_SetIsBorderless` directly?
Author
Owner

@e82eric commented on GitHub (Jan 9, 2024):

I think it is from TerminalWindow::_pageInitialized 375d00d0cd/src/cascadia/TerminalApp/TerminalWindow.cpp (L248)

https://github.com/microsoft/terminal/blob/main/src/cascadia/TerminalApp/TerminalPage.cpp#L3554

This was the call stack

	WindowsTerminal.exe!AppHost::_FocusModeChanged(const winrt::Windows::Foundation::IInspectable & __formal, const winrt::Windows::Foundation::IInspectable & __formal) Line 787	C++
 	WindowsTerminal.exe!`winrt::Windows::Foundation::TypedEventHandler<winrt::Windows::Foundation::IInspectable,winrt::Windows::Foundation::IInspectable>::TypedEventHandler<winrt::Windows::Foundation::IInspectable,winrt::Windows::Foundation::IInspectable><AppHost,void (__cdecl AppHost::*)(winrt::Windows::Foundation::IInspectable const &,winrt::Windows::Foundation::IInspectable const &)>'::`1'::<lambda_295_>::operator()<winrt::Windows::Foundation::IInspectable const &,winrt::Windows::Foundation::IInspectable const &>(const winrt::Windows::Foundation::IInspectable & <args_0>, const winrt::Windows::Foundation::IInspectable & <args_1>) Line 2512	C++
 	WindowsTerminal.exe!winrt::impl::delegate<winrt::Windows::Foundation::TypedEventHandler<winrt::Windows::Foundation::IInspectable,winrt::Windows::Foundation::IInspectable>,`winrt::Windows::Foundation::TypedEventHandler<winrt::Windows::Foundation::IInspectable,winrt::Windows::Foundation::IInspectable>::IInspectable<AppHost,void (__cdecl AppHost::*)(winrt::Windows::Foundation::IInspectable const &,winrt::Windows::Foundation::IInspectable const &)>'::`1'::<lambda_295_>>::Invoke(void * sender, void * args) Line 895	C++
 	TerminalApp.dll!winrt::Windows::Foundation::TypedEventHandler<winrt::Windows::Foundation::IInspectable,winrt::Windows::Foundation::IInspectable>::operator()(const winrt::Windows::Foundation::IInspectable & sender, const winrt::Windows::Foundation::IInspectable & args) Line 2525	C++
 	TerminalApp.dll!winrt::impl::invoke<winrt::Windows::Foundation::TypedEventHandler<winrt::Windows::Foundation::IInspectable,winrt::Windows::Foundation::IInspectable>,winrt::TerminalApp::implementation::TerminalPage,std::nullptr_t>(const winrt::Windows::Foundation::TypedEventHandler<winrt::Windows::Foundation::IInspectable,winrt::Windows::Foundation::IInspectable> & delegate, const winrt::TerminalApp::implementation::TerminalPage & <args_0>, void * const & <args_1>) Line 5890	C++
 	TerminalApp.dll!winrt::event<winrt::Windows::Foundation::TypedEventHandler<winrt::Windows::Foundation::IInspectable,winrt::Windows::Foundation::IInspectable>>::operator()<winrt::TerminalApp::implementation::TerminalPage,std::nullptr_t>(const winrt::TerminalApp::implementation::TerminalPage & <args_0>, void * const & <args_1>) Line 6043	C++
 	TerminalApp.dll!winrt::TerminalApp::implementation::TerminalPage::SetFocusMode(const bool inFocusMode) Line 3556	C++
 	TerminalApp.dll!winrt::TerminalApp::implementation::TerminalWindow::_pageInitialized(const winrt::Windows::Foundation::IInspectable & __formal, const winrt::Windows::Foundation::IInspectable & __formal) Line 253	C++
 	TerminalApp.dll!`winrt::Windows::Foundation::TypedEventHandler<winrt::Windows::Foundation::IInspectable,winrt::Windows::Foundation::IInspectable>::TypedEventHandler<winrt::Windows::Foundation::IInspectable,winrt::Windows::Foundation::IInspectable><winrt::TerminalApp::implementation::TerminalWindow,void (__cdecl winrt::TerminalApp::implementation::TerminalWindow::*)(winrt::Windows::Foundation::IInspectable const &,winrt::Windows::Foundation::IInspectable const &)>'::`1'::<lambda_490_>::operator()<winrt::Windows::Foundation::IInspectable const &,winrt::Windows::Foundation::IInspectable const &>(const winrt::Windows::Foundation::IInspectable & <args_0>, const winrt::Windows::Foundation::IInspectable & <args_1>) Line 2520	C++
 	TerminalApp.dll!winrt::impl::delegate<winrt::Windows::Foundation::TypedEventHandler<winrt::Windows::Foundation::IInspectable,winrt::Windows::Foundation::IInspectable>,`winrt::Windows::Foundation::TypedEventHandler<winrt::Windows::Foundation::IInspectable,winrt::Windows::Foundation::IInspectable>::implementation<winrt::TerminalApp::implementation::TerminalWindow,void (__cdecl winrt::TerminalApp::implementation::TerminalWindow::*)(winrt::Windows::Foundation::IInspectable const &,winrt::Windows::Foundation::IInspectable const &)>'::`1'::<lambda_490_>>::Invoke(void * sender, void * args) Line 895	C++
 	TerminalApp.dll!winrt::Windows::Foundation::TypedEventHandler<winrt::Windows::Foundation::IInspectable,winrt::Windows::Foundation::IInspectable>::operator()(const winrt::Windows::Foundation::IInspectable & sender, const winrt::Windows::Foundation::IInspectable & args) Line 2525	C++
 	TerminalApp.dll!winrt::impl::invoke<winrt::Windows::Foundation::TypedEventHandler<winrt::Windows::Foundation::IInspectable,winrt::Windows::Foundation::IInspectable>,winrt::TerminalApp::implementation::TerminalPage,std::nullptr_t>(const winrt::Windows::Foundation::TypedEventHandler<winrt::Windows::Foundation::IInspectable,winrt::Windows::Foundation::IInspectable> & delegate, const winrt::TerminalApp::implementation::TerminalPage & <args_0>, void * const & <args_1>) Line 5890	C++
 	TerminalApp.dll!winrt::event<winrt::Windows::Foundation::TypedEventHandler<winrt::Windows::Foundation::IInspectable,winrt::Windows::Foundation::IInspectable>>::operator()<winrt::TerminalApp::implementation::TerminalPage,std::nullptr_t>(const winrt::TerminalApp::implementation::TerminalPage & <args_0>, void * const & <args_1>) Line 6043	C++
 	TerminalApp.dll!winrt::TerminalApp::implementation::TerminalPage::_CompleteInitialization::__l7::<lambda_1>::operator()() Line 692	C++
 	TerminalApp.dll!winrt::impl::delegate<winrt::Windows::UI::Core::DispatchedHandler,`winrt::TerminalApp::implementation::TerminalPage::_CompleteInitialization'::`7'::<lambda_1>>::Invoke() Line 1136	C++
 	[External Code]	
 	WindowsTerminal.exe!WindowThread::_messagePump() Line 199	C++
 	WindowsTerminal.exe!WindowThread::RunMessagePump() Line 44	C++
 	WindowsTerminal.exe!WindowEmperor::_createNewWindowThread::__l2::<lambda_1>::operator()() Line 240	C++
 	[External Code]	

Should that caller just call _SetIsBorderless directly?

It didn't look like TerminalWindow or TerminalPage had access to the IslandWindow/NonClientIsland to call IslandWindow::_SetIsBorderLess, I think communication always happens through that FocusModeChanged event.

@e82eric commented on GitHub (Jan 9, 2024): I think it is from TerminalWindow::_pageInitialized https://github.com/microsoft/terminal/blob/375d00d0cd2c2934b0d136dcf7c295a5f99b07d5/src/cascadia/TerminalApp/TerminalWindow.cpp#L248 https://github.com/microsoft/terminal/blob/main/src/cascadia/TerminalApp/TerminalPage.cpp#L3554 This was the call stack ``` WindowsTerminal.exe!AppHost::_FocusModeChanged(const winrt::Windows::Foundation::IInspectable & __formal, const winrt::Windows::Foundation::IInspectable & __formal) Line 787 C++ WindowsTerminal.exe!`winrt::Windows::Foundation::TypedEventHandler<winrt::Windows::Foundation::IInspectable,winrt::Windows::Foundation::IInspectable>::TypedEventHandler<winrt::Windows::Foundation::IInspectable,winrt::Windows::Foundation::IInspectable><AppHost,void (__cdecl AppHost::*)(winrt::Windows::Foundation::IInspectable const &,winrt::Windows::Foundation::IInspectable const &)>'::`1'::<lambda_295_>::operator()<winrt::Windows::Foundation::IInspectable const &,winrt::Windows::Foundation::IInspectable const &>(const winrt::Windows::Foundation::IInspectable & <args_0>, const winrt::Windows::Foundation::IInspectable & <args_1>) Line 2512 C++ WindowsTerminal.exe!winrt::impl::delegate<winrt::Windows::Foundation::TypedEventHandler<winrt::Windows::Foundation::IInspectable,winrt::Windows::Foundation::IInspectable>,`winrt::Windows::Foundation::TypedEventHandler<winrt::Windows::Foundation::IInspectable,winrt::Windows::Foundation::IInspectable>::IInspectable<AppHost,void (__cdecl AppHost::*)(winrt::Windows::Foundation::IInspectable const &,winrt::Windows::Foundation::IInspectable const &)>'::`1'::<lambda_295_>>::Invoke(void * sender, void * args) Line 895 C++ TerminalApp.dll!winrt::Windows::Foundation::TypedEventHandler<winrt::Windows::Foundation::IInspectable,winrt::Windows::Foundation::IInspectable>::operator()(const winrt::Windows::Foundation::IInspectable & sender, const winrt::Windows::Foundation::IInspectable & args) Line 2525 C++ TerminalApp.dll!winrt::impl::invoke<winrt::Windows::Foundation::TypedEventHandler<winrt::Windows::Foundation::IInspectable,winrt::Windows::Foundation::IInspectable>,winrt::TerminalApp::implementation::TerminalPage,std::nullptr_t>(const winrt::Windows::Foundation::TypedEventHandler<winrt::Windows::Foundation::IInspectable,winrt::Windows::Foundation::IInspectable> & delegate, const winrt::TerminalApp::implementation::TerminalPage & <args_0>, void * const & <args_1>) Line 5890 C++ TerminalApp.dll!winrt::event<winrt::Windows::Foundation::TypedEventHandler<winrt::Windows::Foundation::IInspectable,winrt::Windows::Foundation::IInspectable>>::operator()<winrt::TerminalApp::implementation::TerminalPage,std::nullptr_t>(const winrt::TerminalApp::implementation::TerminalPage & <args_0>, void * const & <args_1>) Line 6043 C++ TerminalApp.dll!winrt::TerminalApp::implementation::TerminalPage::SetFocusMode(const bool inFocusMode) Line 3556 C++ TerminalApp.dll!winrt::TerminalApp::implementation::TerminalWindow::_pageInitialized(const winrt::Windows::Foundation::IInspectable & __formal, const winrt::Windows::Foundation::IInspectable & __formal) Line 253 C++ TerminalApp.dll!`winrt::Windows::Foundation::TypedEventHandler<winrt::Windows::Foundation::IInspectable,winrt::Windows::Foundation::IInspectable>::TypedEventHandler<winrt::Windows::Foundation::IInspectable,winrt::Windows::Foundation::IInspectable><winrt::TerminalApp::implementation::TerminalWindow,void (__cdecl winrt::TerminalApp::implementation::TerminalWindow::*)(winrt::Windows::Foundation::IInspectable const &,winrt::Windows::Foundation::IInspectable const &)>'::`1'::<lambda_490_>::operator()<winrt::Windows::Foundation::IInspectable const &,winrt::Windows::Foundation::IInspectable const &>(const winrt::Windows::Foundation::IInspectable & <args_0>, const winrt::Windows::Foundation::IInspectable & <args_1>) Line 2520 C++ TerminalApp.dll!winrt::impl::delegate<winrt::Windows::Foundation::TypedEventHandler<winrt::Windows::Foundation::IInspectable,winrt::Windows::Foundation::IInspectable>,`winrt::Windows::Foundation::TypedEventHandler<winrt::Windows::Foundation::IInspectable,winrt::Windows::Foundation::IInspectable>::implementation<winrt::TerminalApp::implementation::TerminalWindow,void (__cdecl winrt::TerminalApp::implementation::TerminalWindow::*)(winrt::Windows::Foundation::IInspectable const &,winrt::Windows::Foundation::IInspectable const &)>'::`1'::<lambda_490_>>::Invoke(void * sender, void * args) Line 895 C++ TerminalApp.dll!winrt::Windows::Foundation::TypedEventHandler<winrt::Windows::Foundation::IInspectable,winrt::Windows::Foundation::IInspectable>::operator()(const winrt::Windows::Foundation::IInspectable & sender, const winrt::Windows::Foundation::IInspectable & args) Line 2525 C++ TerminalApp.dll!winrt::impl::invoke<winrt::Windows::Foundation::TypedEventHandler<winrt::Windows::Foundation::IInspectable,winrt::Windows::Foundation::IInspectable>,winrt::TerminalApp::implementation::TerminalPage,std::nullptr_t>(const winrt::Windows::Foundation::TypedEventHandler<winrt::Windows::Foundation::IInspectable,winrt::Windows::Foundation::IInspectable> & delegate, const winrt::TerminalApp::implementation::TerminalPage & <args_0>, void * const & <args_1>) Line 5890 C++ TerminalApp.dll!winrt::event<winrt::Windows::Foundation::TypedEventHandler<winrt::Windows::Foundation::IInspectable,winrt::Windows::Foundation::IInspectable>>::operator()<winrt::TerminalApp::implementation::TerminalPage,std::nullptr_t>(const winrt::TerminalApp::implementation::TerminalPage & <args_0>, void * const & <args_1>) Line 6043 C++ TerminalApp.dll!winrt::TerminalApp::implementation::TerminalPage::_CompleteInitialization::__l7::<lambda_1>::operator()() Line 692 C++ TerminalApp.dll!winrt::impl::delegate<winrt::Windows::UI::Core::DispatchedHandler,`winrt::TerminalApp::implementation::TerminalPage::_CompleteInitialization'::`7'::<lambda_1>>::Invoke() Line 1136 C++ [External Code] WindowsTerminal.exe!WindowThread::_messagePump() Line 199 C++ WindowsTerminal.exe!WindowThread::RunMessagePump() Line 44 C++ WindowsTerminal.exe!WindowEmperor::_createNewWindowThread::__l2::<lambda_1>::operator()() Line 240 C++ [External Code] ``` > Should that caller just call `_SetIsBorderless` directly? It didn't look like TerminalWindow or TerminalPage had access to the IslandWindow/NonClientIsland to call IslandWindow::_SetIsBorderLess, I think communication always happens through that FocusModeChanged event.
Author
Owner

@zadjii-msft commented on GitHub (Sep 4, 2024):

maybe also related: #16221

@zadjii-msft commented on GitHub (Sep 4, 2024): maybe also related: [#16221](https://github.com/microsoft/terminal/issues/16221)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#21060