Scroll wheel step



Owen Taylor <otaylor redhat com> writes:

> > I do think it is important that the part of the patch that changes the
> > wheel step from half a page to something more sensible goes in for
> > 2.4. Scroll wheels are very difficult to use currently.
> 
> Hmm, I really don't believe that the formula you use can be quite
> right ... at least for something like GtkScale where the adjustment
> isn't necessarily in pixels.

How about normalizing based on the GtkRange allocation? Ie. making the
scroll step "whatever it takes to move the visible result
pow(allocation,2/3)".

My formula just exploits the fact that allocation == page_size for
scrollable widgets.

Adding gtk_adjustment_wheel_step() would not make any sense then of
course. 

> For proper scale invariance, the scroll step has to have the same units
> as the page_size, and pow(page_size,2/3) doesn't. E.g., if the page size
> is a million, then the scroll wheel will step by 1% of a page.
> 
> Perhaps the right formula involves
> 
>  page_size * function(step_size/page_size)
> 
> ? 

Well, if you assume the step size is the size of a line, then
"step_size/page_size" would be 1/number_of_lines, so the result would
be a function of the number of lines times the page_size. Yes, I think
that could possibly work if step_size and page_size are actually
accurate reflections of reality. On windows "function (x)" would just
be "system_setting * x". (The windows setting is in number of lines,
right?").

But unfortunately step_size is always just page_size/10, so in
practice it would just make the wheel step page_size * k where k is a
constant. And I just don't think there is a good constant to use.  My
first suggestion in the bugzilla bug 

        http://bugzilla.gnome.org/show_bug.cgi?id=89259

was 3 * step_increment, but capped at 99 pixels. Up to about 100
that's actually a fairly good approximation page_size^(2/3) but the 99
pixels is too big a cap up until about 1000 pixels.

It is difficult to fix the step sizes, because the page_size/10 has
been cutted and pasted in just about every scrollable widget ever
written, inside and outside of gtk+. And also, to set step_size
properly, you need knowledge about the physical size of the screen. If
the widget is big compared to the physical size of the screen, then
30% is too little, if it is small, 10% is not enough. 

Or you need the concept of "line", but that reduces to physical size,
because "line" comes with a font size usually. And even the concept of
line is not good enough. What if the widget is smaller than three
lines? You don't want to scroll three lines then.


Søren



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