comparison 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
comparison
equal deleted inserted replaced
83555:053bf1a38bfa 83556:07774e5c3ff5
1 /* Implementation of GUI terminal on the Microsoft W32 API. 1 /* Implementation of GUI terminal on the Microsoft W32 API.
2 Copyright (C) 1989, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2 Copyright (C) 1989, 1993, 1994, 1995, 1996, 1997, 1998,
3 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc. 3 1999, 2000, 2001, 2002, 2003, 2004, 2005,
4 2006, 2007 Free Software Foundation, Inc.
4 5
5 This file is part of GNU Emacs. 6 This file is part of GNU Emacs.
6 7
7 GNU Emacs is free software; you can redistribute it and/or modify 8 GNU Emacs is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by 9 it under the terms of the GNU General Public License as published by
3471 w32_set_scroll_bar_thumb (bar, portion, position, whole) 3472 w32_set_scroll_bar_thumb (bar, portion, position, whole)
3472 struct scroll_bar *bar; 3473 struct scroll_bar *bar;
3473 int portion, position, whole; 3474 int portion, position, whole;
3474 { 3475 {
3475 Window w = SCROLL_BAR_W32_WINDOW (bar); 3476 Window w = SCROLL_BAR_W32_WINDOW (bar);
3476 double range = VERTICAL_SCROLL_BAR_TOP_RANGE (f, XINT (bar->height)); 3477 /* We use the whole scroll-bar height in the calculations below, to
3478 avoid strange effects like scrolling backwards when just clicking
3479 on the handle (without moving it). */
3480 double range = VERTICAL_SCROLL_BAR_TOP_RANGE (f, XINT (bar->height))
3481 + VERTICAL_SCROLL_BAR_MIN_HANDLE;
3477 int sb_page, sb_pos; 3482 int sb_page, sb_pos;
3478 BOOL draggingp = !NILP (bar->dragging) ? TRUE : FALSE; 3483 BOOL draggingp = !NILP (bar->dragging) ? TRUE : FALSE;
3479 SCROLLINFO si; 3484 SCROLLINFO si;
3480 3485
3486 /* We used to change the nPage setting while dragging the handle,
3487 but that had very strange effects (such as scrolling backwards
3488 while dragging downwards).
3489
3490 Now, we don't change the nPage setting while dragging unless we
3491 get near to the end of the buffer, in which case we often have to
3492 resize the handle to "go all the way". */
3493
3494 if (draggingp)
3495 {
3496 int near_bottom_p;
3497 BLOCK_INPUT;
3498 si.cbSize = sizeof (si);
3499 si.fMask = SIF_POS | SIF_PAGE;
3500 GetScrollInfo(w, SB_CTL, &si);
3501 near_bottom_p = si.nPos + si.nPage >= range;
3502 UNBLOCK_INPUT;
3503 if (!near_bottom_p)
3504 return;
3505 }
3506
3481 if (whole) 3507 if (whole)
3482 { 3508 {
3483 /* Position scroll bar at rock bottom if the bottom of the 3509 /* Position scroll bar at rock bottom if the bottom of the
3484 buffer is visible. This avoids shinking the thumb away 3510 buffer is visible. This avoids shinking the thumb away
3485 to nothing if it is held at the bottom of the buffer. */ 3511 to nothing if it is held at the bottom of the buffer. */
3486 if (position + portion >= whole) 3512 if (position + portion >= whole && !draggingp)
3487 { 3513 {
3488 sb_page = range * (whole - position) / whole 3514 sb_page = range * (whole - position) / whole;
3489 + VERTICAL_SCROLL_BAR_MIN_HANDLE; 3515 sb_pos = range;
3490 sb_pos = range; 3516 }
3491 } 3517 else
3492 3518 {
3493 sb_page = portion * range / whole + VERTICAL_SCROLL_BAR_MIN_HANDLE; 3519 sb_pos = position * range / whole;
3494 sb_pos = position * range / whole; 3520 sb_page = (min (portion, (whole - position)) * range) / whole;
3521 }
3495 } 3522 }
3496 else 3523 else
3497 { 3524 {
3498 sb_page = range; 3525 sb_page = range;
3499 sb_pos = 0; 3526 sb_pos = 0;
3500 } 3527 }
3501 3528
3529 sb_page = max (sb_page, VERTICAL_SCROLL_BAR_MIN_HANDLE);
3530
3502 BLOCK_INPUT; 3531 BLOCK_INPUT;
3503 3532
3504 si.cbSize = sizeof (si); 3533 si.cbSize = sizeof (si);
3505 /* Only update page size if currently dragging, to reduce 3534 si.fMask = SIF_PAGE | SIF_POS;
3506 flicker effects. */
3507 if (draggingp)
3508 si.fMask = SIF_PAGE;
3509 else
3510 si.fMask = SIF_PAGE | SIF_POS;
3511 si.nPage = sb_page; 3535 si.nPage = sb_page;
3512 si.nPos = sb_pos; 3536 si.nPos = sb_pos;
3513 3537
3514 SetScrollInfo (w, SB_CTL, &si, !draggingp); 3538 SetScrollInfo (w, SB_CTL, &si, TRUE);
3515 3539
3516 UNBLOCK_INPUT; 3540 UNBLOCK_INPUT;
3517 } 3541 }
3518 3542
3519 3543