Bug 421275

Summary: Context menu of systray icon is misplaced
Product: [Plasma] plasmashell Reporter: Patrick Silva <bugseforuns>
Component: System TrayAssignee: Plasma Bugs List <plasma-bugs>
Status: RESOLVED FIXED    
Severity: normal CC: jjm, kde, materka, nate, woat
Priority: NOR    
Version: 5.18.90   
Target Milestone: 1.0   
Platform: Neon   
OS: Linux   
Latest Commit: Version Fixed In: 5.18.6, 5.19.3, 5.20
Sentry Crash Report:
Attachments: screenshot

Description Patrick Silva 2020-05-10 12:00:51 UTC
Created attachment 128331 [details]
screenshot

STEPS TO REPRODUCE
1. open kmail
2. right-click on its systray icon
3. dismiss the context menu of systray icon
4. right-click on the systray icon of kmail again

OBSERVED RESULT
misplaced context menu, see the attached screenshot please.

EXPECTED RESULT
context menu should always open in correct position

SOFTWARE/OS VERSIONS
Operating System: KDE neon Unstable Edition
KDE Plasma Version: 5.18.80
KDE Frameworks Version: 5.70.0
Qt Version: 5.14.2
Comment 1 Konrad Materka 2020-06-18 12:47:32 UTC
KMail menu fully reloads on each show. All actions are removed and added again. For a short moment it has twice as much items. In that moment size of the menu is twice as big and as a results is wrongly positioned. 

Regression introduced in fix for Bug 399975.
Comment 2 Bug Janitor Service 2020-06-22 07:12:29 UTC
A possibly relevant merge request was started @ https://invent.kde.org/pim/kmail/-/merge_requests/1
Comment 3 Jonathan Marten 2020-06-22 07:15:16 UTC
Fix submitted as https://invent.kde.org/pim/kmail/-/merge_requests/1
Comment 4 Konrad Materka 2020-06-22 21:18:04 UTC
Jonathan, thank you for the fix, it will definitely help for KMail, but this is a bigger problem.

There is a regression introduced in:
https://phabricator.kde.org/D16297

That change is needed, but introduces new problems. I will try to investigate it further.
Comment 5 Bug Janitor Service 2020-06-22 22:08:45 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/plasma-workspace/-/merge_requests/111
Comment 6 Jonathan Marten 2020-06-23 05:02:25 UTC
Git commit ad286a0a61dabe9b7604385d04e6c58710375a04 by Jonathan Marten.
Committed on 22/06/2020 at 07:08.
Pushed by mlaurent into branch 'master'.

Do not clear and recreate the system tray popup menu every time

Just update the "New Messages In" submenu, or disable it if there are no
new messages.  Avoids the menu popping up at the wrong screen position.

M  +21   -16   src/kmsystemtray.cpp
M  +1    -0    src/kmsystemtray.h

https://invent.kde.org/pim/kmail/commit/ad286a0a61dabe9b7604385d04e6c58710375a04
Comment 7 Konrad Materka 2020-06-29 18:33:40 UTC
Git commit c3254912ea916bf3cc6b215e196f41a61d764e82 by Konrad Materka.
Committed on 29/06/2020 at 18:30.
Pushed by kmaterka into branch 'master'.

[applets/systemtray] Fix context menu misplaced

For SNI icons menu is imported from DBus. If during import it is
changed, for example some actions added or replaced, new actions are
added, but old one are only marked for removal in next event loop run.
As a result menu size is too big until delereLater takes effect.
Queue connection, so that Qt will have a chance to delete menu entires
before menu is used.
FIXED-IN: 5.20

M  +2    -1    dataengines/statusnotifieritem/statusnotifieritemjob.cpp

https://invent.kde.org/plasma/plasma-workspace/commit/c3254912ea916bf3cc6b215e196f41a61d764e82
Comment 8 Konrad Materka 2020-06-29 20:51:28 UTC
*** Bug 423603 has been marked as a duplicate of this bug. ***
Comment 9 Konrad Materka 2020-06-30 08:26:09 UTC
Git commit a409b06bbfb0ea10959d9f680ea1ef16e7b7827a by Konrad Materka.
Committed on 30/06/2020 at 08:25.
Pushed by kmaterka into branch 'Plasma/5.18'.

[applets/systemtray] Fix context menu misplaced

For SNI icons menu is imported from DBus. If during import it is
changed, for example some actions added or replaced, new actions are
added, but old one are only marked for removal in next event loop run.
As a result menu size is too big until delereLater takes effect.
Queue connection, so that Qt will have a chance to delete menu entires
before menu is used.
FIXED-IN: 5.18.6

M  +2    -1    dataengines/statusnotifieritem/statusnotifieritemjob.cpp

https://invent.kde.org/plasma/plasma-workspace/commit/a409b06bbfb0ea10959d9f680ea1ef16e7b7827a
Comment 10 Konrad Materka 2020-06-30 08:27:09 UTC
Git commit 35ae7712d40a937e6e03e88376e5a1436ebdf60e by Konrad Materka.
Committed on 30/06/2020 at 08:26.
Pushed by kmaterka into branch 'Plasma/5.19'.

[applets/systemtray] Fix context menu misplaced

For SNI icons menu is imported from DBus. If during import it is
changed, for example some actions added or replaced, new actions are
added, but old one are only marked for removal in next event loop run.
As a result menu size is too big until delereLater takes effect.
Queue connection, so that Qt will have a chance to delete menu entires
before menu is used.
FIXED-IN: 5.19.3

M  +2    -1    dataengines/statusnotifieritem/statusnotifieritemjob.cpp

https://invent.kde.org/plasma/plasma-workspace/commit/35ae7712d40a937e6e03e88376e5a1436ebdf60e