microsoft / wslg

Enabling the Windows Subsystem for Linux to include support for Wayland and X server related scenarios
MIT License
10.06k stars 304 forks source link

Mouse pointer is not visible from Linux application when pointer is outside of any of Linux app. #354

Open murbanowicz opened 3 years ago

murbanowicz commented 3 years ago

Environment

Windows build number: latest Win11 dev
Your Distribution version: Ubuntu 20.04
Your WSLg version: 1.0.24

When the application window is not maximized, the cursor position on the screen is way of from where the application "sees" it in the WSLg.

spronovo commented 3 years ago

Hi @murbanowicz, could you elaborate a bit or do you have an example?

Once important thing to note is that Linux applications only sees the mouse when the mouse is over a Linux window. When the mouse is outside of any Linux Window, X/Wayland aren't notified of mouse position update so they can't track the mouse everywhere on the desktop. That can best be seen with something like xeyes. The eyes will follow the cursor whenever it's over a Linux (X11 or Wayland) window... but lose track when the mouse is moved outside of any Linux applications.

Today this is by design and a restriction from the RDP RAIL/VAIL environment we are using. We haven't encountered fundamental problem as a result of this yet (outside things like eyes not being able to track the mouse everywhere :-)).

rwarren commented 2 years ago

I came to report a similar issue. In my case I was working for many hours with wslg applications working perfectly well (aside from GTK issues noted in #563, and the fact that ctrl-mousewheel doesn't work with wslg), when all of a sudden something changed. It now appears like the mouse pointer moves behind the wslg applications... or at least not within them. I am not sure what triggered this behaviour, but am about to reboot windows in hopes that proper wslg behaviour is restored.

With no mouse interaction I can't do much, but per suggestion above I did install xeyes, and have captured what it looks like for me when I just scan my mouse back and forth across the xeyes window. The cursor disappearing and reappearing is precisely what I see. The eyes don't pick up any mouse movement. I rastered the mouse more-or-less uniformly.

Also worth noting is that I can't use alt-space to try and get window control elements via keyboard, either.

Here's the capture of the xeyes behaviour: https://gfycat.com/edibleillegalgrassspider

rwarren commented 2 years ago

My issue may not belong under this one, but it seemed similar enough that I decided to not create a new issue.

rwarren commented 2 years ago

After a reboot, wslg is now back to normal.

Here is a short clip of xeyes functioning as described, with piece of a second wslg window. xeyes only sees movement when over a wslg window.

https://gfycat.com/sophisticatedphonyacouchi

rwarren commented 2 years ago

I am losing the mouse about once a day now in WSLG apps. If anyone has a workaround on how to restore mouse functionality without needing to reboot, I'd like to hear it! :) Been loving WSLG, but may have to switch back to x410 if this keeps up.

rwarren commented 2 years ago

Aha. Just restarting WSL does the trick. After saving all WSL work first, just do this (on the windows side):

wsl --shutdown

then restart WSL and mouse interaction in WSLG is restored. Much better than a full windows reboot.