[Libreoffice-commits] core.git: Branch 'libreoffice-5-3' - vcl/unx

Caolán McNamara caolanm at redhat.com
Thu Jan 26 13:17:47 UTC 2017


 vcl/unx/gtk/salnativewidgets-gtk.cxx      |   14 ++++++--------
 vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx |   14 ++++++--------
 2 files changed, 12 insertions(+), 16 deletions(-)

New commits:
commit ef7aefef00bddb5008a4fd071f547cef14ce0c3e
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed Jan 25 10:02:54 2017 +0000

    Resolves: tdf#104598 make bright theme shadow the same as it always was
    
    The shadow color was originally set via StyleSettings::Set3DColors taking the
    background color as the input, and doing DecreaseLuminance(64) on it to make
    the shadow color
    
    So, continue to follow that mode if the "dark shadow" is darker than the
    foreground, and IncreaseLuminance the equal amount the other direction for dark
    themes.
    
    This way under a dark theme the problem of impossible to see rulers of
    tdf#90214 is still fixed, while the bright theme colors are the same as they
    always were, which avoid the wearing-on-the-nerves "regression" problem.
    
    Change-Id: I33133ff180ecadce3a14ee45bd33db73c56c0225
    (cherry picked from commit 19663d39f400dac3682228f3f0146807bbbebe74)
    Reviewed-on: https://gerrit.libreoffice.org/33523
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Michael Stahl <mstahl at redhat.com>

diff --git a/vcl/unx/gtk/salnativewidgets-gtk.cxx b/vcl/unx/gtk/salnativewidgets-gtk.cxx
index a3eea16..43cc675 100644
--- a/vcl/unx/gtk/salnativewidgets-gtk.cxx
+++ b/vcl/unx/gtk/salnativewidgets-gtk.cxx
@@ -3979,14 +3979,12 @@ void GtkSalGraphics::updateSettings( AllSettings& rSettings )
     Color aDarkShadowColor = getColor( pStyle->fg[GTK_STATE_INSENSITIVE] );
     aStyleSet.SetDarkShadowColor( aDarkShadowColor );
 
-    int nRedDiff = aBackFieldColor.GetRed() - aDarkShadowColor.GetRed();
-    int nGreenDiff = aBackFieldColor.GetGreen() - aDarkShadowColor.GetGreen();
-    int nBlueDiff = aBackFieldColor.GetBlue() - aDarkShadowColor.GetBlue();
-
-    Color aShadowColor(aBackFieldColor.GetRed() + nRedDiff / 2,
-                       aBackFieldColor.GetGreen() + nGreenDiff / 2,
-                       aBackFieldColor.GetBlue() + nBlueDiff / 2);
-    aStyleSet.SetShadowColor( aShadowColor );
+    ::Color aShadowColor(aBackColor);
+    if (aDarkShadowColor.GetLuminance() > aBackColor.GetLuminance())
+        aShadowColor.IncreaseLuminance(64);
+    else
+        aShadowColor.DecreaseLuminance(64);
+    aStyleSet.SetShadowColor(aShadowColor);
 
     // highlighting colors
     Color aHighlightColor = getColor( pStyle->base[GTK_STATE_SELECTED] );
diff --git a/vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx b/vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx
index 945e68b..729b6f5 100644
--- a/vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx
+++ b/vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx
@@ -2583,14 +2583,12 @@ void GtkSalGraphics::updateSettings( AllSettings& rSettings )
         ::Color aDarkShadowColor = getColor( color );
         aStyleSet.SetDarkShadowColor( aDarkShadowColor );
 
-        int nRedDiff = aBackFieldColor.GetRed() - aDarkShadowColor.GetRed();
-        int nGreenDiff = aBackFieldColor.GetGreen() - aDarkShadowColor.GetGreen();
-        int nBlueDiff = aBackFieldColor.GetBlue() - aDarkShadowColor.GetBlue();
-
-        ::Color aShadowColor(aBackFieldColor.GetRed() + nRedDiff / 2,
-                             aBackFieldColor.GetGreen() + nGreenDiff / 2,
-                             aBackFieldColor.GetBlue() + nBlueDiff / 2);
-        aStyleSet.SetShadowColor( aShadowColor );
+        ::Color aShadowColor(aBackColor);
+        if (aDarkShadowColor.GetLuminance() > aBackColor.GetLuminance())
+            aShadowColor.IncreaseLuminance(64);
+        else
+            aShadowColor.DecreaseLuminance(64);
+        aStyleSet.SetShadowColor(aShadowColor);
 
         g_object_unref( pCStyle );
 


More information about the Libreoffice-commits mailing list