[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master a2e80d2a41: Make interpolated scrolling work above non-selected w
From: |
Po Lu |
Subject: |
master a2e80d2a41: Make interpolated scrolling work above non-selected windows |
Date: |
Fri, 25 Feb 2022 01:16:50 -0500 (EST) |
branch: master
commit a2e80d2a419a2092d6a196c42280295c34388ae4
Author: Po Lu <luangruo@yahoo.com>
Commit: Po Lu <luangruo@yahoo.com>
Make interpolated scrolling work above non-selected windows
* lisp/pixel-scroll.el (pixel-scroll-precision-interpolate): New
parameter `old-window'.
(pixel-scroll-precision): Pass originally selected window to the
interpolation function.
---
lisp/pixel-scroll.el | 16 ++++++++++------
1 file changed, 10 insertions(+), 6 deletions(-)
diff --git a/lisp/pixel-scroll.el b/lisp/pixel-scroll.el
index 463e106c7a..042c8a419e 100644
--- a/lisp/pixel-scroll.el
+++ b/lisp/pixel-scroll.el
@@ -592,10 +592,11 @@ the height of the current window."
(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)
@@ -613,7 +614,9 @@ animation."
(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))
@@ -664,7 +667,8 @@ 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)))
+ (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)
@@ -685,7 +689,7 @@ wheel."
(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)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- master a2e80d2a41: Make interpolated scrolling work above non-selected windows,
Po Lu <=