From e3f932aa6ba9ebb3284c6cfd4fabfacfb01cd9f7 Mon Sep 17 00:00:00 2001 From: deepend Date: Wed, 25 Feb 2026 14:48:18 -0700 Subject: [PATCH] =?UTF-8?q?Updated=20the=20Win32=20window-state=20handling?= =?UTF-8?q?=20to=20include=20shellapi.h=20and=20query=20taskbar=20auto-hid?= =?UTF-8?q?e/taskbar=20edge=20state=20via=20SHAppBarMessage,=20so=20maximi?= =?UTF-8?q?zed=20windows=20can=20leave=20a=201px=20reveal=20edge=20for=20t?= =?UTF-8?q?he=20auto-hidden=20taskbar.=20Added=20monitor-aware=20work-area?= =?UTF-8?q?=20adjustment=20when=20maximized=20(MonitorFromWindow=20+=20Get?= =?UTF-8?q?MonitorInfo)=20and=20shrink=20by=201px=20on=20the=20detected=20?= =?UTF-8?q?taskbar=20edge=20(including=20bottom=20edge),=20then=20apply=20?= =?UTF-8?q?that=20rectangle=20with=20SetWindowPos.=20This=20addresses=20th?= =?UTF-8?q?e=20=E2=80=9Cmouse=20at=20bottom=20edge=20should=20unhide=20tas?= =?UTF-8?q?kbar=E2=80=9D=20behavior.=20Kept=20the=20existing=20HWND=5FNOTO?= =?UTF-8?q?PMOST=20safeguard=20in=20place=20after=20the=20adjustment,=20pr?= =?UTF-8?q?eserving=20prior=20not-topmost=20behavior.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/fe-gtk/maingui.c | 51 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) diff --git a/src/fe-gtk/maingui.c b/src/fe-gtk/maingui.c index 1a58d01d..1dcfb871 100644 --- a/src/fe-gtk/maingui.c +++ b/src/fe-gtk/maingui.c @@ -58,6 +58,7 @@ #ifdef G_OS_WIN32 #include +#include #include static void @@ -80,6 +81,56 @@ mg_win32_allow_autohide_taskbar (GtkWindow *window, GdkEventWindowState *event) if (!hwnd) return; + if (event->new_window_state & GDK_WINDOW_STATE_MAXIMIZED) + { + APPBARDATA appbar_data; + RECT work_area; + + ZeroMemory (&appbar_data, sizeof (APPBARDATA)); + appbar_data.cbSize = sizeof (APPBARDATA); + + if ((SHAppBarMessage (ABM_GETSTATE, &appbar_data) & ABS_AUTOHIDE) != 0 && + SHAppBarMessage (ABM_GETTASKBARPOS, &appbar_data) != 0) + { + HMONITOR monitor; + MONITORINFO monitor_info; + + monitor = MonitorFromWindow (hwnd, MONITOR_DEFAULTTONEAREST); + ZeroMemory (&monitor_info, sizeof (MONITORINFO)); + monitor_info.cbSize = sizeof (MONITORINFO); + + if (monitor && GetMonitorInfo (monitor, &monitor_info)) + { + work_area = monitor_info.rcMonitor; + + switch (appbar_data.uEdge) + { + case ABE_LEFT: + work_area.left += 1; + break; + case ABE_TOP: + work_area.top += 1; + break; + case ABE_RIGHT: + work_area.right -= 1; + break; + case ABE_BOTTOM: + default: + work_area.bottom -= 1; + break; + } + + SetWindowPos (hwnd, + NULL, + work_area.left, + work_area.top, + work_area.right - work_area.left, + work_area.bottom - work_area.top, + SWP_NOACTIVATE | SWP_NOOWNERZORDER | SWP_NOZORDER); + } + } + } + SetWindowPos (hwnd, HWND_NOTOPMOST, 0,