summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYli875 <qq3202390739@gmail.com>2023-11-28 18:18:04 -0800
committerMichael Weghorn <m.weghorn@posteo.de>2023-12-25 01:03:33 +0100
commitf989ee32b35ee4f0750ae313d35d225d252d64d4 (patch)
tree974608e9611878264341a6278a4f3521ae24b7c4
parent04eb7f5a47b77511dd7a6e797b66ef2cfffce235 (diff)
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>
-rw-r--r--vcl/win/gdi/salnativewidgets-luna.cxx22
-rw-r--r--vcl/win/window/salframe.cxx3
2 files changed, 21 insertions, 4 deletions
diff --git a/vcl/win/gdi/salnativewidgets-luna.cxx b/vcl/win/gdi/salnativewidgets-luna.cxx
index c5a368c8c52c..318009acadae 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 019ebaf229dd..cf2c8c6f8b02 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 );