[gimp] app: reduce opacity of GimpHighlightableButton when insensitive



commit 7dd373293c2f7552897d65203638a357fa092697
Author: Ell <ell_se yahoo com>
Date:   Wed Mar 7 09:27:29 2018 -0500

    app: reduce opacity of GimpHighlightableButton when insensitive

 app/widgets/gimphighlightablebutton.c |   19 ++++++++++++-------
 1 files changed, 12 insertions(+), 7 deletions(-)
---
diff --git a/app/widgets/gimphighlightablebutton.c b/app/widgets/gimphighlightablebutton.c
index f6b5b00..d7ea8da 100644
--- a/app/widgets/gimphighlightablebutton.c
+++ b/app/widgets/gimphighlightablebutton.c
@@ -177,6 +177,7 @@ gimp_highlightable_button_expose_event (GtkWidget      *widget,
           GtkAllocation  allocation;
           gboolean       border;
           gdouble        lightness;
+          gdouble        opacity;
           gdouble        x;
           gdouble        y;
           gdouble        width;
@@ -190,12 +191,16 @@ gimp_highlightable_button_expose_event (GtkWidget      *widget,
              state                                       == GTK_STATE_PRELIGHT ||
              gtk_button_get_relief (GTK_BUTTON (button)) == GTK_RELIEF_NORMAL);
 
-          if (state == GTK_STATE_ACTIVE)
-            lightness = 0.80;
-          else if (state == GTK_STATE_PRELIGHT)
-            lightness = 1.25;
-          else
-            lightness = 1.00;
+          lightness = 1.00;
+          opacity   = 1.00;
+
+          switch (state)
+            {
+            case GTK_STATE_ACTIVE:      lightness = 0.80; break;
+            case GTK_STATE_PRELIGHT:    lightness = 1.25; break;
+            case GTK_STATE_INSENSITIVE: opacity   = 0.50; break;
+            default:                                      break;
+            }
 
           x      = allocation.x      +       PADDING;
           y      = allocation.y      +       PADDING;
@@ -218,7 +223,7 @@ gimp_highlightable_button_expose_event (GtkWidget      *widget,
                                  button->priv->highlight_color.r * lightness,
                                  button->priv->highlight_color.g * lightness,
                                  button->priv->highlight_color.b * lightness,
-                                 button->priv->highlight_color.a);
+                                 button->priv->highlight_color.a * opacity);
 
           gimp_cairo_rounded_rectangle (cr,
                                         x, y, width, height, CORNER_RADIUS);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]