From: Po Lu Date: Tue, 30 Nov 2021 05:41:16 +0000 (+0800) Subject: Add `ns-scroll-event-delta-factor' X-Git-Tag: emacs-29.0.90~3639^2 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=f3bb2b80b4a347974de3e9da1feb18181ed20cc0;p=emacs.git Add `ns-scroll-event-delta-factor' * src/nsterm.m (- mouseDown): Take delta factor into account. (Vns_scroll_event_delta_factor): New variable. * lisp/cus-start.el: Add option. --- diff --git a/lisp/cus-start.el b/lisp/cus-start.el index 33b861b3408..53cad99692c 100644 --- a/lisp/cus-start.el +++ b/lisp/cus-start.el @@ -572,6 +572,7 @@ Leaving \"Default\" unchecked is equivalent with specifying a default of (ns-use-native-fullscreen ns boolean "24.4") (ns-use-fullscreen-animation ns boolean "25.1") (ns-use-srgb-colorspace ns boolean "24.4") + (ns-scroll-event-delta-factor ns float "29.1") ;; process.c (delete-exited-processes processes-basics boolean) ;; syntax.c diff --git a/src/nsterm.m b/src/nsterm.m index 78bbae69a27..f5c2d4d9fbc 100644 --- a/src/nsterm.m +++ b/src/nsterm.m @@ -6665,6 +6665,12 @@ not_in_argv (NSString *arg) if (lines == 0 && x_coalesce_scroll_events) return; + if (NUMBERP (Vns_scroll_event_delta_factor)) + { + x *= XFLOATINT (Vns_scroll_event_delta_factor); + y *= XFLOATINT (Vns_scroll_event_delta_factor); + } + emacs_event->kind = horizontal ? HORIZ_WHEEL_EVENT : WHEEL_EVENT; emacs_event->arg = list3 (make_fixnum (lines), make_float (x), @@ -10037,6 +10043,12 @@ This variable is ignored on macOS < 10.7 and GNUstep. Default is t. */); DEFSYM (Qx_underline_at_descent_line, "x-underline-at-descent-line"); + DEFVAR_LISP ("ns-scroll-event-delta-factor", Vns_scroll_event_delta_factor, + doc: /* A delta to apply to pixel deltas reported in scroll events. + This is only effective for pixel deltas generated from touch pads or + mice with smooth scrolling capability. */); + Vns_scroll_event_delta_factor = make_float (1.0); + /* Tell Emacs about this window system. */ Fprovide (Qns, Qnil);