Skip to content

Commit f204a72

Browse files
authored
Merge e482a7b into 859afc6
2 parents 859afc6 + e482a7b commit f204a72

File tree

4 files changed

+75
-23
lines changed

4 files changed

+75
-23
lines changed

Src/StartMenu/StartMenuDLL/MenuContainer.cpp

Lines changed: 60 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -6253,7 +6253,7 @@ LRESULT CMenuContainer::OnDestroy( UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL
62536253
}
62546254

62556255
if (s_pFrameworkInputPane && m_InputCookie)
6256-
s_pFrameworkInputPane->Unadvise(m_InputCookie);
6256+
s_pFrameworkInputPane->Unadvise(m_InputCookie);
62576257

62586258
return 0;
62596259
}
@@ -7401,35 +7401,46 @@ bool CMenuContainer::HasMoreResults( void )
74017401

74027402
RECT CMenuContainer::CalculateWorkArea( const RECT &taskbarRect )
74037403
{
7404-
RECT rc=s_MenuLimits;
7405-
if ((s_TaskBarEdge==ABE_LEFT || s_TaskBarEdge==ABE_RIGHT) && GetSettingBool(L"ShowNextToTaskbar"))
7406-
{
7407-
// when the taskbar is on the side and the menu is not on top of it
7408-
// the start button is assumed at the top
7409-
if (s_TaskBarEdge==ABE_LEFT)
7410-
rc.left=taskbarRect.right;
7411-
else
7412-
rc.right=taskbarRect.left;
7413-
}
7414-
else
7404+
RECT rc;
7405+
if (!GetSettingBool(L"AlignToWorkArea"))
74157406
{
7416-
if (s_TaskBarEdge==ABE_BOTTOM)
7417-
{
7418-
// taskbar is at the bottom
7419-
rc.bottom=taskbarRect.top;
7420-
}
7421-
else if (s_TaskBarEdge==ABE_TOP)
7407+
rc = s_MenuLimits;
7408+
if ((s_TaskBarEdge == ABE_LEFT || s_TaskBarEdge == ABE_RIGHT) && GetSettingBool(L"ShowNextToTaskbar"))
74227409
{
7423-
// taskbar is at the top
7424-
rc.top=taskbarRect.bottom;
7410+
// when the taskbar is on the side and the menu is not on top of it
7411+
// the start button is assumed at the top
7412+
if (s_TaskBarEdge == ABE_LEFT)
7413+
rc.left = taskbarRect.right;
7414+
else
7415+
rc.right = taskbarRect.left;
74257416
}
74267417
else
74277418
{
7428-
// taskbar is on the side, start button must be at the top
7429-
rc.top=s_StartRect.bottom;
7419+
if (s_TaskBarEdge == ABE_BOTTOM)
7420+
{
7421+
// taskbar is at the bottom
7422+
rc.bottom = taskbarRect.top;
7423+
}
7424+
else if (s_TaskBarEdge == ABE_TOP)
7425+
{
7426+
// taskbar is at the top
7427+
rc.top = taskbarRect.bottom;
7428+
}
7429+
else
7430+
{
7431+
// taskbar is on the side, start button must be at the top
7432+
rc.top = s_StartRect.bottom;
7433+
}
74307434
}
74317435
}
7432-
7436+
else
7437+
{
7438+
// Get working area of the monitor the specified taskbar is on
7439+
MONITORINFO info{ sizeof(MONITORINFO) };
7440+
HMONITOR mon = MonitorFromRect(&taskbarRect, 0);
7441+
GetMonitorInfo(mon, &info);
7442+
rc = info.rcWork;
7443+
}
74337444
if (!s_bLockWorkArea)
74347445
{
74357446
// exclude floating keyboard
@@ -7455,6 +7466,32 @@ RECT CMenuContainer::CalculateWorkArea( const RECT &taskbarRect )
74557466
}
74567467
}
74577468
}
7469+
7470+
//calculate offsets
7471+
int xOff = GetSettingInt(L"HorizontalMenuOffset");
7472+
int yOff = GetSettingInt(L"VerticalMenuOffset");
7473+
if (s_TaskBarEdge == ABE_BOTTOM)
7474+
{
7475+
if (xOff != 0)
7476+
rc.left += xOff;
7477+
if (yOff != 0)
7478+
rc.bottom += yOff;
7479+
}
7480+
else if (s_TaskBarEdge == ABE_TOP || s_TaskBarEdge == ABE_LEFT)
7481+
{
7482+
if (xOff != 0)
7483+
rc.left += xOff;
7484+
if (yOff != 0)
7485+
rc.top += yOff;
7486+
}
7487+
else
7488+
{
7489+
if (xOff != 0)
7490+
rc.right += xOff;
7491+
if (yOff != 0)
7492+
rc.top += yOff;
7493+
}
7494+
74587495
return rc;
74597496
}
74607497

