emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 736bf3aaa7: Store sign separately when accumulating precision scr


From: Po Lu
Subject: master 736bf3aaa7: Store sign separately when accumulating precision scroll momentum
Date: Sun, 26 Dec 2021 20:03:11 -0500 (EST)

branch: master
commit 736bf3aaa72e8fdd1c37bb9c8d003b17ffb612f9
Author: Po Lu <luangruo@yahoo.com>
Commit: Po Lu <luangruo@yahoo.com>

    Store sign separately when accumulating precision scroll momentum
    
    * lisp/pixel-scroll.el (pixel-scroll-kinetic-state): Return
    vector in new format.
    (pixel-scroll-accumulate-velocity): Use new sign field.
---
 lisp/pixel-scroll.el | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/lisp/pixel-scroll.el b/lisp/pixel-scroll.el
index 3abd4b2a72..e3a1729521 100644
--- a/lisp/pixel-scroll.el
+++ b/lisp/pixel-scroll.el
@@ -680,10 +680,10 @@ wheel."
 
 (defun pixel-scroll-kinetic-state ()
   "Return the kinetic scroll state of the current window.
-It is a vector of the form [ VELOCITY TIME ]."
+It is a vector of the form [ VELOCITY TIME SIGN ]."
   (or (window-parameter nil 'kinetic-state)
       (set-window-parameter nil 'kinetic-state
-                            (vector (make-ring 10) nil))))
+                            (vector (make-ring 10) nil nil))))
 
 (defun pixel-scroll-accumulate-velocity (delta)
   "Accumulate DELTA into the current window's kinetic scroll state."
@@ -693,9 +693,9 @@ It is a vector of the form [ VELOCITY TIME ]."
     (when (or (and time (> (- (float-time) time) 0.5))
               (and (not (ring-empty-p ring))
                    (not (eq (< delta 0)
-                            (< (cdr (ring-ref ring 0))
-                               0)))))
+                            (aref state 2)))))
       (aset state 0 (make-ring 10)))
+    (aset state 2 (< delta 0))
     (ring-insert (aref state 0)
                  (cons (aset state 1 (float-time))
                        delta))))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]