tdf#99116 modify menu highlight text color in high contrast mode on win
In high contrast mode, persona color won't overwrite the menu highlight text color.
This commit fixes this aspect when using the High Contrast theme on Windows, mentioned in tdf#99116 comment 20:
> expanded top menu hover colour is correct but the white text does not invert to black (although this is not specific to the Start Center)
Change-Id: I1575226d966d60af93b5d64934c965f61b8f2d69
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160058
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
(cherry picked from commit f989ee32b35ee4f0750ae313d35d225d252d64d4)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161228
Reviewed-by: Adolfo Jayme Barrientos <fitojb@ubuntu.com>
diff --git a/vcl/win/gdi/salnativewidgets-luna.cxx b/vcl/win/gdi/salnativewidgets-luna.cxx
index c5a368c..318009a 100644
--- a/vcl/win/gdi/salnativewidgets-luna.cxx
+++ b/vcl/win/gdi/salnativewidgets-luna.cxx
@@ -990,6 +990,17 @@ static bool ImplDrawNativeControl( HDC hDC, HTHEME hTheme, RECT rc,
iState = MBI_HOT;
else
iState = MBI_NORMAL;
if(GetSalData()->mbThemeMenuSupport && Application::GetSettings().GetStyleSettings().GetHighContrastMode()
&& ( nState & (ControlState::SELECTED | nState & ControlState::ROLLOVER )))
{
Color aColor(Application::GetSettings().GetStyleSettings().GetHighlightColor());
ScopedHBRUSH hbrush(CreateSolidBrush(RGB(aColor.GetRed(),
aColor.GetGreen(),
aColor.GetBlue())));
FillRect(hDC, &rc, hbrush.get());
return true;
}
}
else
{
@@ -1604,9 +1615,14 @@ void WinSalGraphics::updateSettingsNative( AllSettings& rSettings )
// FIXME get the color directly from the theme, not from the settings
Color aMenuBarTextColor = aStyleSettings.GetPersonaMenuBarTextColor().value_or( aStyleSettings.GetMenuTextColor() );
// in aero menuitem highlight text is drawn in the same color as normal
aStyleSettings.SetMenuHighlightTextColor( aStyleSettings.GetMenuTextColor() );
aStyleSettings.SetMenuBarRolloverTextColor( aMenuBarTextColor );
aStyleSettings.SetMenuBarHighlightTextColor( aMenuBarTextColor );
// high contrast highlight color is not related to persona and not apply blur or transparency
if( !aStyleSettings.GetHighContrastMode() )
{
aStyleSettings.SetMenuHighlightTextColor( aStyleSettings.GetMenuTextColor() );
aStyleSettings.SetMenuBarRolloverTextColor( aMenuBarTextColor );
aStyleSettings.SetMenuBarHighlightTextColor( aMenuBarTextColor );
}
pSVData->maNWFData.mnMenuFormatBorderX = 2;
pSVData->maNWFData.mnMenuFormatBorderY = 2;
pSVData->maNWFData.maMenuBarHighlightTextColor = aMenuBarTextColor;
diff --git a/vcl/win/window/salframe.cxx b/vcl/win/window/salframe.cxx
index 019ebaf..cf2c8c6 100644
--- a/vcl/win/window/salframe.cxx
+++ b/vcl/win/window/salframe.cxx
@@ -2809,7 +2809,8 @@ void WinSalFrame::UpdateSettings( AllSettings& rSettings )
if ( std::optional<Color> aColor = aStyleSettings.GetPersonaMenuBarTextColor() )
{
aMenuBarTextColor = *aColor;
aMenuBarRolloverTextColor = *aColor;
if (!aStyleSettings.GetHighContrastMode())
aMenuBarRolloverTextColor = *aColor;
}
aStyleSettings.SetMenuBarTextColor( aMenuBarTextColor );