Src/StartMenu/StartMenuDLL/SettingsUI.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4348,6 +4348,9 @@ CSetting g_Settings[]={
43484348
{L"InvertMetroIcons",CSetting::TYPE_BOOL,IDS_INVERT_ICONS,IDS_INVERT_ICONS_TIP,0},
43494349
{L"MaxMainMenuWidth",CSetting::TYPE_INT,IDS_MENU_WIDTH,IDS_MENU_WIDTH_TIP,60,CSetting::FLAG_MENU_CLASSIC_BOTH},
43504350
{L"MaxMenuWidth",CSetting::TYPE_INT,IDS_SUBMENU_WIDTH,IDS_SUBMENU_WIDTH_TIP,60},
4351+
{L"AlignToWorkArea",CSetting::TYPE_BOOL,IDS_ALIGN_WORK_AREA,IDS_ALIGN_WORK_AREA_TIP,0},
4352+
{L"HorizontalMenuOffset",CSetting::TYPE_INT,IDS_HOR_OFFSET,IDS_HOR_OFFSET_TIP,0},
4353+
{L"VerticalMenuOffset",CSetting::TYPE_INT,IDS_VERT_OFFSET,IDS_VERT_OFFSET_TIP,0 },
43514354
{L"OverrideDPI",CSetting::TYPE_INT,IDS_DPI_OVERRIDE,IDS_DPI_OVERRIDE_TIP,0,CSetting::FLAG_COLD},
43524355
{L"MainMenuAnimate",CSetting::TYPE_BOOL,IDS_ANIMATION7,IDS_ANIMATION7_TIP,1,CSetting::FLAG_MENU_WIN7},
43534356
{L"MainMenuAnimation",CSetting::TYPE_INT,IDS_ANIMATION,IDS_ANIMATION_TIP,-1}, // system animation type

Src/StartMenu/StartMenuDLL/StartMenuDLL.rc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -644,6 +644,12 @@ BEGIN
644644
IDS_PIC_COMMAND_TIP "Enter the command you want to run when you click on the user picture"
645645
IDS_NAME_COMMAND "User name command"
646646
IDS_NAME_COMMAND_TIP "Enter the command you want to run when you click on the user name"
647+
IDS_ALIGN_WORK_AREA "Align start menu to working area"
648+
IDS_ALIGN_WORK_AREA_TIP "Align the start menu to the working area instead of to the taskbar. Use with custom taskbars"
649+
IDS_HOR_OFFSET "Horizontal position offset"
650+
IDS_HOR_OFFSET_TIP "Offset the start menu horizontally by the amount of pixels specified"
651+
IDS_VERT_OFFSET "Vertical position offset"
652+
IDS_VERT_OFFSET_TIP "Offset the start menu vertically by the amount of pixels specified"
647653
IDS_SMALL_SIZE_SM "Small icon size"
648654
IDS_SMALL_SIZE_SM_TIP "Set the small icon size. The default is 16 for DPI<=96, 20 for 96<DPI<=120 and 24 for DPI>120"
649655
IDS_LARGE_SIZE_SM "Large icon size"

Src/StartMenu/StartMenuDLL/resource.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -754,6 +754,12 @@
754754
#define IDS_SELECT_LAST 3657
755755
#define IDS_SELECT_LAST_TIP 3658
756756
#define IDS_CLEAR_CACHE 3659
757+
#define IDS_ALIGN_WORK_AREA 3660
758+
#define IDS_ALIGN_WORK_AREA_TIP 3661
759+
#define IDS_HOR_OFFSET 3662
760+
#define IDS_HOR_OFFSET_TIP 3663
761+
#define IDS_VERT_OFFSET 3664
762+
#define IDS_VERT_OFFSET_TIP 3665
757763
#define IDS_STRING7001 7001
758764
#define IDS_STRING7002 7002
759765
#define IDS_STRING7003 7003

0 commit comments

Comments
 (0)