diff --git a/Src/Common/MDITabBar.cpp b/Src/Common/MDITabBar.cpp index 5a931c2b4a7..dac033df011 100644 --- a/Src/Common/MDITabBar.cpp +++ b/Src/Common/MDITabBar.cpp @@ -9,6 +9,7 @@ #include "IMDITab.h" #include "cecolor.h" #include "RoundedRectWithShadow.h" +#include "MainFrm.h" #ifdef _DEBUG #define new DEBUG_NEW @@ -96,7 +97,10 @@ static COLORREF getBackColor(bool onTitleBar) const COLORREF clr = GetSysColor(COLOR_3DFACE); if (!onTitleBar) return clr; - return RGB(GetRValue(clr), std::clamp(GetGValue(clr) + 8, 0, 255), std::clamp(GetBValue(clr) + 8, 0, 255)); + const COLORREF bgclr = dynamic_cast(AfxGetMainWnd())->IsActivate() ? + RGB(GetRValue(clr), std::clamp(GetGValue(clr) + 8, 0, 255), std::clamp(GetBValue(clr) + 8, 0, 255)) + : clr; + return bgclr; } static inline bool IsHighContrastEnabled() diff --git a/Src/MainFrm.cpp b/Src/MainFrm.cpp index 5dd5bed4c6a..caa45f89354 100644 --- a/Src/MainFrm.cpp +++ b/Src/MainFrm.cpp @@ -366,6 +366,7 @@ CMainFrame::CMainFrame() , m_lfDiff(Options::Font::Load(GetOptionsMgr(), OPT_FONT_FILECMP)) , m_lfDir(Options::Font::Load(GetOptionsMgr(), OPT_FONT_DIRCMP)) , m_pDirWatcher(new DirWatcher()) +, m_bActivate(false) { } @@ -2540,6 +2541,16 @@ void CMainFrame::OnActivateApp(BOOL bActive, DWORD dwThreadID) if (IMergeDoc* pMergeDoc = GetActiveIMergeDoc()) PostMessage(WM_USER + 1); } + + const bool bActivate = static_cast(bActive); + if ( bActivate != m_bActivate) + { + m_bActivate = bActivate; + + CRect titleBarRect; + m_wndTabBar.GetClientRect(&titleBarRect); + InvalidateRect(&titleBarRect, TRUE); + } } void CMainFrame::OnNcCalcSize(BOOL bCalcValidRects, NCCALCSIZE_PARAMS FAR* lpncsp) diff --git a/Src/MainFrm.h b/Src/MainFrm.h index 39ddafe2a6a..3b5d0bca8a3 100644 --- a/Src/MainFrm.h +++ b/Src/MainFrm.h @@ -228,6 +228,7 @@ class CMainFrame : public CMDIFrameWnd CMenuBar* GetMenuBar() { return &m_wndMenuBar; } CToolBar* GetToolbar() { return &m_wndToolBar; } static void WaitAndDoMessageLoop(bool& completed, int ms); + bool IsActivate() const { return m_bActivate; } // Overrides virtual void GetMessageString(UINT nID, CString& rMessage) const; @@ -454,4 +455,5 @@ class CMainFrame : public CMDIFrameWnd bool CompareFilesIfFilesAreLarge(IDirDoc* pDirDoc, int nFiles, const FileLocation ifileloc[]); std::unique_ptr m_upszLongTextW; std::unique_ptr m_upszLongTextA; + bool m_bActivate; };