microsoft / wslg

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

mouselock isnt working and mouse input is chaotic in video games #240

Open junefranklin opened 3 years ago

junefranklin commented 3 years ago

Environment

i tried running xonotic and freedoom, both had the same issue. mouse behaviour was chaotic, and the mouse wouldnt lock to the window.

Windows build number: 21382.1000
Your Distribution version: Ubuntu 20.04
Your WSLg version: 1.0.22

Steps to reproduce

I suspect this is a problem with RDP? not sure. any ideas?

you can test with freedoom on ubuntu just sudo apt install freedoom then use freedoom1 to open a game window. same behaviour is reproducable on xonotic.

WSL logs:

You can access the wslg logs using explorer at: \\wsl$\<Distro-Name>\mnt\wslg (e.g.: \\wsl$\Ubuntu-20.04\mnt\wslg)

Expected behavior

mouse locks onto window, providing smooth mouse movement in video game

Actual behavior

any mouse movement is amplified extremely high and you are unable to use mouse controls. mouse does not lock onto window. wasd and keyboard and so on are responsive, but the mouse movement is weird.

Luminoso-256 commented 3 years ago

Any potential temporary workaround to this?

junefranklin commented 3 years ago

Any potential temporary workaround to this?

not that I've found. I suppose if it weren't using RDP and was actually hooked into windows displays tighter it could possibly be able to get tighter integration. I suppose at the moment it's bottlenecked by how RDP handles mouse input at the moment.

Luminoso-256 commented 3 years ago

I wonder if it may be possible to emulate a mouse on the WSL side and make some sort of pipe... Would certainly be very hacky and suboptimal though.

junefranklin commented 3 years ago

I wonder if it may be possible to emulate a mouse on the WSL side and make some sort of pipe... Would certainly be very hacky and suboptimal though.

if there were a way to do usb passthrough to the hyperv wsl machine you could send through a connected usb mouse. i think the hyperv container is too secure for doing that from the windows host, as the windows 'host' is actually a guest from the perspective of hyperv. though if anyone has any idea how to lower the secueity barriers for that id love to know because i have a bunch of ideas id like to do regarding passthrough to wsl. im too nooby with windows internals to know how to do that atm though.

avanisubbiah commented 3 years ago

I'm having the same issue with this in Minecraft on Ubuntu with wslg. Is there not any way to pass USB devices directly to WSLg as a workaround like virt-manager?

junefranklin commented 3 years ago

I'm having the same issue with this in Minecraft on Ubuntu with wslg. Is there not any way to pass USB devices directly to WSLg as a workaround like virt-manager?

I believe you'd need to have access to the hyperv vm, which you don't from windows, since windows is not technically the host of WSL or the windows you're using. I'm all ears if anyone knows how to manage the hypervisor from windows. Please LMK. image

junefranklin commented 3 years ago

I'm having the same issue with this in Minecraft on Ubuntu with wslg. Is there not any way to pass USB devices directly to WSLg as a workaround like virt-manager?

274

I was thinking of that approach here if you find any sort of interesting solution to that

avanisubbiah commented 3 years ago

I believe you'd need to have access to the hyperv vm, which you don't from windows, since windows is not technically the host of WSL or the windows you're using.

I know you can edit hyperv parameters when hosting it in KVM, is there anyway to do that when it's running bare metal? Like some kind of pre-boot environment?

Luminoso-256 commented 3 years ago

a BIOS-like thing perhaps? I don't know if that exists in this context though...

tymondouglas commented 2 years ago

Can confirm, still happening over here.

Blizzardfur-Maxxx commented 4 months ago

still broken

buckwheatxkasha commented 3 months ago

Same on Debian WSL (tested with gzDoom and Descent 3 ports)