From c569aee023adb113a3052dd48f1644244858de7e Mon Sep 17 00:00:00 2001 From: Whindmar Saksit Date: Mon, 25 Nov 2024 19:51:19 +0100 Subject: [PATCH] [EXPLORER] Implement ABM_GET/SETSTATE and ABM_GETTASKBARPOS (#7525) --- base/shell/explorer/appbar.cpp | 35 +++++++++++++++++++++++----------- sdk/include/psdk/shellapi.h | 1 + 2 files changed, 25 insertions(+), 11 deletions(-) diff --git a/base/shell/explorer/appbar.cpp b/base/shell/explorer/appbar.cpp index 3f980ec589f..831231bb190 100644 --- a/base/shell/explorer/appbar.cpp +++ b/base/shell/explorer/appbar.cpp @@ -35,6 +35,8 @@ #include +#define GetPrimaryTaskbar() FindWindowW(L"Shell_TrayWnd", NULL) + struct appbar_cmd { DWORD dwMsg; @@ -198,22 +200,33 @@ static UINT_PTR handle_appbarmessage(DWORD msg, _AppBarData *abd) } return TRUE; case ABM_GETSTATE: - FIXME("SHAppBarMessage(ABM_GETSTATE): stub\n"); - return ABS_ALWAYSONTOP | ABS_AUTOHIDE; + TRACE("SHAppBarMessage(ABM_GETSTATE)\n"); + return (g_TaskbarSettings.sr.AutoHide ? ABS_AUTOHIDE : 0) | + (g_TaskbarSettings.sr.AlwaysOnTop ? ABS_ALWAYSONTOP : 0); + case ABM_SETSTATE: + TRACE("SHAppBarMessage(ABM_SETSTATE lparam=%s)\n", wine_dbgstr_longlong(abd->lParam)); + hwnd = GetPrimaryTaskbar(); + if (hwnd) + { + TaskbarSettings settings = g_TaskbarSettings; + settings.sr.AutoHide = (abd->lParam & ABS_AUTOHIDE) != 0; + settings.sr.AlwaysOnTop = (abd->lParam & ABS_ALWAYSONTOP) != 0; + SendMessageW(hwnd, TWM_SETTINGSCHANGED, 0, (LPARAM)&settings); + return TRUE; + } + return FALSE; case ABM_GETTASKBARPOS: - FIXME("SHAppBarMessage(ABM_GETTASKBARPOS, hwnd=%p): stub\n", hwnd); - /* Report the taskbar is at the bottom of the screen. */ - abd->rc.left = 0; - abd->rc.right = GetSystemMetrics(SM_CXSCREEN); - abd->rc.bottom = GetSystemMetrics(SM_CYSCREEN); - abd->rc.top = abd->rc.bottom-1; - abd->uEdge = ABE_BOTTOM; - return TRUE; + TRACE("SHAppBarMessage(ABM_GETTASKBARPOS, hwnd=%p)\n", hwnd); + abd->uEdge = g_TaskbarSettings.sr.Position; + abd->hWnd = GetPrimaryTaskbar(); + return abd->hWnd && GetWindowRect(abd->hWnd, &abd->rc); case ABM_ACTIVATE: return TRUE; case ABM_GETAUTOHIDEBAR: FIXME("SHAppBarMessage(ABM_GETAUTOHIDEBAR, hwnd=%p, edge=%x): stub\n", hwnd, abd->uEdge); - return 0; + if (abd->uEdge == g_TaskbarSettings.sr.Position && g_TaskbarSettings.sr.AutoHide) + return (SIZE_T)GetPrimaryTaskbar(); + return NULL; case ABM_SETAUTOHIDEBAR: FIXME("SHAppBarMessage(ABM_SETAUTOHIDEBAR, hwnd=%p, edge=%x, lparam=%s): stub\n", hwnd, abd->uEdge, wine_dbgstr_longlong(abd->lParam)); diff --git a/sdk/include/psdk/shellapi.h b/sdk/include/psdk/shellapi.h index b153a18177a..479d27d228d 100644 --- a/sdk/include/psdk/shellapi.h +++ b/sdk/include/psdk/shellapi.h @@ -69,6 +69,7 @@ extern "C" { #define ABM_GETAUTOHIDEBAR 7 #define ABM_SETAUTOHIDEBAR 8 #define ABM_WINDOWPOSCHANGED 9 +#define ABM_SETSTATE 10 #define ABN_STATECHANGE 0 #define ABN_POSCHANGED 1 #define ABN_FULLSCREENAPP 2