Bug 477124

Summary: cursor is able to escape a fullscreen, window, borderless in apex legends under plasma 5.92.0/rc1 wayland
Product: [Plasma] kwin Reporter: Pollux <polluxau>
Component: wayland-genericAssignee: KWin default assignee <kwin-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: agurenko, aksdb, aleixpol, ashcon50, kocelfc, miranda, nate, olib141, paragoumba, s.rapp, u83rmensch, xaver.hugl
Priority: NOR Keywords: qt6
Version: 5.92.0   
Target Milestone: ---   
Platform: Neon   
OS: Linux   
Latest Commit: Version Fixed In: 6.0.3
Sentry Crash Report:

Description Pollux 2023-11-17 03:57:15 UTC
SUMMARY
***
NOTE: If you are reporting a crash, please try to attach a backtrace with debug symbols.
See https://community.kde.org/Guidelines_and_HOWTOs/Debugging/How_to_create_useful_crash_reports
***


STEPS TO REPRODUCE
1. launch apex 
2. use either fullscreen, window or borderless fullscreen
3. flick your mouse fast enough to make the cursor escape apex legends onto your second monitor

OBSERVED RESULT
https://www.youtube.com/watch?v=oMz6uKQVNcw&feature=youtu.be

EXPECTED RESULT
it should stay in the window, fullscreen, borderless like it does under x11 

SOFTWARE/OS VERSIONS
Windows: 
macOS: 
Linux/KDE Plasma: 
(available in About System)
KDE Plasma Version: 5.81.0
KDE Frameworks Version: 5.245.0
Qt Version: 6.6.0

ADDITIONAL INFORMATION
this also happens under 5.27.9 but its a lot harder to do it, while under kde neon unstable its relatively easy to do so
Comment 1 Pollux 2023-11-17 03:57:58 UTC
idk if this is got to do with wayland protocols so sorry if i picked the wrong one for the bug report
Comment 2 Pollux 2023-11-30 05:55:31 UTC
this is now fixed in plasma 6 beta 1 thank you!
Comment 3 Pollux 2023-12-05 03:11:16 UTC
it has returned :(
Comment 4 Oliver Beard 2024-01-20 06:48:50 UTC
For what it's worth, I've been seeing this recently in my Source engine games, which I run as a fullscreen borderless window. Occasionally (and usually rarely) I manage to click on my secondary monitor.
Comment 5 Vlad Zahorodnii 2024-01-23 11:29:52 UTC
What's the output resolution and the scale factor?
Comment 6 Pollux 2024-01-23 17:33:03 UTC
(In reply to Vlad Zahorodnii from comment #5)
> What's the output resolution and the scale factor?

1080p, 100% scale
Comment 7 Bug Janitor Service 2024-03-05 10:12:11 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/kwin/-/merge_requests/5358
Comment 8 Vlad Zahorodnii 2024-03-05 13:31:53 UTC
Git commit bfd755aee9282882dc82d8ce2e44ff4277cc5830 by Vlad Zahorodnii.
Committed on 05/03/2024 at 13:23.
Pushed by vladz into branch 'master'.

Fix confined pointer being able to escape the surface

When using fractional scaling, an xwayland window's client geometry can
have some fractional part. When that's the case, .toRect() can shrink the
client geometry or extruding the decoration borders inside the surface.

On the other hand, the pointer is going to be confined as long as the
wl_surface is focused. If the focus jumps to the decoration, the pointer
constraint is going to be broken. Unfortunately, the focus can shift to
the decoration even though the wl_surface is still focused because of the
pesky .toRect().
Related: bug 482448

M  +1    -1    src/input.cpp

https://invent.kde.org/plasma/kwin/-/commit/bfd755aee9282882dc82d8ce2e44ff4277cc5830
Comment 9 Bug Janitor Service 2024-03-05 13:35:17 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/kwin/-/merge_requests/5360
Comment 10 Vlad Zahorodnii 2024-03-05 13:46:38 UTC
Git commit 7da6ecb3df5edc940eede219dec7efed764e4c22 by Vlad Zahorodnii.
Committed on 05/03/2024 at 13:35.
Pushed by vladz into branch 'Plasma/6.0'.

Fix confined pointer being able to escape the surface

When using fractional scaling, an xwayland window's client geometry can
have some fractional part. When that's the case, .toRect() can shrink the
client geometry or extruding the decoration borders inside the surface.

On the other hand, the pointer is going to be confined as long as the
wl_surface is focused. If the focus jumps to the decoration, the pointer
constraint is going to be broken. Unfortunately, the focus can shift to
the decoration even though the wl_surface is still focused because of the
pesky .toRect().
Related: bug 482448


(cherry picked from commit bfd755aee9282882dc82d8ce2e44ff4277cc5830)

M  +1    -1    src/input.cpp

https://invent.kde.org/plasma/kwin/-/commit/7da6ecb3df5edc940eede219dec7efed764e4c22
Comment 11 Zamundaaa 2024-03-12 15:25:02 UTC
*** Bug 482651 has been marked as a duplicate of this bug. ***
Comment 12 Zamundaaa 2024-03-12 15:26:47 UTC
*** Bug 470773 has been marked as a duplicate of this bug. ***
Comment 13 Samantha 2024-03-14 00:59:31 UTC
The CC'd patch has made no difference to this bug. I updated to 6.0.2 today and the bug is still present while playing Helldivers 2

Disabled HDR.
100% scale factor
3440x1440 + 2560X1440

I was able to jog the mouse into working by changing resolution in game and then changing back
Comment 14 TONKAHANAH 2024-03-16 06:03:52 UTC
im still seeing this issue as well, but its inconsistent. im not quite sure how to pin this down since one game that wouldnt work would just start working, and other games that just wont work at all until I move it into windowed mode, and other games wont work no matter what I do.. then other games will just work again after rebooting but will stop working again at some point despite no real changes being made. other games will start to work after trying to break it by putting it back into full screen. I cant find any consistency in scenarios where im having the issue and scenarios where im not. 

I wish I had more consistent experiences to explain this, but the only thing I can say for the moment is that some times this issue comes up, some times it does not and I cannot sort out at what point it stops working and/or why.
Comment 15 Andreas Schneider 2024-03-24 10:48:46 UTC
I can currently reliably reproduce it with Hell Let Loose using Proton 9 on Plasma 6.0.2 on ArchLinux. Once ingame, the mouse hits a barrier and then starts jumping around, making it impossible to aim at anything. Works fine on X11. It also doesn't matter if I play it windows or fullscreen. (It can be reproduced in the training ground; one doesn't have to join a multiplayer game.)

Elder Scrolls Online behaves a bit different: when I start the game, the mouse jumps every few seconds, turning my camera almost 180° around. Switching the game to window mode (alt+enter) and back fixes it, though.
Comment 16 Andreas Schneider 2024-03-31 09:47:22 UTC
First impression with 6.0.3 is, that it's fixed (for me).
Comment 17 Ashcon Mohseninia 2024-03-31 14:08:02 UTC
KWIN 6.0.3 on wayland, playing Fallout 4 on a multi-screen setup, still experiencing this issue.

However, it appears a little different.

when looking around, the mouse appears for a split second on my other monitors, but then goes back into the game window. The issue here is that when clicking (Example when shooting), if the house has escaped the window at this exact moment, then the click is registered in another open window, and the game minimises itself.
Comment 18 Nate Graham 2024-03-31 19:55:24 UTC
"Looks a little different" means it's now a different issue; can I trouble you to submit a new bug report for it? Thanks!
Comment 19 Ashcon Mohseninia 2024-03-31 20:06:10 UTC
Done. Filed bug 484835 for this