[gtk+/refactor: 145/145] GtkRange: move public members to private structure



commit 3b91a8773704fcfb2626f641d4a7eb00ab1e7ec3
Author: Javier Jardón <jjardon gnome org>
Date:   Mon Aug 16 08:27:49 2010 +0200

    GtkRange: move public members to private structure

 gtk/gtkrange.c | 1536 +++++++++++++++++++++++++++++++-------------------------
 gtk/gtkrange.h |   49 +--
 2 files changed, 842 insertions(+), 743 deletions(-)
---
diff --git a/gtk/gtkrange.c b/gtk/gtkrange.c
index 9fca36c..261374d 100644
--- a/gtk/gtkrange.c
+++ b/gtk/gtkrange.c
@@ -58,26 +58,7 @@
 #define SCROLL_DELAY_FACTOR 5    /* Scroll repeat multiplier */
 #define UPDATE_DELAY        300  /* Delay for queued update */
 
-enum {
-  PROP_0,
-  PROP_ORIENTATION,
-  PROP_UPDATE_POLICY,
-  PROP_ADJUSTMENT,
-  PROP_INVERTED,
-  PROP_LOWER_STEPPER_SENSITIVITY,
-  PROP_UPPER_STEPPER_SENSITIVITY,
-  PROP_SHOW_FILL_LEVEL,
-  PROP_RESTRICT_TO_FILL_LEVEL,
-  PROP_FILL_LEVEL
-};
-
-enum {
-  VALUE_CHANGED,
-  ADJUST_BOUNDS,
-  MOVE_SLIDER,
-  CHANGE_VALUE,
-  LAST_SIGNAL
-};
+typedef struct _GtkRangeStepTimer GtkRangeStepTimer;
 
 typedef enum {
   MOUSE_OUTSIDE,
@@ -90,64 +71,106 @@ typedef enum {
   MOUSE_WIDGET /* inside widget but not in any of the above GUI elements */
 } MouseLocation;
 
-typedef enum {
-  STEPPER_A,
-  STEPPER_B,
-  STEPPER_C,
-  STEPPER_D
-} Stepper;
+struct _GtkRangePriv
+{
+  MouseLocation      mouse_location;
+  /* last mouse coords we got, or -1 if mouse is outside the range */
+  gint  mouse_x;
+  gint  mouse_y;
+  MouseLocation      grab_location;   /* "grabbed" mouse location, OUTSIDE for no grab */
+  guint              grab_button : 8; /* 0 if none */
 
-#define GTK_RANGE_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), GTK_TYPE_RANGE, GtkRangeLayout))
+  GtkRangeStepTimer *timer;
 
-struct _GtkRangeLayout
-{
+  GtkAdjustment     *adjustment;
+  GtkOrientation     orientation;
+  GtkSensitivityType lower_sensitivity;
+  GtkSensitivityType upper_sensitivity;
+  GtkUpdateType      update_policy;
+
+  GdkDevice         *grab_device;
+  GdkRectangle       range_rect;     /* Area of entire stepper + trough assembly in widget->window coords */
   /* These are in widget->window coordinates */
-  GdkRectangle stepper_a;
-  GdkRectangle stepper_b;
-  GdkRectangle stepper_c;
-  GdkRectangle stepper_d;
-  /* The trough rectangle is the area the thumb can slide in, not the
-   * entire range_rect
-   */
-  GdkRectangle trough;
-  GdkRectangle slider;
+  GdkRectangle       stepper_a;
+  GdkRectangle       stepper_b;
+  GdkRectangle       stepper_c;
+  GdkRectangle       stepper_d;
+  GdkRectangle       trough;         /* The trough rectangle is the area the thumb can slide in, not the entire range_rect */
+  GdkRectangle       slider;
+  GdkWindow         *event_window;
 
-  /* Layout-related state */
+  GQuark             slider_detail_quark;
+  GQuark             stepper_detail_quark[4];
 
-  MouseLocation mouse_location;
-  /* last mouse coords we got, or -1 if mouse is outside the range */
-  gint mouse_x;
-  gint mouse_y;
+  gboolean recalc_marks;
+
+  gdouble  fill_level;
+  gdouble *marks;
+
+  gint *mark_pos;
+  gint  min_slider_size;
+  gint  n_marks;
+  gint  round_digits;                /* Round off value to this many digits, -1 for no rounding */
+  gint  slide_initial_slider_position;
+  gint  slide_initial_coordinate;
+  gint  slider_start;                /* Slider range along the long dimension, in widget->window coords */
+  gint  slider_end;
 
-  /* "grabbed" mouse location, OUTSIDE for no grab */
-  MouseLocation grab_location;
-  guint grab_button : 8; /* 0 if none */
+  guint repaint_id;
+  guint update_timeout_id;
+
+  /* Steppers are: < > ---- < >
+   *               a b      c d
+   */
+  guint has_stepper_a          : 1;
+  guint has_stepper_b          : 1;
+  guint has_stepper_c          : 1;
+  guint has_stepper_d          : 1;
+
+  guint flippable              : 1;
+  guint inverted               : 1;
+  guint need_recalc            : 1;
+  guint slider_size_fixed      : 1;
+  guint trough_click_forward   : 1;  /* trough click was on the forward side of slider */
+  guint update_pending         : 1;  /* need to emit value_changed */
 
   /* Stepper sensitivity */
-  guint lower_sensitive : 1;
-  guint upper_sensitive : 1;
+  guint lower_sensitive        : 1;
+  guint upper_sensitive        : 1;
 
   /* Fill level */
-  guint show_fill_level : 1;
+  guint show_fill_level        : 1;
   guint restrict_to_fill_level : 1;
+};
 
-  GtkSensitivityType lower_sensitivity;
-  GtkSensitivityType upper_sensitivity;
-  guint repaint_id;
-
-  gdouble fill_level;
-
-  GQuark slider_detail_quark;
-  GQuark stepper_detail_quark[4];
 
-  gdouble *marks;
-  gint *mark_pos;
-  gint n_marks;
-  gboolean recalc_marks;
+enum {
+  PROP_0,
+  PROP_ORIENTATION,
+  PROP_UPDATE_POLICY,
+  PROP_ADJUSTMENT,
+  PROP_INVERTED,
+  PROP_LOWER_STEPPER_SENSITIVITY,
+  PROP_UPPER_STEPPER_SENSITIVITY,
+  PROP_SHOW_FILL_LEVEL,
+  PROP_RESTRICT_TO_FILL_LEVEL,
+  PROP_FILL_LEVEL
+};
 
-  GdkDevice *grab_device;
+enum {
+  VALUE_CHANGED,
+  ADJUST_BOUNDS,
+  MOVE_SLIDER,
+  CHANGE_VALUE,
+  LAST_SIGNAL
 };
 
+typedef enum {
+  STEPPER_A,
+  STEPPER_B,
+  STEPPER_C,
+  STEPPER_D
+} Stepper;
 
 static void gtk_range_set_property   (GObject          *object,
                                       guint             prop_id,
@@ -604,7 +627,7 @@ gtk_range_class_init (GtkRangeClass *class)
                                                                  FALSE,
                                                                  GTK_PARAM_READABLE));
 
-  g_type_class_add_private (class, sizeof (GtkRangeLayout));
+  g_type_class_add_private (class, sizeof (GtkRangePriv));
 }
 
 static void
