@@ -7401,35 +7401,46 @@ bool CMenuContainer::HasMoreResults( void )
74017401
74027402RECT 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
0 commit comments