Skip to content

Commit

Permalink
Tried to fix invisible tabs issue upon maximizing window but this doe…
Browse files Browse the repository at this point in the history
…sn't seem to entirely work, submitting this to create a pull request that another developer can test
  • Loading branch information
Wallby committed Jan 30, 2024
1 parent 116e571 commit fae1ca5
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 3 deletions.
30 changes: 27 additions & 3 deletions src/TabBar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ CTabBar::CTabBar(HINSTANCE hInst)
, m_tabBarDefaultProc(nullptr)
, m_tabBarSpinDefaultProc(nullptr)
, m_spin(nullptr)
, m_bIsSpinVisible(false)
, m_currentHoverTabItem(-1)
, m_bIsCloseHover(false)
, m_whichCloseClickDown(-1)
Expand Down Expand Up @@ -483,7 +484,7 @@ LRESULT CTabBar::RunProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)

DrawMainBorder(&dis);

if (m_spin)
if (m_bIsSpinVisible)
{
RECT rcSpin{};
GetWindowRect(m_spin, &rcSpin);
Expand Down Expand Up @@ -677,7 +678,7 @@ LRESULT CTabBar::RunProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
auto index = GetTabIndexAt(xPos, yPos);
RECT rcItem{};
TabCtrl_GetItemRect(*this, index, &rcItem);
if (m_spin)
if (m_bIsSpinVisible)
{
RECT rcSpin{};
GetWindowRect(m_spin, &rcSpin);
Expand Down Expand Up @@ -754,7 +755,7 @@ LRESULT CTabBar::RunProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
RECT rPage{};
GetClientRect(*this, &rPage);
TabCtrl_AdjustRect(*this, FALSE, &rPage);
if (m_spin)
if (m_bIsSpinVisible)
{
RECT rcSpin{};
GetWindowRect(m_spin, &rcSpin);
Expand Down Expand Up @@ -1272,6 +1273,13 @@ LRESULT CTabBar::TabBarSpin_Proc(HWND hwnd, UINT message, WPARAM wParam, LPARAM
{
case WM_PAINT:
{
// as WM_SHOWWINDOW is only ever sent with wParam == FALSE, use WM_PAINT instead of WM_SHOWWINDOW with wParam == TRUE
// alternatives might be WM_NCPAINT or 1125, which also both seem to be only sent when updown control is unhidden
if (!pTab->m_bIsSpinVisible)
{
pTab->m_bIsSpinVisible = true;
}

PAINTSTRUCT ps;
BeginPaint(hwnd, &ps);
HDC hdc = ps.hdc;
Expand Down Expand Up @@ -1472,8 +1480,23 @@ LRESULT CTabBar::TabBarSpin_Proc(HWND hwnd, UINT message, WPARAM wParam, LPARAM
InvalidateRect(hwnd, nullptr, false);
}
break;
case WM_SHOWWINDOW:
{
if (wParam == FALSE) //< checked and is only ever sent with wParam == FALSE
{
pTab->m_bIsSpinVisible = false;
}
/*
else
{
pTab->m_bIsSpinVisible = true;
}
*/
break;
}
case WM_DESTROY:
{
pTab->m_bIsSpinVisible = false;
pTab->m_spin = nullptr;
break;
}
Expand Down Expand Up @@ -1533,6 +1556,7 @@ void CTabBar::SubclassSpinBox()

pThis->m_tabBarSpinDefaultProc = reinterpret_cast<WNDPROC>(::SetWindowLongPtr(hChild, GWLP_WNDPROC, reinterpret_cast<LONG_PTR>(TabBarSpin_Proc)));
pThis->m_spin = hChild;
pThis->m_bIsSpinVisible = true;
return FALSE;
}
return TRUE;
Expand Down
1 change: 1 addition & 0 deletions src/TabBar.h
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ class CTabBar : public CWindow
WNDPROC m_tabBarDefaultProc;
WNDPROC m_tabBarSpinDefaultProc;
HWND m_spin;
bool m_bIsSpinVisible;

RECT m_currentHoverTabRect;
int m_currentHoverTabItem;
Expand Down

0 comments on commit fae1ca5

Please sign in to comment.