(when (< delta 0)
(set-window-vscroll nil (- delta) t)))))
-(defun pixel-scroll-precision-interpolate (delta)
+(defun pixel-scroll-precision-interpolate (delta &optional old-window)
"Interpolate a scroll of DELTA pixels.
-This results in the window being scrolled by DELTA pixels with an
-animation."
+OLD-WINDOW is the window which will be selected when redisplay
+takes place, or nil for the current window. This results in the
+window being scrolled by DELTA pixels with an animation."
(let ((percentage 0)
(total-time pixel-scroll-precision-interpolation-total-time)
(factor pixel-scroll-precision-interpolation-factor)
(while-no-input
(unwind-protect
(while (< percentage 1)
- (redisplay t)
+ (with-selected-window (or old-window
+ (selected-window))
+ (redisplay t))
(sleep-for between-scroll)
(setq time-elapsed (+ time-elapsed
(- (float-time) last-time))
scroll the display according to the user's turning the mouse
wheel."
(interactive "e")
- (let ((window (mwheel-event-window event)))
+ (let ((window (mwheel-event-window event))
+ (current-window (selected-window)))
(if (and (nth 4 event))
(let ((delta (round (cdr (nth 4 event)))))
(unless (zerop delta)
(let ((kin-state (pixel-scroll-kinetic-state)))
(aset kin-state 0 (make-ring 30))
(aset kin-state 1 nil))
- (pixel-scroll-precision-interpolate delta))
+ (pixel-scroll-precision-interpolate delta current-window))
(condition-case nil
(progn
(if (< delta 0)