microsoft / wslg

Enabling the Windows Subsystem for Linux to include support for Wayland and X server related scenarios

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Windows keyboard stops producing expected key inputs after copying from a buffer in emacs/Ubuntu/WSL2 and pasting to a Windows progarm, vice versa

yubrshen opened this issue · comments

Windows build number:

Microsoft Windows [Version 10.0.19045.4170]

Your Distribution version:

Release: 22.04 (Ubuntu)

Your WSL versions:

WSL version: 2.1.5.0
Kernel version: 5.15.146.1-2
WSLg version: 1.0.60
MSRDC version: 1.2.5105
Direct3D version: 1.611.1-81528511
DXCore version: 10.0.25131.1002-220531-1700.rs-onecore-base2-hyp
Windows version: 10.0.19045.4170

Steps to reproduce:

  1. Copy some text from a program in Windows (tried, Chrome, MS Edge, Slack)
  2. Paste it to a buffer in emacs
  3. Sometimes, the keyboard would stop producing expected keys when type on the keys. When typing it seemed that the produced output was with some combination of control key. For example, in emacs, pressing p, but emacs would show M-p (Alt p). The problem applies to all applications in both Windows and emacs.

Alternatively (less frequently experienced)

  1. Copy some text from a buffer in emacs
  2. Paste it to a Windows program (tried with Edge and Chrome)
  3. Sometimes, the keyboard stopped working to all applications in both Windows and emacs.

When the problem happens, restart would clear it.

WSL logs:

No response

WSL dumps:

No response

Expected behavior:

The keyboard should always produce the expected input.

Actual behavior:

Sometimes, it produces unexpected outcomes.

I cannot capture the logs, or dumps, when the problems happened, as the keyboard does not work.
If the logs or dumps after restart are still useful and needed, I can try to provide.

With more observation that once my laptop's keyboard stopped producing the expected output, with emacs, I found that when I pressed 'p' key, emacs shows me that the 'M-p' was received. 'M-p' in emacs on Windows is for the key combination of key p and modifier Alt key.
I tried to pressed Alt key, then the keyboard resume working correctly.
It seems that for some reason, when copying selected text in some Windows app (e.g. Chrome browser, etc.), it causes Alt modifier key pressed and sticky. But press Alt again, then Alt would be released, which makes the keyboard working normally.

With the observation, and the work-round the problem is solved. It seems that this problem might not be related to WSLg, but might be Windows 10's.

This closed the issue.