Function: pixel-scroll-precision
pixel-scroll-precision is an interactive and byte-compiled function
defined in pixel-scroll.el.gz.
Signature
(pixel-scroll-precision EVENT)
Documentation
Scroll the display vertically by pixels according to EVENT.
Move the display up or down by the pixel deltas in EVENT to scroll the display according to the user's turning the mouse wheel.
Key Bindings
Source Code
;; Defined in /usr/src/emacs/lisp/pixel-scroll.el.gz
;; FIXME: This doesn't _always_ work when there's an image above the
;; current line that is taller than the window, and scrolling can
;; sometimes be jumpy in that case.
(defun pixel-scroll-precision (event)
"Scroll the display vertically by pixels according to EVENT.
Move the display up or down by the pixel deltas in EVENT to
scroll the display according to the user's turning the mouse
wheel."
(interactive "e")
(let ((window (mwheel-event-window event))
(current-window (selected-window)))
(when (framep window)
(setq window (frame-selected-window window)))
(if (and (nth 4 event))
(let ((delta (round (cdr (nth 4 event)))))
(unless (zerop delta)
(if (> (abs delta) (window-text-height window t))
(mwheel-scroll event nil)
(with-selected-window window
(if (or (and pixel-scroll-precision-interpolate-mice
(eq (device-class last-event-frame
last-event-device)
'mouse))
(and pixel-scroll-precision-large-scroll-height
(> (abs delta)
pixel-scroll-precision-large-scroll-height)
(let* ((kin-state (pixel-scroll-kinetic-state))
(ring (aref kin-state 0))
(time (aref kin-state 1)))
(or (null time)
(> (- (float-time) time) 1.0)
(and (consp ring)
(ring-empty-p ring))))))
(progn
(let ((kin-state (pixel-scroll-kinetic-state)))
(aset kin-state 0 (make-ring 30))
(aset kin-state 1 nil))
(pixel-scroll-precision-interpolate delta current-window))
(condition-case nil
(progn
(if (< delta 0)
(pixel-scroll-precision-scroll-down (- delta))
(pixel-scroll-precision-scroll-up delta))
(pixel-scroll-accumulate-velocity delta))
;; Do not ding at buffer limits. Show a message instead.
(beginning-of-buffer
(message (error-message-string '(beginning-of-buffer))))
(end-of-buffer
(message (error-message-string '(end-of-buffer))))))))))
(mwheel-scroll event nil))))