Skip to content

Commit faf79de

Browse files
committed
Fix custom button position on auto-hiding taskbar
Fixes #2067.
1 parent 552fbd8 commit faf79de

File tree

1 file changed

+19
-3
lines changed

1 file changed

+19
-3
lines changed

Src/StartMenu/StartMenuDLL/StartMenuDLL.cpp

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1216,17 +1216,33 @@ void EnableHotkeys( THotkeys enable )
12161216
}
12171217
}
12181218

1219+
bool IsTouchTaskbar(void)
1220+
{
1221+
if (!IsWin11())
1222+
return false;
1223+
1224+
CRegKey regKey;
1225+
if (regKey.Open(HKEY_CURRENT_USER, L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer") != ERROR_SUCCESS)
1226+
return false;
1227+
1228+
DWORD val;
1229+
return regKey.QueryDWORDValue(L"TabletPostureTaskbar", val) == ERROR_SUCCESS && val;
1230+
}
1231+
12191232
static void UpdateStartButtonPosition(const TaskbarInfo* taskBar, const WINDOWPOS* pPos)
12201233
{
12211234
if (IsStartButtonSmallIcons(taskBar->taskbarId) != IsTaskbarSmallIcons())
12221235
RecreateStartButton(taskBar->taskbarId);
12231236

12241237
RECT rcTask;
12251238
GetWindowRect(taskBar->taskBar, &rcTask);
1226-
if (RECT rc; GetWindowRgnBox(taskBar->taskBar, &rc) != ERROR)
1239+
if (IsTouchTaskbar())
12271240
{
1228-
MapWindowPoints(taskBar->taskBar, NULL, (POINT*)&rc, 2);
1229-
rcTask = rc;
1241+
if (RECT rc; GetWindowRgnBox(taskBar->taskBar, &rc) != ERROR)
1242+
{
1243+
MapWindowPoints(taskBar->taskBar, NULL, (POINT*)&rc, 2);
1244+
rcTask = rc;
1245+
}
12301246
}
12311247
MONITORINFO info;
12321248
UINT uEdge = GetTaskbarPosition(taskBar->taskBar, &info, NULL, NULL);

0 commit comments

Comments
 (0)