-
Notifications
You must be signed in to change notification settings - Fork 309
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Mouse locking/hiding not working in OpenGL app #376
Comments
I can also confirm this issue with Minecraft Java Edition (issue #374). |
Same thing happens for me, but in another app. (issue #170) |
I can confirm this happens to me too, in all OpenGL apps that lock the cursor. I use I would really love for this to be fixed as I'm trying to develop an OpenGL application and this is preventing me from doing so. I might just temporarily switch back to VcXsrv in the meantime. I switched because I wanted anti-aliasing. |
Is there any update to this? |
this happen with qemu too. |
The only "fix" I have for this issue is to use GWSL, a community app implementing vcxsrv. |
I can confirm that mouse hiding and warp in OpenGL is still a problem, even though WSL has gone from pre-release to sharp version. With GWSL, however, it works. WSL-version: 1.0.0.0
Kernelversion: 5.15.74.2
WSLg-version: 1.0.47
MSRDC-version: 1.2.3575
Direct3D-version: 1.606.4
DXCore-version: 10.0.25131.1002-220531-1700.rs-onecore-base2-hyp
Windows: 10.0.19045.2311 |
I was hoping to use WSL to develop OpenGL programs without having to power up two machines for development (isn't that what everyone wants these days?). Quick'n'Dirty: Windows 10 Pro 64-bit, WSL2, Ubuntu 20.04.03 LTS, VSCode 1.75.1 C++, compiled using g++, using GLFW 3.3.8 running an OpenGL 3.3 (Core) context, GLSL 3.30 Alas, when I try to lock the mouse to my program, it seemingly ignores the request. Adding the below information in the hopes that it helps.
This is what I see running the program that I want to behave.
After days of trying every way I can think of to make this work, it really seems like there is some sort of disconnect with waylan/weston/x11/opengl/DX/glfw that's causing this to not work specifically for programs running within WSL. And it apparently has been going on for a while. Onward! To...more investigations. |
If you do find a solution, please let me know! |
If you go to the issue I mentioned in the GLFW repo, you will see that I have taken a deep dive down into GLFW and spent a while tracing out the exact call tree for setting GLFW_CURSOR_DISABLED. I won't reiterate what I did as it can be read in the other issue. What I will say though, this issue seems to be coming from WSLg/RDP/Xorg/Wayland/etc. When I compiled my code on Ubuntu 22.04 running on bare metal, it worked as expected. So, while I won't say definitively that this is a WSLg/etc issue, I'm 99.999% confident it is. Alas, I have neither the time nor the knowledge to fork WSLg and attempt to drill down into it the same way I did with GLFW. My solution is going to be cross-compiling with MinGW and running the code natively on Windows (which was the long term goal anyways). While it would be awesome to not need to cross-compile, it seems to be the state of things. I'll add this issue to my list of "things to tackle if I have spare time". If someone else comes across this issue, and has the time to spare, digging into WSLg seems like the best place to start. Good luck! |
I'll also add, while I haven't setup and used this myself, the authors of it claim it somehow sets up vcxsrv so that these issues go away. While it appears to make it easier to use X11 apps more easy, I don't think it's doing anything magical that will make this particular bug go away. I use vcxsrv manually, and everything their app does using vcxsrv I do by hand, so I have my doubts. |
I am fairly certain it's WSLg as well, it's kinda disappointing really considering that even stuff like windows management isn't as seamless compared to third party solutions like VcXsrv, Xming, or any of those paid solutions. Heck, GL support is kinda useless coz I couldn't get stuff like qemu with virgl to work due to lack of dri, waydroid, etc. It's more of a gimmick really rather than something interesting to use. |
This is also a problem with SDL2, not just GLFW. I believe it has to do with how the hardware mouse works in WSL, since this also occurs in VirtualBox with the hardware mouse enabled, and is fixed when using the software mouse. In fact, every functionality that controls the mouse doesn't work with a hardware mouse. You can't set its position via |
As per the WSL architecture overview from the readme WSLg uses RDP which has this issue as well. So maybe that is the cause? Is there a way to have it use a different RDP client instead? |
The solution is to use GWSL instead of wslg.
The default-size window gave me around 110 FPS in the game, full-screen and maximized-window gave around 40 FPS. I got a 1080p monitor. |
This issue should be higher on the priority, because it prohibits developing opengl with native wsl. The workaround that I found wroked was to skip wsl all together and run on native linux which defeats the whole point of wsl. |
Environment
Steps to reproduce
Download and install https://jenkins.thebrokenrail.com/job/minecraft-pi-reborn/job/master/97/artifact/out/minecraft-pi-reborn-client_2.1.6~buster_amd64.deb. For reference, I'm playing Minecraft Pi Edition: Reborn by MCPI Revival.
WSL logs:
/mnt/wslg
You can access the wslg logs using explorer at:
\\wsl$\<Distro-Name>\mnt\wslg
(e.g.:\\wsl$\Ubuntu-20.04\mnt\wslg
)pulseaudio.log
weston.log
(versions log was empty)
Expected behavior
The mouse should have been hidden, and it should have also locked in place to the center of the window
Actual behavior
The mouse isn't hidden and it also can move freely around when the game is playing without being locked in place. This doesn't happen on normal linux. The mouse moving freely also breaks the player view.
21.07.2021_15.59.26_REC.mp4
The text was updated successfully, but these errors were encountered: