Index: gtk/gtkrange.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtkrange.c,v
retrieving revision 1.127
diff -u -p -r1.127 gtkrange.c
--- gtk/gtkrange.c	9 Jun 2006 13:48:07 -0000	1.127
+++ gtk/gtkrange.c	18 Jul 2006 11:35:16 -0000
@@ -95,6 +95,9 @@ struct _GtkRangeLayout
   /* Stepper sensitivity */
   GtkSensitivityType lower_sensitivity;
   GtkSensitivityType upper_sensitivity;
+
+  guint lower_sensitive : 1;
+  guint upper_sensitive : 1;
 };
 
 
@@ -532,6 +535,8 @@ gtk_range_init (GtkRange *range)
   range->layout->grab_button = 0;
   range->layout->lower_sensitivity = GTK_SENSITIVITY_AUTO;
   range->layout->upper_sensitivity = GTK_SENSITIVITY_AUTO;
+  range->layout->lower_sensitive = TRUE;
+  range->layout->upper_sensitive = TRUE;
   range->timer = NULL;  
 }
 
@@ -716,7 +721,11 @@ gtk_range_set_lower_stepper_sensitivity 
   if (range->layout->lower_sensitivity != sensitivity)
     {
       range->layout->lower_sensitivity = sensitivity;
+
+      range->need_recalc = TRUE;
+      gtk_range_calc_layout (range, range->adjustment->value);
       gtk_widget_queue_draw (GTK_WIDGET (range));
+
       g_object_notify (G_OBJECT (range), "lower-stepper-sensitivity");
     }
 }
@@ -759,7 +768,11 @@ gtk_range_set_upper_stepper_sensitivity 
   if (range->layout->upper_sensitivity != sensitivity)
     {
       range->layout->upper_sensitivity = sensitivity;
+
+      range->need_recalc = TRUE;
+      gtk_range_calc_layout (range, range->adjustment->value);
       gtk_widget_queue_draw (GTK_WIDGET (range));
+
       g_object_notify (G_OBJECT (range), "upper-stepper-sensitivity");
     }
 }
@@ -1079,40 +1092,11 @@ draw_stepper (GtkRange     *range,
       (range->inverted  && (arrow_type == GTK_ARROW_UP ||
                             arrow_type == GTK_ARROW_LEFT)))
     {
-      switch (range->layout->upper_sensitivity)
-        {
-        case GTK_SENSITIVITY_AUTO:
-          arrow_sensitive =
-            (range->adjustment->value <
-             (range->adjustment->upper - range->adjustment->page_size));
-          break;
-
-        case GTK_SENSITIVITY_ON:
-          arrow_sensitive = TRUE;
-          break;
-
-        case GTK_SENSITIVITY_OFF:
-          arrow_sensitive = FALSE;
-          break;
-        }
+      arrow_sensitive = range->layout->upper_sensitive;
     }
   else
     {
-      switch (range->layout->lower_sensitivity)
-        {
-        case GTK_SENSITIVITY_AUTO:
-          arrow_sensitive =
-            (range->adjustment->value > range->adjustment->lower);
-          break;
-
-        case GTK_SENSITIVITY_ON:
-          arrow_sensitive = TRUE;
-          break;
-
-        case GTK_SENSITIVITY_OFF:
-          arrow_sensitive = FALSE;
-          break;
-        }
+      arrow_sensitive = range->layout->lower_sensitive;
     }
 
   if (!GTK_WIDGET_IS_SENSITIVE (range) || !arrow_sensitive)
@@ -1947,6 +1931,9 @@ layout_changed (GtkRangeLayout *layout1,
   check_rectangle (layout1->stepper_b, layout2->stepper_b);
   check_rectangle (layout1->stepper_c, layout2->stepper_c);
 
+  if (layout1->upper_sensitive != layout2->upper_sensitive) return TRUE;
+  if (layout1->lower_sensitive != layout2->lower_sensitive) return TRUE;
+
   return FALSE;
 }
 
@@ -2843,6 +2830,39 @@ gtk_range_calc_layout (GtkRange *range,
     }
   
   gtk_range_update_mouse_location (range);
+
+  switch (range->layout->upper_sensitivity)
+    {
+    case GTK_SENSITIVITY_AUTO:
+      range->layout->upper_sensitive =
+        (range->adjustment->value <
+         (range->adjustment->upper - range->adjustment->page_size));
+      break;
+
+    case GTK_SENSITIVITY_ON:
+      range->layout->upper_sensitive = TRUE;
+      break;
+
+    case GTK_SENSITIVITY_OFF:
+      range->layout->upper_sensitive = FALSE;
+      break;
+    }
+
+  switch (range->layout->lower_sensitivity)
+    {
+    case GTK_SENSITIVITY_AUTO:
+      range->layout->lower_sensitive =
+        (range->adjustment->value > range->adjustment->lower);
+      break;
+
+    case GTK_SENSITIVITY_ON:
+      range->layout->lower_sensitive = TRUE;
+      break;
+
+    case GTK_SENSITIVITY_OFF:
+      range->layout->lower_sensitive = FALSE;
+      break;
+    }
 }
 
 static GdkRectangle*
