Skip to content

Commit

Permalink
Allow negative horizontal/vertical menu offsets (#1629)
Browse files Browse the repository at this point in the history
Menu offsets were previously applied to s_MainMenuLimits.
Though when deciding where to put start menu (CalculateCorner) we are
now taking into account also position of start button (as since Win11 it
may not be in corner of the screen).

This broke negative menu offsets.

We will fix it by applying menu offsets in CalculateCorner as a last
step once we have determined start menu position.
This should make even more sense than previous approach.
  • Loading branch information
ge0rdi committed Aug 16, 2023
1 parent 2f251c4 commit 4b26b4d
Showing 1 changed file with 3 additions and 25 deletions.
28 changes: 3 additions & 25 deletions Src/StartMenu/StartMenuDLL/MenuContainer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7509,31 +7509,6 @@ RECT CMenuContainer::CalculateWorkArea( const RECT &taskbarRect )
}
}

//calculate offsets
int xOff = GetSettingInt(L"HorizontalMenuOffset");
int yOff = GetSettingInt(L"VerticalMenuOffset");
if (s_TaskBarEdge == ABE_BOTTOM)
{
if (xOff != 0)
rc.left += xOff;
if (yOff != 0)
rc.bottom += yOff;
}
else if (s_TaskBarEdge == ABE_TOP || s_TaskBarEdge == ABE_LEFT)
{
if (xOff != 0)
rc.left += xOff;
if (yOff != 0)
rc.top += yOff;
}
else
{
if (xOff != 0)
rc.right += xOff;
if (yOff != 0)
rc.top += yOff;
}

return rc;
}

Expand All @@ -7560,6 +7535,9 @@ POINT CMenuContainer::CalculateCorner( void )
else
corner.y=s_MainMenuLimits.bottom+margin.bottom;

corner.x+=GetSettingInt(L"HorizontalMenuOffset");
corner.y+=GetSettingInt(L"VerticalMenuOffset");

return corner;
}

Expand Down

0 comments on commit 4b26b4d

Please sign in to comment.