Skip to content

Commit

Permalink
Tell Taskbar to be hidden when we are fullscreen
Browse files Browse the repository at this point in the history
When a window_manager window is maximized, the shell treats the window
as fullscreen. When Taskbar is set to auto-hide, and the window is
maximized, the taskbar will not pop up.

This sets NonRudeHWND property before showing the window. This requires
a hide/show cycle when we enter or exit the fullscreen mode.

Fixes leanflutter#438
  • Loading branch information
roman-yepishev committed Mar 4, 2024
1 parent ef786b1 commit 3385880
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions windows/window_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,15 @@ void WindowManager::Show() {
::SetWindowPos(hWnd, HWND_TOP, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE);
}

if (IsFullScreen()) {
// Taskbar should treat the window as fullscreen and adjust itself below the
// window in z-order.
::SetProp(hWnd, L"NonRudeHWND", reinterpret_cast<HANDLE>(FALSE));
} else {
// Taskbar should keep itself in front of the window in z-order.
::SetProp(hWnd, L"NonRudeHWND", reinterpret_cast<HANDLE>(TRUE));
}

ShowWindowAsync(GetMainWindow(), SW_SHOW);
SetForegroundWindow(GetMainWindow());
}
Expand Down Expand Up @@ -558,6 +567,10 @@ void WindowManager::SetFullScreen(const flutter::EncodableMap& args) {
// implements this (we got permission from the author, I believe)
// https://github.com/alexmercerind/media_kit/blob/1226bcff36eab27cb17d60c33e9c15ca489c1f06/media_kit_video/windows/utils.cc

// Hide the window before switching to/from full screen for Taskbar to notice
// the NonRudeHWND property.
Hide();

// Save current window state if not already fullscreen.
if (!g_is_window_fullscreen) {
// Save current window information.
Expand Down Expand Up @@ -615,6 +628,8 @@ void WindowManager::SetFullScreen(const flutter::EncodableMap& args) {
SWP_NOACTIVATE | SWP_NOZORDER);
}
}

Show();
}

void WindowManager::SetAspectRatio(const flutter::EncodableMap& args) {
Expand Down

0 comments on commit 3385880

Please sign in to comment.