Bug 469555 - 7c91c4bad9ee709eebfdf9d5b3997fa00ca7cd13 causes cursor to not snap back to center in Minecraft
Summary: 7c91c4bad9ee709eebfdf9d5b3997fa00ca7cd13 causes cursor to not snap back to ce...
Status: RESOLVED FIXED
Alias: None
Product: kwin
Classification: Plasma
Component: input (show other bugs)
Version: 5.27.5
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords:
: 470028 (view as bug list)
Depends on:
Blocks:
 
Reported: 2023-05-09 22:34 UTC by kocelfc
Modified: 2023-05-27 15:14 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description kocelfc 2023-05-09 22:34:39 UTC
Before this commit, Minecraft used to snap the cursor back to the center when reopening the inventory, as I think is the correct behaviour, since that part of the inventory is highlighted, which probably means the game expects the cursor to be there, but the cursor is instead wherever it was moved before closing the inventory.

I can upload videos of me reproducing the issue if necessary.



STEPS TO REPRODUCE
1. Open Minecraft
2. Start a new world
3. Open inventory
4. Move cursor
5. Close inventory and reopen it
6. Cursor is now at the wrong position (where it previously was, not in the center)

OBSERVED RESULT

Cursor is wherever it was moved

EXPECTED RESULT

Cursor is snapped back to center


Gentoo Linux 2.13
KDE Plasma: 5.27.5
KDE Frameworks:  5.105.0
Graphics Platform: Wayland
Qt Version: 5.15.9
Kernel: 6.3.1
GPU: AMD Radeon RX 6800
Comment 1 Vlad Zahorodnii 2023-05-10 07:42:10 UTC
Do you know if this issue is reproducible in other wayland desktop environments (e.g. gnome shell)?
Comment 2 kocelfc 2023-05-10 08:52:54 UTC
I just tested a fresh Fedora 38 ISO with GNOME 44.1 and it is not reproducible there.
Comment 3 emozdemir 2023-05-10 14:18:23 UTC
Same bug happens in Apex Legends too. On X11 it works as intended. Pointer's position expected to reposition to the center of the game when opening an interactable menu (inventory, deathboxes, esc menu, blackmarket etc.). With this new commit pointer stays where it was before.
Comment 4 Maciej Stanczew 2023-05-10 16:43:16 UTC
Similar issue in Diablo III:
1. Open the item inventory
2. Pick up any item by left-clicking → this will make the cursor disappear
3. Move to a different item slot
4. Drop the item → this will make the cursor appear again

Before, the cursor would appear at the item's new location, as it's supposed to.
After 7c91c4bad9ee709eebfdf9d5b3997fa00ca7cd13, the cursor appears in the previous location (where the item was picked up instead of dropped).

Reverting d7033a3c83134f383fbbd8e005ff6a10c79e48d4 from Plasma/5.27 branch makes the issue go away.
Comment 5 Maciej Stanczew 2023-05-11 00:20:27 UTC
Same with Hearthstone: when clicking a card (cursor disappears), moving it around the game board, and then releasing, the cursor will reappear back at the position where the card was initially clicked, instead of where it was released.
Comment 6 Vlad Zahorodnii 2023-05-11 18:58:05 UTC
Can somebody test whether https://invent.kde.org/-/snippets/2650 fixes the issue?
Comment 7 emozdemir 2023-05-11 19:29:51 UTC
(In reply to Vlad Zahorodnii from comment #6)
> Can somebody test whether https://invent.kde.org/-/snippets/2650 fixes the
> issue?

 I think this is the previous expression. I don't know how to exactly apply the patch but this should work.
Comment 8 Vlad Zahorodnii 2023-05-11 19:37:10 UTC
It only partially reverts 7c91c4bad9ee709eebfdf9d5b3997fa00ca7cd13. Also, are there other affected games? Ideally, free ones and that don't need a lot of disk space

It appears Apex Legends is a free one, but it requires a lot of disk space (and I presume requires a lot of time to download it depending on the internet connection)
Comment 9 emozdemir 2023-05-11 19:52:34 UTC
As Maciej says Hearthstone has an issue because of this commit too. It's a smaller game compared to Apex and can be installed through Lutris.
Comment 10 Bug Janitor Service 2023-05-11 20:00:47 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/kwin/-/merge_requests/4094
Comment 11 Vlad Zahorodnii 2023-05-12 06:25:57 UTC
Git commit 07da1796b8388b00275d8281fac476bde71cd02b by Vlad Zahorodnii.
Committed on 11/05/2023 at 19:56.
Pushed by vladz into branch 'master'.

Revert "wayland: Avoid pointer warp if constraint region is invalid"

This reverts commit 7c91c4bad9ee709eebfdf9d5b3997fa00ca7cd13.

It created regressions in some video games. After a closer look at the
pointer constraint region handling, there are some issues, but it might
be safer to fix them in master.

In meanwhile, let's revert 7c91c4bad because it breaks more things than
it fixes.
Related: bug 457021

M  +2    -2    src/pointer_input.cpp

https://invent.kde.org/plasma/kwin/commit/07da1796b8388b00275d8281fac476bde71cd02b
Comment 12 Vlad Zahorodnii 2023-05-12 07:50:50 UTC
Git commit 3d62e7548955e2ddf298c61a55fcd26007ea27bb by Vlad Zahorodnii.
Committed on 12/05/2023 at 06:26.
Pushed by vladz into branch 'Plasma/5.27'.

Revert "wayland: Avoid pointer warp if constraint region is invalid"

This reverts commit 7c91c4bad9ee709eebfdf9d5b3997fa00ca7cd13.

It created regressions in some video games. After a closer look at the
pointer constraint region handling, there are some issues, but it might
be safer to fix them in master.

In meanwhile, let's revert 7c91c4bad because it breaks more things than
it fixes.
Related: bug 457021


(cherry picked from commit 07da1796b8388b00275d8281fac476bde71cd02b)

M  +2    -2    src/pointer_input.cpp

https://invent.kde.org/plasma/kwin/commit/3d62e7548955e2ddf298c61a55fcd26007ea27bb
Comment 13 Maciej Stanczew 2023-05-12 08:11:53 UTC
> Can somebody test whether https://invent.kde.org/-/snippets/2650 fixes the issue?
It fixes the issue for me in Hearthstone, but not in Diablo III. Only the full revert makes it work.

> Also, are there other affected games? Ideally, free ones and that don't need a lot of disk space
At first I assumed any game which temporarily hides the mouse cursor would be impacted. But then I checked a couple other games, both native as well as running through Wine/Proton, and didn't see this issue. Maybe other people can comment with more affected games?
Comment 14 Fushan Wen 2023-05-27 15:14:20 UTC
*** Bug 470028 has been marked as a duplicate of this bug. ***