]> git.eshelyaron.com Git - emacs.git/commitdiff
Make precision scrolling on top of the tool bar work
authorPo Lu <luangruo@yahoo.com>
Tue, 1 Mar 2022 07:38:37 +0000 (15:38 +0800)
committerPo Lu <luangruo@yahoo.com>
Tue, 1 Mar 2022 07:38:37 +0000 (15:38 +0800)
* lisp/pixel-scroll.el (pixel-scroll-precision-mode-map): Bind
some more events.

(pixel-scroll-precision):
(pixel-scroll-start-momentum): If window is a frame, use its
selected window.

lisp/pixel-scroll.el

index 042c8a419e8075c17e3223b03b51580def61fa03..bfe48ef1f9048fbcc9b06b841ef23b123aca050a 100644 (file)
@@ -129,6 +129,9 @@ is always with pixel resolution.")
     (define-key map [vertical-scroll-bar wheel-down] 'pixel-scroll-precision)
     (define-key map [vertical-scroll-bar wheel-up] 'pixel-scroll-precision)
     (define-key map [vertical-scroll-bar touch-end] 'pixel-scroll-start-momentum)
+    (define-key map [tool-bar wheel-down] 'pixel-scroll-precision)
+    (define-key map [tool-bar wheel-up] 'pixel-scroll-precision)
+    (define-key map [tool-bar touch-end] 'pixel-scroll-start-momentum)
     (define-key map [left-margin wheel-down] 'pixel-scroll-precision)
     (define-key map [left-margin wheel-up] 'pixel-scroll-precision)
     (define-key map [left-margin touch-end] 'pixel-scroll-start-momentum)
@@ -669,6 +672,8 @@ wheel."
   (interactive "e")
   (let ((window (mwheel-event-window event))
         (current-window (selected-window)))
+    (when (framep window)
+      (setq window (frame-selected-window window)))
     (if (and (nth 4 event))
         (let ((delta (round (cdr (nth 4 event)))))
           (unless (zerop delta)
@@ -742,6 +747,8 @@ It is a vector of the form [ VELOCITY TIME SIGN ]."
   (when pixel-scroll-precision-use-momentum
     (let ((window (mwheel-event-window event))
           (state nil))
+      (when (framep window)
+        (setq window (frame-selected-window window)))
       (setq state (pixel-scroll-kinetic-state window))
       (when (and (aref state 1)
                  (listp (aref state 0)))