aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPo Lu2021-12-27 09:02:20 +0800
committerPo Lu2021-12-27 09:02:20 +0800
commit736bf3aaa72e8fdd1c37bb9c8d003b17ffb612f9 (patch)
tree6ba25eceedef3cbe0e34eafd9334d138a7c247dc
parentd4353da0ad969a492c75bae130aed33ab204ed32 (diff)
downloademacs-736bf3aaa72e8fdd1c37bb9c8d003b17ffb612f9.tar.gz
emacs-736bf3aaa72e8fdd1c37bb9c8d003b17ffb612f9.zip
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.
-rw-r--r--lisp/pixel-scroll.el8
1 files changed, 4 insertions, 4 deletions
diff --git a/lisp/pixel-scroll.el b/lisp/pixel-scroll.el
index 3abd4b2a723..e3a17295217 100644
--- a/lisp/pixel-scroll.el
+++ b/lisp/pixel-scroll.el
@@ -680,10 +680,10 @@ wheel."
680 680
681(defun pixel-scroll-kinetic-state () 681(defun pixel-scroll-kinetic-state ()
682 "Return the kinetic scroll state of the current window. 682 "Return the kinetic scroll state of the current window.
683It is a vector of the form [ VELOCITY TIME ]." 683It is a vector of the form [ VELOCITY TIME SIGN ]."
684 (or (window-parameter nil 'kinetic-state) 684 (or (window-parameter nil 'kinetic-state)
685 (set-window-parameter nil 'kinetic-state 685 (set-window-parameter nil 'kinetic-state
686 (vector (make-ring 10) nil)))) 686 (vector (make-ring 10) nil nil))))
687 687
688(defun pixel-scroll-accumulate-velocity (delta) 688(defun pixel-scroll-accumulate-velocity (delta)
689 "Accumulate DELTA into the current window's kinetic scroll state." 689 "Accumulate DELTA into the current window's kinetic scroll state."
@@ -693,9 +693,9 @@ It is a vector of the form [ VELOCITY TIME ]."
693 (when (or (and time (> (- (float-time) time) 0.5)) 693 (when (or (and time (> (- (float-time) time) 0.5))
694 (and (not (ring-empty-p ring)) 694 (and (not (ring-empty-p ring))
695 (not (eq (< delta 0) 695 (not (eq (< delta 0)
696 (< (cdr (ring-ref ring 0)) 696 (aref state 2)))))
697 0)))))
698 (aset state 0 (make-ring 10))) 697 (aset state 0 (make-ring 10)))
698 (aset state 2 (< delta 0))
699 (ring-insert (aref state 0) 699 (ring-insert (aref state 0)
700 (cons (aset state 1 (float-time)) 700 (cons (aset state 1 (float-time))
701 delta)))) 701 delta))))