emacs-diffs
[Top][All Lists]
Advanced

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

master 618070d: Allow customizing the pixel delta of wheel events on X


From: Po Lu
Subject: master 618070d: Allow customizing the pixel delta of wheel events on X
Date: Mon, 29 Nov 2021 02:38:18 -0500 (EST)

branch: master
commit 618070d4b414c20f19a1f873ffb1d7015743599e
Author: Po Lu <luangruo@yahoo.com>
Commit: Po Lu <luangruo@yahoo.com>

    Allow customizing the pixel delta of wheel events on X
    
    * lisp/cus-start.el: Add `x-scroll-event-delta-factor'.
    * src/xterm.c (handle_one_xevent): Apply scroll event
    delta factor to wheel events with pixel data.
    (Vx_scroll_event_delta_factor): New user option.
---
 lisp/cus-start.el | 1 +
 src/xterm.c       | 9 +++++++++
 2 files changed, 10 insertions(+)

diff --git a/lisp/cus-start.el b/lisp/cus-start.el
index 68019c0..e895ebd 100644
--- a/lisp/cus-start.el
+++ b/lisp/cus-start.el
@@ -826,6 +826,7 @@ since it could result in memory overflow and make Emacs 
crash."
             (x-underline-at-descent-line display boolean "22.1")
             (x-stretch-cursor display boolean "21.1")
             (scroll-bar-adjust-thumb-portion windows boolean "24.4")
+             (x-scroll-event-delta-factor mouse float "29.1")
             ;; xselect.c
             (x-select-enable-clipboard-manager killing boolean "24.1")
             ;; xsettings.c
diff --git a/src/xterm.c b/src/xterm.c
index 253e0eb..a6d9c8c 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -10045,6 +10045,9 @@ handle_one_xevent (struct x_display_info *dpyinfo,
 
                        scroll_unit = pow (FRAME_PIXEL_HEIGHT (f), 2.0 / 3.0);
 
+                       if (FLOATP (Vx_scroll_event_delta_factor))
+                         scroll_unit *= XFLOAT_DATA 
(Vx_scroll_event_delta_factor);
+
                        if (val->horizontal)
                          {
                            inev.ie.arg
@@ -15217,4 +15220,10 @@ Otherwise, a wheel event will be sent every time the 
mouse wheel is
 moved.  This option is only effective when Emacs is built with XInput
 2, with Haiku windowing support, or with NS.  */);
   x_coalesce_scroll_events = true;
+
+  DEFVAR_LISP ("x-scroll-event-delta-factor", Vx_scroll_event_delta_factor,
+              doc: /* A scale to apply to pixel deltas reported in scroll 
events.
+This option is only effective when Emacs is built with XInput 2
+support. */);
+  Vx_scroll_event_delta_factor = make_float (1.0);
 }



reply via email to

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