@@ -614,17 +637,18 @@ gtk_range_set_property (GObject      *object,
 			GParamSpec   *pspec)
 {
   GtkRange *range = GTK_RANGE (object);
+  GtkRangePriv *priv = range->priv;
 
   switch (prop_id)
     {
     case PROP_ORIENTATION:
-      range->orientation = g_value_get_enum (value);
+      priv->orientation = g_value_get_enum (value);
 
-      range->layout->slider_detail_quark = 0;
-      range->layout->stepper_detail_quark[0] = 0;
-      range->layout->stepper_detail_quark[1] = 0;
-      range->layout->stepper_detail_quark[2] = 0;
-      range->layout->stepper_detail_quark[3] = 0;
+      priv->slider_detail_quark = 0;
+      priv->stepper_detail_quark[0] = 0;
+      priv->stepper_detail_quark[1] = 0;
+      priv->stepper_detail_quark[2] = 0;
+      priv->stepper_detail_quark[3] = 0;
 
       gtk_widget_queue_resize (GTK_WIDGET (range));
       break;
@@ -665,20 +689,21 @@ gtk_range_get_property (GObject      *object,
 			GParamSpec   *pspec)
 {
   GtkRange *range = GTK_RANGE (object);
+  GtkRangePriv *priv = range->priv;
 
   switch (prop_id)
     {
     case PROP_ORIENTATION:
-      g_value_set_enum (value, range->orientation);
+      g_value_set_enum (value, priv->orientation);
       break;
     case PROP_UPDATE_POLICY:
-      g_value_set_enum (value, range->update_policy);
+      g_value_set_enum (value, priv->update_policy);
       break;
     case PROP_ADJUSTMENT:
-      g_value_set_object (value, range->adjustment);
+      g_value_set_object (value, priv->adjustment);
       break;
     case PROP_INVERTED:
-      g_value_set_boolean (value, range->inverted);
+      g_value_set_boolean (value, priv->inverted);
       break;
     case PROP_LOWER_STEPPER_SENSITIVITY:
       g_value_set_enum (value, gtk_range_get_lower_stepper_sensitivity (range));
@@ -704,34 +729,40 @@ gtk_range_get_property (GObject      *object,
 static void
 gtk_range_init (GtkRange *range)
 {
+  GtkRangePriv *priv;
+
+  range->priv = G_TYPE_INSTANCE_GET_PRIVATE (range,
+                                             GTK_TYPE_RANGE,
+                                             GtkRangePriv);
+  priv = range->priv;
+
   gtk_widget_set_has_window (GTK_WIDGET (range), FALSE);
 
-  range->orientation = GTK_ORIENTATION_HORIZONTAL;
-  range->adjustment = NULL;
-  range->update_policy = GTK_UPDATE_CONTINUOUS;
-  range->inverted = FALSE;
-  range->flippable = FALSE;
-  range->min_slider_size = 1;
-  range->has_stepper_a = FALSE;
-  range->has_stepper_b = FALSE;
-  range->has_stepper_c = FALSE;
-  range->has_stepper_d = FALSE;
-  range->need_recalc = TRUE;
-  range->round_digits = -1;
-  range->layout = GTK_RANGE_GET_PRIVATE (range);
-  range->layout->mouse_location = MOUSE_OUTSIDE;
-  range->layout->mouse_x = -1;
-  range->layout->mouse_y = -1;
-  range->layout->grab_location = MOUSE_OUTSIDE;
-  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->layout->show_fill_level = FALSE;
-  range->layout->restrict_to_fill_level = TRUE;
-  range->layout->fill_level = G_MAXDOUBLE;
-  range->timer = NULL;  
+  priv->orientation = GTK_ORIENTATION_HORIZONTAL;
+  priv->adjustment = NULL;
+  priv->update_policy = GTK_UPDATE_CONTINUOUS;
+  priv->inverted = FALSE;
+  priv->flippable = FALSE;
+  priv->min_slider_size = 1;
+  priv->has_stepper_a = FALSE;
+  priv->has_stepper_b = FALSE;
+  priv->has_stepper_c = FALSE;
+  priv->has_stepper_d = FALSE;
+  priv->need_recalc = TRUE;
+  priv->round_digits = -1;
+  priv->mouse_location = MOUSE_OUTSIDE;
+  priv->mouse_x = -1;
+  priv->mouse_y = -1;
+  priv->grab_location = MOUSE_OUTSIDE;
+  priv->grab_button = 0;
+  priv->lower_sensitivity = GTK_SENSITIVITY_AUTO;
+  priv->upper_sensitivity = GTK_SENSITIVITY_AUTO;
+  priv->lower_sensitive = TRUE;
+  priv->upper_sensitive = TRUE;
+  priv->show_fill_level = FALSE;
+  priv->restrict_to_fill_level = TRUE;
+  priv->fill_level = G_MAXDOUBLE;
+  priv->timer = NULL;
 }
 
 /**
@@ -748,12 +779,16 @@ gtk_range_init (GtkRange *range)
 GtkAdjustment*
 gtk_range_get_adjustment (GtkRange *range)
 {
+  GtkRangePriv *priv;
+
   g_return_val_if_fail (GTK_IS_RANGE (range), NULL);
 
-  if (!range->adjustment)
+  priv = range->priv;
+
+  if (!priv->adjustment)
     gtk_range_set_adjustment (range, NULL);
 
-  return range->adjustment;
+  return priv->adjustment;
 }
 
 /**
@@ -774,11 +809,15 @@ void
 gtk_range_set_update_policy (GtkRange      *range,
 			     GtkUpdateType  policy)
 {
+  GtkRangePriv *priv;
+
   g_return_if_fail (GTK_IS_RANGE (range));
 
-  if (range->update_policy != policy)
+  priv = range->priv;
+
+  if (priv->update_policy != policy)
     {
-      range->update_policy = policy;
+      priv->update_policy = policy;
       g_object_notify (G_OBJECT (range), "update-policy");
     }
 }
@@ -796,7 +835,7 @@ gtk_range_get_update_policy (GtkRange *range)
 {
   g_return_val_if_fail (GTK_IS_RANGE (range), GTK_UPDATE_CONTINUOUS);
 
-  return range->update_policy;
+  return range->priv->update_policy;
 }
 
 /**
@@ -816,27 +855,31 @@ void
 gtk_range_set_adjustment (GtkRange      *range,
 			  GtkAdjustment *adjustment)
 {
+  GtkRangePriv *priv;
+
   g_return_if_fail (GTK_IS_RANGE (range));
-  
+
+  priv = range->priv;
+
   if (!adjustment)
     adjustment = (GtkAdjustment*) gtk_adjustment_new (0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
   else
     g_return_if_fail (GTK_IS_ADJUSTMENT (adjustment));
 
-  if (range->adjustment != adjustment)
+  if (priv->adjustment != adjustment)
     {
-      if (range->adjustment)
+      if (priv->adjustment)
 	{
-	  g_signal_handlers_disconnect_by_func (range->adjustment,
+	  g_signal_handlers_disconnect_by_func (priv->adjustment,
 						gtk_range_adjustment_changed,
 						range);
-	  g_signal_handlers_disconnect_by_func (range->adjustment,
+	  g_signal_handlers_disconnect_by_func (priv->adjustment,
 						gtk_range_adjustment_value_changed,
 						range);
-	  g_object_unref (range->adjustment);
+	  g_object_unref (priv->adjustment);
 	}
 
-      range->adjustment = adjustment;
+      priv->adjustment = adjustment;
       g_object_ref_sink (adjustment);
       
       g_signal_connect (adjustment, "changed",
@@ -865,13 +908,17 @@ void
 gtk_range_set_inverted (GtkRange *range,
                         gboolean  setting)
 {
+  GtkRangePriv *priv;
+
   g_return_if_fail (GTK_IS_RANGE (range));
-  
+
+  priv = range->priv;
+
   setting = setting != FALSE;
 
-  if (setting != range->inverted)
+  if (setting != priv->inverted)
     {
-      range->inverted = setting;
+      priv->inverted = setting;
       g_object_notify (G_OBJECT (range), "inverted");
       gtk_widget_queue_resize (GTK_WIDGET (range));
     }
@@ -890,7 +937,7 @@ gtk_range_get_inverted (GtkRange *range)
 {
   g_return_val_if_fail (GTK_IS_RANGE (range), FALSE);
 
-  return range->inverted;
+  return range->priv->inverted;
 }
 
 /**
@@ -909,13 +956,17 @@ void
 gtk_range_set_flippable (GtkRange *range,
                          gboolean  flippable)
 {
+  GtkRangePriv *priv;
+
   g_return_if_fail (GTK_IS_RANGE (range));
 
+  priv = range->priv;
+
   flippable = flippable ? TRUE : FALSE;
 
-  if (flippable != range->flippable)
+  if (flippable != priv->flippable)
     {
-      range->flippable = flippable;
+      priv->flippable = flippable;
 
       gtk_widget_queue_draw (GTK_WIDGET (range));
     }
@@ -936,7 +987,7 @@ gtk_range_get_flippable (GtkRange *range)
 {
   g_return_val_if_fail (GTK_IS_RANGE (range), FALSE);
 
-  return range->flippable;
+  return range->priv->flippable;
 }
 
 /**
@@ -955,16 +1006,20 @@ void
 gtk_range_set_slider_size_fixed (GtkRange *range,
                                  gboolean  size_fixed)
 {
+  GtkRangePriv *priv;
+
   g_return_if_fail (GTK_IS_RANGE (range));
 
-  if (size_fixed != range->slider_size_fixed)
+  priv = range->priv;
+
+  if (size_fixed != priv->slider_size_fixed)
     {
-      range->slider_size_fixed = size_fixed ? TRUE : FALSE;
+      priv->slider_size_fixed = size_fixed ? TRUE : FALSE;
 
-      if (range->adjustment && gtk_widget_get_mapped (GTK_WIDGET (range)))
+      if (priv->adjustment && gtk_widget_get_mapped (GTK_WIDGET (range)))
         {
-          range->need_recalc = TRUE;
-          gtk_range_calc_layout (range, gtk_adjustment_get_value (range->adjustment));
+          priv->need_recalc = TRUE;
+          gtk_range_calc_layout (range, gtk_adjustment_get_value (priv->adjustment));
           gtk_widget_queue_draw (GTK_WIDGET (range));
         }
     }
@@ -987,7 +1042,7 @@ gtk_range_get_slider_size_fixed (GtkRange *range)
 {
   g_return_val_if_fail (GTK_IS_RANGE (range), FALSE);
 
-  return range->slider_size_fixed;
+  return range->priv->slider_size_fixed;
 }
 
 /**
@@ -1005,15 +1060,19 @@ void
 gtk_range_set_min_slider_size (GtkRange *range,
                                gint      min_size)
 {
+  GtkRangePriv *priv;
+
   g_return_if_fail (GTK_IS_RANGE (range));
   g_return_if_fail (min_size > 0);
 
-  if (min_size != range->min_slider_size)
+  priv = range->priv;
+
+  if (min_size != priv->min_slider_size)
     {
-      range->min_slider_size = min_size;
+      priv->min_slider_size = min_size;
 
-      range->need_recalc = TRUE;
-      gtk_range_calc_layout (range, range->adjustment->value);
+      priv->need_recalc = TRUE;
+      gtk_range_calc_layout (range, priv->adjustment->value);
       gtk_widget_queue_draw (GTK_WIDGET (range));
     }
 }
@@ -1035,7 +1094,7 @@ gtk_range_get_min_slider_size (GtkRange *range)
 {
   g_return_val_if_fail (GTK_IS_RANGE (range), FALSE);
 
-  return range->min_slider_size;
+  return range->priv->min_slider_size;
 }
 
 /**
@@ -1054,12 +1113,16 @@ void
 gtk_range_get_range_rect (GtkRange     *range,
                           GdkRectangle *range_rect)
 {
+  GtkRangePriv *priv;
+
   g_return_if_fail (GTK_IS_RANGE (range));
   g_return_if_fail (range_rect != NULL);
 
-  gtk_range_calc_layout (range, range->adjustment->value);
+  priv = range->priv;
+
+  gtk_range_calc_layout (range, priv->adjustment->value);
 
-  *range_rect = range->range_rect;
+  *range_rect = priv->range_rect;
 }
 
 /**
@@ -1080,15 +1143,19 @@ gtk_range_get_slider_range (GtkRange *range,
                             gint     *slider_start,
                             gint     *slider_end)
 {
+  GtkRangePriv *priv;
+
   g_return_if_fail (GTK_IS_RANGE (range));
 
-  gtk_range_calc_layout (range, range->adjustment->value);
+  priv = range->priv;
+
+  gtk_range_calc_layout (range, priv->adjustment->value);
 
   if (slider_start)
-    *slider_start = range->slider_start;
+    *slider_start = priv->slider_start;
 
   if (slider_end)
-    *slider_end = range->slider_end;
+    *slider_end = priv->slider_end;
 }
 
 /**
@@ -1105,14 +1172,18 @@ void
 gtk_range_set_lower_stepper_sensitivity (GtkRange           *range,
                                          GtkSensitivityType  sensitivity)
 {
+  GtkRangePriv *priv;
+
   g_return_if_fail (GTK_IS_RANGE (range));
 
-  if (range->layout->lower_sensitivity != sensitivity)
+  priv = range->priv;
+
+  if (priv->lower_sensitivity != sensitivity)
     {
-      range->layout->lower_sensitivity = sensitivity;
+      priv->lower_sensitivity = sensitivity;
 
-      range->need_recalc = TRUE;
-      gtk_range_calc_layout (range, range->adjustment->value);
+      priv->need_recalc = TRUE;
+      gtk_range_calc_layout (range, priv->adjustment->value);
       gtk_widget_queue_draw (GTK_WIDGET (range));
 
       g_object_notify (G_OBJECT (range), "lower-stepper-sensitivity");
@@ -1135,7 +1206,7 @@ gtk_range_get_lower_stepper_sensitivity (GtkRange *range)
 {
   g_return_val_if_fail (GTK_IS_RANGE (range), GTK_SENSITIVITY_AUTO);
 
-  return range->layout->lower_sensitivity;
+  return range->priv->lower_sensitivity;
 }
 
 /**
@@ -1152,14 +1223,18 @@ void
 gtk_range_set_upper_stepper_sensitivity (GtkRange           *range,
                                          GtkSensitivityType  sensitivity)
 {
+  GtkRangePriv *priv;
+
   g_return_if_fail (GTK_IS_RANGE (range));
 
-  if (range->layout->upper_sensitivity != sensitivity)
+  priv = range->priv;
+
+  if (priv->upper_sensitivity != sensitivity)
     {
-      range->layout->upper_sensitivity = sensitivity;
+      priv->upper_sensitivity = sensitivity;
 
-      range->need_recalc = TRUE;
-      gtk_range_calc_layout (range, range->adjustment->value);
+      priv->need_recalc = TRUE;
+      gtk_range_calc_layout (range, priv->adjustment->value);
       gtk_widget_queue_draw (GTK_WIDGET (range));
 
       g_object_notify (G_OBJECT (range), "upper-stepper-sensitivity");
@@ -1182,7 +1257,7 @@ gtk_range_get_upper_stepper_sensitivity (GtkRange *range)
 {
   g_return_val_if_fail (GTK_IS_RANGE (range), GTK_SENSITIVITY_AUTO);
 
-  return range->layout->upper_sensitivity;
+  return range->priv->upper_sensitivity;
 }
 
 /**
@@ -1201,12 +1276,16 @@ gtk_range_set_increments (GtkRange *range,
                           gdouble   step,
                           gdouble   page)
 {
+  GtkRangePriv *priv;
+
   g_return_if_fail (GTK_IS_RANGE (range));
 
-  range->adjustment->step_increment = step;
-  range->adjustment->page_increment = page;
+  priv = range->priv;
 
-  gtk_adjustment_changed (range->adjustment);
+  priv->adjustment->step_increment = step;
+  priv->adjustment->page_increment = page;
+
+  gtk_adjustment_changed (priv->adjustment);
 }
 
 /**
@@ -1224,22 +1303,25 @@ gtk_range_set_range (GtkRange *range,
                      gdouble   min,
                      gdouble   max)
 {
+  GtkRangePriv *priv;
   gdouble value;
   
   g_return_if_fail (GTK_IS_RANGE (range));
   g_return_if_fail (min < max);
-  
-  range->adjustment->lower = min;
-  range->adjustment->upper = max;
 
-  value = range->adjustment->value;
+  priv = range->priv;
+
+  priv->adjustment->lower = min;
+  priv->adjustment->upper = max;
+
+  value = priv->adjustment->value;
 
-  if (range->layout->restrict_to_fill_level)
-    value = MIN (value, MAX (range->adjustment->lower,
-                             range->layout->fill_level));
+  if (priv->restrict_to_fill_level)
+    value = MIN (value, MAX (priv->adjustment->lower,
+                             priv->fill_level));
 
-  gtk_adjustment_set_value (range->adjustment, value);
-  gtk_adjustment_changed (range->adjustment);
+  gtk_adjustment_set_value (priv->adjustment, value);
+  gtk_adjustment_changed (priv->adjustment);
 }
 
 /**
@@ -1256,13 +1338,17 @@ void
 gtk_range_set_value (GtkRange *range,
                      gdouble   value)
 {
+  GtkRangePriv *priv;
+
   g_return_if_fail (GTK_IS_RANGE (range));
 
-  if (range->layout->restrict_to_fill_level)
-    value = MIN (value, MAX (range->adjustment->lower,
-                             range->layout->fill_level));
+  priv = range->priv;
+
+  if (priv->restrict_to_fill_level)
+    value = MIN (value, MAX (priv->adjustment->lower,
+                             priv->fill_level));
 
-  gtk_adjustment_set_value (range->adjustment, value);
+  gtk_adjustment_set_value (priv->adjustment, value);
 }
 
 /**
@@ -1278,7 +1364,7 @@ gtk_range_get_value (GtkRange *range)
 {
   g_return_val_if_fail (GTK_IS_RANGE (range), 0.0);
 
-  return range->adjustment->value;
+  return range->priv->adjustment->value;
 }
 
 /**
@@ -1296,13 +1382,17 @@ void
 gtk_range_set_show_fill_level (GtkRange *range,
                                gboolean  show_fill_level)
 {
+  GtkRangePriv *priv;
+
   g_return_if_fail (GTK_IS_RANGE (range));
 
+  priv = range->priv;
+
   show_fill_level = show_fill_level ? TRUE : FALSE;
 
-  if (show_fill_level != range->layout->show_fill_level)
+  if (show_fill_level != priv->show_fill_level)
     {
-      range->layout->show_fill_level = show_fill_level;
+      priv->show_fill_level = show_fill_level;
       g_object_notify (G_OBJECT (range), "show-fill-level");
       gtk_widget_queue_draw (GTK_WIDGET (range));
     }
@@ -1323,7 +1413,7 @@ gtk_range_get_show_fill_level (GtkRange *range)
 {
   g_return_val_if_fail (GTK_IS_RANGE (range), FALSE);
 
-  return range->layout->show_fill_level;
+  return range->priv->show_fill_level;
 }
 
 /**
@@ -1341,13 +1431,17 @@ void
 gtk_range_set_restrict_to_fill_level (GtkRange *range,
                                       gboolean  restrict_to_fill_level)
 {
+  GtkRangePriv *priv;
+
   g_return_if_fail (GTK_IS_RANGE (range));
 
+  priv = range->priv;
+
   restrict_to_fill_level = restrict_to_fill_level ? TRUE : FALSE;
 
-  if (restrict_to_fill_level != range->layout->restrict_to_fill_level)
+  if (restrict_to_fill_level != priv->restrict_to_fill_level)
     {
-      range->layout->restrict_to_fill_level = restrict_to_fill_level;
+      priv->restrict_to_fill_level = restrict_to_fill_level;
       g_object_notify (G_OBJECT (range), "restrict-to-fill-level");
 
       gtk_range_set_value (range, gtk_range_get_value (range));
@@ -1369,7 +1463,7 @@ gtk_range_get_restrict_to_fill_level (GtkRange *range)
 {
   g_return_val_if_fail (GTK_IS_RANGE (range), FALSE);
 
-  return range->layout->restrict_to_fill_level;
+  return range->priv->restrict_to_fill_level;
 }
 
 /**
@@ -1401,17 +1495,21 @@ void
 gtk_range_set_fill_level (GtkRange *range,
                           gdouble   fill_level)
 {
+  GtkRangePriv *priv;
+
   g_return_if_fail (GTK_IS_RANGE (range));
 
-  if (fill_level != range->layout->fill_level)
+  priv = range->priv;
+
+  if (fill_level != priv->fill_level)
     {
-      range->layout->fill_level = fill_level;
+      priv->fill_level = fill_level;
       g_object_notify (G_OBJECT (range), "fill-level");
 
-      if (range->layout->show_fill_level)
+      if (priv->show_fill_level)
         gtk_widget_queue_draw (GTK_WIDGET (range));
 
-      if (range->layout->restrict_to_fill_level)
+      if (priv->restrict_to_fill_level)
         gtk_range_set_value (range, gtk_range_get_value (range));
     }
 }
@@ -1431,52 +1529,55 @@ gtk_range_get_fill_level (GtkRange *range)
 {
   g_return_val_if_fail (GTK_IS_RANGE (range), 0.0);
 
-  return range->layout->fill_level;
+  return range->priv->fill_level;
 }
 
 static gboolean
 should_invert (GtkRange *range)
-{  
-  if (range->orientation == GTK_ORIENTATION_HORIZONTAL)
+{
+  GtkRangePriv *priv = range->priv;
+
+  if (priv->orientation == GTK_ORIENTATION_HORIZONTAL)
     return
-      (range->inverted && !range->flippable) ||
-      (range->inverted && range->flippable && gtk_widget_get_direction (GTK_WIDGET (range)) == GTK_TEXT_DIR_LTR) ||
-      (!range->inverted && range->flippable && gtk_widget_get_direction (GTK_WIDGET (range)) == GTK_TEXT_DIR_RTL);
+      (priv->inverted && !priv->flippable) ||
+      (priv->inverted && priv->flippable && gtk_widget_get_direction (GTK_WIDGET (range)) == GTK_TEXT_DIR_LTR) ||
+      (!priv->inverted && priv->flippable && gtk_widget_get_direction (GTK_WIDGET (range)) == GTK_TEXT_DIR_RTL);
   else
-    return range->inverted;
+    return priv->inverted;
 }
 
 static void
 gtk_range_destroy (GtkObject *object)
 {
   GtkRange *range = GTK_RANGE (object);
+  GtkRangePriv *priv = range->priv;
 
   gtk_range_remove_step_timer (range);
   gtk_range_remove_update_timer (range);
 
-  if (range->layout->repaint_id)
-    g_source_remove (range->layout->repaint_id);
-  range->layout->repaint_id = 0;
+  if (priv->repaint_id)
+    g_source_remove (priv->repaint_id);
+  priv->repaint_id = 0;
 
-  if (range->adjustment)
+  if (priv->adjustment)
     {
-      g_signal_handlers_disconnect_by_func (range->adjustment,
+      g_signal_handlers_disconnect_by_func (priv->adjustment,
 					    gtk_range_adjustment_changed,
 					    range);
-      g_signal_handlers_disconnect_by_func (range->adjustment,
+      g_signal_handlers_disconnect_by_func (priv->adjustment,
 					    gtk_range_adjustment_value_changed,
 					    range);
-      g_object_unref (range->adjustment);
-      range->adjustment = NULL;
+      g_object_unref (priv->adjustment);
+      priv->adjustment = NULL;
     }
 
-  if (range->layout->n_marks)
+  if (priv->n_marks)
     {
-      g_free (range->layout->marks);
-      range->layout->marks = NULL;
-      g_free (range->layout->mark_pos);
-      range->layout->mark_pos = NULL;
-      range->layout->n_marks = 0;
+      g_free (priv->marks);
+      priv->marks = NULL;
+      g_free (priv->mark_pos);
+      priv->mark_pos = NULL;
+      priv->n_marks = 0;
     }
 
   GTK_OBJECT_CLASS (gtk_range_parent_class)->destroy (object);
@@ -1512,19 +1613,18 @@ static void
 gtk_range_size_allocate (GtkWidget     *widget,
                          GtkAllocation *allocation)
 {
-  GtkRange *range;
-
-  range = GTK_RANGE (widget);
+  GtkRange *range = GTK_RANGE (widget);
+  GtkRangePriv *priv = range->priv;
 
   gtk_widget_set_allocation (widget, allocation);
 
-  range->layout->recalc_marks = TRUE;
+  priv->recalc_marks = TRUE;
 
-  range->need_recalc = TRUE;
-  gtk_range_calc_layout (range, range->adjustment->value);
+  priv->need_recalc = TRUE;
+  gtk_range_calc_layout (range, priv->adjustment->value);
 
   if (gtk_widget_get_realized (widget))
-    gdk_window_move_resize (range->event_window,
+    gdk_window_move_resize (priv->event_window,
                             allocation->x, allocation->y,
                             allocation->width, allocation->height);
 }
@@ -1533,14 +1633,13 @@ static void
 gtk_range_realize (GtkWidget *widget)
 {
   GtkAllocation allocation;
-  GtkRange *range;
+  GtkRange *range = GTK_RANGE (widget);
+  GtkRangePriv *priv = range->priv;
   GdkWindow *window;
   GdkWindowAttr attributes;
   gint attributes_mask;  
 
-  range = GTK_RANGE (widget);
-
-  gtk_range_calc_layout (range, range->adjustment->value);
+  gtk_range_calc_layout (range, priv->adjustment->value);
   
   gtk_widget_set_realized (widget, TRUE);
 
@@ -1566,9 +1665,9 @@ gtk_range_realize (GtkWidget *widget)
 
   attributes_mask = GDK_WA_X | GDK_WA_Y;
 
-  range->event_window = gdk_window_new (gtk_widget_get_parent_window (widget),
+  priv->event_window = gdk_window_new (gtk_widget_get_parent_window (widget),
 					&attributes, attributes_mask);
-  gdk_window_set_user_data (range->event_window, range);
+  gdk_window_set_user_data (priv->event_window, range);
 
   gtk_widget_style_attach (widget);
 }
@@ -1577,13 +1676,14 @@ static void
 gtk_range_unrealize (GtkWidget *widget)
 {
   GtkRange *range = GTK_RANGE (widget);
+  GtkRangePriv *priv = range->priv;
 
   gtk_range_remove_step_timer (range);
   gtk_range_remove_update_timer (range);
-  
-  gdk_window_set_user_data (range->event_window, NULL);
-  gdk_window_destroy (range->event_window);
-  range->event_window = NULL;
+
+  gdk_window_set_user_data (priv->event_window, NULL);
+  gdk_window_destroy (priv->event_window);
+  priv->event_window = NULL;
 
   GTK_WIDGET_CLASS (gtk_range_parent_class)->unrealize (widget);
 }
@@ -1592,8 +1692,9 @@ static void
 gtk_range_map (GtkWidget *widget)
 {
   GtkRange *range = GTK_RANGE (widget);
-  
-  gdk_window_show (range->event_window);
+  GtkRangePriv *priv = range->priv;
+
+  gdk_window_show (priv->event_window);
 
   GTK_WIDGET_CLASS (gtk_range_parent_class)->map (widget);
 }
@@ -1602,10 +1703,11 @@ static void
 gtk_range_unmap (GtkWidget *widget)
 {
   GtkRange *range = GTK_RANGE (widget);
-    
+  GtkRangePriv *priv = range->priv;
+
   stop_scrolling (range);
 
-  gdk_window_hide (range->event_window);
+  gdk_window_hide (priv->event_window);
 
   GTK_WIDGET_CLASS (gtk_range_parent_class)->unmap (widget);
 }
@@ -1613,10 +1715,11 @@ gtk_range_unmap (GtkWidget *widget)
 static const gchar *
 gtk_range_get_slider_detail (GtkRange *range)
 {
+  GtkRangePriv *priv = range->priv;
   const gchar *slider_detail;
 
-  if (range->layout->slider_detail_quark)
-    return g_quark_to_string (range->layout->slider_detail_quark);
+  if (priv->slider_detail_quark)
+    return g_quark_to_string (priv->slider_detail_quark);
 
   slider_detail = GTK_RANGE_GET_CLASS (range)->slider_detail;
 
@@ -1624,13 +1727,13 @@ gtk_range_get_slider_detail (GtkRange *range)
     {
       gchar *detail = g_strdup (slider_detail);
 
-      detail[0] = range->orientation == GTK_ORIENTATION_HORIZONTAL ? 'h' : 'v';
+      detail[0] = priv->orientation == GTK_ORIENTATION_HORIZONTAL ? 'h' : 'v';
 
-      range->layout->slider_detail_quark = g_quark_from_string (detail);
+      priv->slider_detail_quark = g_quark_from_string (detail);
 
       g_free (detail);
 
-      return g_quark_to_string (range->layout->slider_detail_quark);
+      return g_quark_to_string (priv->slider_detail_quark);
     }
 
   return slider_detail;
@@ -1640,12 +1743,13 @@ static const gchar *
 gtk_range_get_stepper_detail (GtkRange *range,
                               Stepper   stepper)
 {
+  GtkRangePriv *priv = range->priv;
   const gchar *stepper_detail;
   gboolean need_orientation;
   gboolean need_position;
 
-  if (range->layout->stepper_detail_quark[stepper])
-    return g_quark_to_string (range->layout->stepper_detail_quark[stepper]);
+  if (priv->stepper_detail_quark[stepper])
+    return g_quark_to_string (priv->stepper_detail_quark[stepper]);
 
   stepper_detail = GTK_RANGE_GET_CLASS (range)->stepper_detail;
 
@@ -1668,13 +1772,13 @@ gtk_range_get_stepper_detail (GtkRange *range,
               position = "_start";
               break;
             case STEPPER_B:
-              if (range->has_stepper_a)
+              if (priv->has_stepper_a)
                 position = "_start_inner";
               else
                 position = "_start";
               break;
             case STEPPER_C:
-              if (range->has_stepper_d)
+              if (priv->has_stepper_d)
                 position = "_end_inner";
               else
                 position = "_end";
@@ -1690,13 +1794,13 @@ gtk_range_get_stepper_detail (GtkRange *range,
       detail = g_strconcat (stepper_detail, position, NULL);
 
       if (need_orientation)
-        detail[0] = range->orientation == GTK_ORIENTATION_HORIZONTAL ? 'h' : 'v';
+        detail[0] = priv->orientation == GTK_ORIENTATION_HORIZONTAL ? 'h' : 'v';
 
-      range->layout->stepper_detail_quark[stepper] = g_quark_from_string (detail);
+      priv->stepper_detail_quark[stepper] = g_quark_from_string (detail);
 
       g_free (detail);
 
-      return g_quark_to_string (range->layout->stepper_detail_quark[stepper]);
+      return g_quark_to_string (priv->stepper_detail_quark[stepper]);
     }
 
   return stepper_detail;
@@ -1710,6 +1814,7 @@ draw_stepper (GtkRange     *range,
               gboolean      prelighted,
               GdkRectangle *area)
 {
+  GtkRangePriv *priv = range->priv;
   GtkAllocation allocation;
   GtkStateType state_type;
   GtkShadowType shadow_type;
@@ -1727,16 +1832,16 @@ draw_stepper (GtkRange     *range,
   switch (stepper)
     {
     case STEPPER_A:
-      rect = &range->layout->stepper_a;
+      rect = &priv->stepper_a;
       break;
     case STEPPER_B:
-      rect = &range->layout->stepper_b;
+      rect = &priv->stepper_b;
       break;
     case STEPPER_C:
-      rect = &range->layout->stepper_c;
+      rect = &priv->stepper_c;
       break;
     case STEPPER_D:
-      rect = &range->layout->stepper_d;
+      rect = &priv->stepper_d;
       break;
     default:
       g_assert_not_reached ();
@@ -1753,16 +1858,16 @@ draw_stepper (GtkRange     *range,
   intersection.x += allocation.x;
   intersection.y += allocation.y;
 
-  if ((!range->inverted && (arrow_type == GTK_ARROW_DOWN ||
+  if ((!priv->inverted && (arrow_type == GTK_ARROW_DOWN ||
                             arrow_type == GTK_ARROW_RIGHT)) ||
-      (range->inverted  && (arrow_type == GTK_ARROW_UP ||
+      (priv->inverted  && (arrow_type == GTK_ARROW_UP ||
                             arrow_type == GTK_ARROW_LEFT)))
     {
-      arrow_sensitive = range->layout->upper_sensitive;
+      arrow_sensitive = priv->upper_sensitive;
     }
   else
     {
-      arrow_sensitive = range->layout->lower_sensitive;
+      arrow_sensitive = priv->lower_sensitive;
     }
 
   if (!gtk_widget_is_sensitive (GTK_WIDGET (range)) || !arrow_sensitive)
@@ -1826,6 +1931,7 @@ gtk_range_expose (GtkWidget      *widget,
 {
   GtkAllocation allocation;
   GtkRange *range = GTK_RANGE (widget);
+  GtkRangePriv *priv = range->priv;
   gboolean sensitive;
   GtkStateType state;
   GtkShadowType shadow_type;
@@ -1851,9 +1957,9 @@ gtk_range_expose (GtkWidget      *widget,
   window = gtk_widget_get_window (widget);
 
   /* we're now exposing, so there's no need to force early repaints */
-  if (range->layout->repaint_id)
-    g_source_remove (range->layout->repaint_id);
-  range->layout->repaint_id = 0;
+  if (priv->repaint_id)
+    g_source_remove (priv->repaint_id);
+  priv->repaint_id = 0;
 
   gtk_widget_get_allocation (widget, &allocation);
 
@@ -1862,7 +1968,7 @@ gtk_range_expose (GtkWidget      *widget,
   expose_area.y -= allocation.y;
 
   gtk_range_calc_marks (range);
-  gtk_range_calc_layout (range, range->adjustment->value);
+  gtk_range_calc_layout (range, priv->adjustment->value);
 
   sensitive = gtk_widget_is_sensitive (widget);
 
@@ -1873,16 +1979,16 @@ gtk_range_expose (GtkWidget      *widget,
   /* The gdk_rectangle_intersect is more to get the right
    * clip region (limited to range_rect) than for efficiency
    */
-  if (gdk_rectangle_intersect (&expose_area, &range->range_rect,
+  if (gdk_rectangle_intersect (&expose_area, &priv->range_rect,
                                &area))
     {
-      gint     x      = (allocation.x + range->range_rect.x +
+      gint     x      = (allocation.x + priv->range_rect.x +
                          focus_line_width + focus_padding);
-      gint     y      = (allocation.y + range->range_rect.y +
+      gint     y      = (allocation.y + priv->range_rect.y +
                          focus_line_width + focus_padding);
-      gint     width  = (range->range_rect.width -
+      gint     width  = (priv->range_rect.width -
                          2 * (focus_line_width + focus_padding));
-      gint     height = (range->range_rect.height -
+      gint     height = (priv->range_rect.height -
                          2 * (focus_line_width + focus_padding));
       gboolean trough_side_details;
       gboolean trough_under_steppers;
@@ -1907,32 +2013,32 @@ gtk_range_expose (GtkWidget      *widget,
           gint offset  = 0;
           gint shorter = 0;
 
-          if (range->has_stepper_a)
+          if (priv->has_stepper_a)
             offset += stepper_size;
 
-          if (range->has_stepper_b)
+          if (priv->has_stepper_b)
             offset += stepper_size;
 
           shorter += offset;
 
-          if (range->has_stepper_c)
+          if (priv->has_stepper_c)
             shorter += stepper_size;
 
-          if (range->has_stepper_d)
+          if (priv->has_stepper_d)
             shorter += stepper_size;
 
-          if (range->has_stepper_a || range->has_stepper_b)
+          if (priv->has_stepper_a || priv->has_stepper_b)
             {
               offset  += stepper_spacing;
               shorter += stepper_spacing;
             }
 
-          if (range->has_stepper_c || range->has_stepper_d)
+          if (priv->has_stepper_c || priv->has_stepper_d)
             {
               shorter += stepper_spacing;
             }
 
-          if (range->orientation == GTK_ORIENTATION_HORIZONTAL)
+          if (priv->orientation == GTK_ORIENTATION_HORIZONTAL)
             {
               x     += offset;
               width -= shorter;
@@ -1958,13 +2064,13 @@ gtk_range_expose (GtkWidget      *widget,
 	  gint trough_change_pos_x = width;
 	  gint trough_change_pos_y = height;
 
-	  if (range->orientation == GTK_ORIENTATION_HORIZONTAL)
-	    trough_change_pos_x = (range->layout->slider.x +
-                                   range->layout->slider.width / 2 -
+	  if (priv->orientation == GTK_ORIENTATION_HORIZONTAL)
+	    trough_change_pos_x = (priv->slider.x +
+                                   priv->slider.width / 2 -
                                    (x - allocation.x));
 	  else
-	    trough_change_pos_y = (range->layout->slider.y +
-                                   range->layout->slider.height / 2 -
+	    trough_change_pos_y = (priv->slider.y +
+                                   priv->slider.height / 2 -
                                    (y - allocation.y));
 
           gtk_paint_box (style, window,
@@ -1975,7 +2081,7 @@ gtk_range_expose (GtkWidget      *widget,
                          x, y,
                          trough_change_pos_x, trough_change_pos_y);
 
-	  if (range->orientation == GTK_ORIENTATION_HORIZONTAL)
+	  if (priv->orientation == GTK_ORIENTATION_HORIZONTAL)
 	    trough_change_pos_y = 0;
 	  else
 	    trough_change_pos_x = 0;
@@ -1990,51 +2096,51 @@ gtk_range_expose (GtkWidget      *widget,
                          height - trough_change_pos_y);
         }
 
-      if (range->layout->show_fill_level &&
-          range->adjustment->upper - range->adjustment->page_size -
-          range->adjustment->lower != 0)
+      if (priv->show_fill_level &&
+          priv->adjustment->upper - priv->adjustment->page_size -
+          priv->adjustment->lower != 0)
 	{
-          gdouble  fill_level  = range->layout->fill_level;
+          gdouble  fill_level  = priv->fill_level;
 	  gint     fill_x      = x;
 	  gint     fill_y      = y;
 	  gint     fill_width  = width;
 	  gint     fill_height = height;
 	  gchar   *fill_detail;
 
-          fill_level = CLAMP (fill_level, range->adjustment->lower,
-                              range->adjustment->upper -
-                              range->adjustment->page_size);
+          fill_level = CLAMP (fill_level, priv->adjustment->lower,
+                              priv->adjustment->upper -
+                              priv->adjustment->page_size);
 
-	  if (range->orientation == GTK_ORIENTATION_HORIZONTAL)
+	  if (priv->orientation == GTK_ORIENTATION_HORIZONTAL)
 	    {
-	      fill_x     = allocation.x + range->layout->trough.x;
-	      fill_width = (range->layout->slider.width +
-                            (fill_level - range->adjustment->lower) /
-                            (range->adjustment->upper -
-                             range->adjustment->lower -
-                             range->adjustment->page_size) *
-                            (range->layout->trough.width -
-                             range->layout->slider.width));
+	      fill_x     = allocation.x + priv->trough.x;
+	      fill_width = (priv->slider.width +
+                            (fill_level - priv->adjustment->lower) /
+                            (priv->adjustment->upper -
+                             priv->adjustment->lower -
+                             priv->adjustment->page_size) *
+                            (priv->trough.width -
+                             priv->slider.width));
 
               if (should_invert (range))
-                fill_x += range->layout->trough.width - fill_width;
+                fill_x += priv->trough.width - fill_width;
 	    }
 	  else
 	    {
-	      fill_y      = allocation.y + range->layout->trough.y;
-	      fill_height = (range->layout->slider.height +
-                             (fill_level - range->adjustment->lower) /
-                             (range->adjustment->upper -
-                              range->adjustment->lower -
-                              range->adjustment->page_size) *
-                             (range->layout->trough.height -
-                              range->layout->slider.height));
+	      fill_y      = allocation.y + priv->trough.y;
+	      fill_height = (priv->slider.height +
+                             (fill_level - priv->adjustment->lower) /
+                             (priv->adjustment->upper -
+                              priv->adjustment->lower -
+                              priv->adjustment->page_size) *
+                             (priv->trough.height -
+                              priv->slider.height));
 
               if (should_invert (range))
-                fill_y += range->layout->trough.height - fill_height;
+                fill_y += priv->trough.height - fill_height;
 	    }
 
-	  if (fill_level < range->adjustment->upper - range->adjustment->page_size)
+	  if (fill_level < priv->adjustment->upper - priv->adjustment->page_size)
 	    fill_detail = "trough-fill-level-full";
 	  else
 	    fill_detail = "trough-fill-level";
@@ -2051,22 +2157,22 @@ gtk_range_expose (GtkWidget      *widget,
         gtk_paint_focus (style, window,
                          gtk_widget_get_state (widget),
                          &area, widget, "trough",
-                         allocation.x + range->range_rect.x,
-                         allocation.y + range->range_rect.y,
-                         range->range_rect.width,
-                         range->range_rect.height);
+                         allocation.x + priv->range_rect.x,
+                         allocation.y + priv->range_rect.y,
+                         priv->range_rect.width,
+                         priv->range_rect.height);
     }
 
   shadow_type = GTK_SHADOW_OUT;
 
   if (!sensitive)
     state = GTK_STATE_INSENSITIVE;
-  else if (!touchscreen && range->layout->mouse_location == MOUSE_SLIDER)
+  else if (!touchscreen && priv->mouse_location == MOUSE_SLIDER)
     state = GTK_STATE_PRELIGHT;
   else
     state = GTK_STATE_NORMAL;
 
-  if (range->layout->grab_location == MOUSE_SLIDER)
+  if (priv->grab_location == MOUSE_SLIDER)
     {
       gboolean activate_slider;
 
@@ -2080,7 +2186,7 @@ gtk_range_expose (GtkWidget      *widget,
     }
 
   if (gdk_rectangle_intersect (&expose_area,
-                               &range->layout->slider,
+                               &priv->slider,
                                &area))
     {
       area.x += allocation.x;
@@ -2093,39 +2199,39 @@ gtk_range_expose (GtkWidget      *widget,
                         &area,
                         widget,
                         gtk_range_get_slider_detail (range),
-                        allocation.x + range->layout->slider.x,
-                        allocation.y + range->layout->slider.y,
-                        range->layout->slider.width,
-                        range->layout->slider.height,
-                        range->orientation);
+                        allocation.x + priv->slider.x,
+                        allocation.y + priv->slider.y,
+                        priv->slider.width,
+                        priv->slider.height,
+                        priv->orientation);
     }
-  
-  if (range->has_stepper_a)
+
+  if (priv->has_stepper_a)
     draw_stepper (range, STEPPER_A,
-                  range->orientation == GTK_ORIENTATION_VERTICAL ? GTK_ARROW_UP : GTK_ARROW_LEFT,
-                  range->layout->grab_location == MOUSE_STEPPER_A,
-                  !touchscreen && range->layout->mouse_location == MOUSE_STEPPER_A,
+                  priv->orientation == GTK_ORIENTATION_VERTICAL ? GTK_ARROW_UP : GTK_ARROW_LEFT,
+                  priv->grab_location == MOUSE_STEPPER_A,
+                  !touchscreen && priv->mouse_location == MOUSE_STEPPER_A,
                   &expose_area);
 
-  if (range->has_stepper_b)
+  if (priv->has_stepper_b)
     draw_stepper (range, STEPPER_B,
-                  range->orientation == GTK_ORIENTATION_VERTICAL ? GTK_ARROW_DOWN : GTK_ARROW_RIGHT,
-                  range->layout->grab_location == MOUSE_STEPPER_B,
-                  !touchscreen && range->layout->mouse_location == MOUSE_STEPPER_B,
+                  priv->orientation == GTK_ORIENTATION_VERTICAL ? GTK_ARROW_DOWN : GTK_ARROW_RIGHT,
+                  priv->grab_location == MOUSE_STEPPER_B,
+                  !touchscreen && priv->mouse_location == MOUSE_STEPPER_B,
                   &expose_area);
 
-  if (range->has_stepper_c)
+  if (priv->has_stepper_c)
     draw_stepper (range, STEPPER_C,
-                  range->orientation == GTK_ORIENTATION_VERTICAL ? GTK_ARROW_UP : GTK_ARROW_LEFT,
-                  range->layout->grab_location == MOUSE_STEPPER_C,
-                  !touchscreen && range->layout->mouse_location == MOUSE_STEPPER_C,
+                  priv->orientation == GTK_ORIENTATION_VERTICAL ? GTK_ARROW_UP : GTK_ARROW_LEFT,
+                  priv->grab_location == MOUSE_STEPPER_C,
+                  !touchscreen && priv->mouse_location == MOUSE_STEPPER_C,
                   &expose_area);
 
-  if (range->has_stepper_d)
+  if (priv->has_stepper_d)
     draw_stepper (range, STEPPER_D,
-                  range->orientation == GTK_ORIENTATION_VERTICAL ? GTK_ARROW_DOWN : GTK_ARROW_RIGHT,
-                  range->layout->grab_location == MOUSE_STEPPER_D,
-                  !touchscreen && range->layout->mouse_location == MOUSE_STEPPER_D,
+                  priv->orientation == GTK_ORIENTATION_VERTICAL ? GTK_ARROW_DOWN : GTK_ARROW_RIGHT,
+                  priv->grab_location == MOUSE_STEPPER_D,
+                  !touchscreen && priv->mouse_location == MOUSE_STEPPER_D,
                   &expose_area);
   
   return FALSE;
@@ -2137,23 +2243,23 @@ range_grab_add (GtkRange      *range,
                 MouseLocation  location,
                 gint           button)
 {
-  GtkRangeLayout *layout = range->layout;
+  GtkRangePriv *priv = range->priv;
 
-  if (device == layout->grab_device)
+  if (device == priv->grab_device)
     return;
 
-  if (layout->grab_device != NULL)
+  if (priv->grab_device != NULL)
     {
       g_warning ("GtkRange already had a grab device, releasing device grab");
-      gtk_device_grab_remove (GTK_WIDGET (range), layout->grab_device);
+      gtk_device_grab_remove (GTK_WIDGET (range), priv->grab_device);
     }
 
   /* we don't actually gdk_grab, since a button is down */
   gtk_device_grab_add (GTK_WIDGET (range), device, TRUE);
 
-  range->layout->grab_location = location;
-  range->layout->grab_button = button;
-  range->layout->grab_device = device;
+  priv->grab_location = location;
+  priv->grab_button = button;
+  priv->grab_device = device;
 
   if (gtk_range_update_mouse_location (range))
     gtk_widget_queue_draw (GTK_WIDGET (range));
@@ -2162,19 +2268,19 @@ range_grab_add (GtkRange      *range,
 static void
 range_grab_remove (GtkRange *range)
 {
-  GtkRangeLayout *layout = range->layout;
+  GtkRangePriv *priv = range->priv;
   MouseLocation location;
 
-  if (layout->grab_device)
+  if (priv->grab_device)
     {
       gtk_device_grab_remove (GTK_WIDGET (range),
-                              layout->grab_device);
-      layout->grab_device = NULL;
+                              priv->grab_device);
+      priv->grab_device = NULL;
     }
 
-  location = range->layout->grab_location; 
-  range->layout->grab_location = MOUSE_OUTSIDE;
-  range->layout->grab_button = 0;
+  location = priv->grab_location;
+  priv->grab_location = MOUSE_OUTSIDE;
+  priv->grab_button = 0;
 
   if (gtk_range_update_mouse_location (range) ||
       location != MOUSE_OUTSIDE)
@@ -2183,16 +2289,17 @@ range_grab_remove (GtkRange *range)
 
 static GtkScrollType
 range_get_scroll_for_grab (GtkRange      *range)
-{ 
+{
+  GtkRangePriv *priv = range->priv;
   gboolean invert;
 
   invert = should_invert (range);
-  switch (range->layout->grab_location)
+  switch (priv->grab_location)
     {
       /* Backward stepper */
     case MOUSE_STEPPER_A:
     case MOUSE_STEPPER_C:
-      switch (range->layout->grab_button)
+      switch (priv->grab_button)
         {
         case 1:
           return invert ? GTK_SCROLL_STEP_FORWARD : GTK_SCROLL_STEP_BACKWARD;
@@ -2209,7 +2316,7 @@ range_get_scroll_for_grab (GtkRange      *range)
       /* Forward stepper */
     case MOUSE_STEPPER_B:
     case MOUSE_STEPPER_D:
-      switch (range->layout->grab_button)
+      switch (priv->grab_button)
         {
         case 1:
           return invert ? GTK_SCROLL_STEP_BACKWARD : GTK_SCROLL_STEP_FORWARD;
@@ -2226,7 +2333,7 @@ range_get_scroll_for_grab (GtkRange      *range)
       /* In the trough */
     case MOUSE_TROUGH:
       {
-        if (range->trough_click_forward)
+        if (priv->trough_click_forward)
 	  return GTK_SCROLL_PAGE_FORWARD;
         else
 	  return GTK_SCROLL_PAGE_BACKWARD;
@@ -2246,6 +2353,7 @@ static gdouble
 coord_to_value (GtkRange *range,
                 gint      coord)
 {
+  GtkRangePriv *priv = range->priv;
   gdouble frac;
   gdouble value;
   gint    trough_length;
@@ -2254,17 +2362,17 @@ coord_to_value (GtkRange *range,
   gint    trough_border;
   gint    trough_under_steppers;
 
-  if (range->orientation == GTK_ORIENTATION_VERTICAL)
+  if (priv->orientation == GTK_ORIENTATION_VERTICAL)
     {
-      trough_length = range->layout->trough.height;
-      trough_start  = range->layout->trough.y;
-      slider_length = range->layout->slider.height;
+      trough_length = priv->trough.height;
+      trough_start  = priv->trough.y;
+      slider_length = priv->slider.height;
     }
   else
     {
-      trough_length = range->layout->trough.width;
-      trough_start  = range->layout->trough.x;
-      slider_length = range->layout->slider.width;
+      trough_length = priv->trough.width;
+      trough_start  = priv->trough.x;
+      slider_length = priv->slider.width;
     }
 
   gtk_range_get_props (range, NULL, NULL, NULL, &trough_border, NULL,
@@ -2285,9 +2393,9 @@ coord_to_value (GtkRange *range,
   if (should_invert (range))
     frac = 1.0 - frac;
 
-  value = range->adjustment->lower + frac * (range->adjustment->upper -
-                                             range->adjustment->lower -
-                                             range->adjustment->page_size);
+  value = priv->adjustment->lower + frac * (priv->adjustment->upper -
+                                            priv->adjustment->lower -
+                                            priv->adjustment->page_size);
 
   return value;
 }
@@ -2298,20 +2406,20 @@ gtk_range_key_press (GtkWidget   *widget,
 {
   GdkDevice *device;
   GtkRange *range = GTK_RANGE (widget);
-  GtkRangeLayout *layout = range->layout;
+  GtkRangePriv *priv = range->priv;
 
   device = gdk_event_get_device ((GdkEvent *) event);
   device = gdk_device_get_associated_device (device);
 
-  if (device == layout->grab_device &&
+  if (device == priv->grab_device &&
       event->keyval == GDK_Escape &&
-      range->layout->grab_location != MOUSE_OUTSIDE)
+      priv->grab_location != MOUSE_OUTSIDE)
     {
       stop_scrolling (range);
 
       update_slider_position (range,
-			      range->slide_initial_coordinate,
-			      range->slide_initial_coordinate);
+			      priv->slide_initial_coordinate,
+			      priv->slide_initial_coordinate);
 
       return TRUE;
     }
@@ -2324,23 +2432,24 @@ gtk_range_button_press (GtkWidget      *widget,
 			GdkEventButton *event)
 {
   GtkRange *range = GTK_RANGE (widget);
+  GtkRangePriv *priv = range->priv;
   GdkDevice *device;
-  
+
   if (!gtk_widget_has_focus (widget))
     gtk_widget_grab_focus (widget);
 
   /* ignore presses when we're already doing something else. */
-  if (range->layout->grab_location != MOUSE_OUTSIDE)
+  if (priv->grab_location != MOUSE_OUTSIDE)
     return FALSE;
 
   device = gdk_event_get_device ((GdkEvent *) event);
-  range->layout->mouse_x = event->x;
-  range->layout->mouse_y = event->y;
+  priv->mouse_x = event->x;
+  priv->mouse_y = event->y;
 
   if (gtk_range_update_mouse_location (range))
     gtk_widget_queue_draw (widget);
-    
-  if (range->layout->mouse_location == MOUSE_TROUGH  &&
+
+  if (priv->mouse_location == MOUSE_TROUGH  &&
       event->button == 1)
     {
       /* button 1 steps by page increment, as with button 2 on a stepper
@@ -2349,10 +2458,10 @@ gtk_range_button_press (GtkWidget      *widget,
       gdouble click_value;
       
       click_value = coord_to_value (range,
-                                    range->orientation == GTK_ORIENTATION_VERTICAL ?
+                                    priv->orientation == GTK_ORIENTATION_VERTICAL ?
                                     event->y : event->x);
-      
-      range->trough_click_forward = click_value > range->adjustment->value;
+
+      priv->trough_click_forward = click_value > priv->adjustment->value;
       range_grab_add (range, device, MOUSE_TROUGH, event->button);
       
       scroll = range_get_scroll_for_grab (range);
@@ -2361,20 +2470,21 @@ gtk_range_button_press (GtkWidget      *widget,
 
       return TRUE;
     }
-  else if ((range->layout->mouse_location == MOUSE_STEPPER_A ||
-            range->layout->mouse_location == MOUSE_STEPPER_B ||
-            range->layout->mouse_location == MOUSE_STEPPER_C ||
-            range->layout->mouse_location == MOUSE_STEPPER_D) &&
+  else if ((priv->mouse_location == MOUSE_STEPPER_A ||
+            priv->mouse_location == MOUSE_STEPPER_B ||
+            priv->mouse_location == MOUSE_STEPPER_C ||
+            priv->mouse_location == MOUSE_STEPPER_D) &&
            (event->button == 1 || event->button == 2 || event->button == 3))
     {
       GtkAllocation allocation;
       GdkRectangle *stepper_area;
       GtkScrollType scroll;
-      
-      range_grab_add (range, device, range->layout->mouse_location, event->button);
 
-      stepper_area = get_area (range, range->layout->mouse_location);
+      range_grab_add (range, device, priv->mouse_location, event->button);
+
       gtk_widget_get_allocation (widget, &allocation);
+      stepper_area = get_area (range, priv->mouse_location);
+
       gtk_widget_queue_draw_area (widget,
                                   allocation.x + stepper_area->x,
                                   allocation.y + stepper_area->y,
@@ -2387,9 +2497,9 @@ gtk_range_button_press (GtkWidget      *widget,
       
       return TRUE;
     }
-  else if ((range->layout->mouse_location == MOUSE_TROUGH &&
+  else if ((priv->mouse_location == MOUSE_TROUGH &&
             event->button == 2) ||
-           range->layout->mouse_location == MOUSE_SLIDER)
+           priv->mouse_location == MOUSE_SLIDER)
     {
       gboolean need_value_update = FALSE;
       gboolean activate_slider;
@@ -2405,21 +2515,21 @@ gtk_range_button_press (GtkWidget      *widget,
           
           slider_high_value =
             coord_to_value (range,
-                            range->orientation == GTK_ORIENTATION_VERTICAL ?
+                            priv->orientation == GTK_ORIENTATION_VERTICAL ?
                             event->y : event->x);
           slider_low_value =
             coord_to_value (range,
-                            range->orientation == GTK_ORIENTATION_VERTICAL ?
-                            event->y - range->layout->slider.height :
-                            event->x - range->layout->slider.width);
-          
+                            priv->orientation == GTK_ORIENTATION_VERTICAL ?
+                            event->y - priv->slider.height :
+                            event->x - priv->slider.width);
+
           /* compute new value for warped slider */
           new_value = slider_low_value + (slider_high_value - slider_low_value) / 2;
 
 	  /* recalc slider, so we can set slide_initial_slider_position
            * properly
            */
-	  range->need_recalc = TRUE;
+	  priv->need_recalc = TRUE;
           gtk_range_calc_layout (range, new_value);
 
 	  /* defer adjustment updates to update_slider_position() in order
@@ -2427,16 +2537,16 @@ gtk_range_button_press (GtkWidget      *widget,
 	   */
 	  need_value_update = TRUE;
         }
-      
-      if (range->orientation == GTK_ORIENTATION_VERTICAL)
+
+      if (priv->orientation == GTK_ORIENTATION_VERTICAL)
         {
-          range->slide_initial_slider_position = range->layout->slider.y;
-          range->slide_initial_coordinate = event->y;
+          priv->slide_initial_slider_position = priv->slider.y;
+          priv->slide_initial_coordinate = event->y;
         }
       else
         {
-          range->slide_initial_slider_position = range->layout->slider.x;
-          range->slide_initial_coordinate = event->x;
+          priv->slide_initial_slider_position = priv->slider.x;
+          priv->slide_initial_coordinate = event->x;
         }
 
       range_grab_add (range, device, MOUSE_SLIDER, event->button);
@@ -2464,6 +2574,7 @@ update_slider_position (GtkRange *range,
                         gint      mouse_x,
                         gint      mouse_y)
 {
+  GtkRangePriv *priv = range->priv;
   gint delta;
   gint c;
   gdouble new_value;
@@ -2473,24 +2584,24 @@ update_slider_position (GtkRange *range,
   gdouble mark_delta;
   gint i;
 
-  if (range->orientation == GTK_ORIENTATION_VERTICAL)
-    delta = mouse_y - range->slide_initial_coordinate;
+  if (priv->orientation == GTK_ORIENTATION_VERTICAL)
+    delta = mouse_y - priv->slide_initial_coordinate;
   else
-    delta = mouse_x - range->slide_initial_coordinate;
+    delta = mouse_x - priv->slide_initial_coordinate;
 
-  c = range->slide_initial_slider_position + delta;
+  c = priv->slide_initial_slider_position + delta;
 
   new_value = coord_to_value (range, c);
   next_value = coord_to_value (range, c + 1);
   mark_delta = fabs (next_value - new_value); 
 
-  for (i = 0; i < range->layout->n_marks; i++)
+  for (i = 0; i < priv->n_marks; i++)
     {
-      mark_value = range->layout->marks[i];
+      mark_value = priv->marks[i];
 
-      if (fabs (range->adjustment->value - mark_value) < 3 * mark_delta)
+      if (fabs (priv->adjustment->value - mark_value) < 3 * mark_delta)
         {
-          if (fabs (new_value - mark_value) < (range->slider_end - range->slider_start) * 0.5 * mark_delta)
+          if (fabs (new_value - mark_value) < (priv->slider_end - priv->slider_start) * 0.5 * mark_delta)
             {
               new_value = mark_value;
               break;
@@ -2516,16 +2627,17 @@ gtk_range_grab_broken (GtkWidget          *widget,
 		       GdkEventGrabBroken *event)
 {
   GtkRange *range = GTK_RANGE (widget);
+  GtkRangePriv *priv = range->priv;
   GdkDevice *device;
 
   device = gdk_event_get_device ((GdkEvent *) event);
 
-  if (device == range->layout->grab_device &&
-      range->layout->grab_location != MOUSE_OUTSIDE)
+  if (device == priv->grab_device &&
+      priv->grab_location != MOUSE_OUTSIDE)
     {
-      if (range->layout->grab_location == MOUSE_SLIDER)
-	update_slider_position (range, range->layout->mouse_x, range->layout->mouse_y);
-      
+      if (priv->grab_location == MOUSE_SLIDER)
+	update_slider_position (range, priv->mouse_x, priv->mouse_y);
+
       stop_scrolling (range);
       
       return TRUE;
@@ -2539,29 +2651,30 @@ gtk_range_button_release (GtkWidget      *widget,
 			  GdkEventButton *event)
 {
   GtkRange *range = GTK_RANGE (widget);
+  GtkRangePriv *priv = range->priv;
   GdkDevice *device;
 
-  if (event->window == range->event_window)
+  if (event->window == priv->event_window)
     {
-      range->layout->mouse_x = event->x;
-      range->layout->mouse_y = event->y;
+      priv->mouse_x = event->x;
+      priv->mouse_y = event->y;
     }
   else
     {
-      gdk_window_get_device_position (range->event_window,
+      gdk_window_get_device_position (priv->event_window,
                                       event->device,
-                                      &range->layout->mouse_x,
-                                      &range->layout->mouse_y,
+                                      &priv->mouse_x,
+                                      &priv->mouse_y,
                                       NULL);
     }
 
   device = gdk_event_get_device ((GdkEvent *) event);
 
-  if (range->layout->grab_device == device &&
-      range->layout->grab_button == event->button)
+  if (priv->grab_device == device &&
+      priv->grab_button == event->button)
     {
-      if (range->layout->grab_location == MOUSE_SLIDER)
-        update_slider_position (range, range->layout->mouse_x, range->layout->mouse_y);
+      if (priv->grab_location == MOUSE_SLIDER)
+        update_slider_position (range, priv->mouse_x, priv->mouse_y);
 
       stop_scrolling (range);
       
@@ -2586,7 +2699,8 @@ gdouble
 _gtk_range_get_wheel_delta (GtkRange           *range,
 			    GdkScrollDirection  direction)
 {
-  GtkAdjustment *adj = range->adjustment;
+  GtkRangePriv *priv = range->priv;
+  GtkAdjustment *adj = priv->adjustment;
   gdouble delta;
 
   if (GTK_IS_SCROLLBAR (range))
@@ -2598,7 +2712,7 @@ _gtk_range_get_wheel_delta (GtkRange           *range,
       direction == GDK_SCROLL_LEFT)
     delta = - delta;
   
-  if (range->inverted)
+  if (priv->inverted)
     delta = - delta;
 
   return delta;
@@ -2609,10 +2723,11 @@ gtk_range_scroll_event (GtkWidget      *widget,
 			GdkEventScroll *event)
 {
   GtkRange *range = GTK_RANGE (widget);
+  GtkRangePriv *priv = range->priv;
 
   if (gtk_widget_get_realized (widget))
     {
-      GtkAdjustment *adj = GTK_RANGE (range)->adjustment;
+      GtkAdjustment *adj = priv->adjustment;
       gdouble delta;
       gboolean handled;
 
@@ -2626,7 +2741,7 @@ gtk_range_scroll_event (GtkWidget      *widget,
        * but DISCONTINUOUS doesn't, so we update immediately
        * for DISCONTINUOUS
        */
-      if (range->update_policy == GTK_UPDATE_DISCONTINUOUS)
+      if (priv->update_policy == GTK_UPDATE_DISCONTINUOUS)
         gtk_range_update_value (range);
     }
 
@@ -2637,23 +2752,22 @@ static gboolean
 gtk_range_motion_notify (GtkWidget      *widget,
 			 GdkEventMotion *event)
 {
-  GtkRange *range;
-
-  range = GTK_RANGE (widget);
+  GtkRange *range = GTK_RANGE (widget);
+  GtkRangePriv *priv = range->priv;
 
   gdk_event_request_motions (event);
-  
-  range->layout->mouse_x = event->x;
-  range->layout->mouse_y = event->y;
+
+  priv->mouse_x = event->x;
+  priv->mouse_y = event->y;
 
   if (gtk_range_update_mouse_location (range))
     gtk_widget_queue_draw (widget);
 
-  if (range->layout->grab_location == MOUSE_SLIDER)
+  if (priv->grab_location == MOUSE_SLIDER)
     update_slider_position (range, event->x, event->y);
 
   /* We handled the event if the mouse was in the range_rect */
-  return range->layout->mouse_location != MOUSE_OUTSIDE;
+  return priv->mouse_location != MOUSE_OUTSIDE;
 }
 
 static gboolean
@@ -2661,9 +2775,10 @@ gtk_range_enter_notify (GtkWidget        *widget,
 			GdkEventCrossing *event)
 {
   GtkRange *range = GTK_RANGE (widget);
+  GtkRangePriv *priv = range->priv;
 
-  range->layout->mouse_x = event->x;
-  range->layout->mouse_y = event->y;
+  priv->mouse_x = event->x;
+  priv->mouse_y = event->y;
 
   if (gtk_range_update_mouse_location (range))
     gtk_widget_queue_draw (widget);
@@ -2676,9 +2791,10 @@ gtk_range_leave_notify (GtkWidget        *widget,
 			GdkEventCrossing *event)
 {
   GtkRange *range = GTK_RANGE (widget);
+  GtkRangePriv *priv = range->priv;
 
-  range->layout->mouse_x = -1;
-  range->layout->mouse_y = -1;
+  priv->mouse_x = -1;
+  priv->mouse_y = -1;
 
   if (gtk_range_update_mouse_location (range))
     gtk_widget_queue_draw (widget);
@@ -2690,10 +2806,10 @@ static void
 gtk_range_grab_notify (GtkWidget *widget,
 		       gboolean   was_grabbed)
 {
-  GtkRangeLayout *layout = GTK_RANGE (widget)->layout;
+  GtkRangePriv *priv = GTK_RANGE (widget)->priv;
 
-  if (layout->grab_device &&
-      gtk_widget_device_is_shadowed (widget, layout->grab_device))
+  if (priv->grab_device &&
+      gtk_widget_device_is_shadowed (widget, priv->grab_device))
     stop_scrolling (GTK_RANGE (widget));
 }
 
@@ -2714,18 +2830,18 @@ gtk_range_state_changed (GtkWidget    *widget,
   }
 
 static gboolean
-layout_changed (GtkRangeLayout *layout1, 
-		GtkRangeLayout *layout2)
+layout_changed (GtkRangePriv *priv1,
+		GtkRangePriv *priv2)
 {
-  check_rectangle (layout1->slider, layout2->slider);
-  check_rectangle (layout1->trough, layout2->trough);
-  check_rectangle (layout1->stepper_a, layout2->stepper_a);
-  check_rectangle (layout1->stepper_d, layout2->stepper_d);
-  check_rectangle (layout1->stepper_b, layout2->stepper_b);
-  check_rectangle (layout1->stepper_c, layout2->stepper_c);
+  check_rectangle (priv1->slider, priv2->slider);
+  check_rectangle (priv1->trough, priv2->trough);
+  check_rectangle (priv1->stepper_a, priv2->stepper_a);
+  check_rectangle (priv1->stepper_d, priv2->stepper_d);
+  check_rectangle (priv1->stepper_b, priv2->stepper_b);
+  check_rectangle (priv1->stepper_c, priv2->stepper_c);
 
-  if (layout1->upper_sensitive != layout2->upper_sensitive) return TRUE;
-  if (layout1->lower_sensitive != layout2->lower_sensitive) return TRUE;
+  if (priv1->upper_sensitive != priv2->upper_sensitive) return TRUE;
+  if (priv1->lower_sensitive != priv2->lower_sensitive) return TRUE;
 
   return FALSE;
 }
@@ -2735,18 +2851,18 @@ gtk_range_adjustment_changed (GtkAdjustment *adjustment,
 			      gpointer       data)
 {
   GtkRange *range = GTK_RANGE (data);
-  /* create a copy of the layout */
-  GtkRangeLayout layout = *range->layout;
+  GtkRangePriv *priv = range->priv;
+  GtkRangePriv priv_aux = *priv;
+
+  priv->recalc_marks = TRUE;
+  priv->need_recalc = TRUE;
+  gtk_range_calc_layout (range, priv->adjustment->value);
 
-  range->layout->recalc_marks = TRUE;
-  range->need_recalc = TRUE;
-  gtk_range_calc_layout (range, range->adjustment->value);
-  
   /* now check whether the layout changed  */
-  if (layout_changed (range->layout, &layout))
+  if (layout_changed (priv, &priv_aux))
     gtk_widget_queue_draw (GTK_WIDGET (range));
 
-  /* Note that we don't round off to range->round_digits here.
+  /* Note that we don't round off to priv->round_digits here.
    * that's because it's really broken to change a value
    * in response to a change signal on that value; round_digits
    * is therefore defined to be a filter on what the GtkRange
@@ -2759,9 +2875,10 @@ static gboolean
 force_repaint (gpointer data)
 {
   GtkRange *range = GTK_RANGE (data);
+  GtkRangePriv *priv = range->priv;
   GtkWidget *widget = GTK_WIDGET (range);
 
-  range->layout->repaint_id = 0;
+  priv->repaint_id = 0;
   if (gtk_widget_is_drawable (widget))
     gdk_window_process_updates (gtk_widget_get_window (widget), FALSE);
 
@@ -2773,23 +2890,23 @@ gtk_range_adjustment_value_changed (GtkAdjustment *adjustment,
 				    gpointer       data)
 {
   GtkRange *range = GTK_RANGE (data);
-  /* create a copy of the layout */
-  GtkRangeLayout layout = *range->layout;
+  GtkRangePriv *priv = range->priv;
+  GtkRangePriv priv_aux = *priv;
 
-  range->need_recalc = TRUE;
-  gtk_range_calc_layout (range, range->adjustment->value);
+  priv->need_recalc = TRUE;
+  gtk_range_calc_layout (range, priv->adjustment->value);
   
   /* now check whether the layout changed  */
-  if (layout_changed (range->layout, &layout) ||
+  if (layout_changed (priv, &priv_aux) ||
       (GTK_IS_SCALE (range) && gtk_scale_get_draw_value (GTK_SCALE (range))))
     {
       gtk_widget_queue_draw (GTK_WIDGET (range));
       /* setup a timer to ensure the range isn't lagging too much behind the scroll position */
-      if (!range->layout->repaint_id)
-        range->layout->repaint_id = gdk_threads_add_timeout_full (GDK_PRIORITY_EVENTS, 181, force_repaint, range, NULL);
+      if (!priv->repaint_id)
+        priv->repaint_id = gdk_threads_add_timeout_full (GDK_PRIORITY_EVENTS, 181, force_repaint, range, NULL);
     }
   
-  /* Note that we don't round off to range->round_digits here.
+  /* Note that we don't round off to priv->round_digits here.
    * that's because it's really broken to change a value
    * in response to a change signal on that value; round_digits
    * is therefore defined to be a filter on what the GtkRange
@@ -2805,8 +2922,9 @@ gtk_range_style_set (GtkWidget *widget,
                      GtkStyle  *previous_style)
 {
   GtkRange *range = GTK_RANGE (widget);
+  GtkRangePriv *priv = range->priv;
 
-  range->need_recalc = TRUE;
+  priv->need_recalc = TRUE;
 
   GTK_WIDGET_CLASS (gtk_range_parent_class)->style_set (widget, previous_style);
 }
@@ -2816,12 +2934,13 @@ apply_marks (GtkRange *range,
              gdouble   oldval,
              gdouble  *newval)
 {
+  GtkRangePriv *priv = range->priv;
   gint i;
   gdouble mark;
 
-  for (i = 0; i < range->layout->n_marks; i++)
+  for (i = 0; i < priv->n_marks; i++)
     {
-      mark = range->layout->marks[i];
+      mark = priv->marks[i];
       if ((oldval < mark && mark < *newval) ||
           (oldval > mark && mark > *newval))
         {
@@ -2834,11 +2953,12 @@ apply_marks (GtkRange *range,
 static void
 step_back (GtkRange *range)
 {
+  GtkRangePriv *priv = range->priv;
   gdouble newval;
   gboolean handled;
-  
-  newval = range->adjustment->value - range->adjustment->step_increment;
-  apply_marks (range, range->adjustment->value, &newval);
+
+  newval = priv->adjustment->value - priv->adjustment->step_increment;
+  apply_marks (range, priv->adjustment->value, &newval);
   g_signal_emit (range, signals[CHANGE_VALUE], 0,
                  GTK_SCROLL_STEP_BACKWARD, newval, &handled);
 }
@@ -2846,11 +2966,12 @@ step_back (GtkRange *range)
 static void
 step_forward (GtkRange *range)
 {
+  GtkRangePriv *priv = range->priv;
   gdouble newval;
   gboolean handled;
 
-  newval = range->adjustment->value + range->adjustment->step_increment;
-  apply_marks (range, range->adjustment->value, &newval);
+  newval = priv->adjustment->value + priv->adjustment->step_increment;
+  apply_marks (range, priv->adjustment->value, &newval);
   g_signal_emit (range, signals[CHANGE_VALUE], 0,
                  GTK_SCROLL_STEP_FORWARD, newval, &handled);
 }
@@ -2859,11 +2980,12 @@ step_forward (GtkRange *range)
 static void
 page_back (GtkRange *range)
 {
+  GtkRangePriv *priv = range->priv;
   gdouble newval;
   gboolean handled;
 
-  newval = range->adjustment->value - range->adjustment->page_increment;
-  apply_marks (range, range->adjustment->value, &newval);
+  newval = priv->adjustment->value - priv->adjustment->page_increment;
+  apply_marks (range, priv->adjustment->value, &newval);
   g_signal_emit (range, signals[CHANGE_VALUE], 0,
                  GTK_SCROLL_PAGE_BACKWARD, newval, &handled);
 }
@@ -2871,11 +2993,12 @@ page_back (GtkRange *range)
 static void
 page_forward (GtkRange *range)
 {
+  GtkRangePriv *priv = range->priv;
   gdouble newval;
   gboolean handled;
 
-  newval = range->adjustment->value + range->adjustment->page_increment;
-  apply_marks (range, range->adjustment->value, &newval);
+  newval = priv->adjustment->value + priv->adjustment->page_increment;
+  apply_marks (range, priv->adjustment->value, &newval);
   g_signal_emit (range, signals[CHANGE_VALUE], 0,
                  GTK_SCROLL_PAGE_FORWARD, newval, &handled);
 }
@@ -2883,19 +3006,22 @@ page_forward (GtkRange *range)
 static void
 scroll_begin (GtkRange *range)
 {
+  GtkRangePriv *priv = range->priv;
   gboolean handled;
+
   g_signal_emit (range, signals[CHANGE_VALUE], 0,
-                 GTK_SCROLL_START, range->adjustment->lower,
+                 GTK_SCROLL_START, priv->adjustment->lower,
                  &handled);
 }
 
 static void
 scroll_end (GtkRange *range)
 {
+  GtkRangePriv *priv = range->priv;
   gdouble newval;
   gboolean handled;
 
-  newval = range->adjustment->upper - range->adjustment->page_size;
+  newval = priv->adjustment->upper - priv->adjustment->page_size;
   g_signal_emit (range, signals[CHANGE_VALUE], 0, GTK_SCROLL_END, newval,
                  &handled);
 }
@@ -2904,7 +3030,8 @@ static gboolean
 gtk_range_scroll (GtkRange     *range,
                   GtkScrollType scroll)
 {
-  gdouble old_value = range->adjustment->value;
+  GtkRangePriv *priv = range->priv;
+  gdouble old_value = priv->adjustment->value;
 
   switch (scroll)
     {
@@ -2996,13 +3123,14 @@ gtk_range_scroll (GtkRange     *range,
       break;
     }
 
-  return range->adjustment->value != old_value;
+  return priv->adjustment->value != old_value;
 }
 
 static void
 gtk_range_move_slider (GtkRange     *range,
                        GtkScrollType scroll)
 {
+  GtkRangePriv *priv = range->priv;
   gboolean cursor_only;
 
   g_object_get (gtk_widget_get_settings (GTK_WIDGET (range)),
@@ -3013,7 +3141,7 @@ gtk_range_move_slider (GtkRange     *range,
     {
       GtkWidget *toplevel = gtk_widget_get_toplevel (GTK_WIDGET (range));
 
-      if (range->orientation == GTK_ORIENTATION_HORIZONTAL)
+      if (priv->orientation == GTK_ORIENTATION_HORIZONTAL)
         {
           if (scroll == GTK_SCROLL_STEP_UP ||
               scroll == GTK_SCROLL_STEP_DOWN)
@@ -3046,7 +3174,7 @@ gtk_range_move_slider (GtkRange     *range,
    * but DISCONTINUOUS doesn't, so we update immediately
    * for DISCONTINUOUS
    */
-  if (range->update_policy == GTK_UPDATE_DISCONTINUOUS)
+  if (priv->update_policy == GTK_UPDATE_DISCONTINUOUS)
     gtk_range_update_value (range);
 }
 
@@ -3131,40 +3259,39 @@ gtk_range_get_props (GtkRange  *range,
 static gboolean
 gtk_range_update_mouse_location (GtkRange *range)
 {
+  GtkRangePriv *priv = range->priv;
   GtkAllocation allocation;
   gint x, y;
   MouseLocation old;
-  GtkWidget *widget;
+  GtkWidget *widget = GTK_WIDGET (range);
 
-  widget = GTK_WIDGET (range);
-  
-  old = range->layout->mouse_location;
-  
-  x = range->layout->mouse_x;
-  y = range->layout->mouse_y;
+  old = priv->mouse_location;
+
+  x = priv->mouse_x;
+  y = priv->mouse_y;
 
   gtk_widget_get_allocation (widget, &allocation);
 
-  if (range->layout->grab_location != MOUSE_OUTSIDE)
-    range->layout->mouse_location = range->layout->grab_location;
-  else if (POINT_IN_RECT (x, y, range->layout->stepper_a))
-    range->layout->mouse_location = MOUSE_STEPPER_A;
-  else if (POINT_IN_RECT (x, y, range->layout->stepper_b))
-    range->layout->mouse_location = MOUSE_STEPPER_B;
-  else if (POINT_IN_RECT (x, y, range->layout->stepper_c))
-    range->layout->mouse_location = MOUSE_STEPPER_C;
-  else if (POINT_IN_RECT (x, y, range->layout->stepper_d))
-    range->layout->mouse_location = MOUSE_STEPPER_D;
-  else if (POINT_IN_RECT (x, y, range->layout->slider))
-    range->layout->mouse_location = MOUSE_SLIDER;
-  else if (POINT_IN_RECT (x, y, range->layout->trough))
-    range->layout->mouse_location = MOUSE_TROUGH;
+  if (priv->grab_location != MOUSE_OUTSIDE)
+    priv->mouse_location = priv->grab_location;
+  else if (POINT_IN_RECT (x, y, priv->stepper_a))
+    priv->mouse_location = MOUSE_STEPPER_A;
+  else if (POINT_IN_RECT (x, y, priv->stepper_b))
+    priv->mouse_location = MOUSE_STEPPER_B;
+  else if (POINT_IN_RECT (x, y, priv->stepper_c))
+    priv->mouse_location = MOUSE_STEPPER_C;
+  else if (POINT_IN_RECT (x, y, priv->stepper_d))
+    priv->mouse_location = MOUSE_STEPPER_D;
+  else if (POINT_IN_RECT (x, y, priv->slider))
+    priv->mouse_location = MOUSE_SLIDER;
+  else if (POINT_IN_RECT (x, y, priv->trough))
+    priv->mouse_location = MOUSE_TROUGH;
   else if (POINT_IN_RECT (x, y, allocation))
-    range->layout->mouse_location = MOUSE_WIDGET;
+    priv->mouse_location = MOUSE_WIDGET;
   else
-    range->layout->mouse_location = MOUSE_OUTSIDE;
+    priv->mouse_location = MOUSE_OUTSIDE;
 
-  return old != range->layout->mouse_location;
+  return old != priv->mouse_location;
 }
 
 /* Clamp rect, border inside widget->allocation, such that we prefer
@@ -3277,6 +3404,7 @@ gtk_range_calc_request (GtkRange      *range,
                         gboolean      *has_steppers_cd,
                         gint          *slider_length_p)
 {
+  GtkRangePriv *priv = range->priv;
   gint slider_length;
   gint n_steppers;
   gint n_steppers_ab;
@@ -3293,18 +3421,18 @@ gtk_range_calc_request (GtkRange      *range,
   n_steppers_ab = 0;
   n_steppers_cd = 0;
 
-  if (range->has_stepper_a)
+  if (priv->has_stepper_a)
     n_steppers_ab += 1;
-  if (range->has_stepper_b)
+  if (priv->has_stepper_b)
     n_steppers_ab += 1;
-  if (range->has_stepper_c)
+  if (priv->has_stepper_c)
     n_steppers_cd += 1;
-  if (range->has_stepper_d)
+  if (priv->has_stepper_d)
     n_steppers_cd += 1;
 
   n_steppers = n_steppers_ab + n_steppers_cd;
 
-  slider_length = range->min_slider_size;
+  slider_length = priv->min_slider_size;
 
   range_rect->x = 0;
   range_rect->y = 0;
@@ -3312,7 +3440,7 @@ gtk_range_calc_request (GtkRange      *range,
   /* We never expand to fill available space in the small dimension
    * (i.e. vertical scrollbars are always a fixed width)
    */
-  if (range->orientation == GTK_ORIENTATION_VERTICAL)
+  if (priv->orientation == GTK_ORIENTATION_VERTICAL)
     {
       range_rect->width = (focus_width + trough_border) * 2 + slider_width;
       range_rect->height = stepper_size * n_steppers + (focus_width + trough_border) * 2 + slider_length;
@@ -3352,6 +3480,7 @@ static void
 gtk_range_calc_layout (GtkRange *range,
 		       gdouble   adjustment_value)
 {
+  GtkRangePriv *priv = range->priv;
   gint slider_width, stepper_size, focus_width, trough_border, stepper_spacing;
   gint slider_length;
   GtkBorder border;
@@ -3360,10 +3489,9 @@ gtk_range_calc_layout (GtkRange *range,
   gboolean has_steppers_cd;
   gboolean trough_under_steppers;
   GdkRectangle range_rect;
-  GtkRangeLayout *layout;
   GtkWidget *widget;
-  
-  if (!range->need_recalc)
+
+  if (!priv->need_recalc)
     return;
 
   /* If we have a too-small allocation, we prefer the steppers over
@@ -3373,12 +3501,11 @@ gtk_range_calc_layout (GtkRange *range,
    * Also, we prefer to draw the range itself rather than the border
    * areas if there's a conflict, since the borders will be decoration
    * not controls. Though this depends on subclasses cooperating by
-   * not drawing on range->range_rect.
+   * not drawing on priv->range_rect.
    */
 
   widget = GTK_WIDGET (range);
-  layout = range->layout;
-  
+
   gtk_range_get_props (range,
                        &slider_width, &stepper_size,
                        &focus_width, &trough_border,
@@ -3394,7 +3521,7 @@ gtk_range_calc_layout (GtkRange *range,
   /* We never expand to fill available space in the small dimension
    * (i.e. vertical scrollbars are always a fixed width)
    */
-  if (range->orientation == GTK_ORIENTATION_VERTICAL)
+  if (priv->orientation == GTK_ORIENTATION_VERTICAL)
     {
       clamp_dimensions (widget, &range_rect, &border, TRUE);
     }
@@ -3405,10 +3532,10 @@ gtk_range_calc_layout (GtkRange *range,
   
   range_rect.x = border.left;
   range_rect.y = border.top;
-  
-  range->range_rect = range_rect;
-  
-  if (range->orientation == GTK_ORIENTATION_VERTICAL)
+
+  priv->range_rect = range_rect;
+
+  if (priv->orientation == GTK_ORIENTATION_VERTICAL)
     {
       gint stepper_width, stepper_height;
 
@@ -3431,88 +3558,88 @@ gtk_range_calc_layout (GtkRange *range,
 
       /* Stepper A */
       
-      layout->stepper_a.x = range_rect.x + focus_width + trough_border * trough_under_steppers;
-      layout->stepper_a.y = range_rect.y + focus_width + trough_border * trough_under_steppers;
+      priv->stepper_a.x = range_rect.x + focus_width + trough_border * trough_under_steppers;
+      priv->stepper_a.y = range_rect.y + focus_width + trough_border * trough_under_steppers;
 
-      if (range->has_stepper_a)
+      if (priv->has_stepper_a)
         {
-          layout->stepper_a.width = stepper_width;
-          layout->stepper_a.height = stepper_height;
+          priv->stepper_a.width = stepper_width;
+          priv->stepper_a.height = stepper_height;
         }
       else
         {
-          layout->stepper_a.width = 0;
-          layout->stepper_a.height = 0;
+          priv->stepper_a.width = 0;
+          priv->stepper_a.height = 0;
         }
 
       /* Stepper B */
       
-      layout->stepper_b.x = layout->stepper_a.x;
-      layout->stepper_b.y = layout->stepper_a.y + layout->stepper_a.height;
+      priv->stepper_b.x = priv->stepper_a.x;
+      priv->stepper_b.y = priv->stepper_a.y + priv->stepper_a.height;
 
-      if (range->has_stepper_b)
+      if (priv->has_stepper_b)
         {
-          layout->stepper_b.width = stepper_width;
-          layout->stepper_b.height = stepper_height;
+          priv->stepper_b.width = stepper_width;
+          priv->stepper_b.height = stepper_height;
         }
       else
         {
-          layout->stepper_b.width = 0;
-          layout->stepper_b.height = 0;
+          priv->stepper_b.width = 0;
+          priv->stepper_b.height = 0;
         }
 
       /* Stepper D */
 
-      if (range->has_stepper_d)
+      if (priv->has_stepper_d)
         {
-          layout->stepper_d.width = stepper_width;
-          layout->stepper_d.height = stepper_height;
+          priv->stepper_d.width = stepper_width;
+          priv->stepper_d.height = stepper_height;
         }
       else
         {
-          layout->stepper_d.width = 0;
-          layout->stepper_d.height = 0;
+          priv->stepper_d.width = 0;
+          priv->stepper_d.height = 0;
         }
       
-      layout->stepper_d.x = layout->stepper_a.x;
-      layout->stepper_d.y = range_rect.y + range_rect.height - layout->stepper_d.height - focus_width - trough_border * trough_under_steppers;
+      priv->stepper_d.x = priv->stepper_a.x;
+      priv->stepper_d.y = range_rect.y + range_rect.height - priv->stepper_d.height - focus_width - trough_border * trough_under_steppers;
 
       /* Stepper C */
 
-      if (range->has_stepper_c)
+      if (priv->has_stepper_c)
         {
-          layout->stepper_c.width = stepper_width;
-          layout->stepper_c.height = stepper_height;
+          priv->stepper_c.width = stepper_width;
+          priv->stepper_c.height = stepper_height;
         }
       else
         {
-          layout->stepper_c.width = 0;
-          layout->stepper_c.height = 0;
+          priv->stepper_c.width = 0;
+          priv->stepper_c.height = 0;
         }
       
-      layout->stepper_c.x = layout->stepper_a.x;
-      layout->stepper_c.y = layout->stepper_d.y - layout->stepper_c.height;
+      priv->stepper_c.x = priv->stepper_a.x;
+      priv->stepper_c.y = priv->stepper_d.y - priv->stepper_c.height;
 
       /* Now the trough is the remaining space between steppers B and C,
        * if any, minus spacing
        */
-      layout->trough.x = range_rect.x;
-      layout->trough.y = layout->stepper_b.y + layout->stepper_b.height + stepper_spacing * has_steppers_ab;
-      layout->trough.width = range_rect.width;
-      layout->trough.height = layout->stepper_c.y - layout->trough.y - stepper_spacing * has_steppers_cd;
+      priv->trough.x = range_rect.x;
+      priv->trough.y = priv->stepper_b.y + priv->stepper_b.height + stepper_spacing * has_steppers_ab;
+      priv->trough.width = range_rect.width;
+      priv->trough.height = priv->stepper_c.y - priv->trough.y - stepper_spacing * has_steppers_cd;
 
       /* Slider fits into the trough, with stepper_spacing on either side,
        * and the size/position based on the adjustment or fixed, depending.
        */
-      layout->slider.x = layout->trough.x + focus_width + trough_border;
-      layout->slider.width = layout->trough.width - (focus_width + trough_border) * 2;
+      priv->slider.x = priv->trough.x + focus_width + trough_border;
+      priv->slider.width = priv->trough.width - (focus_width + trough_border) * 2;
 
       /* Compute slider position/length */
       {
         gint y, bottom, top, height;
         
-        top = layout->trough.y;
-        bottom = layout->trough.y + layout->trough.height;
+        top = priv->trough.y;
+        bottom = priv->trough.y + priv->trough.height;
 
         if (! trough_under_steppers)
           {
@@ -3524,35 +3651,35 @@ gtk_range_calc_layout (GtkRange *range,
          * total_adjustment_range) times the trough height in pixels
          */
 
-	if (range->adjustment->upper - range->adjustment->lower != 0)
-	  height = ((bottom - top) * (range->adjustment->page_size /
-				       (range->adjustment->upper - range->adjustment->lower)));
+	if (priv->adjustment->upper - priv->adjustment->lower != 0)
+	  height = ((bottom - top) * (priv->adjustment->page_size /
+				       (priv->adjustment->upper - priv->adjustment->lower)));
 	else
-	  height = range->min_slider_size;
-        
-        if (height < range->min_slider_size ||
-            range->slider_size_fixed)
-          height = range->min_slider_size;
+          height = priv->min_slider_size;
+
+        if (height < priv->min_slider_size ||
+            priv->slider_size_fixed)
+          height = priv->min_slider_size;
 
-        height = MIN (height, layout->trough.height);
+        height = MIN (height, priv->trough.height);
         
         y = top;
-        
-	if (range->adjustment->upper - range->adjustment->lower - range->adjustment->page_size != 0)
-	  y += (bottom - top - height) * ((adjustment_value - range->adjustment->lower) /
-					  (range->adjustment->upper - range->adjustment->lower - range->adjustment->page_size));
-        
+
+	if (priv->adjustment->upper - priv->adjustment->lower - priv->adjustment->page_size != 0)
+	  y += (bottom - top - height) * ((adjustment_value - priv->adjustment->lower) /
+					  (priv->adjustment->upper - priv->adjustment->lower - priv->adjustment->page_size));
+
         y = CLAMP (y, top, bottom);
         
         if (should_invert (range))
           y = bottom - (y - top + height);
         
-        layout->slider.y = y;
-        layout->slider.height = height;
+        priv->slider.y = y;
+        priv->slider.height = height;
 
         /* These are publically exported */
-        range->slider_start = layout->slider.y;
-        range->slider_end = layout->slider.y + layout->slider.height;
+        priv->slider_start = priv->slider.y;
+        priv->slider_end = priv->slider.y + priv->slider.height;
       }
     }
   else
@@ -3578,90 +3705,90 @@ gtk_range_calc_layout (GtkRange *range,
 
       /* Stepper A */
       
-      layout->stepper_a.x = range_rect.x + focus_width + trough_border * trough_under_steppers;
-      layout->stepper_a.y = range_rect.y + focus_width + trough_border * trough_under_steppers;
+      priv->stepper_a.x = range_rect.x + focus_width + trough_border * trough_under_steppers;
+      priv->stepper_a.y = range_rect.y + focus_width + trough_border * trough_under_steppers;
 
-      if (range->has_stepper_a)
+      if (priv->has_stepper_a)
         {
-          layout->stepper_a.width = stepper_width;
-          layout->stepper_a.height = stepper_height;
+          priv->stepper_a.width = stepper_width;
+          priv->stepper_a.height = stepper_height;
         }
       else
         {
-          layout->stepper_a.width = 0;
-          layout->stepper_a.height = 0;
+          priv->stepper_a.width = 0;
+          priv->stepper_a.height = 0;
         }
 
       /* Stepper B */
       
-      layout->stepper_b.x = layout->stepper_a.x + layout->stepper_a.width;
-      layout->stepper_b.y = layout->stepper_a.y;
+      priv->stepper_b.x = priv->stepper_a.x + priv->stepper_a.width;
+      priv->stepper_b.y = priv->stepper_a.y;
 
-      if (range->has_stepper_b)
+      if (priv->has_stepper_b)
         {
-          layout->stepper_b.width = stepper_width;
-          layout->stepper_b.height = stepper_height;
+          priv->stepper_b.width = stepper_width;
+          priv->stepper_b.height = stepper_height;
         }
       else
         {
-          layout->stepper_b.width = 0;
-          layout->stepper_b.height = 0;
+          priv->stepper_b.width = 0;
+          priv->stepper_b.height = 0;
         }
 
       /* Stepper D */
 
-      if (range->has_stepper_d)
+      if (priv->has_stepper_d)
         {
-          layout->stepper_d.width = stepper_width;
-          layout->stepper_d.height = stepper_height;
+          priv->stepper_d.width = stepper_width;
+          priv->stepper_d.height = stepper_height;
         }
       else
         {
-          layout->stepper_d.width = 0;
-          layout->stepper_d.height = 0;
+          priv->stepper_d.width = 0;
+          priv->stepper_d.height = 0;
         }
 
-      layout->stepper_d.x = range_rect.x + range_rect.width - layout->stepper_d.width - focus_width - trough_border * trough_under_steppers;
-      layout->stepper_d.y = layout->stepper_a.y;
+      priv->stepper_d.x = range_rect.x + range_rect.width - priv->stepper_d.width - focus_width - trough_border * trough_under_steppers;
+      priv->stepper_d.y = priv->stepper_a.y;
 
 
       /* Stepper C */
 
-      if (range->has_stepper_c)
+      if (priv->has_stepper_c)
         {
-          layout->stepper_c.width = stepper_width;
-          layout->stepper_c.height = stepper_height;
+          priv->stepper_c.width = stepper_width;
+          priv->stepper_c.height = stepper_height;
         }
       else
         {
-          layout->stepper_c.width = 0;
-          layout->stepper_c.height = 0;
+          priv->stepper_c.width = 0;
+          priv->stepper_c.height = 0;
         }
       
-      layout->stepper_c.x = layout->stepper_d.x - layout->stepper_c.width;
-      layout->stepper_c.y = layout->stepper_a.y;
+      priv->stepper_c.x = priv->stepper_d.x - priv->stepper_c.width;
+      priv->stepper_c.y = priv->stepper_a.y;
 
       /* Now the trough is the remaining space between steppers B and C,
        * if any
        */
-      layout->trough.x = layout->stepper_b.x + layout->stepper_b.width + stepper_spacing * has_steppers_ab;
-      layout->trough.y = range_rect.y;
+      priv->trough.x = priv->stepper_b.x + priv->stepper_b.width + stepper_spacing * has_steppers_ab;
+      priv->trough.y = range_rect.y;
 
-      layout->trough.width = layout->stepper_c.x - layout->trough.x - stepper_spacing * has_steppers_cd;
-      layout->trough.height = range_rect.height;
+      priv->trough.width = priv->stepper_c.x - priv->trough.x - stepper_spacing * has_steppers_cd;
+      priv->trough.height = range_rect.height;
 
       /* Slider fits into the trough, with stepper_spacing on either side,
        * and the size/position based on the adjustment or fixed, depending.
        */
-      layout->slider.y = layout->trough.y + focus_width + trough_border;
-      layout->slider.height = layout->trough.height - (focus_width + trough_border) * 2;
+      priv->slider.y = priv->trough.y + focus_width + trough_border;
+      priv->slider.height = priv->trough.height - (focus_width + trough_border) * 2;
 
       /* Compute slider position/length */
       {
         gint x, left, right, width;
         
-        left = layout->trough.x;
-        right = layout->trough.x + layout->trough.width;
+        left = priv->trough.x;
+        right = priv->trough.x + priv->trough.width;
 
         if (! trough_under_steppers)
           {
@@ -3672,71 +3799,71 @@ gtk_range_calc_layout (GtkRange *range,
         /* slider width is the fraction (page_size /
          * total_adjustment_range) times the trough width in pixels
          */
-	
-	if (range->adjustment->upper - range->adjustment->lower != 0)
-	  width = ((right - left) * (range->adjustment->page_size /
-                                   (range->adjustment->upper - range->adjustment->lower)));
+
+	if (priv->adjustment->upper - priv->adjustment->lower != 0)
+	  width = ((right - left) * (priv->adjustment->page_size /
+                                   (priv->adjustment->upper - priv->adjustment->lower)));
 	else
-	  width = range->min_slider_size;
-        
-        if (width < range->min_slider_size ||
-            range->slider_size_fixed)
-          width = range->min_slider_size;
-        
-        width = MIN (width, layout->trough.width);
+	  width = priv->min_slider_size;
+
+        if (width < priv->min_slider_size ||
+            priv->slider_size_fixed)
+          width = priv->min_slider_size;
+
+        width = MIN (width, priv->trough.width);
         
         x = left;
-        
-	if (range->adjustment->upper - range->adjustment->lower - range->adjustment->page_size != 0)
-          x += (right - left - width) * ((adjustment_value - range->adjustment->lower) /
-                                         (range->adjustment->upper - range->adjustment->lower - range->adjustment->page_size));
+
+	if (priv->adjustment->upper - priv->adjustment->lower - priv->adjustment->page_size != 0)
+          x += (right - left - width) * ((adjustment_value - priv->adjustment->lower) /
+                                         (priv->adjustment->upper - priv->adjustment->lower - priv->adjustment->page_size));
         
         x = CLAMP (x, left, right);
         
         if (should_invert (range))
           x = right - (x - left + width);
         
-        layout->slider.x = x;
-        layout->slider.width = width;
+        priv->slider.x = x;
+        priv->slider.width = width;
 
         /* These are publically exported */
-        range->slider_start = layout->slider.x;
-        range->slider_end = layout->slider.x + layout->slider.width;
+        priv->slider_start = priv->slider.x;
+        priv->slider_end = priv->slider.x + priv->slider.width;
       }
     }
   
   gtk_range_update_mouse_location (range);
 
-  switch (range->layout->upper_sensitivity)
+  switch (priv->upper_sensitivity)
     {
     case GTK_SENSITIVITY_AUTO:
-      range->layout->upper_sensitive =
-        (range->adjustment->value <
-         (range->adjustment->upper - range->adjustment->page_size));
+      priv->upper_sensitive =
+        (priv->adjustment->value <
+         (priv->adjustment->upper - priv->adjustment->page_size));
       break;
 
     case GTK_SENSITIVITY_ON:
-      range->layout->upper_sensitive = TRUE;
+      priv->upper_sensitive = TRUE;
       break;
 
     case GTK_SENSITIVITY_OFF:
-      range->layout->upper_sensitive = FALSE;
+      priv->upper_sensitive = FALSE;
       break;
     }
 
-  switch (range->layout->lower_sensitivity)
+  switch (priv->lower_sensitivity)
     {
     case GTK_SENSITIVITY_AUTO:
-      range->layout->lower_sensitive =
-        (range->adjustment->value > range->adjustment->lower);
+      priv->lower_sensitive =
+        (priv->adjustment->value > priv->adjustment->lower);
       break;
 
     case GTK_SENSITIVITY_ON:
-      range->layout->lower_sensitive = TRUE;
+      priv->lower_sensitive = TRUE;
       break;
 
     case GTK_SENSITIVITY_OFF:
-      range->layout->lower_sensitive = FALSE;
+      priv->lower_sensitive = FALSE;
       break;
     }
 }
@@ -3745,20 +3872,22 @@ static GdkRectangle*
 get_area (GtkRange     *range,
           MouseLocation location)
 {
+  GtkRangePriv *priv = range->priv;
+
   switch (location)
     {
     case MOUSE_STEPPER_A:
-      return &range->layout->stepper_a;
+      return &priv->stepper_a;
     case MOUSE_STEPPER_B:
-      return &range->layout->stepper_b;
+      return &priv->stepper_b;
     case MOUSE_STEPPER_C:
-      return &range->layout->stepper_c;
+      return &priv->stepper_c;
     case MOUSE_STEPPER_D:
-      return &range->layout->stepper_d;
+      return &priv->stepper_d;
     case MOUSE_TROUGH:
-      return &range->layout->trough;
+      return &priv->trough;
     case MOUSE_SLIDER:
-      return &range->layout->slider;
+      return &priv->slider;
     case MOUSE_WIDGET:
     case MOUSE_OUTSIDE:
       break;
@@ -3771,24 +3900,25 @@ get_area (GtkRange     *range,
 static void
 gtk_range_calc_marks (GtkRange *range)
 {
+  GtkRangePriv *priv = range->priv;
   gint i;
-  
-  if (!range->layout->recalc_marks)
+
+  if (!priv->recalc_marks)
     return;
 
-  range->layout->recalc_marks = FALSE;
+  priv->recalc_marks = FALSE;
 
-  for (i = 0; i < range->layout->n_marks; i++)
+  for (i = 0; i < priv->n_marks; i++)
     {
-      range->need_recalc = TRUE;
-      gtk_range_calc_layout (range, range->layout->marks[i]);
-      if (range->orientation == GTK_ORIENTATION_HORIZONTAL)
-        range->layout->mark_pos[i] = range->layout->slider.x + range->layout->slider.width / 2;
+      priv->need_recalc = TRUE;
+      gtk_range_calc_layout (range, priv->marks[i]);
+      if (priv->orientation == GTK_ORIENTATION_HORIZONTAL)
+        priv->mark_pos[i] = priv->slider.x + priv->slider.width / 2;
       else
-        range->layout->mark_pos[i] = range->layout->slider.y + range->layout->slider.height / 2;
+        priv->mark_pos[i] = priv->slider.y + priv->slider.height / 2;
     }
 
-  range->need_recalc = TRUE;
+  priv->need_recalc = TRUE;
 }
 
 static gboolean
@@ -3796,39 +3926,41 @@ gtk_range_real_change_value (GtkRange     *range,
                              GtkScrollType scroll,
                              gdouble       value)
 {
+  GtkRangePriv *priv = range->priv;
+
   /* potentially adjust the bounds _before_ we clamp */
   g_signal_emit (range, signals[ADJUST_BOUNDS], 0, value);
 
-  if (range->layout->restrict_to_fill_level)
-    value = MIN (value, MAX (range->adjustment->lower,
-                             range->layout->fill_level));
+  if (priv->restrict_to_fill_level)
+    value = MIN (value, MAX (priv->adjustment->lower,
+                             priv->fill_level));
 
-  value = CLAMP (value, range->adjustment->lower,
-                 (range->adjustment->upper - range->adjustment->page_size));
+  value = CLAMP (value, priv->adjustment->lower,
+                 (priv->adjustment->upper - priv->adjustment->page_size));
 
-  if (range->round_digits >= 0)
+  if (priv->round_digits >= 0)
     {
       gdouble power;
       gint i;
 
-      i = range->round_digits;
+      i = priv->round_digits;
       power = 1;
       while (i--)
         power *= 10;
       
       value = floor ((value * power) + 0.5) / power;
     }
-  
-  if (range->adjustment->value != value)
+
+  if (priv->adjustment->value != value)
     {
-      range->need_recalc = TRUE;
+      priv->need_recalc = TRUE;
 
       gtk_widget_queue_draw (GTK_WIDGET (range));
-      
-      switch (range->update_policy)
+
+      switch (priv->update_policy)
         {
         case GTK_UPDATE_CONTINUOUS:
-          gtk_adjustment_set_value (range->adjustment, value);
+          gtk_adjustment_set_value (priv->adjustment, value);
           break;
 
           /* Delayed means we update after a period of inactivity */
@@ -3839,8 +3971,8 @@ gtk_range_real_change_value (GtkRange     *range,
           /* Discontinuous means we update on button release */
         case GTK_UPDATE_DISCONTINUOUS:
           /* don't emit value_changed signal */
-          range->adjustment->value = value;
-          range->update_pending = TRUE;
+          priv->adjustment->value = value;
+          priv->update_pending = TRUE;
           break;
         }
     }
@@ -3850,13 +3982,15 @@ gtk_range_real_change_value (GtkRange     *range,
 static void
 gtk_range_update_value (GtkRange *range)
 {
+  GtkRangePriv *priv = range->priv;
+
   gtk_range_remove_update_timer (range);
-  
-  if (range->update_pending)
+
+  if (priv->update_pending)
     {
-      gtk_adjustment_value_changed (range->adjustment);
+      gtk_adjustment_value_changed (priv->adjustment);
 
-      range->update_pending = FALSE;
+      priv->update_pending = FALSE;
     }
 }
 
@@ -3869,26 +4003,26 @@ struct _GtkRangeStepTimer
 static gboolean
 second_timeout (gpointer data)
 {
-  GtkRange *range;
+  GtkRange *range = GTK_RANGE (data);
+  GtkRangePriv *priv = range->priv;
+
+  gtk_range_scroll (range, priv->timer->step);
 
-  range = GTK_RANGE (data);
-  gtk_range_scroll (range, range->timer->step);
-  
   return TRUE;
 }
 
 static gboolean
 initial_timeout (gpointer data)
 {
-  GtkRange    *range;
+  GtkRange *range = GTK_RANGE (data);
+  GtkRangePriv *priv = range->priv;
   GtkSettings *settings;
   guint        timeout;
 
   settings = gtk_widget_get_settings (GTK_WIDGET (data));
   g_object_get (settings, "gtk-timeout-repeat", &timeout, NULL);
 
-  range = GTK_RANGE (data);
-  range->timer->timeout_id = gdk_threads_add_timeout (timeout * SCROLL_DELAY_FACTOR,
+  priv->timer->timeout_id = gdk_threads_add_timeout (timeout * SCROLL_DELAY_FACTOR,
                                             second_timeout,
                                             range);
   /* remove self */
@@ -3899,47 +4033,50 @@ static void
 gtk_range_add_step_timer (GtkRange      *range,
                           GtkScrollType  step)
 {
+  GtkRangePriv *priv = range->priv;
   GtkSettings *settings;
   guint        timeout;
 
-  g_return_if_fail (range->timer == NULL);
+  g_return_if_fail (priv->timer == NULL);
   g_return_if_fail (step != GTK_SCROLL_NONE);
 
   settings = gtk_widget_get_settings (GTK_WIDGET (range));
   g_object_get (settings, "gtk-timeout-initial", &timeout, NULL);
 
-  range->timer = g_new (GtkRangeStepTimer, 1);
+  priv->timer = g_new (GtkRangeStepTimer, 1);
 
-  range->timer->timeout_id = gdk_threads_add_timeout (timeout,
+  priv->timer->timeout_id = gdk_threads_add_timeout (timeout,
                                             initial_timeout,
                                             range);
-  range->timer->step = step;
+  priv->timer->step = step;
 
-  gtk_range_scroll (range, range->timer->step);
+  gtk_range_scroll (range, priv->timer->step);
 }
 
 static void
 gtk_range_remove_step_timer (GtkRange *range)
 {
-  if (range->timer)
+  GtkRangePriv *priv = range->priv;
+
+  if (priv->timer)
     {
-      if (range->timer->timeout_id != 0)
-        g_source_remove (range->timer->timeout_id);
+      if (priv->timer->timeout_id != 0)
+        g_source_remove (priv->timer->timeout_id);
 
-      g_free (range->timer);
+      g_free (priv->timer);
 
-      range->timer = NULL;
+      priv->timer = NULL;
     }
 }
 
 static gboolean
 update_timeout (gpointer data)
 {
-  GtkRange *range;
+  GtkRange *range = GTK_RANGE (data);
+  GtkRangePriv *priv = range->priv;
 
-  range = GTK_RANGE (data);
   gtk_range_update_value (range);
-  range->update_timeout_id = 0;
+  priv->update_timeout_id = 0;
 
   /* self-remove */
   return FALSE;
@@ -3948,9 +4085,11 @@ update_timeout (gpointer data)
 static void
 gtk_range_reset_update_timer (GtkRange *range)
 {
+  GtkRangePriv *priv = range->priv;
+
   gtk_range_remove_update_timer (range);
 
-  range->update_timeout_id = gdk_threads_add_timeout (UPDATE_DELAY,
+  priv->update_timeout_id = gdk_threads_add_timeout (UPDATE_DELAY,
                                             update_timeout,
                                             range);
 }
@@ -3958,10 +4097,12 @@ gtk_range_reset_update_timer (GtkRange *range)
 static void
 gtk_range_remove_update_timer (GtkRange *range)
 {
-  if (range->update_timeout_id != 0)
+  GtkRangePriv *priv = range->priv;
+
+  if (priv->update_timeout_id != 0)
     {
-      g_source_remove (range->update_timeout_id);
-      range->update_timeout_id = 0;
+      g_source_remove (priv->update_timeout_id);
+      priv->update_timeout_id = 0;
     }
 }
 
@@ -3970,39 +4111,42 @@ _gtk_range_set_stop_values (GtkRange *range,
                             gdouble  *values,
                             gint      n_values)
 {
+  GtkRangePriv *priv = range->priv;
   gint i;
 
-  g_free (range->layout->marks);
-  range->layout->marks = g_new (gdouble, n_values);
+  g_free (priv->marks);
+  priv->marks = g_new (gdouble, n_values);
 
-  g_free (range->layout->mark_pos);
-  range->layout->mark_pos = g_new (gint, n_values);
+  g_free (priv->mark_pos);
+  priv->mark_pos = g_new (gint, n_values);
 
-  range->layout->n_marks = n_values;
+  priv->n_marks = n_values;
 
   for (i = 0; i < n_values; i++) 
-    range->layout->marks[i] = values[i];
+    priv->marks[i] = values[i];
 
-  range->layout->recalc_marks = TRUE;
+  priv->recalc_marks = TRUE;
 }
 
 gint
 _gtk_range_get_stop_positions (GtkRange  *range,
                                gint     **values)
 {
+  GtkRangePriv *priv = range->priv;
+
   gtk_range_calc_marks (range);
 
   if (values)
-    *values = g_memdup (range->layout->mark_pos, range->layout->n_marks * sizeof (gint));
+    *values = g_memdup (priv->mark_pos, priv->n_marks * sizeof (gint));
 
-  return range->layout->n_marks;
+  return priv->n_marks;
 }
 
 void
 _gtk_range_set_round_digits (GtkRange *range,
                              gint     round_digits)
 {
-  range->round_digits = round_digits;
+  range->priv->round_digits = round_digits;
 }
 
 void
@@ -4012,8 +4156,8 @@ _gtk_range_set_steppers (GtkRange      *range,
                          gboolean       has_c,
                          gboolean       has_d)
 {
-  range->has_stepper_a = has_a;
-  range->has_stepper_b = has_b;
-  range->has_stepper_c = has_c;
-  range->has_stepper_d = has_d;
+  range->priv->has_stepper_a = has_a;
+  range->priv->has_stepper_b = has_b;
+  range->priv->has_stepper_c = has_c;
+  range->priv->has_stepper_d = has_d;
 }
diff --git a/gtk/gtkrange.h b/gtk/gtkrange.h
index 9075632..81b18ba 100644
--- a/gtk/gtkrange.h
+++ b/gtk/gtkrange.h
@@ -46,60 +46,15 @@ G_BEGIN_DECLS
 #define GTK_IS_RANGE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_RANGE))
 #define GTK_RANGE_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_RANGE, GtkRangeClass))
 
-/* These two are private/opaque types, ignore */
-typedef struct _GtkRangeLayout    GtkRangeLayout;
-typedef struct _GtkRangeStepTimer GtkRangeStepTimer;
-
 typedef struct _GtkRange        GtkRange;
+typedef struct _GtkRangePriv    GtkRangePriv;
 typedef struct _GtkRangeClass   GtkRangeClass;
 
 struct _GtkRange
 {
   GtkWidget widget;
 
-  GtkAdjustment *GSEAL (adjustment);
-  GtkUpdateType GSEAL (update_policy);
-  guint GSEAL (inverted) : 1;
-
-  /*< protected >*/
-
-  guint GSEAL (flippable) : 1;
-
-  /* Steppers are: < > ---- < >
-   *               a b      c d
-   */
-
-  guint GSEAL (has_stepper_a) : 1;
-  guint GSEAL (has_stepper_b) : 1;
-  guint GSEAL (has_stepper_c) : 1;
-  guint GSEAL (has_stepper_d) : 1;
-
-  guint GSEAL (need_recalc) : 1;
-
-  guint GSEAL (slider_size_fixed) : 1;
-
-  gint GSEAL (min_slider_size);
-
-  GtkOrientation GSEAL (orientation);
-
-  /* Area of entire stepper + trough assembly in widget->window coords */
-  GdkRectangle GSEAL (range_rect);
-  /* Slider range along the long dimension, in widget->window coords */
-  gint GSEAL (slider_start);
-  gint GSEAL (slider_end);
-
-  /* Round off value to this many digits, -1 for no rounding */
-  gint GSEAL (round_digits);
-
-  /*< private >*/
-  guint GSEAL (trough_click_forward) : 1;  /* trough click was on the forward side of slider */
-  guint GSEAL (update_pending) : 1;        /* need to emit value_changed */
-  GtkRangeLayout *GSEAL (layout);
-  GtkRangeStepTimer *GSEAL (timer);
-  gint GSEAL (slide_initial_slider_position);
-  gint GSEAL (slide_initial_coordinate);
-  guint GSEAL (update_timeout_id);
-  GdkWindow *GSEAL (event_window);
+  GtkRangePriv *priv;
 };
 
 struct _GtkRangeClass



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