Fix missing window border when use "win+arrow down" in fullscreen mode in Terminal (#11653)

Window sends an event that requests exit from fullscreen then SC_RESTORE messages is sent and it is in fullscreen mode.
Closes #10607

## Validation Steps Performed
Border and tabbar now appear after exiting fullscreen via "win+arrow down".
This commit is contained in:
Sergey 2021-11-05 02:46:57 +03:00 committed by GitHub
parent 74d21afacf
commit 7aae2e9100
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 31 additions and 3 deletions

View file

@ -1565,6 +1565,11 @@ namespace winrt::TerminalApp::implementation
return _root->IsQuakeWindow(); return _root->IsQuakeWindow();
} }
void AppLogic::RequestExitFullscreen()
{
_root->SetFullscreen(false);
}
bool AppLogic::GetMinimizeToNotificationArea() bool AppLogic::GetMinimizeToNotificationArea()
{ {
if constexpr (Feature_NotificationIcon::IsEnabled()) if constexpr (Feature_NotificationIcon::IsEnabled())

View file

@ -91,6 +91,7 @@ namespace winrt::TerminalApp::implementation
void SetPersistedLayoutIdx(const uint32_t idx); void SetPersistedLayoutIdx(const uint32_t idx);
void SetNumberOfOpenWindows(const uint64_t num); void SetNumberOfOpenWindows(const uint64_t num);
bool IsQuakeWindow() const noexcept; bool IsQuakeWindow() const noexcept;
void RequestExitFullscreen();
Windows::Foundation::Size GetLaunchDimensions(uint32_t dpi); Windows::Foundation::Size GetLaunchDimensions(uint32_t dpi);
bool CenterOnLaunch(); bool CenterOnLaunch();

View file

@ -74,6 +74,7 @@ namespace TerminalApp
void SetPersistedLayoutIdx(UInt32 idx); void SetPersistedLayoutIdx(UInt32 idx);
void SetNumberOfOpenWindows(UInt64 num); void SetNumberOfOpenWindows(UInt64 num);
void RenameFailed(); void RenameFailed();
void RequestExitFullscreen();
Boolean IsQuakeWindow(); Boolean IsQuakeWindow();
Windows.Foundation.Size GetLaunchDimensions(UInt32 dpi); Windows.Foundation.Size GetLaunchDimensions(UInt32 dpi);

View file

@ -2535,9 +2535,7 @@ namespace winrt::TerminalApp::implementation
// - <none> // - <none>
void TerminalPage::ToggleFullscreen() void TerminalPage::ToggleFullscreen()
{ {
_isFullscreen = !_isFullscreen; SetFullscreen(!_isFullscreen);
_UpdateTabView();
_FullscreenChangedHandlers(*this, nullptr);
} }
// Method Description: // Method Description:
@ -2754,6 +2752,17 @@ namespace winrt::TerminalApp::implementation
return _isAlwaysOnTop; return _isAlwaysOnTop;
} }
void TerminalPage::SetFullscreen(bool newFullscreen)
{
if (_isFullscreen == newFullscreen)
{
return;
}
_isFullscreen = newFullscreen;
_UpdateTabView();
_FullscreenChangedHandlers(*this, nullptr);
}
HRESULT TerminalPage::_OnNewConnection(const ConptyConnection& connection) HRESULT TerminalPage::_OnNewConnection(const ConptyConnection& connection)
{ {
// We need to be on the UI thread in order for _OpenNewTab to run successfully. // We need to be on the UI thread in order for _OpenNewTab to run successfully.

View file

@ -83,6 +83,7 @@ namespace winrt::TerminalApp::implementation
bool FocusMode() const; bool FocusMode() const;
bool Fullscreen() const; bool Fullscreen() const;
bool AlwaysOnTop() const; bool AlwaysOnTop() const;
void SetFullscreen(bool);
void SetStartupActions(std::vector<Microsoft::Terminal::Settings::Model::ActionAndArgs>& actions); void SetStartupActions(std::vector<Microsoft::Terminal::Settings::Model::ActionAndArgs>& actions);

View file

@ -84,6 +84,7 @@ AppHost::AppHost() noexcept :
_window->WindowMoved({ this, &AppHost::_WindowMoved }); _window->WindowMoved({ this, &AppHost::_WindowMoved });
_window->HotkeyPressed({ this, &AppHost::_GlobalHotkeyPressed }); _window->HotkeyPressed({ this, &AppHost::_GlobalHotkeyPressed });
_window->SetAlwaysOnTop(_logic.GetInitialAlwaysOnTop()); _window->SetAlwaysOnTop(_logic.GetInitialAlwaysOnTop());
_window->ShouldExitFullscreen({ &_logic, &winrt::TerminalApp::AppLogic::RequestExitFullscreen });
_window->MakeWindow(); _window->MakeWindow();
_GetWindowLayoutRequestedToken = _windowManager.GetWindowLayoutRequested([this](auto&&, const winrt::Microsoft::Terminal::Remoting::GetWindowLayoutArgs& args) { _GetWindowLayoutRequestedToken = _windowManager.GetWindowLayoutRequested([this](auto&&, const winrt::Microsoft::Terminal::Remoting::GetWindowLayoutArgs& args) {

View file

@ -606,6 +606,15 @@ long IslandWindow::_calculateTotalSize(const bool isWidth, const long clientSize
} }
break; break;
} }
case WM_SYSCOMMAND:
{
if (wparam == SC_RESTORE && _fullscreen)
{
_ShouldExitFullscreenHandlers();
return 0;
}
break;
}
case WM_MENUCOMMAND: case WM_MENUCOMMAND:
{ {
_NotifyNotificationIconMenuItemSelectedHandlers((HMENU)lparam, (UINT)wparam); _NotifyNotificationIconMenuItemSelectedHandlers((HMENU)lparam, (UINT)wparam);

View file

@ -73,6 +73,7 @@ public:
WINRT_CALLBACK(NotifyShowNotificationIconContextMenu, winrt::delegate<void(til::point)>); WINRT_CALLBACK(NotifyShowNotificationIconContextMenu, winrt::delegate<void(til::point)>);
WINRT_CALLBACK(NotifyNotificationIconMenuItemSelected, winrt::delegate<void(HMENU, UINT)>); WINRT_CALLBACK(NotifyNotificationIconMenuItemSelected, winrt::delegate<void(HMENU, UINT)>);
WINRT_CALLBACK(NotifyReAddNotificationIcon, winrt::delegate<void()>); WINRT_CALLBACK(NotifyReAddNotificationIcon, winrt::delegate<void()>);
WINRT_CALLBACK(ShouldExitFullscreen, winrt::delegate<void()>);
WINRT_CALLBACK(WindowMoved, winrt::delegate<void()>); WINRT_CALLBACK(WindowMoved, winrt::delegate<void()>);