Bug 455952

Summary: Touchpad gestures crashing Wine applications (Steam Proton included)
Product: [Plasma] kwin Reporter: ryu.ketsueki
Component: wayland-genericAssignee: KWin default assignee <kwin-bugs-null>
Status: RESOLVED FIXED    
Severity: crash CC: ericedlund2017, kde, nate, tinozzo123, xaver.hugl
Priority: NOR    
Version: master   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In: 5.25.4

Description ryu.ketsueki 2022-06-26 14:28:49 UTC
SUMMARY
Previously I thought this was an issue with Wine being incompatible or something but I noticed it only happened whenever I used a touchpad gesture to change between virtual desktops. If I use the Super + W to do that or Ctrl + Num, nothing happens. It only happens with touchpad gestures. Looking up on the log, I got the following error:

X Error of failed request:  BadMatch (invalid parameter attributes)
  Major opcode of failed request:  131 (XInputExtension)
  Minor opcode of failed request:  28 (X_GetDeviceButtonMapping)
  Serial number of failed request:  485
  Current serial number in output stream:  485
X Error of failed request:  BadWindow (invalid Window parameter)
  Major opcode of failed request:  10 (X_UnmapWindow)
  Resource id in failed request:  0x2800001
  Serial number of failed request:  1468
  Current serial number in output stream:  1471
Initial process has exited (return code: 0)

I marked this as a grave issue because of the following. It is affecting not only Wine applications but also Steam Proton games as well. With the Steam Deck shipping , it is an incentive for people to try an OS with Plasma also being shipped by default. While it may be an upstream issue with Wine in specific, it is still being caused by a Plasma feature, in this case, touchpad gestures. It may take a while before a patch can be issued on Wine side, if it will ever be, to then be used downstream on Proton and the like.

STEPS TO REPRODUCE
1. Run any Wine application
2. Use touchpad gestures to change virtual desktops, for example

OBSERVED RESULT
Wine application is immediately terminated

SOFTWARE/OS VERSIONS
Operating System: openSUSE Tumbleweed 20220623
KDE Plasma Version: 5.25.80
KDE Frameworks Version: 5.96.0
Qt Version: 5.15.2
Kernel Version: 5.18.5-lqx1-2-liquorix (64-bit)
Graphics Platform: Wayland
Processors: 4 × Intel® Core™ i3-7020U CPU @ 2.30GHz
Memory: 11.5 GiB of RAM
Graphics Processor: Mesa Intel® HD Graphics 620
Manufacturer: LENOVO
Product Name: 81FE
System Version: Lenovo ideapad 330-15IKB

ADDITIONAL INFORMATION
While the Kernel I'm using is Liquorix, I only started using this today. This issue exists for quite a while now and other users seem to be experiencing it as well as it was noted on Bug 53114 on WineDB Bugzilla. Wine only works on X11 and has no Wayland driver afaik so the fix needs to be implemented on XWayland side.
Comment 1 ryu.ketsueki 2022-06-27 14:37:56 UTC
I forgot to mention which applications crash with the use of touchpad gestures. I noticed this behavior happening with The Sims 4, StarCraft 2 and a non native Steam game called Sonic Chrono Adventure because it wasn't working properly in native Wine so I used Steam Proton. I couldn't test with many others since I don't play many other games very often.
Comment 2 Eric Edlund 2022-06-28 19:25:31 UTC
I downloaded "FreeStyle 2: Street Basketball" which is a Windows-Only game with steam. It's glitchy and broken but the start menu doesn't appear to notice when I use swipe gestures. I am unable to find StarCraft 2 or Sonic Chrono Adventure on steam. Is there a free steam game I we could both test?
Comment 3 ryu.ketsueki 2022-06-28 19:46:10 UTC
(In reply to Eric Edlund from comment #2)
> I downloaded "FreeStyle 2: Street Basketball" which is a Windows-Only game
> with steam. It's glitchy and broken but the start menu doesn't appear to
> notice when I use swipe gestures. I am unable to find StarCraft 2 or Sonic
> Chrono Adventure on steam. Is there a free steam game I we could both test?

I previously said that Sonic Chrono Adventure is a non-steam game I only used Steam Client's proton to run it. It's free, so you can just look up online for a download link. StarCraft 2 is an Activision Blizzard game so you need Battle.net to install the game but is Free to Play, so you can install it as well. I believe Sims 4 has a Demo you can download to test it
Comment 4 Zamundaaa 2022-06-28 21:06:41 UTC
I tested The Witcher 3 and it crashes with the same error. Not sure what's going on yet, apps are not supposed to get any of the gesture events that KWin uses itself
Comment 5 ryu.ketsueki 2022-06-28 22:38:44 UTC
(In reply to Zamundaaa from comment #4)
> I tested The Witcher 3 and it crashes with the same error. Not sure what's
> going on yet, apps are not supposed to get any of the gesture events that
> KWin uses itself

From what I could see, Wine natively doesn't even have a Wayland driver so everything is running on XWayland. It seems to be the case with Proton as well. My guess is that there is some kind of input from Wayland to XWayland that is causing that crash.
Comment 6 David Edmundson 2022-06-29 16:03:25 UTC
Is the wine application crashing or Xwayland?
Simple test is to open xterm whilst reproducing the issue.
Comment 7 Zamundaaa 2022-06-29 16:45:54 UTC
Xwayland keeps running, is only the app that crashes
Comment 8 Bug Janitor Service 2022-07-13 15:05:45 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/kwin/-/merge_requests/2651
Comment 9 Zamundaaa 2022-07-28 10:23:11 UTC
Git commit 34344c8dc4f66f43d8f8479d192cede35814a6a7 by Xaver Hugl.
Committed on 28/07/2022 at 10:01.
Pushed by zamundaaa into branch 'master'.

input: don't forward gestures used by KWin to applications

If both compositor and applications were to use these gestures at the same
time, that would be quite confusing for the user. This also works around
a bug in Wine that makes applications crash.

M  +49   -16   src/input.cpp

https://invent.kde.org/plasma/kwin/commit/34344c8dc4f66f43d8f8479d192cede35814a6a7
Comment 10 Zamundaaa 2022-07-28 12:15:09 UTC
Git commit 31b13af3612c305fde40ace9c8654402090136a0 by Xaver Hugl.
Committed on 28/07/2022 at 12:15.
Pushed by zamundaaa into branch 'Plasma/5.25'.

input: don't forward gestures used by KWin to applications

If both compositor and applications were to use these gestures at the same
time, that would be quite confusing for the user. This also works around
a bug in Wine that makes applications crash.


(cherry picked from commit 34344c8dc4f66f43d8f8479d192cede35814a6a7)

M  +49   -16   src/input.cpp

https://invent.kde.org/plasma/kwin/commit/31b13af3612c305fde40ace9c8654402090136a0