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

From: Eli Zaretskii <[email-masked]>
Date: Mon, 01 Apr 2024 14:40:29 +0300

> Date: Mon, 1 Apr 2024 11:09:47 +0200
> Cc: [email-masked], [email-masked]
> From: martin rudalics <[email-masked]>
> 
>  > The mini-window test was added by Martin, AFAICT, as part of rewriting
>  > the mouse-autoselect-window support.  Martin, do you remember why you
>  > added the MINI_WINDOW_P test in xterm.c, but not, for example, in
>  > w32term.c?
>  >
>  > In any case, I couldn't find any problems with the current behavior on
>  > MS-Windows when mouse-autoselect-window is non-nil.
> 
> The original mini-window test was conceived by Stefan
> 
> commit 66c226bf5a1e8289b0ce676d5e4225810a11af91
> Author: Stefan Monnier <[email-masked]>
> Date:   Thu Jan 20 14:23:23 2005 +0000
> 
>      (handle-select-window): Don't switch window when we're in the minibuffer.
> 
> and I moved it to xterm.c later.  I don't remember why and all I
> remember is that the accompanying comment was not mine.
> 
> The check is redundant because the condition is tested again here in
> 'handle-select-window':
> 
>                  ;; Don't switch if window autoselection with mouse is active
>                  ;; and minibuffer window is selected.
>                  (and mouse-autoselect-window (window-minibuffer-p))
> 
> One could say that the xterm.c code is more efficient because it doesn't
> generate a SELECT_WINDOW_EVENT when the selected window is the
> minibuffer window.  The w32 code generates the event but has it
> dismissed later in 'handle-select-window'.
> 
> In either case I would not remove the check from 'handle-select-window'
> because that one is platform-independent so there's no need to implement
> anything separately in the backends.
> 
> Though it might be more accurate to replace 'window-minibuffer-p' with
> 'minibuffer-window-active-p' to catch the case where a user, for some
> reason, selects the minibuffer window manually without activating the
> minibuffer.  And the 'mouse-autoselect-window' conjunct above is likely
> redundant...

Thanks.

Jared and Olaf, so I think the minibuffer test in the patch should
stay, but please see Martin's suggestions above.