From 4b26b4d9e61b73fe422bfef00838f75810cbb580 Mon Sep 17 00:00:00 2001 From: ge0rdi Date: Mon, 31 Jul 2023 14:10:46 +0200 Subject: [PATCH] Allow negative horizontal/vertical menu offsets (#1629) 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. --- Src/StartMenu/StartMenuDLL/MenuContainer.cpp | 28 +++----------------- 1 file changed, 3 insertions(+), 25 deletions(-) diff --git a/Src/StartMenu/StartMenuDLL/MenuContainer.cpp b/Src/StartMenu/StartMenuDLL/MenuContainer.cpp index a56e77b..f75b090 100644 --- a/Src/StartMenu/StartMenuDLL/MenuContainer.cpp +++ b/Src/StartMenu/StartMenuDLL/MenuContainer.cpp @@ -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; } @@ -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; }