Subject: bug#51891: 29.0.50; [PATCH] Pixel delta support for wheel events on X

From: Eli Zaretskii <[email-masked]>
Date: Wed, 17 Nov 2021 15:33:29 +0200

> Cc: [email-masked]
> Date: Wed, 17 Nov 2021 10:38:41 +0800
> From:  Po Lu via "Bug reports for GNU Emacs,
>  the Swiss army knife of text editors" <[email-masked]>
> 
> --- a/doc/lispref/commands.texi
> +++ b/doc/lispref/commands.texi
> @@ -1985,7 +1985,11 @@ Misc Events
>  These kinds of event are generated by moving a mouse wheel.  The
>  @var{position} element is a mouse position list (@pxref{Click
>  Events}), specifying the position of the mouse cursor when the event
> -occurred.
> +occurred.  The event may have additional arguments after
> +@var{position}.  The third argument after @var{position}, if present,
> +is a property list of the form @w{@code{(:delta-x @var{x} :delta-y
> +@var{y})}}, where @var{x} and @var{y} are the number of pixels to
> +scroll by in each axis.

Did you consider the possibility of defining a new event?

And should mwheel.el be aware of this change somehow?

And finally, why introduce keyword-value pairs into a form that didn't
use them before?  Can we store just the values there?

> +			scroll_unit = pow (FRAME_PIXEL_HEIGHT (f), 2.0 / 3.0);

Ouch! can we avoid calling 'pow' here?  It's an expensive function.

> +  DEFVAR_BOOL ("x-coalesce-scroll-events", x_coalesce_scroll_events,
> +	       doc: /* Non-nil means to only send one wheel event for each scroll unit.
> +Otherwise, a wheel event will be sent every time the mouse wheel is
> +moved.

This is confusing: what does "scroll unit" mean in this context?