After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 89259 - Make scroll wheel step dimensionally correct
Make scroll wheel step dimensionally correct
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Widget: Other
2.0.x
Other Linux
: Normal enhancement
: Small feature
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2002-07-28 13:56 UTC by Daniel Borgmann
Modified: 2016-09-23 11:34 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Patch to make the wheel scroll page_size^(2/3) (2.51 KB, patch)
2003-09-19 11:15 UTC, Soren Sandmann Pedersen
none Details | Review
New patch that only uses the power function for scrollbars (3.30 KB, patch)
2004-02-21 18:09 UTC, Soren Sandmann Pedersen
none Details | Review

Description Daniel Borgmann 2002-07-28 13:56:32 UTC
Currently the mousewheel in Gtk Textviews (I'm mainly talking about gedit,
just assuming that it's controled by the Gtk widget) scrolls about half a
page. At this speed it is very hard to keep track of where I am and it
usually happens to me that I completely loose track whenever I use the
scrollwheel. Other applications always scroll about three lines at once
(like Moleskine or Mozilla), that's very easy to follow. The current
behaviour might be advantegous when scrolling through large files, but this
advantage becomes dubious when I constantly miss what I'm looking for
because it's going by so fast. 
I would much rather use the scrollbar when looking for something in a large
file (because it scrolls smooth and/or fast) but use the scrollwheel for
fine adjustment.
Comment 1 Soren Sandmann Pedersen 2002-07-30 15:58:31 UTC
I agree.

It is very difficult to track the contents when we scroll half a 
page. We should probably instead scroll 3 * step_increment 
instead of page_size / 2. Also, widgets generally set  
step_increment to 10% of the widget's allocation unless they have 
the concept "line".  I think this value should instead be 
something like MIN (33, 10%) so that the result of both step and 
wheel operations become more predictable (if wheel events become 
3 * step_increment).

For the wheel events, this is easy to fix for most widgets - just 
change page_size/2 to step_increment * 3 in gtkscrolledwindow.c 
and gtkrange.c. 

The step_increments must be fixed on a widget-by-widget basis.
Comment 2 Owen Taylor 2002-07-30 22:38:23 UTC
Where does 33 come from? And if we are going to pick a magical
number of pixels, shouldn't we just use that, rather than including
the 10% in there as well?
Comment 3 Soren Sandmann Pedersen 2002-07-30 23:44:25 UTC
33 comes from the usual "seems right to me". I can comfortably 
track about 100-140 pixels per wheel event on a 1600x1200 21" 
monitor and 33-40 is not an unreasonable amount for a step. The 
exact numbers are negotiable, of course.

We shouldn't use the magic constant for all cases, because when 
the allocation gets smaller than 33, this would make stepping 
scroll more than was visible on screen, which would be confusing. 
I think in this case, 10% is not unreasonable and so, to get a 
continous function, I suggest MIN (33, 10%).

Comment 4 Soren Sandmann Pedersen 2002-07-30 23:53:28 UTC
I'll add that the numbers could be different from widget to widget  
The text widget might require a smaller step_increment than the tree 
widget because tracking running text is more difficult than tracking 
a vertical list.

Comment 5 Owen Taylor 2002-11-06 23:02:59 UTC
I think this is going to require some demo patches for
people to play around with and see what works best.
Comment 6 Rob Adams 2003-05-25 05:58:48 UTC
ping.

This seems like a problem that should be fixed for Gnome 2.4.  The
scroll wheel is essentially useless as it stands for the gtk2 versions
of apps like evolution and gedit.

The 3 lines of scrolling seems to be the accepted norm in almost every
other app that I can think of, but this might also make sense as a
mouse preference in gnome control center, along with the pointer
acceleration, but that's certainly debatable.

How hard is this to fix?
Comment 7 Owen Taylor 2003-05-25 15:39:04 UTC
This won't be changed for GNOME-2.4, since GNOME-2.4
will be based on GTK+-2.2, and this isn't the sort of
thing we want to change in maintenance releases.

My comment above stands for what is needed here next ... 
some demo patches for people to play around with.
Comment 8 Soren Sandmann Pedersen 2003-09-19 11:15:31 UTC
Created attachment 20086 [details] [review]
Patch to make the wheel scroll   page_size^(2/3)
Comment 9 Soren Sandmann Pedersen 2003-09-19 11:21:19 UTC
I just attached a patch to make the wheel scroll page_size^(2/3).

That formula works very well for me, but see

   http://mail.gnome.org/archives/gtk-devel-list/2003-June/msg00116.html

and the follow-up for discussion about the scroll-step.

(Something like

       if (GTK_IS_SCROLLBAR (range))
             use pow(page_size, 2/3)
       else
             use linear_function(page_size);

may be possible, or even have the wheel step virtualized for
GtkRanges)
Comment 10 Daniel Borgmann 2004-01-06 02:09:49 UTC
Can't we just use MIN(page_size, 3 * lineheight) like KDE (and
Mozilla) seem to do? That makes a lot of sense to me. It's consistent
and the dependence on font size makes it somewhat resolution
independant. The maximum of it's own size makes sure that you never
scroll more than one page on very small widgets. It's also simple,
tried and tested.
Unfortunately I couldn't figure out how to calculate a proper
lineheight (fontsize + something?), so I'm currently testing it with
fixed values, but I like it a lot so far.
Comment 11 alexander.winston 2004-01-24 04:18:26 UTC
Adding the PATCH keyword.
Comment 12 Soren Sandmann Pedersen 2004-02-21 18:09:48 UTC
Created attachment 24631 [details] [review]
New patch that only uses the power function for scrollbars
Comment 13 Soren Sandmann Pedersen 2004-02-29 18:24:56 UTC
Retitling and leaving bug open to track the isssue of whether we
should normalize based on font size, ie. use something along the lines of 

     font_size * pow (page_size / font_size, k);


Sun Feb 29 19:04:33 2004  Soeren Sandmann  <sandmann@daimi.au.dk>

	* gtk/gtkrange.c (_gtk_range_get_wheel_delta): New internal
	function returning a good step value for the mouse wheel. For
	scrollbars, base the step on page_size^(2/3), for other ranges,
	use 2 * step_increment.

	* gtk/gtkrange.c (gtk_range_scroll_event): Use it here ...

	* gtk/gtkscrolledwindow.c (gtk_scrolled_window_scroll_event): 
	... and here.

	* gtk/gtkmenu.c (gtk_menu_leave_notify): Fix a warning.

Comment 14 plamen 2004-05-18 09:01:58 UTC
How about making it configurable?
Obviously there is no one universal or magic number!
Comment 15 Björn Lindqvist 2008-03-23 10:43:17 UTC
Isn't it time to close this bug? AFAICT the meat of the patches have been applied and the issue solved?
Comment 16 Benjamin Otte (Company) 2012-03-07 00:55:03 UTC
I was just reading git logs for this, and I've not heard anybody complain about scroll wheel performance forever, so I consider this closed.

Also, the patches here are committed since 2004.
Comment 17 herr.pilsner 2013-02-08 21:17:56 UTC
Please make it page_size/4!

page_size^(2/3) is unusable on high-resolution screens.
Comment 18 Claudius Ellsel 2016-09-23 11:34:23 UTC
So maybe this should be looked at again?