Bug 448050

Summary: cannot restore Gtk2 application from tray On wayland
Product: [Plasma] plasmashell Reporter: Svyatoslav Timofeev <timofeevsv1989>
Component: XembedSNIProxyAssignee: Plasma Bugs List <plasma-bugs>
Status: RESOLVED FIXED    
Severity: normal CC: ahmed.com, bugseforuns, materka, nate, qydwhotmail, ryu.ketsueki
Priority: NOR Keywords: wayland
Version: 5.23.4   
Target Milestone: 1.0   
Platform: Manjaro   
OS: Linux   
See Also: https://bugs.kde.org/show_bug.cgi?id=456168
Latest Commit: Version Fixed In: 5.27
Sentry Crash Report:

Description Svyatoslav Timofeev 2022-01-07 10:13:54 UTC
SUMMARY
***
cannot restore Gtk2 application from tray (Tixati) on wayland
***


STEPS TO REPRODUCE
1. Open Tixati
2. Set "Close to tray"
3. Close
4. You cannot restore its window from tray icon

OBSERVED RESULT
Cannot restore Tixati window from tray icon on wayland

EXPECTED RESULT
Normal X11 behavior

SOFTWARE/OS VERSIONS

Linux/KDE Plasma: Manjaro Testing, Plasma 5.23.4

KDE Plasma Version: 5.23.4
KDE Frameworks Version: 5.89.0
Qt Version: 5.15.2
Comment 1 Nate Graham 2022-01-12 17:28:52 UTC
Can reproduce with Hexchat.
Comment 2 Konrad Materka 2022-01-12 21:30:50 UTC
Is right click working?

Can you share logs when xembedsniproxy is run with debug logging enabled? You can run it from console:

killall xembedsniproxy; QT_LOGGING_RULES="kde.xembedsniproxy=true" xembedsniproxy

With NVIDIA card I had no luck running Wayland (so far)
Comment 3 Nate Graham 2022-01-13 17:53:22 UTC
It's not working. Here's the output:

kde.xembedsniproxy: Received click 3 with passed x*y 8 678
kde.xembedsniproxy: Received click 3 with passed x*y 8 678
kde.xembedsniproxy: Received click 3 with passed x*y 9 678
kde.xembedsniproxy: Received click 3 with passed x*y 9 678
kde.xembedsniproxy: Received click 1 with passed x*y 33 686
kde.xembedsniproxy: Received click 3 with passed x*y 27 691
kde.xembedsniproxy: Received click 3 with passed x*y 25 691
kde.xembedsniproxy: Received click 3 with passed x*y 25 688
kde.xembedsniproxy: Received click 3 with passed x*y 25 688
kde.xembedsniproxy: Received click 3 with passed x*y 25 688
Comment 4 Konrad Materka 2022-01-23 21:30:49 UTC
I still can't run Wayland, but maybe this is a good workaround:

killall xembedsniproxy; wmsystemtray --non-wmaker --bgcolor white

This will show XEmbed tray icons in a separate window. All modern tray items (SNI) will work as currently, unimpacted.
Comment 5 Patrick Silva 2022-05-16 16:53:04 UTC
Can reproduce with Tixati 2.89 torrent client. Even right-click does not work while Tixati is closed in system tray.
And when Tixati window is focused, right clicks on its systray icon do no work consistently. I need to position mouse pointer in specific positions to right-click to work. Very annoying.

Operating System: Arch Linux
KDE Plasma Version: 5.24.5
KDE Frameworks Version: 5.94.0
Qt Version: 5.15.4
Graphics Platform: Wayland
Comment 6 Nate Graham 2022-08-01 19:02:53 UTC
*** Bug 457376 has been marked as a duplicate of this bug. ***
Comment 7 ryu.ketsueki 2022-08-18 17:56:27 UTC
I noticed this issue happening with many Wine applications as well. I could open a bug report on their side to see if this deprecated proxy can be replaced with a new one but I'm not sure what exactly needs to be done so it can be fixed on Wine's side. The workaround won't work with me because wmsystemtray is not in the repos of my current distro.
Comment 9 Fushan Wen 2023-01-27 18:03:51 UTC
Git commit 033b9dd14c6c807990f780858e543ad8eec0e913 by Fushan Wen.
Committed on 27/01/2023 at 15:37.
Pushed by fusionfuture into branch 'master'.

applets/systemtray: fix xembed icon not receiving click events when screen scale > 1 on Wayland

On Wayland, when using "Scaled by application", mapToGlobal will return a scaled position
which is unusable in SNIProxy::sendClick. This fixes the bug by
multiplying the position  by devicePixelRatio.
Related: bug 456168
FIXED-IN: 5.27

M  +10   -0    CMakeLists.txt
M  +14   -0    applets/systemtray/CMakeLists.txt
M  +120  -8    applets/systemtray/systemtray.cpp
M  +11   -0    applets/systemtray/systemtray.h
A  +1    -0    config-WaylandProtocols.h.cmake

https://invent.kde.org/plasma/plasma-workspace/commit/033b9dd14c6c807990f780858e543ad8eec0e913
Comment 10 Fushan Wen 2023-01-27 21:43:14 UTC
Git commit 46cb1454335cd20b5ce705ed3c1205843119055b by Fushan Wen.
Committed on 27/01/2023 at 21:43.
Pushed by fusionfuture into branch 'cherry-pick-033b9dd1'.

applets/systemtray: fix xembed icon not receiving click events when screen scale > 1 on Wayland

On Wayland, when using "Scaled by application", mapToGlobal will return a scaled position
which is unusable in SNIProxy::sendClick. This fixes the bug by
multiplying the position  by devicePixelRatio.
Related: bug 456168
FIXED-IN: 5.27


(cherry picked from commit 033b9dd14c6c807990f780858e543ad8eec0e913)

M  +10   -0    CMakeLists.txt
M  +14   -0    applets/systemtray/CMakeLists.txt
M  +120  -8    applets/systemtray/systemtray.cpp
M  +11   -0    applets/systemtray/systemtray.h
A  +1    -0    config-WaylandProtocols.h.cmake

https://invent.kde.org/plasma/plasma-workspace/commit/46cb1454335cd20b5ce705ed3c1205843119055b
Comment 11 Nate Graham 2023-02-02 22:06:06 UTC
*** Bug 457376 has been marked as a duplicate of this bug. ***
Comment 12 Patrick Silva 2023-02-15 18:14:48 UTC
This bug is not completely solved with Tixati and Hexchat. Nothing happens most the times I click on their systray icons.

Operating System: Arch Linux 
KDE Plasma Version: 5.27.0
KDE Frameworks Version: 5.103.0
Qt Version: 5.15.8
Graphics Platform: Wayland
Comment 13 Fushan Wen 2023-02-15 18:17:07 UTC
Can confirm. Happens on Wayland because the window is not properly lowered. Please report a new bug.