Subject: Re: bug#75674: 31.0.50; Random keyboard input detected when clicking with mouse in Emacs

From: Eli Zaretskii <[email-masked]>
Date: Mon, 20 Jan 2025 14:07:32 +0200

> From: Bartosz Kaczyński <[email-masked]>
> Date: Sun, 19 Jan 2025 19:12:58 +0000
> 
> 
> I have encountered an issue in Emacs where random keyboard input (e.g.,
> single letters like d or repeated ones like cc) is inserted into the
> current buffer when I click inside the Emacs window with the mouse and
> while switching focus between Emacs and other application (e.g. browser
> or file manager). This behavior occurs inconsistently but is
> reproducible over time.

Is this on GUI frame or on TTY frame?

> I added the following diagnostic function to my configuration to capture
> input events:
> 
> (defun my/debug-input-event ()
>   (interactive)
>   (let ((event (read-event)))
>     (message "Event detected: %s" event)
>     (push event unread-command-events)))
> 
> (global-set-key [mouse-1] 'my/debug-input-event)
> 
> Using this code, I observed the following log in the *Messages* buffer
> when the issue occurred:
> 
> Event detected: 100
> 
> For context, ASCII value 100 corresponds to the letter d. However, other
> times, I observe different letters like cc.
> 
> I am using openSUSE Tumbleweed GNU/Linux distro on KDE Wayland system and
> running Emacs as a daemon and connecting via emacsclient.

I cannot think of any reason except some problem with your hardware or
system software.