bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#61241: 29.0.60; Incoherent last_mouse_window (xterm.c) between XInpu


From: Po Lu
Subject: 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
User-agent: Gnus/5.13 (Gnus v5.13)

Eli Zaretskii <eliz@gnu.org> writes:

>> From: Adrián Medraño Calvo
>>  <adrian@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?




reply via email to

[Prev in Thread] Current Thread [Next in Thread]