Function: scroll-bar-drag-1
scroll-bar-drag-1 is a byte-compiled function defined in
scroll-bar.el.gz.
Signature
(scroll-bar-drag-1 EVENT)
Source Code
;; Defined in /usr/src/emacs/lisp/scroll-bar.el.gz
;; Scroll the window to the proper position for EVENT.
(defun scroll-bar-drag-1 (event)
(let* ((start-position (event-start event))
(window (nth 0 start-position))
(portion-whole (nth 2 start-position)))
;; With 'scroll-bar-adjust-thumb-portion' nil and 'portion-whole'
;; indicating that the buffer is fully visible, do not scroll the
;; window since that might make it impossible to scroll it back
;; with GTK's thumb (Bug#32002).
(when (or scroll-bar-adjust-thumb-portion
(not (numberp (car portion-whole)))
(not (numberp (cdr portion-whole)))
(/= (car portion-whole) (cdr portion-whole)))
(save-excursion
(with-current-buffer (window-buffer window)
;; Calculate position relative to the accessible part of the buffer.
(goto-char (+ (point-min)
(scroll-bar-scale portion-whole
(- (point-max) (point-min)))))
(vertical-motion 0 window)
(set-window-start window (point)))))))