emacs-devel
[Top][All Lists]
Advanced

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

Re: master e37eb7f: Add support for pixel wheel deltas on NS


From: Po Lu
Subject: Re: master e37eb7f: Add support for pixel wheel deltas on NS
Date: Sun, 28 Nov 2021 10:54:26 +0800
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.60 (gnu/linux)

Po Lu <luangruo@yahoo.com> writes:

> Eli Zaretskii <eliz@gnu.org> writes:
>
>> It's simple: we could provide a variable to scale the pixels
>> calculated by the *term code.
>
> Alternatively, how about putting such an option in the code that makes
> use of such events, something like `pixel-scroll-precision-scale'.

diff --git a/lisp/pixel-scroll.el b/lisp/pixel-scroll.el
index 888320cf1a..a14c211207 100644
--- a/lisp/pixel-scroll.el
+++ b/lisp/pixel-scroll.el
@@ -100,6 +100,11 @@ pixel-scroll-precision-mode-map
     map)
   "The key map used by `pixel-scroll-precision-mode'.")
 
+(defcustom pixel-scroll-precision-scale 1.0
+  "Value by which to multiply pixel deltas used in 
`pixel-scroll-precision-mode'."
+  :type 'float
+  :group 'mouse)
+
 (defun pixel-scroll-in-rush-p ()
   "Return non-nil if next scroll should be non-smooth.
 When scrolling request is delivered soon after the previous one,
@@ -476,7 +481,8 @@ pixel-scroll-precision
   (let ((window (mwheel-event-window event)))
     (if (and (nth 4 event)
              (zerop (window-hscroll window)))
-        (let ((delta (round (cdr (nth 4 event)))))
+        (let ((delta (round (* pixel-scroll-precision-scale
+                               (cdr (nth 4 event))))))
           (if (> (abs delta) (window-text-height window t))
               (mwheel-scroll event nil)
             (with-selected-window window
-- 
2.33.1

WDYT about this?  Thanks.


reply via email to

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