Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refrigerated window causes focus mode to show title bar #16532

Closed
e82eric opened this issue Jan 6, 2024 · 4 comments · Fixed by #18215
Closed

Refrigerated window causes focus mode to show title bar #16532

e82eric opened this issue Jan 6, 2024 · 4 comments · Fixed by #18215
Labels
Area-Windowing Window frame, quake mode, tearout In-PR This issue has a related PR Issue-Bug It either shouldn't be doing this or needs an investigation. Needs-Tag-Fix Doesn't match tag requirements Product-Terminal The new Windows Terminal.
Milestone

Comments

@e82eric
Copy link
Contributor

e82eric commented Jan 6, 2024

Windows Terminal version

63c3573

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

@e82eric e82eric added Issue-Bug It either shouldn't be doing this or needs an investigation. Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting labels Jan 6, 2024
@e82eric
Copy link
Contributor Author

e82eric commented 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.

Controls::Grid::SetRow(_titlebar, 0);

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);
}

if (focusMode == _borderless)

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

@lhecker
Copy link
Member

lhecker commented Jan 8, 2024

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

@e82eric
Copy link
Contributor Author

e82eric commented Jan 9, 2024

I think it is from TerminalWindow::_pageInitialized

_root->SetFocusMode(true);

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.

@zadjii-msft zadjii-msft added Product-Terminal The new Windows Terminal. Area-Windowing Window frame, quake mode, tearout labels Jan 9, 2024
@zadjii-msft zadjii-msft added this to the Terminal v1.20 milestone Jan 9, 2024
@carlos-zamora carlos-zamora removed the Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting label Jan 10, 2024
@zadjii-msft
Copy link
Member

maybe also related: #16221

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Windowing Window frame, quake mode, tearout In-PR This issue has a related PR Issue-Bug It either shouldn't be doing this or needs an investigation. Needs-Tag-Fix Doesn't match tag requirements Product-Terminal The new Windows Terminal.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants