[Libreoffice-commits] core.git: vcl/unx
Caolán McNamara
caolanm at redhat.com
Wed Jan 25 10:12:06 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 19663d39f400dac3682228f3f0146807bbbebe74
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
diff --git a/vcl/unx/gtk/salnativewidgets-gtk.cxx b/vcl/unx/gtk/salnativewidgets-gtk.cxx
index 5e07ade..e8e8cdd 100644
--- a/vcl/unx/gtk/salnativewidgets-gtk.cxx
+++ b/vcl/unx/gtk/salnativewidgets-gtk.cxx
@@ -3943,14 +3943,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 48edf22..e036c20 100644
--- a/vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx
+++ b/vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx
@@ -2585,14 +2585,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