Skip to content

Commit

Permalink
Fix issue #2518: When WinMerge window is maximized, it prevents auto-…
Browse files Browse the repository at this point in the history
…hidden Windows 11 taskbar from appearing (This fix only works when the taskbar is at the bottom)
  • Loading branch information
sdottaka committed Nov 6, 2024
1 parent c73bd25 commit e57eee8
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 15 deletions.
12 changes: 11 additions & 1 deletion Src/MainFrm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2549,7 +2549,17 @@ void CMainFrame::OnNcCalcSize(BOOL bCalcValidRects, NCCALCSIZE_PARAMS FAR* lpncs
RECT rcWindow = lpncsp->rgrc[0];
__super::OnNcCalcSize(bCalcValidRects, lpncsp);
if (m_bTabsOnTitleBar.value_or(false) && m_wndTabBar.IsVisible())
lpncsp->rgrc[0].top = rcWindow.top + 0;
{
if (IsZoomed())
{
lpncsp->rgrc[0].top = rcWindow.top + GetSystemMetrics(SM_CYFRAME) + GetSystemMetrics(SM_CXPADDEDBORDER);
//lpncsp->rgrc[0].left += 1;
//lpncsp->rgrc[0].right -= 1;
lpncsp->rgrc[0].bottom -= 1;
}
else
lpncsp->rgrc[0].top = rcWindow.top + 0;
}
}

void CMainFrame::OnSize(UINT nType, int cx, int cy)
Expand Down
23 changes: 10 additions & 13 deletions Src/TitleBarHelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@ void CTitleBarHelper::Init(CWnd *pWnd)

int CTitleBarHelper::GetTopMargin() const
{
return m_maximized ?
GetSystemMetrics(SM_CYFRAME) + GetSystemMetrics(SM_CXPADDEDBORDER) : 0;
return 0;
}

void CTitleBarHelper::DrawIcon(CWnd* pWnd, CDC& dc)
Expand Down Expand Up @@ -145,29 +144,27 @@ void CTitleBarHelper::SetSize(int cx, int cy)
m_size = CSize(cx, cy);
CClientDC dc(m_pWnd);
m_dpi = dc.GetDeviceCaps(LOGPIXELSX);
m_pWnd->GetWindowRect(&m_rc);
}

LRESULT CTitleBarHelper::OnNcHitTest(CPoint pt)
{
if (!m_pWnd)
return HTNOWHERE;
CClientDC dc(m_pWnd);
const int leftMargin = PointToPixel(m_leftMargin);
const int rightMargin = PointToPixel(m_rightMargin);
const int borderWidth = PointToPixel(6);
CRect rc;
m_pWnd->GetWindowRect(&rc);
if (pt.y < rc.top + borderWidth)
{
if (pt.x < rc.left + borderWidth)
return HTTOPLEFT;
else if (rc.right - borderWidth <= pt.x)
return HTTOPRIGHT;
return HTTOP;
}
AfxGetMainWnd()->GetWindowRect(&rc);
if (!m_maximized)
{
if (pt.y < rc.top + borderWidth)
{
if (pt.x < rc.left + borderWidth)
return HTTOPLEFT;
else if (rc.right - borderWidth <= pt.x)
return HTTOPRIGHT;
return HTTOP;
}
if (pt.x < rc.left + borderWidth)
return HTLEFT;
if (rc.right - borderWidth <= pt.x)
Expand Down
1 change: 0 additions & 1 deletion Src/TitleBarHelper.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ class CTitleBarHelper {

CWnd* m_pWnd;
CSize m_size;
CRect m_rc;
bool m_maximized;
bool m_bMouseTracking;
int m_nTrackingButton;
Expand Down

0 comments on commit e57eee8

Please sign in to comment.