robloxWineBuildGuide icon indicating copy to clipboard operation
robloxWineBuildGuide copied to clipboard

Roblox cannot grab cursor on Wayland

Open Nolij opened this issue 3 years ago • 9 comments

Ironically the inverse of the original mouse issue exists on Wayland: the cursor will not be locked by Roblox under any circumstances. Right clicking will tell Roblox the cursor is locked but the cursor will continue to move around freely. It will be stopped by the edge of the monitor, and it will occasionally "warp" back to the locked position causing the camera to snap quickly in ways that make the game almost unplayable.

This likely requires a specific patch for Roblox. Notable details:

  • Using Proton version tested to confirmed be able to grab my cursor in SpyParty on Steam is not able to grab my cursor in Roblox. Vanilla Wine also behaves the same way
  • The Roblox mouse patch actually has no effect on any behaviour at all in Wayland
  • This happens both with and without staging
  • Using the experimental Wayland patch (with modified Grapejuice to apply custom environment variables to launch using the Wayland driver) does not fix the issue (also has other issues, but doesn't matter since it doesn't fix it).
  • Subscribing to the +cursor channel with WINEDEBUG shows no notable differences between X11 and Wayland on the same system and Wine build
  • Using _plain_version="wine-6.17" and _use_staging="false" for build (after much effort to fix errors during build) the issue still occurs, so it's unlikely an older Wine version will work (going much further back than 6.17 is difficult to get to build with TKG, and not long before this version Roblox itself would start having issues in Wine, so I don't see that as worth the time putting more effort in to. Someone else is free to though, would love to be wrong)
  • There are patches mentioning cursor grabbing in https://github.com/openglfreak/wine-tkg-userpatches, but I have yet to get this to build successfully, so I do not know if that will work. Attempting to just use all of the ones with grab and such in the name did not work. I am trying to filter through them to see which ones I can get working.

Nolij avatar Jun 07 '22 22:06 Nolij

How did you setup your env vars? Mainly because all I get on nvidia is 0724:err:winediag:nodrv_CreateWindow Application tried to create a window, but no driver could be loaded. 0724:err:winediag:nodrv_CreateWindow L"The explorer process failed to start."

ColdIce1605 avatar Jun 20 '22 09:06 ColdIce1605

Thats probably an Nvidia issue with Wayland. All I had to do was mod Grapejuice to allow overriding the "DISPLAY" environment variable. Someone on Discord informed us that Wayland does not allow grabbing the cursor while it's visible (don't ask me why). So, theoretically, one may be able to patch Wine to "hide" the cursor when it's grabbed, and draw a fake one in its place. I'm not sure how to do this though.

Nolij avatar Jun 20 '22 11:06 Nolij

mind sending your user_settings.json?

ColdIce1605 avatar Jun 29 '22 00:06 ColdIce1605

mind sending your user_settings.json?

I'm on AMD, and I believe it was generated fresh, so I don't think that will help. Also, that seems pretty off-topic for this issue. You can open another issue or ask for help on the Grapejuice Discord if you have a separate issue.

Nolij avatar Jun 29 '22 00:06 Nolij

I'm having this issue on my gaming PC, but not my laptop.

My gaming PC: Void Linux with KDE, Radeon GPU, Logitech USB mouse Laptop: Ubuntu 22.04, Intel GPU, Thinkpad trackpoint, fractional scaling set to 125%

Any other potentially relevant differences in specs, you ask I'll provide.

ghost avatar Sep 02 '22 06:09 ghost

I'm having this issue on my gaming PC, but not my laptop.

My gaming PC: Void Linux with KDE, Radeon GPU, Logitech USB mouse Laptop: Ubuntu 22.04, Intel GPU, Thinkpad trackpoint, fractional scaling set to 125%

Any other potentially relevant differences in specs, you ask I'll provide.

Your laptop is likely using X11. Please double check.

Update for those who stumble upon this issue: the cause for this is known. It is an intentional limitation of the Wayland protocol -_-. Basically, if the cursor is "visible", it cannot be locked in place. mouse.c (refer to the mouse patch for X11, same file) can theoretically be modified to pretend the cursor is not visible, and this should fix this issue (theoretically).

Nolij avatar Sep 02 '22 14:09 Nolij

Your laptop is likely using X11. Please double check.

I can say with 100% confidence it was not.

  • The Roblox window was blurry from being upscaled, as is what happens to XWayland windows in a fractionally scaled Gnome environment.
  • 1:1 scrolling and pinch-to-zoom was working in Firefox.
  • The cursor felt, looked, and performed like it was on the same buffer layer as the rest of the desktop, and cursor FPS would drop along with compositor FPS.
  • The desktop was smooth and tear free. Fractional scaling on Xorg on Intel graphics causes really noticable tearing regardless of what compositor is being used.
  • I never use an Xorg session on this laptop.

I suspect fractional scaling may, at the very least, mitigate this issue enough where I didn't notice it in my few minutes of test playing. I'll test this in a few days, as I'm in a time crunch for weekend plans.

ghost avatar Sep 02 '22 14:09 ghost

I've put Ubuntu 22.04 on my gaming PC on an extra hard drive and made sure it's running Wayland. Though the cursor grabbing issue persists, the camera snapping behavior never happened over ~5 minutes of game play. Which means Roblox is completely playable on Ubuntu Gnome Wayland.

Interestingly, the Grapejuice documentation suggests the use of "Wayland with XWayland" under System Requirements. https://brinkervii.gitlab.io/grapejuice/docs/

ghost avatar Apr 10 '23 00:04 ghost

Wine/Roblox issue, maybe it could be fixed when Wine gets native wayland support

karimrir1 avatar Sep 30 '23 14:09 karimrir1