[Xfce4-commits] <xfce4-panel:master> Propertly handle the insensitive clock colors.

Nick Schermer noreply at xfce.org
Sat Nov 20 22:50:02 CET 2010


Updating branch refs/heads/master
         to e0f7fd32541eeee71ee4efee1c0669564eea2391 (commit)
       from 3edffa8dd6e622376546d0a950f1f7ccf068befd (commit)

commit e0f7fd32541eeee71ee4efee1c0669564eea2391
Author: Nick Schermer <nick at xfce.org>
Date:   Sat Nov 20 22:48:56 2010 +0100

    Propertly handle the insensitive clock colors.

 plugins/clock/clock-analog.c |    2 +-
 plugins/clock/clock-binary.c |   24 ++++++++++++++++++++----
 plugins/clock/clock-lcd.c    |    1 +
 3 files changed, 22 insertions(+), 5 deletions(-)

diff --git a/plugins/clock/clock-analog.c b/plugins/clock/clock-analog.c
index c3dca8c..28c3597 100644
--- a/plugins/clock/clock-analog.c
+++ b/plugins/clock/clock-analog.c
@@ -245,7 +245,7 @@ xfce_clock_analog_expose_event (GtkWidget      *widget,
 
       /* set the line properties */
       cairo_set_line_width (cr, 1);
-      gdk_cairo_set_source_color (cr, &widget->style->fg[GTK_STATE_NORMAL]);
+      gdk_cairo_set_source_color (cr, &widget->style->fg[GTK_WIDGET_STATE (widget)]);
 
       /* draw the ticks */
       xfce_clock_analog_draw_ticks (cr, xc, yc, radius);
diff --git a/plugins/clock/clock-binary.c b/plugins/clock/clock-binary.c
index abe34d3..1c2a311 100644
--- a/plugins/clock/clock-binary.c
+++ b/plugins/clock/clock-binary.c
@@ -276,8 +276,16 @@ xfce_clock_binary_expose_event_true_binary (XfceClockBinary *binary,
   gint         w, h, x;
   gint         ticks;
 
-  inactive = &(GTK_WIDGET (binary)->style->dark[GTK_STATE_NORMAL]);
-  active = &(GTK_WIDGET (binary)->style->dark[GTK_STATE_SELECTED]);
+  if (G_UNLIKELY (GTK_WIDGET_STATE (binary) == GTK_STATE_INSENSITIVE))
+    {
+      inactive = &(GTK_WIDGET (binary)->style->mid[GTK_STATE_INSENSITIVE]);
+      active = &(GTK_WIDGET (binary)->style->dark[GTK_STATE_INSENSITIVE]);
+    }
+  else
+    {
+      inactive = &(GTK_WIDGET (binary)->style->dark[GTK_STATE_NORMAL]);
+      active = &(GTK_WIDGET (binary)->style->dark[GTK_STATE_SELECTED]);
+    }
 
   clock_plugin_get_localtime (&tm);
 
@@ -352,8 +360,16 @@ xfce_clock_binary_expose_event_binary (XfceClockBinary *binary,
   gint         w, h, y;
   gint         ticks;
 
-  inactive = &(GTK_WIDGET (binary)->style->dark[GTK_STATE_NORMAL]);
-  active = &(GTK_WIDGET (binary)->style->dark[GTK_STATE_SELECTED]);
+  if (G_UNLIKELY (GTK_WIDGET_STATE (binary) == GTK_STATE_INSENSITIVE))
+    {
+      inactive = &(GTK_WIDGET (binary)->style->mid[GTK_STATE_INSENSITIVE]);
+      active = &(GTK_WIDGET (binary)->style->dark[GTK_STATE_INSENSITIVE]);
+    }
+  else
+    {
+      inactive = &(GTK_WIDGET (binary)->style->dark[GTK_STATE_NORMAL]);
+      active = &(GTK_WIDGET (binary)->style->dark[GTK_STATE_SELECTED]);
+    }
 
   clock_plugin_get_localtime (&tm);
 
diff --git a/plugins/clock/clock-lcd.c b/plugins/clock/clock-lcd.c
index aaf345c..5360b88 100644
--- a/plugins/clock/clock-lcd.c
+++ b/plugins/clock/clock-lcd.c
@@ -299,6 +299,7 @@ xfce_clock_lcd_expose_event (GtkWidget      *widget,
 
   /* get the cairo context */
   cr = gdk_cairo_create (widget->window);
+  gdk_cairo_set_source_color (cr, &widget->style->fg[GTK_WIDGET_STATE (widget)]);
 
   if (G_LIKELY (cr != NULL))
     {



More information about the Xfce4-commits mailing list