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

From: Bartosz Kaczyński <[email-masked]>
Date: Wed, 22 Jan 2025 16:14:48 +0000

On 1/20/25 13:07, Eli Zaretskii wrote:
>> 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?

GUI 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.

Thank you for your response. While I understand that this could be 
caused by hardware or system software, I would like to ask for guidance 
in diagnosing whether the issue might caused from my Emacs configuration 
or related software (e.g., the windowing system, input handling in 
Emacs, etc.).