unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan <monnier@iro.umontreal.ca>
Cc: emacs devel <emacs-devel@gnu.org>
Subject: Re: Addition to emacsbug.el
Date: Fri, 29 Oct 2004 17:17:31 -0400	[thread overview]
Message-ID: <m18y9pz2ar.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <24DBCE88-298E-11D9-8B5E-000D93505B76@swipnet.se> (Jan D.'s message of "Fri, 29 Oct 2004 11:37:26 +0200")

>>> 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.
>> 
>> Huh?  Are you sure?  I'd expect that the display-size of the thumb is
>> "unrelated" to the size as specified by the C code.  What if your document
>> is made of 10 pages and your scrollbar is 40 pixels and your minimum thumb
>> size is 20 pixels, is GTK going to prevent you from seeing more than
>> 2 pages?

> No, but the 9 pages will be scrolled in 20 pixels.  So no precision
> scrolling is possible if you have many pages and a small window.  It is the
> same for any scroll bar, the minimum size is at least 1 pixel.  And if you
> have a window that is 40 pixels and the buffer is 1000 pages, you have to
> scroll through 999 pages in 39 pixels.  Basically the scroll bar is useless
> in this situation.

Yup.  So you agree it's actually not specific to the fact that some themes
have a minimum size for the thumb.  The problem is simply that Gtk makes
overscrolling "impossible", just like Xaw3d and Motif (used to) do.

>>> Otherwise we should do something else, be it your solution or the thumb
>>> shrinking one.
>> I don't know what is the "thumb shrinking" solution.

> I described previously in
> http://lists.gnu.org/archive/html/emacs-devel/2004-10/msg01300.html

Oh, I see.  That's more or less what Xaw3d used to use.
The problem with it was that the thumb was shrunk too late:
- the user moves the mouse past the bottom.
- the thumb is moved by Xaw3d to the bottom (and no further).
- the callback is called and Emacs finally gets a chance to change the thumb
  size (but it doesn't know how far the mouse has moved: it only knows that
  it's at least gotton to the bottom, so it doesn't know how much to shrink
  it).
- unless the user moves the mouse again, the position of the thumb
  is not updated to take into account the original "past the bottom"
  mouse movement.

So what often happened is that you'd move the mouse past the bottom and then
you'd have to wiggle it to get the callback to shrink the thumb little
by little.  Your suggestion to shrink it to 0 as soon as you hit the bottom
would indeed help: you'd only have to move the mouse once after
hitting bottom.

In the case of Xaw3d an additional problem is that the Xaw3d code ignore(d|s)
requests to change the size of the thumb while dragging (the xterm.c code
has/had some really ugly hacks that accessed internal variables of Xaw3d to
try and fool it into thinking it's not dragging).

>>> 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.
>> 
>> Hmm... I'll trust you on that one because I obviously don't understand
>> the difficulty: the way the xterm.c code uses SB_MAX or equivalent as the
>> "maximum value" it would work exactly the same whether SB_MAX is
>> a constant
>> or not.

> If I change the maximum value, the thumb size changes.  I then also have to
> adjust the value otherwise the thumb changes position.  Also, page_size
> page_increment and step_increment has to be changed.  Obviously this
> is no more than to find a suitable algorithm, but the bad thing is that
> the thumb almost always jump a bit when these values are changed.

I'd think this algorithm is already written (to update the size and position
of the thumb after point movement or buffer modifications).  But as I said,
I don't actually know what I'm talking about, so please ignore me here.

> I used Xaw3d.  The point that bothered me is if I have to pages in
> a buffer, scrolling three lines involves a small mouse movement.
> If I have three lines in the buffer, scrolling three lines involves a very
> big mouse movement, even if I start with the mouse pointer in the same
> place in both cases.

If that's the only thing that bothered you with my Xaw3d code, I'm
flattered ;-).  After all, it's the desired behavior (and AFAICT this part
of the behavior is common to all scrollbar implementations, even for other
programs).


        Stefan

  parent reply	other threads:[~2004-10-29 21:17 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-10-27  9:37 Addition to emacsbug.el Jan D.
2004-10-27 13:27 ` Stefan Monnier
2004-10-27 19:37   ` Jan D.
2004-10-27 20:50     ` Stefan Monnier
2004-10-28  6:21       ` Jan D.
2004-10-28 19:54         ` Stefan
2004-10-29  9:37           ` Jan D.
2004-10-29 12:28             ` Jan D.
2004-10-29 21:17             ` Stefan [this message]
2004-10-30 15:01               ` Jan D.
2004-10-30 16:53                 ` Stefan
2004-10-30 17:17                   ` Jan D.
2004-10-28  6:24 ` Richard Stallman
2004-10-28  8:07   ` Jan D.

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m18y9pz2ar.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).