Bug 358589

Summary: Regression: Left click on system tray icon is not seen under XFCE (KDE 4.14 works)
Product: [Frameworks and Libraries] frameworks-knotifications Reporter: David Jarvie <djarvie>
Component: generalAssignee: Martin Klapetek <mklapetek>
Status: RESOLVED FIXED    
Severity: normal CC: darose, kdelibs-bugs, rdieter
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed In: 5.21.0
Sentry Crash Report:
Bug Depends on:    
Bug Blocks: 356519    
Attachments: Bustle log for KAlarm version 14.4
Bustle log for KAlarm version 15.12
Patch

Description David Jarvie 2016-01-26 13:36:18 UTC
Using XFCE 4.10 desktop, a left click on a system tray icon is not seen for a KDE application (version 15.12) using frameworks 5.17. Running the same application (version 4.14) under the same XFCE login session, the left click works. See https://bugs.kde.org/show_bug.cgi?id=356519 for more details.

I added debug output into KStatusNotifierItem, and verified that it does not emit the activateRequested() signal in frameworks 5.17, because the KStatusNotifierItem::activate() method never got called. It did emit the signal in KDE 4.14. I couldn't identify any differences in the KStatusNotifierItem class between 4.14 and 5.17 which might account for why it functions differently, so perhaps it's due to changes in some other class.

Reproducible: Always
Comment 1 Martin Klapetek 2016-01-26 14:46:11 UTC
Thanks for the report

The click handling is done by the container (the SNI host) iirc. Have you actually
tested the same app in the same XFCE session yourself? It's not clear from the
other bug report.

Nevertheless, can you please try running Bustle, start recording new log and
then click on the old icon and then click on the new icon after couple seconds
delay and then stop recording and then attach the log here please.

Thank you
Comment 2 David Jarvie 2016-01-26 15:27:16 UTC
Created attachment 96853 [details]
Bustle log for KAlarm version 14.4

I did personally test both versions of the application in the same XFCE session before reporting this bug.

I can't run the two versions of the app at the same time, because it's a KUniqueApplication. Instead, I ran one version, started the Bustle recording, clicked a couple of times on the system tray icon, and then stopped the Bustle log. I then repeated this for the other version.
Comment 3 David Jarvie 2016-01-26 15:27:50 UTC
Created attachment 96854 [details]
Bustle log for KAlarm version 15.12
Comment 4 David Jarvie 2016-01-26 15:28:51 UTC
.
Comment 5 Martin Klapetek 2016-01-26 15:37:02 UTC
Ah, I think I understand now. XFCE does not have a SNI support, does it?
That means it is actually using QSystemTrayIcon as the backend. This may
also be QSystemTrayIcon issue and/or how the KStatusNotifierItem interacts
with it.

I'll have a look, maybe I'll spot something obvious.
Comment 6 Martin Klapetek 2016-01-26 18:21:18 UTC
Ok I think I may have spotted something, are you able to test patches to knotifications framework?
Comment 7 David Jarvie 2016-01-26 22:15:30 UTC
I can test patches, as long as they can be applied to KF 5.17 (I'm not running master).
Comment 8 Martin Klapetek 2016-02-17 23:54:51 UTC
Created attachment 97272 [details]
Patch

Ok here's a patch. It should work against 5.17 too.

Let me know if this does anything useful.
Comment 9 David Jarvie 2016-02-21 00:15:58 UTC
I tried the patch, but it doesn't make any difference to left clicks on the system tray icon. The signal activateRequested() is still not received by the application on left click. It is however received when Minimize/Restore are selected from the system tray icon context menu (the same as without the patch).
Comment 10 David Jarvie 2016-02-21 00:21:40 UTC
Sorry, please ignore my last comment - I built the wrong branch.

In fact, the patch does fix the issue - a left click on the system tray icon works correctly with the patch.
Comment 11 David Jarvie 2016-03-09 23:22:13 UTC
On Wednesday 17 Feb 2016 23:54:51 you wrote:
> https://bugs.kde.org/show_bug.cgi?id=358589
> 
> --- Comment #8 from Martin Klapetek <mklapetek@kde.org> ---
> Created attachment 97272 [details]
>   --> https://bugs.kde.org/attachment.cgi?id=97272&action=edit
> Patch
> 
> Ok here's a patch. It should work against 5.17 too.
> 
> Let me know if this does anything useful.

I tested your patch, which worked successfully (see my comment in Bugzilla 
https://bugs.kde.org/show_bug.cgi?id=358589#c10). Can you commit it 
(presumably after a ReviewBoard review), so that things work for XFCE users?

Thanks,
Comment 12 Rex Dieter 2016-03-24 14:53:01 UTC
My findings testing this patch with pidgin running on plasma-5.5.5:

* stock pidgin systray icon reacts to left click now
* pidgin-indicator icon (which presumably uses SNI), does nothing on left click
Comment 13 Martin Klapetek 2016-03-31 02:50:32 UTC
Git commit dae4401f6d85c22074b3160cc3ae33b91d986468 by Martin Klapetek.
Committed on 31/03/2016 at 02:47.
Pushed by mklapetek into branch 'master'.

Handle left-button clicking on legacy systray icons

As reported in https://bugs.kde.org/show_bug.cgi?id=358589 the left
click is not handled when SNI host is not present and the legacy icon is
used.

This adds handling of the left button.

REVIEW: 127452

M  +2    -0    src/kstatusnotifieritem.cpp

http://commits.kde.org/knotifications/dae4401f6d85c22074b3160cc3ae33b91d986468
Comment 14 David Jarvie 2016-04-09 12:22:19 UTC
This has been fixed in KDE Frameworks 5.21.