https://git.reactos.org/?p=reactos.git;a=commitdiff;h=5618b33c3b9472c7f5805…
commit 5618b33c3b9472c7f5805fe20312d1d6c7a72691
Author: Giannis Adamopoulos <gadamopoulos(a)reactos.org>
AuthorDate: Sat Jan 13 14:57:24 2018 +0200
Commit: Giannis Adamopoulos <gadamopoulos(a)reactos.org>
CommitDate: Sat Jan 13 14:57:24 2018 +0200
[SHELL32] CMenuBand: Redraw the toolbars if this is the menu bar of a window and its
active state changed. Use COLOR_GRAYTEXT for the text of the inactive menu bar items.
CORE-14197
---
dll/win32/shell32/shellmenu/CMenuBand.cpp | 8 ++++++++
dll/win32/shell32/shellmenu/CMenuToolbars.cpp | 8 ++++++--
2 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/dll/win32/shell32/shellmenu/CMenuBand.cpp
b/dll/win32/shell32/shellmenu/CMenuBand.cpp
index aaa21b7847..e09bc007ee 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 909c5fb21f..2e8dbf3463 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;