Subject: Re: bug#57476: 29.0.50; Mouse wheel event ignored on Lucid build

From: Stephen Berman <[email-masked]>
Date: Tue, 30 Aug 2022 12:41:07 +0200

On Tue, 30 Aug 2022 18:15:29 +0800 Po Lu <[email-masked]> wrote:

> Stephen Berman <[email-masked]> writes:
>
>> 1.79769e+308
>
> Please instrument this piece of xterm.c, around line 20724, as follows:
>
>   	      xi_reset_scroll_valuators_for_device_id (dpyinfo, enter->deviceid,
> 						       true);
> #endif
> 	      printf ("Enter %d %d\n", enter->mode, enter->detail); <===
>
> 	      {
> #ifdef HAVE_XWIDGETS
> 		struct xwidget_view *xwidget_view = xwidget_view_from_window (enter->event);
>
> and this piece of the same function, around line 20843, as follows:
>
> 	      if (device)
> 		xi_report_motion_window_clear (device);
> 	      printf ("Leave %d %d\n", leave->mode, leave_detail); <====
                                                    ^^^^^^^^^^^^
This failed to build; I assume you meant leave->detail, which did build.

> and see what is printed as you move the mouse wheel.

The shell output looks like this:

Enter 0 3
Leave 1 0
Enter 2 0
Leave 1 0
Enter 2 0
Leave 1 0
Enter 2 0
Leave 1 0
... (and so on)

> Should it print "Enter" and "Leave" repetitively, please try the
> following patch:
>
> diff --git a/src/xfns.c b/src/xfns.c
> index 0b1f707e9f..bebac747fb 100644
> --- a/src/xfns.c
> +++ b/src/xfns.c
> @@ -3996,6 +3996,9 @@ x_window (struct frame *f, long window_prompting)
>    /* Make all the standard events reach the Emacs frame.  */
>    attributes.event_mask = STANDARD_EVENT_SET;
>
> +  if (FRAME_DISPLAY_INFO (f)->supports_xi2)
> +    attributes.event_mask &= ~(ButtonPressMask | ButtonReleaseMask);
> +
>  #ifdef HAVE_X_I18N
>    if (FRAME_XIC (f))
>      {
>
> Thanks in advance.
>
> P.S. I can't see anything wrong with that patch at first glance;
> however, it is a big change to very old code, so please report any
> issues that show up with it applied.

After applying the patch and rebuilding, scrolling the mouse wheel is
still a no-op.

Steve Berman