diff --git a/dll/win32/shell32/shellmenu/CMenuBand.cpp b/dll/win32/shell32/shellmenu/CMenuBand.cpp index aaa21b7847c..e09bc007ee1 100644 --- a/dll/win32/shell32/shellmenu/CMenuBand.cpp +++ b/dll/win32/shell32/shellmenu/CMenuBand.cpp @@ -669,6 +669,14 @@ HRESULT STDMETHODCALLTYPE CMenuBand::IsMenuMessage(MSG *pmsg) HRESULT STDMETHODCALLTYPE CMenuBand::TranslateMenuMessage(MSG *pmsg, LRESULT *plRet) { + if (pmsg->message == WM_ACTIVATE && _IsPopup() == S_FALSE) + { + if (m_staticToolbar) + m_staticToolbar->Invalidate(); + if (m_SFToolbar) + m_SFToolbar->Invalidate(); + } + return S_FALSE; } diff --git a/dll/win32/shell32/shellmenu/CMenuToolbars.cpp b/dll/win32/shell32/shellmenu/CMenuToolbars.cpp index 909c5fb21fa..2e8dbf34632 100644 --- a/dll/win32/shell32/shellmenu/CMenuToolbars.cpp +++ b/dll/win32/shell32/shellmenu/CMenuToolbars.cpp @@ -149,7 +149,7 @@ HRESULT CMenuToolbarBase::OnPagerCalcSize(LPNMPGCALCSIZE csize) HRESULT CMenuToolbarBase::OnCustomDraw(LPNMTBCUSTOMDRAW cdraw, LRESULT * theResult) { - bool isHot, isPopup; + bool isHot, isPopup, isActive; TBBUTTONINFO btni; switch (cdraw->nmcd.dwDrawStage) @@ -160,9 +160,13 @@ HRESULT CMenuToolbarBase::OnCustomDraw(LPNMTBCUSTOMDRAW cdraw, LRESULT * theResu case CDDS_ITEMPREPAINT: + HWND tlw; + m_menuBand->_GetTopLevelWindow(&tlw); + // The item with an active submenu gets the CHECKED flag. isHot = m_hotBar == this && (int) cdraw->nmcd.dwItemSpec == m_hotItem; isPopup = m_popupBar == this && (int) cdraw->nmcd.dwItemSpec == m_popupItem; + isActive = (GetForegroundWindow() == tlw) || (m_popupBar == this); if (m_hotItem < 0 && isPopup) isHot = TRUE; @@ -207,7 +211,7 @@ HRESULT CMenuToolbarBase::OnCustomDraw(LPNMTBCUSTOMDRAW cdraw, LRESULT * theResu else { // Set the text color, will be used by the internal drawing code - cdraw->clrText = GetSysColor(COLOR_MENUTEXT); + cdraw->clrText = GetSysColor(isActive ? COLOR_MENUTEXT : COLOR_GRAYTEXT); // Remove HOT and CHECKED flags (will restore HOT if necessary) cdraw->nmcd.uItemState &= ~CDIS_HOT;