? 1345.patch
? 74750-3.patch
? 98343.patch
? asdf.patch
? birnan.patch
? changes
? check-and-radio
? color.patch
? complete.patch
? diff.patss
? emfle
? emflediff
? f10patch
? gtkdiff
? gtkpatch
? maxangle.patch
? oldunchanged.patch
? patch
? smooth.patch
? smoothscroll.patch
? sofar
? sowhat
? statusbar.patch
? stylediff
? symbolfix
? unchanged.patch
? visibility.diff.ssp
? demos/gtk-demo/appwindow.ac
? demos/gtk-demo/geninclude.pl
? demos/gtk-demo/hest
? gdk/asdf
? gdk/gdkmarshalers.c
? gdk/scroll_area.patch
? gdk/scrollarea.patch
? gdk/visibility2.diff
? gdk/x11/core.3538
? gtk/64832.patch
? gtk/74750-3.patch
? gtk/87160-2.patch
? gtk/92548
? gtk/92548.patch
? gtk/99313.patch
? gtk/acc.patch
? gtk/adjdiff
? gtk/angle.asdf
? gtk/angle.patch
? gtk/asdf.patch
? gtk/butt.patch
? gtk/butth.patch
? gtk/buttonfocus.patch
? gtk/check.patch
? gtk/checkstyle.patch
? gtk/core.8478
? gtk/finalpaned
? gtk/flipping.patch
? gtk/gtkcellrenderertext.c.layout-caching
? gtk/gtklabel.ac
? gtk/gtkmenu-explicit-triangle.c
? gtk/gtkmenu.ac
? gtk/gtkmenubar.with_init.c
? gtk/gtkrange.blah.c
? gtk/gtkstatusbar.ac
? gtk/gtkstyle-possible-fix.c
? gtk/gtkstyle.ac
? gtk/gtktreeviewcolumn.hacked.c
? gtk/hest
? gtk/menubar.diff
? gtk/menucrack.patch
? gtk/menusofar
? gtk/nowrapping.patch
? gtk/paned-keyboard.patch
? gtk/patch
? gtk/prog
? gtk/progress.ac
? gtk/progresspatch
? gtk/progresstext.patch
? gtk/rangechanges
? gtk/rotated.diff
? gtk/scrolldif
? gtk/smooth
? gtk/smooth-plus-menu-nobg.patch
? gtk/smooth.patch
? gtk/smooth.patch.1
? gtk/so_far
? gtk/std
? gtk/stylediff
? gtk/tempfix
? gtk/treescroll.patch
? gtk/unch
? tests/asdf
? tests/testgtk.patch
? tests/testgtkdiff
Index: gtk/gtkadjustment.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtkadjustment.c,v
retrieving revision 1.27
diff -u -p -u -r1.27 gtkadjustment.c
--- gtk/gtkadjustment.c	9 Oct 2002 22:25:17 -0000	1.27
+++ gtk/gtkadjustment.c	29 Jun 2003 12:12:53 -0000
@@ -26,7 +26,7 @@
 
 #include "gtkadjustment.h"
 #include "gtkmarshalers.h"
