3

I needed to change the mouse wheel scroll rate in GTK applications. I downloaded and modified GTK3 source code. I recompiled it. It did the trick for gedit and nautilus. But did not do it for gnome-terminal even though it is a GTK3 application.

I changed the lines starting with delta= in the if-else clause. Just changed the numbers to weird ones so that I can see the change if there is any.

Here are the change I made to gtk/gtkrange.c:

 /**        
 * _gtk_range_get_wheel_delta:
 * @range: a #GtkRange
 * @direction: A #GdkScrollDirection
 * 
 * Returns a good step value for the mouse wheel.
 * 
 * Return value: A good step value for the mouse wheel. 
 * 
 * Since: 2.4
 **/
gdouble
_gtk_range_get_wheel_delta (GtkRange           *range,
                GdkScrollDirection  direction)
{
  GtkRangePrivate *priv = range->priv;
  GtkAdjustment *adjustment = priv->adjustment;
  gdouble delta;

  if (GTK_IS_SCROLLBAR (range))
    **delta = pow (gtk_adjustment_get_page_size (adjustment), 1.0 / 94.0);**
  else
    **delta = gtk_adjustment_get_step_increment (adjustment) * 400;**

  if (direction == GDK_SCROLL_UP ||
      direction == GDK_SCROLL_LEFT)
    delta = - delta;

  if (priv->inverted)
    delta = - delta;

  return delta;
}
2
  • 1
    Since your changes and compilation obviously worked, the only remaining question seems to be whether gnome-terminal actually uses this part of the code. Have you found the code where this happens?
    – xubuntix
    Nov 8, 2011 at 21:31
  • Hello, this question has no information and activity for a very long time. I am voting to close it for now. If by any reason you think this question is still viable or useful in anyways or that there is still a good chance it will be answered please flag it to a moderator or add a comment with the reasons why you want it open. Regards. Feb 28, 2012 at 16:25

0

Browse other questions tagged .