From: Eli Zaretskii Date: Sat, 19 Aug 2023 14:01:18 +0000 (+0300) Subject: Fix touchpad scrolling on MS-Windows X-Git-Tag: emacs-29.1.90~188 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=781ddd7e7d8;p=emacs.git 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. --- 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)); }