[Top][All Lists]

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

Re: Addition to emacsbug.el

From: Jan D.
Subject: Re: Addition to emacsbug.el
Date: Thu, 28 Oct 2004 08:21:30 +0200

Hmm, I don't like it. First of all, it is during a thumb-drag that you actually look at the thumb and the feedback you get from the size of the thumb (how much of the whole we are viewing, and where we currently are) is
most useful.  Also, the thumb does not always show up under the mouse
pointer, but often quite a bit from it. If I continue to drag, the thumb
jumps to the pointer.  I'd rather keep the current GTK behaviour, with
a thumb size that includes the empty virtual page, but others may
feel different.

Well, it's a question of taste, obviously. I myself introduced the idea of "empty virtual page" in the Xaw3d code (so if you're looking at a 25 lines
buffer in a 25-lines window, the thumb is only covering half of the
scrollbar).  But after using it for a while I decided I didn't like it
because I was never sure whether there was still something left in the
buffer (typically when reading Gnus messages). There are various ways to provide some other visual feedback, but experience showed that the scrollbar
is the feedback that I use.

For GTK at least some compromise is needed.  Some themes have a minimum
size for the thumb.  So if the thumb is at its minimum size
the overscrolling with the thumb shrinking can't happen.  If the shown
portion of the buffer is small compared to the total size of the buffer,
I think the virtual page behaviour is OK.  After all, can you see the
difference between a thumb who has a height that is 1/30 of the window
height, or 1/31?
Otherwise we should do something else, be it your solution or the thumb
shrinking one.

Secondly it does not work at all for GTK. The event from the scroll bar stops when the thumb hits the bottom, so overscrolling for a window where
the whole contents is shown does not happen.

I don't understand what you mean by "it doesn't work". In the above case, the thumb would start covering the whole scrollbar, but as soon as the drag starts you make it size 0, so the user can drag at will and the thumb will only hit the bottom of the scrollbar when the beginning of the thumb is at
the bottom (i.e. when the last char of the buffer is at the top of the

To change the thumb size means fiddling with the page size and the maximum values for the scroll bar. Relating values back to a buffer position then
becomes so much harder.  Not impossible, but certainly a lot of testing
needs to be done.

The problem of not being able to move past the bottom is just the same
in Xaw3d. Well, was, since AFAIK Xaw3g version 1.5g fixes it (it can be
argued that it was a bug since it didn't follow the Xaw behavior).

Also, GTK thumbs can not be resized with ease like the Xaw and Motif ones,
it involves setting the page size and the max and min just right.

Isn't that a small matter of programming (I mean, Emacs does change the size
of the thumb, already, right?).

Yes, in principle that is correct.

It depends on what we consider the perfect behaviour.  My idea (and
I thought the other versions of Emacs behaved like this already, I don't use
scroll bars much) is that when the thumb hits the bottom we enter
overscrolling mode. In that mode the thumb smoothly shrinks if dragged down
further, and grows again if dragged up.

Yes, that's exactly what I mean by "perfect behavior", except that your
description only focuses on the scrollbar, whereas one key aspect is how it relates to the actual buffer text displayed: when the thumb hits the bottom
is when the EOB is displayed.

There is another thing I noticed about your patch. If the buffer contains three lines and the window is 34 lines, the thumb covers the whole window.
Now, if I start to scroll down putting the pointer somewhere at the top
of the thumb, I'll have to move down to half the window before one line
is actually scrolled. Then down to 3/4 before the second line is scrolled
and finally to the bottom to get the third line to scroll.

Now, if I start with the pointer near the bottom of the thumb, the two
first lines are scrolled just by moving the pointer one pixel.

I think the amount you move the pointer should determine how many lines
are scrolled, not where you happen to put the pointer when you start.
Also, the amount to move for scrolling one line should be the same
regardless of the size of the buffer or the amount show.

I am not sure if there is a general way to do this (resizing of thumbs and event handling differ between toolkits), or if it must be done individually for each toolkit. Perhaps if this is done for two toolkits we can then rewrite it in a general way. That would be 22.0 stuff I think. But as GTK
is just one toolkit and the scroll code to modify is either all in
gtkutils.c or #ifdef:ed USE_GTK in xterm, the risc is low.

Currently a fair bit of code is shared, but not all of it.  the current
imperfect solution uses different tricks for different toolkits.

My suggested new imperfect solution is less dependent on details of the
toolkits so it reduces the among of toolkit-specific tweaks.
Check the patch I sent.

BTW, what about the other part of my patch:
merge xg_set_toolkit_scroll_bar_thumb back into
x_set_toolkit_scroll_bar_thumb ?

The code shared is smaller than the code that differs, so I really don't
see the point.  But if the shared code could go into a function of its
own that would make sense.  For GTK it was convinient to have all code
that modifies the scroll bars in one file when changes had to be done.

        Jan D.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]