Mercurial > emacs
diff src/w32term.c @ 83556:07774e5c3ff5
Merged from emacs@sv.gnu.org
Patches applied:
* emacs@sv.gnu.org/emacs--devo--0--patch-619
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-620
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-621
Merge from gnus--rel--5.10
* emacs@sv.gnu.org/emacs--devo--0--patch-622
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-623
Remove RCS keywords
* emacs@sv.gnu.org/emacs--devo--0--patch-624
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-625
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-626
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-627
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-628
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-629
Merge from gnus--rel--5.10
* emacs@sv.gnu.org/emacs--devo--0--patch-630
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-631
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-632
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-633
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-634
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-635
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-636
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-637
Remove RCS keywords
* emacs@sv.gnu.org/emacs--devo--0--patch-638
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-639
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-640
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-641
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-642
Merge from gnus--rel--5.10
* emacs@sv.gnu.org/emacs--devo--0--patch-643
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-644
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-645
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-646
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-647
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-648
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-649
Update from CVS
* emacs@sv.gnu.org/gnus--rel--5.10--patch-197
Merge from emacs--devo--0
* emacs@sv.gnu.org/gnus--rel--5.10--patch-198
Update from CVS
* emacs@sv.gnu.org/gnus--rel--5.10--patch-199
Update from CVS
* emacs@sv.gnu.org/gnus--rel--5.10--patch-200
Merge from emacs--devo--0
* emacs@sv.gnu.org/gnus--rel--5.10--patch-201
Update from CVS: lisp/nnweb.el (nnweb-google-parse-1): Update parser.
* emacs@sv.gnu.org/gnus--rel--5.10--patch-202
Update from CVS
git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-596
author | Karoly Lorentey <karoly@lorentey.hu> |
---|---|
date | Sat, 24 Feb 2007 19:26:54 +0000 |
parents | b8d9a391daf3 e892213b9815 |
children | 86395c339701 |
line wrap: on
line diff
--- a/src/w32term.c Sat Feb 24 19:12:27 2007 +0000 +++ b/src/w32term.c Sat Feb 24 19:26:54 2007 +0000 @@ -1,6 +1,7 @@ /* Implementation of GUI terminal on the Microsoft W32 API. - Copyright (C) 1989, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, - 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc. + Copyright (C) 1989, 1993, 1994, 1995, 1996, 1997, 1998, + 1999, 2000, 2001, 2002, 2003, 2004, 2005, + 2006, 2007 Free Software Foundation, Inc. This file is part of GNU Emacs. @@ -3473,25 +3474,51 @@ int portion, position, whole; { Window w = SCROLL_BAR_W32_WINDOW (bar); - double range = VERTICAL_SCROLL_BAR_TOP_RANGE (f, XINT (bar->height)); + /* We use the whole scroll-bar height in the calculations below, to + avoid strange effects like scrolling backwards when just clicking + on the handle (without moving it). */ + double range = VERTICAL_SCROLL_BAR_TOP_RANGE (f, XINT (bar->height)) + + VERTICAL_SCROLL_BAR_MIN_HANDLE; int sb_page, sb_pos; BOOL draggingp = !NILP (bar->dragging) ? TRUE : FALSE; SCROLLINFO si; + /* We used to change the nPage setting while dragging the handle, + but that had very strange effects (such as scrolling backwards + while dragging downwards). + + Now, we don't change the nPage setting while dragging unless we + get near to the end of the buffer, in which case we often have to + resize the handle to "go all the way". */ + + if (draggingp) + { + int near_bottom_p; + BLOCK_INPUT; + si.cbSize = sizeof (si); + si.fMask = SIF_POS | SIF_PAGE; + GetScrollInfo(w, SB_CTL, &si); + near_bottom_p = si.nPos + si.nPage >= range; + UNBLOCK_INPUT; + if (!near_bottom_p) + return; + } + if (whole) { /* Position scroll bar at rock bottom if the bottom of the buffer is visible. This avoids shinking the thumb away to nothing if it is held at the bottom of the buffer. */ - if (position + portion >= whole) - { - sb_page = range * (whole - position) / whole - + VERTICAL_SCROLL_BAR_MIN_HANDLE; - sb_pos = range; - } - - sb_page = portion * range / whole + VERTICAL_SCROLL_BAR_MIN_HANDLE; - sb_pos = position * range / whole; + if (position + portion >= whole && !draggingp) + { + sb_page = range * (whole - position) / whole; + sb_pos = range; + } + else + { + sb_pos = position * range / whole; + sb_page = (min (portion, (whole - position)) * range) / whole; + } } else { @@ -3499,19 +3526,16 @@ sb_pos = 0; } + sb_page = max (sb_page, VERTICAL_SCROLL_BAR_MIN_HANDLE); + BLOCK_INPUT; si.cbSize = sizeof (si); - /* Only update page size if currently dragging, to reduce - flicker effects. */ - if (draggingp) - si.fMask = SIF_PAGE; - else - si.fMask = SIF_PAGE | SIF_POS; + si.fMask = SIF_PAGE | SIF_POS; si.nPage = sb_page; si.nPos = sb_pos; - SetScrollInfo (w, SB_CTL, &si, !draggingp); + SetScrollInfo (w, SB_CTL, &si, TRUE); UNBLOCK_INPUT; }