Bug 376277 - Right clicking on a system tray icon causes keeps focus on the icon even if user has moved elsewhere
Summary: Right clicking on a system tray icon causes keeps focus on the icon even if u...
Status: RESOLVED FIXED
Alias: None
Product: plasmashell
Classification: Plasma
Component: System Tray (show other bugs)
Version: 5.9.1
Platform: Other Linux
: NOR normal
Target Milestone: 1.0
Assignee: Plasma Bugs List
URL:
Keywords:
: 409649 410749 (view as bug list)
Depends on:
Blocks:
 
Reported: 2017-02-10 10:41 UTC by Nikolaos Kakouros
Modified: 2019-08-15 16:54 UTC (History)
12 users (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Nikolaos Kakouros 2017-02-10 10:41:53 UTC
Steps to Reproduce:
1) Right click on an icon in the system tray that provides a context menu (eg not klipper)
2) Open the settings of the plasmoid or press Esc to move the focus elsewhere
3) Lefft-click somewhere in any panel (even on the system tray).

Actual Results:
The dropdown menu (the one that appears with a left click on an icon) of the icon pressed in step 1 appears.

Expected results:
The left-click action of the panel part the user clicked on should happen.
Comment 1 Kai Uwe Broulik 2017-02-10 15:56:16 UTC
Are you really using Plasma 5.9.1? I did a fix that landed there (cf. Bug 375941) but if you're still experiencing this, my fix wasn't good enough.
Comment 2 Kai Uwe Broulik 2017-02-10 15:56:55 UTC
Wrong bug, I was refering to this commit https://cgit.kde.org/plasma-workspace.git/commit/?id=dfdb7296275c2c4bb9eda77982f8ff5663e58e5f (is both in 5.8.6 and 5.9.1)
Comment 3 sparhawk 2017-02-12 23:57:44 UTC
I can confirm this in Arch Linux, Plasma 5.9.1-2.
Comment 4 Joost Bremmer 2017-03-26 22:40:37 UTC
Also seem to still have this problem (plasma-workspace 5.9.4; Arch Linux).
Comment 5 Marco Martin 2017-03-29 11:42:39 UTC
Git commit e20f155190ac4e47bd2a9c1967b79f6e125c95ec by Marco Martin.
Committed on 29/03/2017 at 11:42.
Pushed by mart into branch 'master'.

Setting a sensible minimum size for plasmawindowed

Summary:
plasmawindowed didn't set any minimum size to its window,
so it could be resized unusably small.
it tried to find its attached Layout, but the attached property
object wasn't created.
now set the minimum size by the following heiristics:
* if there is a switchsize, set it to switch to full representation
* then take the full representation minimum size if available and bigger then switch size
* otherwise, set it as SizeEnormous icon size
* in any case, don't let the window be less than that

Test Plan:
tried both an applet that exports a layout and ful lrepresentation (kickoff)
and an applet that wants to stay collapsed (analog clock) kickoff
stays expanded at a reasonable minimum size, the clock can be scaled down
to 128x128

Reviewers: #plasma, broulik

Reviewed By: #plasma, broulik

Subscribers: broulik, plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D5235

M  +1    -0    plasma-windowed/CMakeLists.txt
M  +29   -15   plasma-windowed/plasmawindowedview.cpp
M  +2    -0    plasma-windowed/plasmawindowedview.h

https://commits.kde.org/plasma-workspace/e20f155190ac4e47bd2a9c1967b79f6e125c95ec
Comment 6 Marco Martin 2017-03-29 11:45:59 UTC
commit closed wrong bug, sorry
Comment 7 hal7df 2019-06-30 13:34:45 UTC
I'm experiencing this issue in Plasma 5.16.2, although the behavior is a little different:

- Plasmoids in the system tray that do provide context menus are unaffected
- The user needs to click on one of the context menu items for the bug to occur

Strangely, this was not an issue for me in Plasma 5.13-5.15. Only the update to 5.16 started causing this issue.
Comment 8 Konrad Materka 2019-07-29 09:19:04 UTC
I confirm that with latest Plasma 5.16.3. I found solution, will provide patch later.

