summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEli Zaretskii <eliz@gnu.org>2023-08-19 17:01:18 +0300
committerEli Zaretskii <eliz@gnu.org>2023-08-19 17:01:18 +0300
commit781ddd7e7d87de150d74d6d8615c25e68b42275b (patch)
tree2fb7d2e3629618f03234bcb2ea395e9380ce45a1
parentc125bd060e28367239779e25c1586a52fbfa54db (diff)
downloademacs-781ddd7e7d87de150d74d6d8615c25e68b42275b.tar.gz
Fix touchpad scrolling on MS-Windows
* src/w32term.c (w32_construct_mouse_wheel): The number of lines to scroll should always be positive in wheel-scroll events. Whether to scroll up or down is encoded in the modifiers, which produce either wheel-up or wheel-down event. (Bug#65070) * doc/lispref/commands.texi (Misc Events): Clarify the documentation of 'wheel-up' and 'wheel-down' events.
-rw-r--r--doc/lispref/commands.texi11
-rw-r--r--src/w32term.c2
2 files changed, 7 insertions, 6 deletions
diff --git a/doc/lispref/commands.texi b/doc/lispref/commands.texi
index 0298a5d77ee..028209b2bc1 100644
--- a/doc/lispref/commands.texi
+++ b/doc/lispref/commands.texi
@@ -2249,11 +2249,12 @@ occurred.
@var{clicks}, if present, is the number of times that the wheel was
moved in quick succession. @xref{Repeat Events}. @var{lines}, if
-present and not @code{nil}, is the number of screen lines that should
-be scrolled. @var{pixel-delta}, if present, is a cons cell of the
-form @w{@code{(@var{x} . @var{y})}}, where @var{x} and @var{y} are the
-numbers of pixels by which to scroll in each axis, a.k.a.@:
-@dfn{pixelwise deltas}.
+present and not @code{nil}, is the positive number of screen lines
+that should be scrolled (either up, when the event is @code{wheel-up},
+or down when the event is @code{wheel-down}). @var{pixel-delta}, if
+present, is a cons cell of the form @w{@code{(@var{x} . @var{y})}},
+where @var{x} and @var{y} are the numbers of pixels by which to scroll
+in each axis, a.k.a.@: @dfn{pixelwise deltas}.
@cindex pixel-resolution wheel events
You can use these @var{x} and @var{y} pixelwise deltas to determine
diff --git a/src/w32term.c b/src/w32term.c
index 2899e82b295..40b04b15993 100644
--- a/src/w32term.c
+++ b/src/w32term.c
@@ -3412,7 +3412,7 @@ w32_construct_mouse_wheel (struct input_event *result, W32Msg *msg,
((double)FRAME_LINE_HEIGHT (f) * scroll_unit)
/ ((double)WHEEL_DELTA / delta);
nlines = value_to_report / FRAME_LINE_HEIGHT (f) + 0.5;
- result->arg = list3 (make_fixnum (nlines),
+ result->arg = list3 (make_fixnum (eabs (nlines)),
make_float (0.0),
make_float (value_to_report));
}