[Libreoffice-commits] core.git: vcl/osx

Thorsten Wagner (via logerrit) logerrit at kemper.freedesktop.org
Sun Jan 17 20:38:52 UTC 2021


 vcl/osx/salframe.cxx |   32 +++++++++++++++++++++-----------
 1 file changed, 21 insertions(+), 11 deletions(-)

New commits:
commit 058ad4b900b5e0ee902f3e89ed121c2b5f8c58f1
Author:     Thorsten Wagner <thorsten.wagner.4 at gmail.com>
AuthorDate: Sun Jan 17 20:24:26 2021 +0100
Commit:     Tor Lillqvist <tml at collabora.com>
CommitDate: Sun Jan 17 21:38:12 2021 +0100

    tdf#138314 Change selected tab text color on macOS Big Sur
    
    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 text color is changed for macOS Big Sur and
    newer only.
    
    Change-Id: I2e8c83527775c17f95e5e4afe70577442e14715e
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109479
    Tested-by: Tor Lillqvist <tml at collabora.com>
    Reviewed-by: Tor Lillqvist <tml at collabora.com>

diff --git a/vcl/osx/salframe.cxx b/vcl/osx/salframe.cxx
index b4168a2142e7..9d4f68827a06 100644
--- a/vcl/osx/salframe.cxx
+++ b/vcl/osx/salframe.cxx
@@ -1302,27 +1302,37 @@ SAL_WNODEPRECATED_DECLARATIONS_POP
     // black otherwise
 
     Color aControlTextColor(getColor([NSColor controlTextColor], COL_BLACK, mpNSWindow));
-    Color aSelectedControlTextColor(getColor([NSColor alternateSelectedControlTextColor], COL_WHITE, mpNSWindow));
-    aStyleSettings.SetDefaultButtonTextColor(aSelectedControlTextColor);
+    Color aSelectedControlTextColor(getColor([NSColor selectedControlTextColor], COL_BLACK, mpNSWindow));
+    Color aAlternateSelectedControlTextColor(getColor([NSColor alternateSelectedControlTextColor], COL_WHITE, mpNSWindow));
+    aStyleSettings.SetDefaultButtonTextColor(aAlternateSelectedControlTextColor);
     aStyleSettings.SetButtonTextColor(aControlTextColor);
-    aStyleSettings.SetDefaultActionButtonTextColor(aSelectedControlTextColor);
+    aStyleSettings.SetDefaultActionButtonTextColor(aAlternateSelectedControlTextColor);
     aStyleSettings.SetActionButtonTextColor(aControlTextColor);
     aStyleSettings.SetFlatButtonTextColor(aControlTextColor);
-    aStyleSettings.SetDefaultButtonRolloverTextColor(aSelectedControlTextColor);
+    aStyleSettings.SetDefaultButtonRolloverTextColor(aAlternateSelectedControlTextColor);
     aStyleSettings.SetButtonRolloverTextColor(aControlTextColor);
-    aStyleSettings.SetDefaultActionButtonRolloverTextColor(aSelectedControlTextColor);
+    aStyleSettings.SetDefaultActionButtonRolloverTextColor(aAlternateSelectedControlTextColor);
     aStyleSettings.SetActionButtonRolloverTextColor(aControlTextColor);
     aStyleSettings.SetFlatButtonRolloverTextColor(aControlTextColor);
-    aStyleSettings.SetDefaultButtonPressedRolloverTextColor(aSelectedControlTextColor);
-    aStyleSettings.SetButtonPressedRolloverTextColor(aSelectedControlTextColor);
-    aStyleSettings.SetDefaultActionButtonPressedRolloverTextColor(aSelectedControlTextColor);
-    aStyleSettings.SetActionButtonPressedRolloverTextColor(aSelectedControlTextColor);
+    aStyleSettings.SetDefaultButtonPressedRolloverTextColor(aAlternateSelectedControlTextColor);
+    aStyleSettings.SetButtonPressedRolloverTextColor(aAlternateSelectedControlTextColor);
+    aStyleSettings.SetDefaultActionButtonPressedRolloverTextColor(aAlternateSelectedControlTextColor);
+    aStyleSettings.SetActionButtonPressedRolloverTextColor(aAlternateSelectedControlTextColor);
     aStyleSettings.SetFlatButtonPressedRolloverTextColor(aControlTextColor);
 
-    // Set text colors for tabs according to OS settings, typically white for selected buttons, black otherwise
+    // Set text colors for tabs according to OS settings
 
     aStyleSettings.SetTabTextColor(aControlTextColor);
-    aStyleSettings.SetTabHighlightTextColor(aSelectedControlTextColor);
+
+    // 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 = 11, .minorVersion = 0, .patchVersion = 0 };
+    if ([NSProcessInfo.processInfo isOperatingSystemAtLeastVersion: aOSVersion])
+        aStyleSettings.SetTabHighlightTextColor(aSelectedControlTextColor);
+    else
+        aStyleSettings.SetTabHighlightTextColor(aAlternateSelectedControlTextColor);
 
     aStyleSettings.SetCursorBlinkTime( mnBlinkCursorDelay );
 


More information about the Libreoffice-commits mailing list