* Re: vertical scrollbar error on MS Windows
@ 2007-02-21 0:24 grischka
2007-02-21 8:07 ` Kim F. Storm
2007-02-21 19:01 ` Stefan Monnier
0 siblings, 2 replies; 27+ messages in thread
From: grischka @ 2007-02-21 0:24 UTC (permalink / raw)
To: storm; +Cc: emacs-devel
[-- Attachment #1: Type: text/plain, Size: 239 bytes --]
Hi there,
Here is another fix for the scrollbars. From the approach
it calculates the thumb length once on mouse down and
then leaves bar parameters alone during dragging. Patch
for w32term.c is in the attachement.
Regards
-- grischka
[-- Attachment #2: w32term.c.diff --]
[-- Type: application/octet-stream, Size: 3482 bytes --]
--- c:/checkout/emacs-cvs/emacs/src/w32term.c Tue Feb 20 02:22:42 2007
+++ w32term.c Wed Feb 21 00:10:48 2007
@@ -3468,11 +3468,70 @@
/* Set the thumb size and position of scroll bar BAR. We are currently
displaying PORTION out of a whole WHOLE, and our position POSITION. */
+#define SCROLL_FIX
+
static void
w32_set_scroll_bar_thumb (bar, portion, position, whole)
struct scroll_bar *bar;
int portion, position, whole;
{
+#ifdef SCROLL_FIX
+ Window w;
+ BOOL draggingp = !NILP (bar->dragging) ? TRUE : FALSE;
+ SCROLLINFO si;
+ int sb_page, sb_pos, range, window, lines, n, mem;
+
+ static int was_draggingp;
+ if (draggingp && was_draggingp)
+ return;
+ was_draggingp = draggingp;
+
+ // scan some text
+ mem = whole;
+ if (mem > 20000)
+ mem = 20000;
+
+ for (lines = 0, n = 1; n <= mem; ++n)
+ if (FETCH_BYTE(n) == '\n')
+ ++lines;
+
+ window = WINDOW_TOTAL_LINES (XWINDOW (bar->window));
+ range = VERTICAL_SCROLL_BAR_INSIDE_HEIGHT (f, XINT(bar->height));
+
+ if (mem == whole) {
+ sb_page = range * window / (lines + window);
+ } else {
+ window = window * mem / (lines + 1); // in bytes, avg.
+ sb_page = range * window / (whole + window);
+ }
+
+ // bigger is nicer for them with a cheap mouse
+ n = VERTICAL_SCROLL_BAR_INSIDE_WIDTH (f, XINT(bar->width));
+ if (sb_page < n) {
+ sb_page = n;
+ // but not too big ...
+ n = range/4;
+ if (sb_page > n)
+ sb_page = n;
+ }
+
+ if (0 == whole)
+ sb_pos = 0;
+ else
+ sb_pos = ((double) position * (range - sb_page) + whole - 1) / whole;
+
+ si.cbSize = sizeof (si);
+ si.fMask = SIF_PAGE | SIF_POS | SIF_RANGE | SIF_DISABLENOSCROLL;
+ si.nMin = 0;
+ si.nMax = range - 1;
+ si.nPage = sb_page;
+ si.nPos = sb_pos;
+
+ w = SCROLL_BAR_W32_WINDOW (bar);
+ SetScrollInfo (w, SB_CTL, &si, TRUE);
+ return;
+
+#else
Window w = SCROLL_BAR_W32_WINDOW (bar);
/* We use the whole scroll-bar height in the calculations below, to
avoid strange effects like scrolling backwards when just clicking
@@ -3538,6 +3597,7 @@
SetScrollInfo (w, SB_CTL, &si, TRUE);
UNBLOCK_INPUT;
+#endif
}
\f
@@ -3946,9 +4006,15 @@
si.cbSize = sizeof (si);
si.fMask = SIF_POS;
+#ifdef SCROLL_FIX
+ si.fMask = SIF_POS|SIF_RANGE|SIF_PAGE; //gr
+#endif
GetScrollInfo ((HWND) msg->msg.lParam, SB_CTL, &si);
y = si.nPos;
+#ifdef SCROLL_FIX
+ top_range = si.nMax + 1 - si.nPage; //gr
+#endif
bar->dragging = Qnil;
@@ -3983,6 +4049,7 @@
bar->dragging = Qt;
emacs_event->part = scroll_bar_handle;
+#ifndef SCROLL_FIX
/* "Silently" update current position. */
{
SCROLLINFO si;
@@ -3996,11 +4063,13 @@
SetScrollInfo (SCROLL_BAR_W32_WINDOW (bar), SB_CTL, &si, FALSE);
}
+#endif
break;
case SB_ENDSCROLL:
/* If this is the end of a drag sequence, then reset the scroll
handle size to normal and do a final redraw. Otherwise do
nothing. */
+#ifndef SCROLL_FIX
if (dragging)
{
SCROLLINFO si;
@@ -4013,6 +4082,7 @@
si.nPos = last_scroll_bar_drag_pos;
SetScrollInfo (SCROLL_BAR_W32_WINDOW (bar), SB_CTL, &si, TRUE);
}
+#endif
/* fall through */
default:
emacs_event->kind = NO_EVENT;
[-- Attachment #3: Type: text/plain, Size: 142 bytes --]
_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: vertical scrollbar error on MS Windows
2007-02-21 0:24 vertical scrollbar error on MS Windows grischka
@ 2007-02-21 8:07 ` Kim F. Storm
2007-02-21 14:02 ` grischka
2007-02-21 19:01 ` Stefan Monnier
1 sibling, 1 reply; 27+ messages in thread
From: Kim F. Storm @ 2007-02-21 8:07 UTC (permalink / raw)
To: grischka; +Cc: emacs-devel
"grischka" <grishka@gmx.de> writes:
> Hi there,
>
> Here is another fix for the scrollbars. From the approach
> it calculates the thumb length once on mouse down and
> then leaves bar parameters alone during dragging. Patch
> for w32term.c is in the attachement.
Thank you.
But I think this change is too radical at this time.
Counting lines like that does not always give a
correct answer - e.g. if there are overlays / images
in the buffer.
I think we need to rethink the whole scrolling functionality
after the release (also for the other ports).
--
Kim F. Storm <storm@cua.dk> http://www.cua.dk
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: vertical scrollbar error on MS Windows
2007-02-21 8:07 ` Kim F. Storm
@ 2007-02-21 14:02 ` grischka
0 siblings, 0 replies; 27+ messages in thread
From: grischka @ 2007-02-21 14:02 UTC (permalink / raw)
To: Kim F. Storm; +Cc: emacs-devel
Kim F. Storm writes:
> "grischka" writes:
>
> > Hi there,
> >
> > Here is another fix for the scrollbars. From the approach
> > it calculates the thumb length once on mouse down and
> > then leaves bar parameters alone during dragging. Patch
> > for w32term.c is in the attachement.
>
> Thank you.
>
> But I think this change is too radical at this time.
>
> Counting lines like that does not always give a
> correct answer - e.g. if there are overlays / images
> in the buffer.
>
Shure, but then it does not really matter whether the
slider is a bit longer or shorter in cases.
It is important on the UI level however, that there is a
reliable relation between slider position and text view,
i.e. that the visual feedback is consistent with the hand's
movement. Otherwise it feels like a loose handle bar on
a bicyle.
For example even with your patch there is still the problem
that sometimes the slider shrinks in the end as supposed,
while with other files it remains stuck and it's not possible
to see the last line. Or sometimes the slider shrinks itself
on mouse down already such that mouse points into void. Etc.
> I think we need to rethink the whole scrolling functionality
> after the release (also for the other ports).
No objection to that. Also I'd suggest to bind Ctrl-up/down
as standard for single line scrolling. This is really missing,
the more as long as sliders dont work so well ;)
Thanks,
-- grischka
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: vertical scrollbar error on MS Windows
2007-02-21 0:24 vertical scrollbar error on MS Windows grischka
2007-02-21 8:07 ` Kim F. Storm
@ 2007-02-21 19:01 ` Stefan Monnier
2007-02-21 23:36 ` grischka
1 sibling, 1 reply; 27+ messages in thread
From: Stefan Monnier @ 2007-02-21 19:01 UTC (permalink / raw)
To: grischka; +Cc: emacs-devel, storm
> Here is another fix for the scrollbars. From the approach
> it calculates the thumb length once on mouse down and
> then leaves bar parameters alone during dragging.
This approach suffers from the same problems.
I only know of two simple solutions:
1 - set the thumb size to 0 while dragging.
2 - make the thumb size "fixed" and arrange that when it hits bottom,
then the start of the thumb corresponds to position point-max.
The best solution is to change the toolkit such that it doesn't hide from
you the information that the mouse was moved past the bottom of the
scrollbar. This is what Xaw does. It's generally trivial to do,
technically, but it usually hits a human brick wall.
Stefan
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: vertical scrollbar error on MS Windows
2007-02-21 19:01 ` Stefan Monnier
@ 2007-02-21 23:36 ` grischka
2007-02-26 19:39 ` Stefan Monnier
0 siblings, 1 reply; 27+ messages in thread
From: grischka @ 2007-02-21 23:36 UTC (permalink / raw)
To: Stefan Monnier; +Cc: emacs-devel, Kim F. Storm
Stefan Monnier wrote:
> > Here is another fix for the scrollbars. From the approach
> > it calculates the thumb length once on mouse down and
> > then leaves bar parameters alone during dragging.
>
> This approach suffers from the same problems.
Not shure what you mean, works for me.
> I only know of two simple solutions:
> 1 - set the thumb size to 0 while dragging.
Too much activity on the peripheral visuals for my taste.
> 2 - make the thumb size "fixed" and arrange that when it hits bottom,
> then the start of the thumb corresponds to position point-max.
If you change the start position then you constantly need
to watch it whether it's still there where you left it off.
> The best solution is to change the toolkit such that it doesn't hide from
> you the information that the mouse was moved past the bottom of the
> scrollbar. This is what Xaw does. It's generally trivial to do,
> technically, but it usually hits a human brick wall.
>
>
> Stefan
You mean subclass the control? Shure, why not.
If only there wasn't one more general problem which Xaw
(if thats what I figure) does not have because it doesn't
have a slider, really. That is with a slider if you can
grab it at the lower end, it means you end up pulling
below the frame bottom and outside the monitor if the
slider gets shorter during dragging. So ...
-- grischka
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: vertical scrollbar error on MS Windows
2007-02-21 23:36 ` grischka
@ 2007-02-26 19:39 ` Stefan Monnier
2007-02-27 19:19 ` grischka
0 siblings, 1 reply; 27+ messages in thread
From: Stefan Monnier @ 2007-02-26 19:39 UTC (permalink / raw)
To: grischka; +Cc: emacs-devel, Kim F. Storm
>> > Here is another fix for the scrollbars. From the approach
>> > it calculates the thumb length once on mouse down and
>> > then leaves bar parameters alone during dragging.
>> This approach suffers from the same problems.
> Not shure what you mean, works for me.
The other code works as well. But there are problems in some circumstances.
BTW, if changing the thumb during drag-scroll causes jitter, an alternative
to "no resize" is to only allow resize in one direction (typically: only
shrink).
>> 2 - make the thumb size "fixed" and arrange that when it hits bottom,
>> then the start of the thumb corresponds to position point-max.
> If you change the start position then you constantly need
> to watch it whether it's still there where you left it off.
No, you don't understand what I mean. Just change the way thumb positions
are mapped to buffer positions. Say your scrollbar has size 130, and you
choose thumbsize of 30, then position 0-30 is "window-start == point-min",
and position 100-130 is "window-start == point-max".
> If only there wasn't one more general problem which Xaw
> (if thats what I figure) does not have because it doesn't
> have a slider, really. That is with a slider if you can
> grab it at the lower end, it means you end up pulling
> below the frame bottom and outside the monitor if the
> slider gets shorter during dragging. So ...
If I understand correctly what you mean, then the Xaw behavior is exactly
what we want. That leaves it to the application to decide whether the thumb
can "slide past the end" or not.
A slider that slides past the end is not a problem, really. You seem to
dislike it, could you explain why?
Stefan
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: vertical scrollbar error on MS Windows
2007-02-26 19:39 ` Stefan Monnier
@ 2007-02-27 19:19 ` grischka
2007-02-27 20:44 ` David Kastrup
2007-02-27 22:56 ` Stefan Monnier
0 siblings, 2 replies; 27+ messages in thread
From: grischka @ 2007-02-27 19:19 UTC (permalink / raw)
To: Stefan Monnier; +Cc: emacs-devel
> > > > Here is another fix for the scrollbars ...
> > > This approach suffers from the same problems.
> > Not shure what you mean, works for me.
> The other code works as well. But there are problems
> in some circumstances.
Problems with the other code? May be.
> If I understand correctly what you mean, then the Xaw behavior is exactly
> what we want. That leaves it to the application to decide whether the
> thumb can "slide past the end" or not.
Xaw certainly has its nostalgic charme with its own behaviour
and design. But, no, I don't think you want Xaw behaviour with
windows scrollbars. Not even with GTK scrollbars, really.
> A slider that slides past the end is not a problem, really.
> You seem to dislike it, could you explain why?
Actually I don't know what it means. An end where it can
go past is not the end, no?
Ah, okay, maybe you see it differently. Such that the slider
does not shrink on bottom, but actually slips into some
slit in the frame. Is it that?
-- grischka
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: vertical scrollbar error on MS Windows
2007-02-27 19:19 ` grischka
@ 2007-02-27 20:44 ` David Kastrup
2007-02-27 22:56 ` Stefan Monnier
1 sibling, 0 replies; 27+ messages in thread
From: David Kastrup @ 2007-02-27 20:44 UTC (permalink / raw)
To: grischka; +Cc: Stefan Monnier, emacs-devel
"grischka" <grishka@gmx.de> writes:
> Xaw certainly has its nostalgic charme with its own behaviour
> and design. But, no, I don't think you want Xaw behaviour with
> windows scrollbars. Not even with GTK scrollbars, really.
I'd want to. I have asked on the GTK+ developer list for it (without
any response), and I compile my Emacs --with-gtk
--without-toolkit-scrollbars (add or take a hyphen, can't remember)
since anything but Athena behavior (and the resulting Lucid toolbars
_have_ Athena behavior) is so much less functional as to be crippled.
Scroll back and forth without moving the mouse in between? Blank.
Scroll a variable amount with one click? Blank.
Scroll back and forth a variable amount? Double blank.
--
David Kastrup, Kriemhildstr. 15, 44793 Bochum
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: vertical scrollbar error on MS Windows
2007-02-27 19:19 ` grischka
2007-02-27 20:44 ` David Kastrup
@ 2007-02-27 22:56 ` Stefan Monnier
2007-02-28 19:45 ` grischka
1 sibling, 1 reply; 27+ messages in thread
From: Stefan Monnier @ 2007-02-27 22:56 UTC (permalink / raw)
To: grischka; +Cc: emacs-devel
>> If I understand correctly what you mean, then the Xaw behavior is exactly
>> what we want. That leaves it to the application to decide whether the
>> thumb can "slide past the end" or not.
> Xaw certainly has its nostalgic charme with its own behaviour
> and design. But, no, I don't think you want Xaw behaviour with
> windows scrollbars. Not even with GTK scrollbars, really.
I sure do.
>> A slider that slides past the end is not a problem, really.
>> You seem to dislike it, could you explain why?
> Actually I don't know what it means. An end where it can
> go past is not the end, no?
So you don't like it because .... you don't know what it means?
Why would you want to "know what it means"?
> Ah, okay, maybe you see it differently. Such that the slider
> does not shrink on bottom, but actually slips into some
> slit in the frame. Is it that?
A scrollbar is nothing more than a bunch of pixels that give you some rough
idea of where you are (and how much of the rest there is left to see), along
with some way to move with the use of a mouse.
I believe that confining oneself strictly to some analogy to the physical
world is just plain dumb. What's the benefit, concretely? No user has ever
complained that she doesn't understand how Emacs scrollbars work just
because they "slide off the end". When the thumb slides off the end, all
users know immediately that it "has slid off the end": they understand it
completely intuitively. Only GUI-nitpickers get annoyed that it doesn't
conform to some model.
Stefan
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: vertical scrollbar error on MS Windows
2007-02-27 22:56 ` Stefan Monnier
@ 2007-02-28 19:45 ` grischka
2007-02-28 21:45 ` Stefan Monnier
0 siblings, 1 reply; 27+ messages in thread
From: grischka @ 2007-02-28 19:45 UTC (permalink / raw)
To: Stefan Monnier; +Cc: emacs-devel
Stefan Monnier wrote:
> A scrollbar is nothing more than a bunch of pixels that give
> you some rough idea of where you are (and how much of the
> rest there is left to see), along with some way to move with
> the use of a mouse.
Sounds like a somehow applicable description of scrolling
in emacs, to be honest.
> I believe that confining oneself strictly to some analogy to the physical
> world is just plain dumb. What's the benefit, concretely? No user has ever
> complained that she doesn't understand how Emacs scrollbars work just
> because they "slide off the end". When the thumb slides off the end, all
> users know immediately that it "has slid off the end": they understand it
> completely intuitively. Only GUI-nitpickers get annoyed that it doesn't
> conform to some model.
I have my doubts whether everybody sees it as you see it.
As you say one is not confined to one analogy exclusively.
Also I would not trust a developer with such things anyway.
Other than that I'm still curious to see all that work with
the intuitive Xaw features added on the scrollbar from the
other OS.
-- grischka
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: vertical scrollbar error on MS Windows
2007-02-28 19:45 ` grischka
@ 2007-02-28 21:45 ` Stefan Monnier
0 siblings, 0 replies; 27+ messages in thread
From: Stefan Monnier @ 2007-02-28 21:45 UTC (permalink / raw)
To: grischka; +Cc: emacs-devel
> Other than that I'm still curious to see all that work with
> the intuitive Xaw features added on the scrollbar from the
> other OS.
Just to make things clear: I have not talked about any of the user-level
features of the Xaw scrollbar in this thread.
I only referred to Xaw w.r.t its programmer-level behavior: it is the only
toolkit I know which does not hide from the program the fact that the user
is attempting to move the thumb off the end, thus making it possible for the
program to let the thumb slide off the end (while also making it possible to
disallow it).
Stefan
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: vertical scrollbar error on MS Windows
@ 2007-02-28 20:01 grischka
2007-02-28 20:54 ` Lennart Borgman (gmail)
2007-03-01 9:11 ` David Kastrup
0 siblings, 2 replies; 27+ messages in thread
From: grischka @ 2007-02-28 20:01 UTC (permalink / raw)
To: David Kastrup; +Cc: emacs-devel
David Kastrup wrote:
> ... since anything but Athena behavior (and the resulting Lucid toolbars
> _have_ Athena behavior) is so much less functional as to be crippled.
> Scroll back and forth without moving the mouse in between? Blank.
> Scroll a variable amount with one click? Blank.
> Scroll back and forth a variable amount? Double blank.
Yes, not bad. Aside from personal preference, I'm all pro
to keep up variety in GUI culture.
-- grischka
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: vertical scrollbar error on MS Windows
2007-02-28 20:01 grischka
@ 2007-02-28 20:54 ` Lennart Borgman (gmail)
2007-03-01 9:11 ` David Kastrup
1 sibling, 0 replies; 27+ messages in thread
From: Lennart Borgman (gmail) @ 2007-02-28 20:54 UTC (permalink / raw)
To: grischka; +Cc: emacs-devel
grischka wrote:
> Yes, not bad. Aside from personal preference, I'm all pro
> to keep up variety in GUI culture.
As long as it is very easy to change (just a few seconds for the user
for simple things, a some minutes for more complicated things) it is
good. When it takes longer I doubt that variety in GUI is that good.
But I believe it is possible to have big variation with such boundaries.
But it takes work to bring things together.
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: vertical scrollbar error on MS Windows
2007-02-28 20:01 grischka
2007-02-28 20:54 ` Lennart Borgman (gmail)
@ 2007-03-01 9:11 ` David Kastrup
1 sibling, 0 replies; 27+ messages in thread
From: David Kastrup @ 2007-03-01 9:11 UTC (permalink / raw)
To: grischka; +Cc: emacs-devel
"grischka" <grishka@gmx.de> writes:
> David Kastrup wrote:
>
>> ... since anything but Athena behavior (and the resulting Lucid toolbars
>> _have_ Athena behavior) is so much less functional as to be crippled.
>
>> Scroll back and forth without moving the mouse in between? Blank.
>> Scroll a variable amount with one click? Blank.
>> Scroll back and forth a variable amount? Double blank.
>
> Yes, not bad. Aside from personal preference, I'm all pro
> to keep up variety in GUI culture.
Not being able to do things is not variety. Variety is being able to
do them in different ways.
--
David Kastrup, Kriemhildstr. 15, 44793 Bochum
^ permalink raw reply [flat|nested] 27+ messages in thread
[parent not found: <b5accf970702131432t76036b4erb72cbe4d86e11077@mail.gmail.com>]
end of thread, other threads:[~2007-03-01 9:11 UTC | newest]
Thread overview: 27+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-02-21 0:24 vertical scrollbar error on MS Windows grischka
2007-02-21 8:07 ` Kim F. Storm
2007-02-21 14:02 ` grischka
2007-02-21 19:01 ` Stefan Monnier
2007-02-21 23:36 ` grischka
2007-02-26 19:39 ` Stefan Monnier
2007-02-27 19:19 ` grischka
2007-02-27 20:44 ` David Kastrup
2007-02-27 22:56 ` Stefan Monnier
2007-02-28 19:45 ` grischka
2007-02-28 21:45 ` Stefan Monnier
-- strict thread matches above, loose matches on Subject: below --
2007-02-28 20:01 grischka
2007-02-28 20:54 ` Lennart Borgman (gmail)
2007-03-01 9:11 ` David Kastrup
[not found] <b5accf970702131432t76036b4erb72cbe4d86e11077@mail.gmail.com>
[not found] ` <er4kem$ce7$1@sea.gmane.org>
2007-02-19 14:58 ` Kim F. Storm
2007-02-19 16:13 ` Juanma Barranquero
2007-02-19 22:39 ` Kim F. Storm
2007-02-19 23:01 ` Juanma Barranquero
2007-02-19 23:16 ` Nick Roberts
2007-02-19 17:03 ` Lennart Borgman (gmail)
2007-02-19 22:54 ` Peter Tury
2007-02-22 15:07 ` Stephan Hennig
2007-02-22 15:56 ` Jason Rumney
2007-02-22 16:52 ` Kim F. Storm
2007-02-22 17:00 ` Stephan Hennig
2007-02-22 17:28 ` Kim F. Storm
2007-02-22 23:35 ` Stefan Monnier
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).