Subject: Re: bug#69915: 30.0.50; mouse-autoselect-window has no effect in terminal

From: Olaf Rogalsky <[email-masked]>
Date: Wed, 20 Mar 2024 19:10:53 +0100

> On an MS-Windows terminal I don't see this problem, so maybe there's
> more here than meets the eye?
Yes, same in X11. I wasn't able to track it down. Maybe it is burried
deep inside of "read_char".

> Anyway, why do you call posn-at-point with first argument nil?  I
Because I was lazy and didn't thought, that "the position of point in that
window is at all relevant".

Eli Zaretskii <[email-masked]> writes:

>> From: Olaf Rogalsky <[email-masked]>
>> Date: Wed, 20 Mar 2024 15:29:33 +0100
>> 
>> when using emacs in the terminal, the mouse-autoselect-window variable
>> has no effect, i.e. moving the mouse from one window to the next does
>> not change the selected window.
>> 
>> Recipe:
>> --- snip ---
>> emacs -nw
>> M-: (xterm-mouse-mode 1)
>> M-: (setq mouse-autoselect-window t)
>> C-x 2
>> <mouse-motion <<<other window>>> >
>> --- snap ---
>> 
>> The reason is, that xt-mouse.el does not generate <select-window>
>> events. The following patch fixes that.
>
> Thanks.
>
>> To this end, it also fixes a bug in "window.el". Here, the
>> <select-window> event which is added to `last-input-event', does not
>> contain a propper posn field. In X11, this works fine, but in the
>> terminal it results in a "nil <select-window> is undefined" error.
>
> On an MS-Windows terminal I don't see this problem, so maybe there's
> more here than meets the eye?
>
> Anyway, why do you call posn-at-point with first argument nil?  I
> don't think the position of point in that window is at all relevant,
> is it?  Should we perhaps use the position derived from mouse-position
> instead?
>
> Jared, any comments to this patch?

-- 
Olaf Rogalsky
Schwoerhausgasse 5
89073 Ulm
Germany