GNU bug report logs - #61241
29.0.60; Incoherent last_mouse_window (xterm.c) between XInput and XInput 2

Previous Next

Package: emacs;

Reported by: Adrián Medraño Calvo <adrian <at> medranocalvo.com>

Date: Thu, 2 Feb 2023 22:29:02 UTC

Severity: normal

Found in version 29.0.60

Done: Eli Zaretskii <eliz <at> gnu.org>

Full log


Message #11 received at 61241 <at> debbugs.gnu.org (full text, mbox):

From: Po Lu <luangruo <at> yahoo.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 61241 <at> debbugs.gnu.org,
 Adrián Medraño Calvo <adrian <at> medranocalvo.com>
Subject: Re: bug#61241: 29.0.60; Incoherent last_mouse_window (xterm.c)
 between XInput and XInput 2
Date: Sat, 04 Feb 2023 16:43:31 +0800
Eli Zaretskii <eliz <at> gnu.org> writes:

>> From: Adrián Medraño Calvo
>>  <adrian <at> medranocalvo.com>
>> Date: Thu, 2 Feb 2023 23:28:01 +0100
>> 
>> For the implementation of `mouse-autoselect-window', the entered window
>> is remembered and then compared when an mouse motion event is received.
>> Up to Emacs 28, this value was stored in a static local variable named
>> `last_mouse_window' in the block handling MotionNotify within
>> `handle_one_xevent'.  With the introduction of XInput 2,
>> `handle_one_xevent' was adjusted to account for XI_Motion events, with
>> the oversight that a new local static `last_mouse_window' variable was
>> declared in the new handler block for XI_Motion.  As a result, when
>> Emacs receives motion events from XInput and XInput2 sources
>> alternatively the value of each `last_mouse_window’ differs, leading to
>> the window under the motion sometimes not being selected, as the
>> value `last_mouse_window' is out-of-date for the particular XInput
>> version.
>> 
>> This bug impacts the GNU ELPA package EXWM.  EXWM tries to extrapolate
>> applicable Emacs functionality to X window management; among others
>> assigns an Emacs buffer to each managed X window, and positions the X
>> window over the Emacs window in which the buffer is displayed.  When
>> `mouse-autoselect-windows’ and the user moves the mouse pointer over one
>> X window managed by EXWM, this X window receives the mouse events and not
>> Emacs, therefore the Emacs window is not selected.  In order to overcome
>> this, EXWM sends a synthetic MotionNotify event to Emacs.
>> 
>> The attached patch fixes the issue.

Thanks.  But first of all, Emacs is not at all prepared to receive both
MotionNotify events and XI_Motion events on a frame at the same time in
other areas as well, such as focus tracking.

This is not possible under an X server.

So EXWM should send XI_Motion events when the X server supports XInput 2
(they are Generic Events, and XCB lets you send them, though not Xlib
because nobody has written a working event to wire function yet.)

Or alternatively, why doesn't exwm just focus the window itself?




This bug report was last modified 9 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.