[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: Wed, 27 Oct 2004 21:37:01 +0200
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.3) Gecko/20040916

Stefan Monnier wrote:
I'm working on the GTK scroll bars again, trying to get overscrolling to
work as in the native scroll bars.  But I see that depending on what GTK
version and what X server version I run on (specifically with DAMAGE
extension or not), I sometimes get different behaviour.  Therefore I would
like to have this information inserted by report-emacs-bug.  The GTK version
is already in emacs-version, so I propose this patch to emacsbug.el:

BTW, with the Xaw3d scrollbars (which had/have the same problem), I've been
using the following trick very happily:
- use the "normal" thumb position and size (the same as was used for the
  non-toolkit scroll bars).
- at the beginning of a thumb-drag, set the thumb size to 0.
- at the end of a thumb-drag reset the thumb-size to its real value.

I find this to be the best solution to the problem: from the code's point of
view, it's clean and simple (much cleaner and simpler than the hacks that
are currently used in xterm.c).  From the user's point of view, it makes
dragging a bit strange at first because the thumb almost disappears under
the mouse cursor, but to make up for it, the actual behavior during dragging
is now flawless and so is the rest of the behavior.

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.

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. 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.

Since we can't have a perfect behavior I find this trade off to be much
better than anything I've seen so far.

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.

Say you have a buffer with two pages, and if one page is visible the thumb is half the size of the window. You drag down the thumb to the bottom, so that the top of page two is at the top of the window. If you drag down further, the thumb shrinks until the bottom of page two is at the top of the window. The thumb in this case shrinks to a minimum of a third of the window height (2 real pages and one virtual).

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.

I have a test program that does just this for GTK, but it is one thing to write a pure GTK program and another to get the same behaviour in Emacs. I hope it can be done. Also, I haven't tested with complicated themes yet.

        Jan D.

reply via email to

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