Skip to content

Commit

Permalink
Fix custom button position on auto-hiding taskbar
Browse files Browse the repository at this point in the history
Fixes #2067.
  • Loading branch information
ge0rdi committed Jan 4, 2025
1 parent 552fbd8 commit faf79de
Showing 1 changed file with 19 additions and 3 deletions.
22 changes: 19 additions & 3 deletions Src/StartMenu/StartMenuDLL/StartMenuDLL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1216,17 +1216,33 @@ void EnableHotkeys( THotkeys enable )
}
}

bool IsTouchTaskbar(void)
{
if (!IsWin11())
return false;

CRegKey regKey;
if (regKey.Open(HKEY_CURRENT_USER, L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer") != ERROR_SUCCESS)
return false;

DWORD val;
return regKey.QueryDWORDValue(L"TabletPostureTaskbar", val) == ERROR_SUCCESS && val;
}

static void UpdateStartButtonPosition(const TaskbarInfo* taskBar, const WINDOWPOS* pPos)
{
if (IsStartButtonSmallIcons(taskBar->taskbarId) != IsTaskbarSmallIcons())
RecreateStartButton(taskBar->taskbarId);

RECT rcTask;
GetWindowRect(taskBar->taskBar, &rcTask);
if (RECT rc; GetWindowRgnBox(taskBar->taskBar, &rc) != ERROR)
if (IsTouchTaskbar())
{
MapWindowPoints(taskBar->taskBar, NULL, (POINT*)&rc, 2);
rcTask = rc;
if (RECT rc; GetWindowRgnBox(taskBar->taskBar, &rc) != ERROR)
{
MapWindowPoints(taskBar->taskBar, NULL, (POINT*)&rc, 2);
rcTask = rc;
}
}
MONITORINFO info;
UINT uEdge = GetTaskbarPosition(taskBar->taskBar, &info, NULL, NULL);
Expand Down

0 comments on commit faf79de

Please sign in to comment.