Root cause:
System Tray sends two "ContextMenu" events which breaks focus. One is send on mouse pressed, second on mouse clicked. It is leftover from not full reverted patch.
Revert commit:
https://github.com/KDE/plasma-workspace/commit/27b1030756002e91b60ba51483efe9c2c477d16e


Fix:
Remove lines 111-113 from:
https://github.com/KDE/plasma-workspace/blob/master/applets/systemtray/package/contents/ui/items/AbstractItem.qml

Local test:
Edit file and logout/reboot:
/usr/share/plasma/plasmoids/org.kde.plasma.private.systemtray/contents/ui/items/AbstractItem.qml


It will also fix Wine applications, now it is not possible to close context menu by clicking outside of the menu. Sometimes it is not working at all - menu shows, but cannon click on any position.
Surprisingly GTK + xembededsniproxy was working fine (For example XChat). GTK applications ignore first event because mouse state is invalid (pressed), only the second event is handled.
Comment 9 Konrad Materka 2019-07-29 09:23:59 UTC
*** Bug 409649 has been marked as a duplicate of this bug. ***
Comment 10 hal7df 2019-07-31 18:08:47 UTC
(In reply to Konrad Materka from comment #8)
> I confirm that with latest Plasma 5.16.3. I found solution, will provide
> patch later.
> 
> Root cause:
> System Tray sends two "ContextMenu" events which breaks focus. One is send
> on mouse pressed, second on mouse clicked. It is leftover from not full
> reverted patch.
> Revert commit:
> https://github.com/KDE/plasma-workspace/commit/27b1030756002e91b60ba51483efe9c2c477d16e
> 
> 
> Fix:
> Remove lines 111-113 from:
> https://github.com/KDE/plasma-workspace/blob/master/applets/systemtray/package/contents/ui/items/AbstractItem.qml
> 
> Local test:
> Edit file and logout/reboot:
> /usr/share/plasma/plasmoids/org.kde.plasma.private.systemtray/contents/ui/
> items/AbstractItem.qml
> 
> 
> It will also fix Wine applications, now it is not possible to close context
> menu by clicking outside of the menu. Sometimes it is not working at all -
> menu shows, but cannon click on any position.
> Surprisingly GTK + xembededsniproxy was working fine (For example XChat).
> GTK applications ignore first event because mouse state is invalid
> (pressed), only the second event is handled.

Just tried the fix on my machine, and can confirm that it works. Thanks!
Comment 11 Konrad Materka 2019-07-31 20:41:23 UTC
My fix from comment above is not correct - it breaks right click for plasmoids. Improved patch sent for review:
https://phabricator.kde.org/D22804
Comment 12 Nate Graham 2019-08-09 15:14:06 UTC
*** Bug 410749 has been marked as a duplicate of this bug. ***
Comment 13 Nate Graham 2019-08-15 16:54:32 UTC
Git commit 67c1117fa52d43877626ed2d7e3b5cdf02f3e5df by Nate Graham, on behalf of Konrad Materka.
Committed on 15/08/2019 at 16:54.
Pushed by ngraham into branch 'master'.

[System Tray] Do not send ContextMenu signal twice

Summary:
System Tray sends two "ContextMenu" events which breaks focus.
One is send on mouse pressed, second on mouse clicked. As a result
right click on the system tray icon causes focus to lock on the icon.
If later user clicks somewhere else event is send to the first icon.
Related: bug 409768
FIXED-IN: 5.17.0

Test Plan:
The best to test with Skype for Linux with SNI bridge.

To reproduce:
* Right click on the Skype icon, click on menu item (can be Show Skype)
* Right click on any other icon in system tray (or even any other place on the panel)
* Skype menu will appear

After fix:
* Right click on the Skype icon, click on menu item (can be Show Skype)
* Right click on any other icon in system tray (or even any other place on the panel)
* Correct menu should show

Reviewers: #plasma, broulik, davidedmundson

Reviewed By: #plasma, davidedmundson

Subscribers: broulik, apol, plasma-devel, #plasma_workspaces

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D22804

M  +2    -3    applets/systemtray/package/contents/ui/items/AbstractItem.qml
M  +5    -0    applets/systemtray/package/contents/ui/items/PlasmoidItem.qml

https://commits.kde.org/plasma-workspace/67c1117fa52d43877626ed2d7e3b5cdf02f3e5df