Bug 474774

Summary: Star Citizen does not grab the mouse correctly when in a Wayland session.
Product: [Plasma] kwin Reporter: Jack Greiner <jack>
Component: inputAssignee: KWin default assignee <kwin-bugs-null>
Status: RESOLVED DUPLICATE    
Severity: normal CC: d2_ricci, evohl, jack, mactan, nate, xaver.hugl
Priority: NOR Keywords: wayland-only
Version First Reported In: 5.27.8   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Jack Greiner 2023-09-21 20:36:57 UTC
SUMMARY
Hello, I'm pretty sure I opened this in the right place but if not feel free to let me know where I should open this issue.

I've been slowly but surely transitioning to Wayland, and for the most part this has been a pretty painless experience but I have noticed a KWin specific bug related to how this particular game captures mouse input. It only appears when selecting something with the 'inner thought' function in the game. 

What is supposed to happen is that the mouse cursor is anchored in the middle of the window and then you select something, however in KWin the cursor is locked to the bottom right of the window, causing issues in this particular title.

In other Wayland compositors: Sway, mutter, weston this issue is not observed.

STEPS TO REPRODUCE
1. Launch the game using WINE
2. Get into the game (Persistent Universe is easiest to reproduce in)
3. Hold 'F' and move the mouse

OBSERVED RESULT
Mouse will be correctly centred until mouse movement is detected, it will then snap to the bottom right of the game window and become anchored there. 

EXPECTED RESULT
Mouse cursor should be anchored in the centre of the screen, allowing you to interact with items in the game.

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: Linux 6.5.3-cbert7.0.fc38.x86_64 (64-bit)
KDE Plasma Version: 5.27.8
KDE Frameworks Version: 5.109.0
Qt Version: 5.15.10

ADDITIONAL INFORMATION
This is also observed in other inventory menus in the game, pointing to whatever API call WINE is making being given incorrect information. The mouse cursor works when not anchored in the game.

When using gamescope with '--force-grab-cursor' passed to the micro-compositor, the mouse cursor will correctly be centered in the game, I suspect this only happens as gamescope takes full control of the mouse cursor.

If I can provide any additional information that can help narrow this issue down please let me know.
Comment 1 evohl 2024-01-25 14:06:14 UTC
plasma under X11 works, gnome under wayland works, too.
so only combination of plasma and wayland leeds to this issue.
Comment 2 mactan 2024-02-23 16:52:10 UTC
gif of the issue being reproduced https://bugzilla-attachments.redhat.com/attachment.cgi?id=2016433
Comment 3 Jack Greiner 2024-02-23 20:14:42 UTC
This may be an issue with the relative-pointer-unstable-v1 protocol(https://wayland.app/protocols/relative-pointer-unstable-v1) implementation and how it interacts with xwayland. (if it is indeed implemented at all, I haven't looked into the code all too much)
Comment 4 Jack Greiner 2024-03-27 06:40:17 UTC
This looks like a duplicate of 458233.

*** This bug has been marked as a duplicate of bug 458233 ***