vcl/osx/salframe.cxx | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-)
New commits: commit 87318da781b429abd8261a8b64bb8d72c79b9da2 Author: Thorsten Wagner <thorsten.wagne...@gmail.com> AuthorDate: Thu Aug 25 10:16:50 2022 +0200 Commit: Adolfo Jayme Barrientos <fit...@ubuntu.com> CommitDate: Sun Aug 28 06:20:28 2022 +0200 Adjust button text colors for macOS Big Sur Change-Id: I1bbdcc97d65afbebce0b2d2e7530f156aa037315 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138799 Tested-by: Jenkins Reviewed-by: Adolfo Jayme Barrientos <fit...@ubuntu.com> diff --git a/vcl/osx/salframe.cxx b/vcl/osx/salframe.cxx index 574122a1a91d..2685705287c8 100644 --- a/vcl/osx/salframe.cxx +++ b/vcl/osx/salframe.cxx @@ -1288,13 +1288,17 @@ SAL_WNODEPRECATED_DECLARATIONS_POP aStyleSettings.SetListBoxWindowHighlightColor( aMenuHighlightColor ); aStyleSettings.SetListBoxWindowHighlightTextColor( aMenuHighlightTextColor ); + // FIXME: Starting with macOS Big Sur, coloring has changed. Currently there is no documentation which system color should be + // used for some button states and for selected tab text. As a workaround the current OS version has to be considered. This code + // has to be reviewed once issue is covered by documentation. + // Set text colors for buttons and their different status according to OS settings, typically white for selected buttons, // black otherwise + NSOperatingSystemVersion aOSVersion = { .majorVersion = 10, .minorVersion = 16, .patchVersion = 0 }; Color aControlTextColor(getColor([NSColor controlTextColor], COL_BLACK, mpNSWindow)); Color aSelectedControlTextColor(getColor([NSColor selectedControlTextColor], COL_BLACK, mpNSWindow)); Color aAlternateSelectedControlTextColor(getColor([NSColor alternateSelectedControlTextColor], COL_WHITE, mpNSWindow)); - aStyleSettings.SetDefaultButtonTextColor(aAlternateSelectedControlTextColor); aStyleSettings.SetButtonTextColor(aControlTextColor); aStyleSettings.SetDefaultActionButtonTextColor(aAlternateSelectedControlTextColor); aStyleSettings.SetActionButtonTextColor(aControlTextColor); @@ -1305,20 +1309,24 @@ SAL_WNODEPRECATED_DECLARATIONS_POP aStyleSettings.SetActionButtonRolloverTextColor(aControlTextColor); aStyleSettings.SetFlatButtonRolloverTextColor(aControlTextColor); aStyleSettings.SetDefaultButtonPressedRolloverTextColor(aAlternateSelectedControlTextColor); - aStyleSettings.SetButtonPressedRolloverTextColor(aAlternateSelectedControlTextColor); aStyleSettings.SetDefaultActionButtonPressedRolloverTextColor(aAlternateSelectedControlTextColor); - aStyleSettings.SetActionButtonPressedRolloverTextColor(aAlternateSelectedControlTextColor); aStyleSettings.SetFlatButtonPressedRolloverTextColor(aControlTextColor); + if ([NSProcessInfo.processInfo isOperatingSystemAtLeastVersion: aOSVersion]) + { + aStyleSettings.SetDefaultButtonTextColor(aAlternateSelectedControlTextColor); + aStyleSettings.SetButtonPressedRolloverTextColor(aSelectedControlTextColor); + aStyleSettings.SetActionButtonPressedRolloverTextColor(aSelectedControlTextColor); + } + else + { + aStyleSettings.SetButtonPressedRolloverTextColor(aAlternateSelectedControlTextColor); + aStyleSettings.SetActionButtonPressedRolloverTextColor(aAlternateSelectedControlTextColor); + aStyleSettings.SetDefaultButtonTextColor(aSelectedControlTextColor); + } // Set text colors for tabs according to OS settings aStyleSettings.SetTabTextColor(aControlTextColor); - - // FIXME: Starting with macOS Big Sur, coloring has changed. Currently there is no documentation which system color should be - // used for selected tab text. As a workaround the current OS version has to be considered. This code has to be reviewed once - // issue is covered by documentation. - - NSOperatingSystemVersion aOSVersion = { .majorVersion = 10, .minorVersion = 16, .patchVersion = 0 }; if ([NSProcessInfo.processInfo isOperatingSystemAtLeastVersion: aOSVersion]) aStyleSettings.SetTabHighlightTextColor(aSelectedControlTextColor); else