Closed LordLux closed 2 months ago
~I had this exact issue except for the top bar.
Basically when the window is maximized, it doesn't leave any gap for the taskbar side.
Here's how I fixed it (should've opened a new PR for that) 81b972a
(#374)
If you got time, maybe open a PR and try to experiment with the bottom border.~
Don't do that, see below
The sample code from Microsoft at https://learn.microsoft.com/en-us/windows/apps/develop/title-bar#full-customization-example also exhibits this problem: https://github.com/microsoft/microsoft-ui-xaml/issues/8431.
The workaround mentioned in that bug is using https://learn.microsoft.com/en-us/windows/win32/api/shobjidl_core/nf-shobjidl_core-itaskbarlist2-markfullscreenwindow#remarks:
Since Windows 7, call
SetProp(hwnd, L”NonRudeHWND”, reinterpret_cast<HANDLE>(TRUE))
before showing a window to indicate to the Shell that the window should not be treated as full-screen. This ensures the taskbar does not adjust itself to be below the window in z-order.
Adding a call of SetProp with NonRudeHWND in windows/window_manager.cpp fixes the taskbar visibility:
diff --git a/windows/window_manager.cpp b/windows/window_manager.cpp
index 3484176..5bd0e28 100644
--- a/windows/window_manager.cpp
+++ b/windows/window_manager.cpp
@@ -256,6 +256,7 @@ bool WindowManager::IsFocused() {
void WindowManager::Show() {
HWND hWnd = GetMainWindow();
+ SetProp(hWnd, L"NonRudeHWND", reinterpret_cast<HANDLE>(TRUE));
DWORD gwlStyle = GetWindowLong(hWnd, GWL_STYLE);
gwlStyle = gwlStyle | WS_VISIBLE;
if ((gwlStyle & WS_VISIBLE) == 0) {
However, since this is the first time I see the codebase, I am not sure where this call should actually live.
@roman-yepishev If this is only called once ever, you can put that here https://github.com/leanflutter/window_manager/blob/ef786b1574455ca141cea899ca2db788731163d4/windows/window_manager.cpp#L208-L211 and if you want, also enable/disable it when going to/from fullscreen here https://github.com/leanflutter/window_manager/blob/ef786b1574455ca141cea899ca2db788731163d4/windows/window_manager.cpp#L572-L617
A crude version of how this may work is https://github.com/roman-yepishev/window_manager/commit/338588062efaf22031154c09ae53c4ae924b52e3, however it changes the behavior dramatically (hides the window before switching to/from full-screen), which is likely not expected by the clients. Additionally the example app had issues redrawing with this enabled so this does not look like a good solution.
Is there an update? I'm still experiencing errors.
Describe the bug
When creating a window without the default title bar by setting
titleBarStyle: TitleBarStyle.hidden
to implement a custom title bar, and then maximizing the window usingwindowManager.maximize();
, the Auto-Hide feature of the Windows Taskbar stops functioning as expected.To Reproduce
Steps to reproduce the behavior:
TitleBarStyle.hidden
for a custom title bar implementation.windowManager.maximize();
to maximize the window programmatically.Expected behavior
Even when the Flutter application window is maximized with a custom title bar, the Windows Taskbar's Auto-Hide feature should function normally, revealing the taskbar when the mouse is moved to the bottom edge of the screen, like all other windows apps do.
Additional context
Maybe it could have something to do with this stackoverflow answer
Thanks in advance and thanks for this plugin!