-
+#include <math.h>
 
 enum {
   CHANGED,
@@ -35,9 +35,19 @@ enum {
 };
 
 
-static void gtk_adjustment_class_init (GtkAdjustmentClass *klass);
-static void gtk_adjustment_init       (GtkAdjustment      *adjustment);
+typedef struct _GtkAdjustmentPrivate GtkAdjustmentPrivate;
+struct _GtkAdjustmentPrivate
+{
+  GTimer *timer;
+  gdouble start_value;
+  gdouble goal_value;
+  guint idle_id;
+};
 
+static void                  gtk_adjustment_private_finalize   (GtkAdjustmentPrivate *private);
+static void                  gtk_adjustment_class_init         (GtkAdjustmentClass   *klass);
+static void                  gtk_adjustment_init               (GtkAdjustment        *adjustment);
+static GtkAdjustmentPrivate *gtk_adjustment_get_private        (GtkAdjustment        *adjustment);
 
 static guint adjustment_signals[LAST_SIGNAL] = { 0 };
 
@@ -75,7 +85,7 @@ gtk_adjustment_class_init (GtkAdjustment
 {
   class->changed = NULL;
   class->value_changed = NULL;
-
+  
   adjustment_signals[CHANGED] =
     g_signal_new ("changed",
 		  G_OBJECT_CLASS_TYPE (class),
@@ -105,6 +115,44 @@ gtk_adjustment_init (GtkAdjustment *adju
   adjustment->page_size = 0.0;
 }
 
+static GtkAdjustmentPrivate *
+gtk_adjustment_get_private (GtkAdjustment *adjustment)
+{
+  GtkAdjustmentPrivate *private;
+  static GQuark private_quark = 0;
+
+  if (!private_quark)
+    private_quark = g_quark_from_static_string ("gtk-adjustment-private");
+
+  private = g_object_get_qdata (G_OBJECT (adjustment), private_quark);
+
+  if (!private)
+    {
+      private = g_new0 (GtkAdjustmentPrivate, 1);
+
+      private->timer = g_timer_new ();
+      private->start_value = 0.0;
+      private->goal_value = 0.0;
+      private->idle_id = 0;
+      
+      g_object_set_qdata_full (G_OBJECT (adjustment), private_quark,
+			       private,
+                               (GDestroyNotify) gtk_adjustment_private_finalize);
+    }
+
+  return private;
+}
+
+static void
+gtk_adjustment_private_finalize (GtkAdjustmentPrivate *private)
+{
+  if (private->idle_id)
+    g_source_remove (private->idle_id);
+
+  g_timer_destroy (private->timer);
+  g_free (private);
+}
+
 GtkObject*
 gtk_adjustment_new (gdouble value,
 		    gdouble lower,
@@ -168,12 +216,27 @@ gtk_adjustment_changed (GtkAdjustment   
   g_signal_emit (adjustment, adjustment_signals[CHANGED], 0);
 }
 
+static void
+gtk_adjustment_value_changed_unchecked (GtkAdjustment *adjustment)
+{
+  g_signal_emit (adjustment, adjustment_signals[VALUE_CHANGED], 0);
+}
+
 void
 gtk_adjustment_value_changed (GtkAdjustment        *adjustment)
 {
+  GtkAdjustmentPrivate *priv;
+  
   g_return_if_fail (GTK_IS_ADJUSTMENT (adjustment));
 
-  g_signal_emit (adjustment, adjustment_signals[VALUE_CHANGED], 0);
+  priv = gtk_adjustment_get_private (adjustment);
+  if (priv->idle_id)
+    {
+      g_source_remove (priv->idle_id);
+      priv->idle_id = 0;
+    }
+  
+  gtk_adjustment_value_changed_unchecked (adjustment);
 }
 
 void
@@ -203,4 +266,160 @@ gtk_adjustment_clamp_page (GtkAdjustment
 
   if (need_emission)
     gtk_adjustment_value_changed (adjustment);
+}
+
+#define UPDATE_TIME 0.1
+
+static gboolean
+adjustment_update_idle (gpointer data)
+{
+  GtkAdjustment *adj = data;
+  GtkAdjustmentPrivate *priv = gtk_adjustment_get_private (adj);
+
+  gdouble new_value;
+  gdouble elapsed = g_timer_elapsed (priv->timer, NULL);
+
+  new_value = priv->start_value +
+    (elapsed / UPDATE_TIME) * (priv->goal_value - priv->start_value);
+
+  /* make sure new_value is betweeen start_value and goal_value */
+  if (!((new_value >= priv->start_value && new_value <= priv->goal_value) ||
+	(new_value <= priv->start_value && new_value >= priv->goal_value)))
+    {
+      new_value = priv->goal_value;
+    }
+
+  if (new_value > adj->upper - adj->page_size)
+    new_value = adj->upper - adj->page_size;
+  
+  if (new_value < adj->lower)
+    new_value = adj->lower;
+
+  if (new_value != adj->value)
+    {
+      adj->value = new_value;
+
+      GDK_THREADS_ENTER();
+      gtk_adjustment_value_changed_unchecked (adj);
+      GDK_THREADS_LEAVE();
+    }
+  
+  if (adj->value == priv->goal_value ||
+      adj->value == adj->lower ||
+      adj->value == adj->upper - adj->page_size)
+    {
+      priv->idle_id = 0;
+      return FALSE;
+    }
+
+  return TRUE;
+}
+
+static void
+gtk_adjustment_change_value (GtkAdjustment *adjustment,
+			     gdouble        delta)
+{
+  GtkAdjustmentPrivate *priv;
+
+  g_return_if_fail (GTK_IS_ADJUSTMENT (adjustment));
+  
+  priv = gtk_adjustment_get_private (adjustment);
+
+  if (delta > -1 && delta < 1)
+    return;
+
+  priv->start_value = adjustment->value;
+  g_timer_reset (priv->timer);
+  
+  if (!priv->idle_id)
+    {
+      priv->idle_id = g_idle_add_full (GDK_PRIORITY_REDRAW + 3, adjustment_update_idle, adjustment, NULL);
+      priv->goal_value = adjustment->value + delta;
+    }
+  else
+    priv->goal_value = priv->goal_value + delta;
+}
+
+void
+gtk_adjustment_step_up (GtkAdjustment *adjustment)
+{
+  g_return_if_fail (GTK_IS_ADJUSTMENT (adjustment));
+  
+  gtk_adjustment_change_value (adjustment, -adjustment->step_increment);
+}
+
+void
+gtk_adjustment_step_down (GtkAdjustment *adjustment)
+{
+  g_return_if_fail (GTK_IS_ADJUSTMENT (adjustment));
+  
+  gtk_adjustment_change_value (adjustment, adjustment->step_increment);
+}
+
+void
+gtk_adjustment_wheel_up (GtkAdjustment *adjustment)
+{
+  g_return_if_fail (GTK_IS_ADJUSTMENT (adjustment));
+
+  gtk_adjustment_change_value (adjustment,
+			       -pow (adjustment->page_size, 2.0/3.0));
+}
+
+void
+gtk_adjustment_wheel_down (GtkAdjustment *adjustment)
+{
+  g_return_if_fail (GTK_IS_ADJUSTMENT (adjustment));
+
+  gtk_adjustment_change_value (adjustment,
+			       pow (adjustment->page_size, 2.0/3.0));
+}
+
+void
+gtk_adjustment_page_up (GtkAdjustment *adjustment)
+{
+  g_return_if_fail (GTK_IS_ADJUSTMENT (adjustment));
+
+  gtk_adjustment_change_value (adjustment, -adjustment->page_increment);
+}
+
+void
+gtk_adjustment_page_down (GtkAdjustment *adjustment)
+{
+  g_return_if_fail (GTK_IS_ADJUSTMENT (adjustment));
+  
+  gtk_adjustment_change_value (adjustment, adjustment->page_increment);
+}
+
+void
+gtk_adjustment_home (GtkAdjustment *adjustment)
+{
+  g_return_if_fail (GTK_IS_ADJUSTMENT (adjustment));
+  
+  gtk_adjustment_goto_value (adjustment, 0.0);
+}
+
+void
+gtk_adjustment_end (GtkAdjustment *adjustment)
+{
+  g_return_if_fail (GTK_IS_ADJUSTMENT (adjustment));
+  
+  gtk_adjustment_goto_value (adjustment, adjustment->upper - adjustment->page_size);
+}
+
+void
+gtk_adjustment_goto_value (GtkAdjustment *adjustment,
+			   gdouble        value)
+{
+  GtkAdjustmentPrivate *priv;
+  
+  g_return_if_fail (GTK_IS_ADJUSTMENT (adjustment));
+
+  priv = gtk_adjustment_get_private (adjustment);
+
+  priv->start_value = adjustment->value;
+  priv->goal_value = value;
+  g_timer_reset (priv->timer);
+
+  if (!priv->idle_id)
+    priv->idle_id = g_idle_add_full (GDK_PRIORITY_REDRAW + 3, adjustment_update_idle, adjustment, NULL);
 }
Index: gtk/gtkadjustment.h
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtkadjustment.h,v
retrieving revision 1.18
diff -u -p -u -r1.18 gtkadjustment.h
--- gtk/gtkadjustment.h	9 Oct 2002 22:25:17 -0000	1.18
+++ gtk/gtkadjustment.h	29 Jun 2003 12:12:53 -0000
@@ -75,21 +75,32 @@ struct _GtkAdjustmentClass
 };
 
 
-GType	   gtk_adjustment_get_type		(void) G_GNUC_CONST;
-GtkObject* gtk_adjustment_new			(gdouble	  value,
-						 gdouble	  lower,
-						 gdouble	  upper,
-						 gdouble	  step_increment,
-						 gdouble	  page_increment,
-						 gdouble	  page_size);
-void	   gtk_adjustment_changed		(GtkAdjustment	 *adjustment);
-void	   gtk_adjustment_value_changed		(GtkAdjustment	 *adjustment);
-void	   gtk_adjustment_clamp_page		(GtkAdjustment	 *adjustment,
-						 gdouble	  lower,
-						 gdouble	  upper);
-gdouble	   gtk_adjustment_get_value		(GtkAdjustment   *adjustment);
-void	   gtk_adjustment_set_value		(GtkAdjustment	 *adjustment,
-						 gdouble	  value);
+GType	   gtk_adjustment_get_type	(void) G_GNUC_CONST;
+GtkObject* gtk_adjustment_new           (gdouble        value,
+					 gdouble        lower,
+					 gdouble        upper,
+					 gdouble        step_increment,
+					 gdouble        page_increment,
+					 gdouble        page_size);
+void       gtk_adjustment_changed       (GtkAdjustment *adjustment);
+void       gtk_adjustment_value_changed (GtkAdjustment *adjustment);
+void       gtk_adjustment_clamp_page    (GtkAdjustment *adjustment,
+					 gdouble        lower,
+					 gdouble        upper);
+gdouble    gtk_adjustment_get_value     (GtkAdjustment *adjustment);
+void       gtk_adjustment_set_value     (GtkAdjustment *adjustment,
+					 gdouble        value);
+
+void       gtk_adjustment_goto_value    (GtkAdjustment *adjustment,
+					 gdouble        value);
+void	   gtk_adjustment_home		(GtkAdjustment *adjustment);
+void       gtk_adjustment_end           (GtkAdjustment *adjustment);
+void       gtk_adjustment_step_up       (GtkAdjustment *adjustment);
+void       gtk_adjustment_step_down     (GtkAdjustment *adjustment);
+void       gtk_adjustment_wheel_up      (GtkAdjustment *adjustment);
+void       gtk_adjustment_wheel_down    (GtkAdjustment *adjustment);
+void       gtk_adjustment_page_up       (GtkAdjustment *adjustment);
+void       gtk_adjustment_page_down     (GtkAdjustment *adjustment);
 
 #ifdef __cplusplus
 }
Index: gtk/gtkrange.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtkrange.c,v
retrieving revision 1.90
diff -u -p -u -r1.90 gtkrange.c
--- gtk/gtkrange.c	29 Mar 2003 00:19:50 -0000	1.90
+++ gtk/gtkrange.c	29 Jun 2003 12:12:54 -0000
@@ -31,9 +31,10 @@
 #include "gtkmarshalers.h"
 #include "gtkrange.h"
 #include "gtkintl.h"
+#include <math.h>
 
-#define SCROLL_INITIAL_DELAY 250  /* must hold button this long before ... */
-#define SCROLL_LATER_DELAY   100  /* ... it starts repeating at this rate  */
+#define SCROLL_INITIAL_DELAY 225  /* must hold button this long before ... */
+#define SCROLL_LATER_DELAY   75   /* ... it starts repeating at this rate  */
 #define UPDATE_DELAY         300  /* Delay for queued update */
 
 enum {
@@ -699,6 +700,12 @@ should_invert (GtkRange *range)
     return range->inverted;
 }
 
+static gboolean
+can_be_smooth (GtkRange *range)
+{
+  return (range->round_digits < 0 && range->update_policy == GTK_UPDATE_CONTINUOUS);
+}
+
 static void
 gtk_range_finalize (GObject *object)
 {
@@ -1371,22 +1378,52 @@ gtk_range_scroll_event (GtkWidget      *
   if (GTK_WIDGET_REALIZED (range))
     {
       GtkAdjustment *adj = GTK_RANGE (range)->adjustment;
-      gdouble increment = ((event->direction == GDK_SCROLL_UP ||
-			    event->direction == GDK_SCROLL_LEFT) ? 
-			   -adj->page_increment / 2: 
-			   adj->page_increment / 2);
-      
-      if (range->inverted)
-	increment = -increment;
+      GdkScrollDirection direction = event->direction;
 	  
-      gtk_range_internal_set_value (range, adj->value + increment);
+      if (direction == GDK_SCROLL_UP ||
+	  direction == GDK_SCROLL_LEFT)
+	{
+	  direction = GDK_SCROLL_UP;
+	}
+      else
+	{
+	  direction = GDK_SCROLL_DOWN;
+	}
+      
+      if (should_invert (range))
+	{
+	  if (direction == GDK_SCROLL_UP)
+	    direction = GDK_SCROLL_DOWN;
+	  else
+	    direction = GDK_SCROLL_UP;
+	}
 
-      /* Policy DELAYED makes sense with scroll events,
-       * but DISCONTINUOUS doesn't, so we update immediately
-       * for DISCONTINOUS
-       */
-      if (range->update_policy == GTK_UPDATE_DISCONTINUOUS)
-        gtk_range_update_value (range);
+      if (can_be_smooth (range))
+	{
+	  if (direction == GDK_SCROLL_UP)
+	    gtk_adjustment_wheel_up (adj);
+	  else
+	    gtk_adjustment_wheel_down (adj);
+
+	  range->need_recalc = TRUE;
+	  gtk_widget_queue_draw (GTK_WIDGET (range));
+	}
+      else
+	{
+	  gdouble increment = pow (adj->page_size, 2.0/3.0);
+
+	  if (direction == GDK_SCROLL_UP)
+	    increment *= -1;
+
+	  gtk_range_internal_set_value (range, adj->value + increment);
+
+	  /* Policy DELAYED makes sense with scroll events,
+	   * but DISCONTINUOUS doesn't, so we update immediately
+	   * for DISCONTINUOUS
+	   */
+	  if (range->update_policy == GTK_UPDATE_DISCONTINUOUS)
+	    gtk_range_update_value (range);
+	}
     }
 
   return TRUE;
@@ -1485,14 +1522,22 @@ gtk_range_adjustment_value_changed (GtkA
 				    gpointer       data)
 {
   GtkRange *range = GTK_RANGE (data);
+  GtkRangeLayout old_layout;
+
+  old_layout = *range->layout;
 
   range->need_recalc = TRUE;
+  gtk_range_calc_layout (range, adjustment->value);
+
+  if (memcmp (&old_layout, range->layout, sizeof (GtkRangeLayout)) != 0)
+    {
+      gtk_widget_queue_draw (GTK_WIDGET (range));
+
+      /* This is so we don't lag the widget being scrolled. */
+      if (GTK_WIDGET_REALIZED (range))
+	gdk_window_process_updates (GTK_WIDGET (range)->window, FALSE);
+    }
 
-  gtk_widget_queue_draw (GTK_WIDGET (range));
-  /* This is so we don't lag the widget being scrolled. */
-  if (GTK_WIDGET_REALIZED (range))
-    gdk_window_process_updates (GTK_WIDGET (range)->window, FALSE);
-  
   /* Note that we don't round off to range->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
@@ -1518,40 +1563,81 @@ gtk_range_style_set (GtkWidget *widget,
 static void
 step_back (GtkRange *range)
 {
-  gdouble newval;
-  
-  newval = range->adjustment->value - range->adjustment->step_increment;
-  gtk_range_internal_set_value (range, newval);
+  GtkAdjustment *adj = range->adjustment;
+
+  if (can_be_smooth (range))
+    {
+      gtk_adjustment_step_up (adj);
+      range->need_recalc = TRUE;
+      gtk_widget_queue_draw (GTK_WIDGET (range));
+    }
+  else
+    {
+      gdouble newval;
+
+      newval = adj->value - adj->step_increment;
+      gtk_range_internal_set_value (range, newval);
+    }
 }
 
 static void
 step_forward (GtkRange *range)
 {
-  gdouble newval;
+  GtkAdjustment *adj = range->adjustment;
 
-  newval = range->adjustment->value + range->adjustment->step_increment;
+  if (can_be_smooth (range))
+    {
+      gtk_adjustment_step_down (adj);
+      range->need_recalc = TRUE;
+      gtk_widget_queue_draw (GTK_WIDGET (range));
+    }
+  else
+    {
+      gdouble newval;
 
-  gtk_range_internal_set_value (range, newval);
+      newval = adj->value + adj->step_increment;
+      gtk_range_internal_set_value (range, newval);
+    }
 }
 
-
 static void
 page_back (GtkRange *range)
 {
-  gdouble newval;
+  GtkAdjustment *adj = range->adjustment;
 
-  newval = range->adjustment->value - range->adjustment->page_increment;
-  gtk_range_internal_set_value (range, newval);
+  if (can_be_smooth (range))
+    {
+      gtk_adjustment_page_up (adj);
+      range->need_recalc = TRUE;
+      gtk_widget_queue_draw (GTK_WIDGET (range));
+    }
+  else
+    {
+      gdouble newval;
+
+      newval = adj->value - adj->page_increment;
+      gtk_range_internal_set_value (range, newval);
+    }
 }
 
 static void
 page_forward (GtkRange *range)
 {
-  gdouble newval;
+  GtkAdjustment *adj = range->adjustment;
 
-  newval = range->adjustment->value + range->adjustment->page_increment;
+  if (can_be_smooth (range))
+    {
+      gtk_adjustment_page_down (adj);
+      range->need_recalc = TRUE;
+      gtk_widget_queue_draw (GTK_WIDGET (range));
+    }
+  else
+    {
+      gdouble newval;
 
-  gtk_range_internal_set_value (range, newval);
+      newval = adj->value - adj->page_increment;
+      gtk_range_internal_set_value (range, newval);
+    }
 }
 
 static void
@@ -1633,13 +1719,27 @@ gtk_range_scroll (GtkRange     *range,
       break;
 
     case GTK_SCROLL_START:
-      gtk_range_internal_set_value (range,
-                                    range->adjustment->lower);
+      if (can_be_smooth (range))
+	{
+	  gtk_adjustment_home (range->adjustment);
+	  range->need_recalc = TRUE;
+	  gtk_widget_queue_draw (GTK_WIDGET (range));
+	}
+      else
+	gtk_range_internal_set_value (range,
+				      range->adjustment->lower);
       break;
 
     case GTK_SCROLL_END:
-      gtk_range_internal_set_value (range,
-                                    range->adjustment->upper - range->adjustment->page_size);
+      if (can_be_smooth (range))
+	{
+	  gtk_adjustment_end (range->adjustment);
+	  range->need_recalc = TRUE;
+	  gtk_widget_queue_draw (GTK_WIDGET (range));
+	}
+      else
+	gtk_range_internal_set_value (range,
+				      range->adjustment->upper - range->adjustment->page_size);
       break;
 
     case GTK_SCROLL_JUMP:
Index: gtk/gtkscrolledwindow.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtkscrolledwindow.c,v
retrieving revision 1.67
diff -u -p -u -r1.67 gtkscrolledwindow.c
--- gtk/gtkscrolledwindow.c	28 Feb 2003 23:48:40 -0000	1.67
+++ gtk/gtkscrolledwindow.c	29 Jun 2003 12:12:55 -0000
@@ -793,98 +793,65 @@ gtk_scrolled_window_scroll_child (GtkScr
 				  GtkScrollType      scroll,
 				  gboolean           horizontal)
 {
-  GtkAdjustment *adjustment = NULL;
+  GtkAdjustment *hadj = NULL;
+  GtkAdjustment *vadj = NULL;
+
+  if (scrolled_window->hscrollbar)
+    hadj = gtk_range_get_adjustment (GTK_RANGE (scrolled_window->hscrollbar));
+
+  if (scrolled_window->vscrollbar)
+    vadj = gtk_range_get_adjustment (GTK_RANGE (scrolled_window->vscrollbar));
   
   switch (scroll)
     {
     case GTK_SCROLL_STEP_UP:
-      scroll = GTK_SCROLL_STEP_BACKWARD;
-      horizontal = FALSE;
+    case GTK_SCROLL_STEP_BACKWARD:
+      if (vadj)
+	gtk_adjustment_step_up (vadj);
       break;
     case GTK_SCROLL_STEP_DOWN:
-      scroll = GTK_SCROLL_STEP_FORWARD;
-      horizontal = FALSE;
+    case GTK_SCROLL_STEP_FORWARD:
+      if (vadj)
+	gtk_adjustment_step_down (vadj);
       break;
     case GTK_SCROLL_STEP_LEFT:
-      scroll = GTK_SCROLL_STEP_BACKWARD;
-      horizontal = TRUE;
+      if (hadj)
+	gtk_adjustment_step_up (hadj);
       break;
     case GTK_SCROLL_STEP_RIGHT:
-      scroll = GTK_SCROLL_STEP_FORWARD;
-      horizontal = TRUE;
+      if (hadj)
+	gtk_adjustment_step_down (hadj);
       break;
     case GTK_SCROLL_PAGE_UP:
-      scroll = GTK_SCROLL_PAGE_BACKWARD;
-      horizontal = FALSE;
+    case GTK_SCROLL_PAGE_BACKWARD:
+      if (vadj)
+	gtk_adjustment_page_up (vadj);
       break;
     case GTK_SCROLL_PAGE_DOWN:
-      scroll = GTK_SCROLL_PAGE_FORWARD;
-      horizontal = FALSE;
+    case GTK_SCROLL_PAGE_FORWARD:
+      if (vadj)
+	gtk_adjustment_page_down (vadj);
       break;
     case GTK_SCROLL_PAGE_LEFT:
-      scroll = GTK_SCROLL_STEP_BACKWARD;
-      horizontal = TRUE;
+      if (hadj)
+	gtk_adjustment_page_up (hadj);
       break;
     case GTK_SCROLL_PAGE_RIGHT:
-      scroll = GTK_SCROLL_STEP_FORWARD;
-      horizontal = TRUE;
+      if (hadj)
+	gtk_adjustment_page_down (hadj);
       break;
-    case GTK_SCROLL_STEP_BACKWARD:
-    case GTK_SCROLL_STEP_FORWARD:
-    case GTK_SCROLL_PAGE_BACKWARD:
-    case GTK_SCROLL_PAGE_FORWARD:
     case GTK_SCROLL_START:
+      if (vadj)
+	gtk_adjustment_home (vadj);
+      break;
     case GTK_SCROLL_END:
+      if (vadj)
+	gtk_adjustment_end (vadj);
       break;
     default:
       g_warning ("Invalid scroll type %d for GtkSpinButton::change-value", scroll);
       return;
     }
-
-  if (horizontal)
-    {
-      if (scrolled_window->hscrollbar)
-	adjustment = gtk_range_get_adjustment (GTK_RANGE (scrolled_window->hscrollbar));
-    }
-  else
-    {
-      if (scrolled_window->vscrollbar)
-	adjustment = gtk_range_get_adjustment (GTK_RANGE (scrolled_window->vscrollbar));
-    }
-
-  if (adjustment)
-    {
-      gdouble value = adjustment->value;
-      
-      switch (scroll)
-	{
-	case GTK_SCROLL_STEP_FORWARD:
-	  value += adjustment->step_increment;
-	  break;
-	case GTK_SCROLL_STEP_BACKWARD:
-	  value -= adjustment->step_increment;
-	  break;
-	case GTK_SCROLL_PAGE_FORWARD:
-	  value += adjustment->page_increment;
-	  break;
-	case GTK_SCROLL_PAGE_BACKWARD:
-	  value -= adjustment->page_increment;
-	  break;
-	case GTK_SCROLL_START:
-	  value = adjustment->lower;
-	  break;
-	case GTK_SCROLL_END:
-	  value = adjustment->upper;
-	  break;
-	default:
-	  g_assert_not_reached ();
-	  break;
-	}
-
-      value = CLAMP (value, adjustment->lower, adjustment->upper - adjustment->page_size);
-      
-      gtk_adjustment_set_value (adjustment, value);
-    }
 }
 
 static void
@@ -1214,16 +1181,17 @@ gtk_scrolled_window_scroll_event (GtkWid
 
   if (range && GTK_WIDGET_VISIBLE (range))
     {
-      GtkAdjustment *adj = GTK_RANGE (range)->adjustment;
-      gdouble new_value;
+      GtkAdjustment *adjustment = GTK_RANGE (range)->adjustment;
 
-      if (event->direction == GDK_SCROLL_UP || event->direction == GDK_SCROLL_LEFT)
-	new_value = adj->value - adj->page_increment / 2;
+      if (event->direction == GDK_SCROLL_UP ||
+	  event->direction == GDK_SCROLL_LEFT)
+	{
+	  gtk_adjustment_wheel_up (adjustment);
+	}
       else
-	new_value = adj->value + adj->page_increment / 2;
-
-      new_value = CLAMP (new_value, adj->lower, adj->upper - adj->page_size);
-      gtk_adjustment_set_value (adj, new_value);
+	{
+	  gtk_adjustment_wheel_down (adjustment);
+	}
 
       return TRUE;
     }
