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

Caolán McNamara caolanm at redhat.com
Tue Nov 29 13:25:40 UTC 2016


 vcl/unx/gtk/salnativewidgets-gtk.cxx      |   24 +++++++++---------------
 vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx |    9 +++++++++
 2 files changed, 18 insertions(+), 15 deletions(-)

New commits:
commit 8114a779143a7f0042d7e15b476037315ed2b4c3
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue Nov 29 13:22:33 2016 +0000

    Resolves: tdf#90214 set gtk[2|3] lightshadow halfway between darkshadow and bg
    
    Change-Id: Ie8d41c6b507c837f369b34b6a0290da02f0a1665
    (cherry picked from commit 308b0fcd2081e2a2665b572d62f7f07de85e2b45)

diff --git a/vcl/unx/gtk/salnativewidgets-gtk.cxx b/vcl/unx/gtk/salnativewidgets-gtk.cxx
index b9bb56a..a3eea16 100644
--- a/vcl/unx/gtk/salnativewidgets-gtk.cxx
+++ b/vcl/unx/gtk/salnativewidgets-gtk.cxx
@@ -3979,6 +3979,15 @@ 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 );
+
     // highlighting colors
     Color aHighlightColor = getColor( pStyle->base[GTK_STATE_SELECTED] );
     Color aHighlightTextColor = getColor( pStyle->text[GTK_STATE_SELECTED] );
@@ -4044,21 +4053,6 @@ void GtkSalGraphics::updateSettings( AllSettings& rSettings )
     std::fprintf( stderr, "DarkShadowColor = %x (%d)\n", (int)aStyleSet.GetDarkShadowColor().GetColor(), aStyleSet.GetDarkShadowColor().GetLuminance() );
 #endif
 
-    // Awful hack for menu separators in the Sonar and similar themes.
-    // If the menu color is not too dark, and the menu text color is lighter,
-    // make the "light" color lighter than the menu color and the "shadow"
-    // color darker than it.
-    if ( aStyleSet.GetMenuColor().GetLuminance() >= 32 &&
-     aStyleSet.GetMenuColor().GetLuminance() <= aStyleSet.GetMenuTextColor().GetLuminance() )
-    {
-      Color temp = aStyleSet.GetMenuColor();
-      temp.IncreaseLuminance( 8 );
-      aStyleSet.SetLightColor( temp );
-      temp = aStyleSet.GetMenuColor();
-      temp.DecreaseLuminance( 16 );
-      aStyleSet.SetShadowColor( temp );
-    }
-
     aHighlightColor = getColor( pMenuItemStyle->bg[ GTK_STATE_SELECTED ] );
     aHighlightTextColor = getColor( pMenuItemStyle->fg[ GTK_STATE_SELECTED ] );
     aStyleSet.SetMenuHighlightColor( aHighlightColor );
diff --git a/vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx b/vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx
index 8090f68..f8be136 100644
--- a/vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx
+++ b/vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx
@@ -2583,6 +2583,15 @@ 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 );
+
         g_object_unref( pCStyle );
 
         // Tab colors


More information about the Libreoffice-commits mailing list