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.
This commit is contained in:
Eli Zaretskii 2023-08-19 17:01:18 +03:00
parent c125bd060e
commit 781ddd7e7d
2 changed files with 7 additions and 6 deletions

View file

@ -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

View file

@ -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));
}