aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/term
diff options
context:
space:
mode:
authorAlan Third2017-09-08 19:26:47 +0100
committerAlan Third2017-09-19 20:08:51 +0100
commita5fec62b519ae8c0a6528366ac8b71cd0c7ac52e (patch)
treef9b300285aacb4df9995ea5e4559663f2afee735 /lisp/term
parent7b3d1c6beb54ef6c423a93df88aebfd6fecbe2c2 (diff)
downloademacs-a5fec62b519ae8c0a6528366ac8b71cd0c7ac52e.tar.gz
emacs-a5fec62b519ae8c0a6528366ac8b71cd0c7ac52e.zip
Provide native touchpad scrolling on macOS
* etc/NEWS: Describe changes. * lisp/term/ns-win.el (mouse-wheel-scroll-amount, mouse-wheel-progressive-speed): Set to smarter values for macOS touchpads. * src/nsterm.m (emacsView::mouseDown): Use precise scrolling deltas to calculate scrolling for touchpads and mouse wheels. (syms_of_nsterm): Add variables 'ns-use-system-mwheel-acceleration', 'ns-touchpad-scroll-line-height' and 'ns-touchpad-use-momentum'. * src/keyboard.c (make_lispy_event): Pass on .arg when relevant. * src/termhooks.h (event_kind): Update comments re. WHEEL_EVENT. * lisp/mwheel.el (mwheel-scroll): Use line count. * lisp/subr.el (event-line-count): New function.
Diffstat (limited to 'lisp/term')
-rw-r--r--lisp/term/ns-win.el19
1 files changed, 19 insertions, 0 deletions
diff --git a/lisp/term/ns-win.el b/lisp/term/ns-win.el
index 68b659bf751..bc211ea9589 100644
--- a/lisp/term/ns-win.el
+++ b/lisp/term/ns-win.el
@@ -736,6 +736,25 @@ See the documentation of `create-fontset-from-fontset-spec' for the format.")
736(global-unset-key [horizontal-scroll-bar drag-mouse-1]) 736(global-unset-key [horizontal-scroll-bar drag-mouse-1])
737 737
738 738
739;;;; macOS-like defaults for trackpad and mouse wheel scrolling on
740;;;; macOS 10.7+.
741
742;; FIXME: This doesn't look right. Is there a better way to do this
743;; that keeps customize happy?
744(let ((appkit-version (progn
745 (string-match "^appkit-\\([^\s-]*\\)" ns-version-string)
746 (string-to-number (match-string 1 ns-version-string)))))
747 ;; Appkit 1138 ~= macOS 10.7.
748 (when (and (featurep 'cocoa) (>= appkit-version 1138))
749 (setq mouse-wheel-scroll-amount '(1 ((shift) . 5) ((control))))
750 (put 'mouse-wheel-scroll-amount 'customized-value
751 (list (custom-quote (symbol-value 'mouse-wheel-scroll-amount))))
752
753 (setq mouse-wheel-progressive-speed nil)
754 (put 'mouse-wheel-progressive-speed 'customized-value
755 (list (custom-quote (symbol-value 'mouse-wheel-progressive-speed))))))
756
757
739;;;; Color support. 758;;;; Color support.
740 759
741;; Functions for color panel + drag 760;; Functions for color panel + drag