Subject: bug#73469: 29.4; mouse passing on terminal window generates events

From: Eli Zaretskii <[email-masked]>
Date: Wed, 25 Sep 2024 18:45:23 +0300

> Date: Wed, 25 Sep 2024 14:23:29 +0200
> From:  Francesco Potortì via "Bug reports for GNU Emacs,
>  the Swiss army knife of text editors" <[email-masked]>
> 
> I don't know when this has started happening.  I use the Emacs shipped
> by Debian, so I suppose it started when Debian pushed a new version
> into Testing.

What was the previous Emacs version you used?

> I run Lucid Emacs inside Screen, running in a Mate-Terminal window under
> the Mate desktop under X.
> 
> From the terminal emacs frame, I create X frames and usually work there,
> when I'm on X.  However, I keep the terminal open and sometimes I use
> the emacs frame in the terminal.
> 
> When the mouse cursor passes over the terminal window, it generates
> events, like this as seen by view-lossage:
> 
>  C-<mouse-1> 1 2 0 ; 2 1 M ESC [ M 3 5 ; C-<mouse-1> 1 2 0 ; 2 1 M ESC [ M 3 5 ; C-<mouse-1> 1 2 0 ; 2 1 M ESC [ M 3 5 ; C-<mouse-1> 1 2 0 ; 2 1 M <switch-frame> ESC [ M 3 5 ; C-<mouse-1> 1 1 0 ; 2 2 M ESC [ M 3 5 ; C-<mouse-1> 1 0 4 ; 2 2 M ESC [ M 3 5 ; C-<mouse-1> 9 8 ; 2 1 M ESC [ M 3 5 ; C-<mouse-1> 9 7 ; 2 1 M ESC [ M 3 5 ; C-<mouse-1> 9 7 ; 2 1 M ESC [ M 3 5 ; C-<mouse-1> 9 6 ; 2 1 M ESC [ M 3 5 ; C-<mouse-1> 9 4 ; 2 1 M ESC [ M 3 5 ; C-<mouse-1> 9 0 ; 2 2 M ESC [ M 3 5 ; C-<mouse-1> 8 8 ; 2 2 M ESC [ M 3 5 ; C-<mouse-1> 8 7 ; 2 2 M ESC [ 2 1 ~ C-j ;; electric-newline-and-maybe-indent
>  C-h l ;; view-lossage
> 
> After passing the mouse over the windows, it almost always calls the terminal menu (in red and blue colors) and I have to hit f10 to make it go away.  Often I do not realise that I have moved the mouse over the termial window and I find Emacs apparently hung on the X frames, until I go to the terminal window and hit f10.  Sometimes Emacs hangs during one of these events and I have to kill it as I find no way to revive it.
> 
> I do not know if this depends on mate-terminal, screen or emacs, and I have not tried to debug it, as I just discovered the reason why this happens at all (that is, passing the mouse cursor over the terminal window).
> 
> If this is not a known bug, please let me know and I'll try to dig deeper.  Suggestions at where to start looking at would be appreciated.

I'd start at the terminal-specific initializations your sessions are
loading.  What does tty-type return when called without arguments from
the terminal Emacs frame?

The next suspect is xt-mouse.el.

Another thing to look into is whether this happens in "emacs -Q"; if
not, take a good look at your customizations, especially those which
are related to mouse support on terminal frames.