Bug 342605

Summary: Notification starting position too high off panel
Product: [Plasma] plasmashell Reporter: enoopt.adams
Component: NotificationsAssignee: Martin Klapetek <mklapetek>
Status: RESOLVED FIXED    
Severity: normal CC: aacid, hrvoje.senjan, kde, nortexoid, ondra, patrick.auernig, tromzy
Priority: NOR    
Version: master   
Target Milestone: 1.0   
Platform: Arch Linux   
OS: Linux   
Latest Commit: Version Fixed In: 5.3.2
Sentry Crash Report:
Attachments: Glitched starting position
Spawning multiple notifications in a row causes them to climb up the screen
Can you guys try this and post the output please?
Output 1
Output 2
Can you please try out this patch?
Misplaced notification
an example with a top panel

Description enoopt.adams 2015-01-08 00:27:29 UTC
Seems to be a regression of the patch for bug 339732. Notifications now start higher than before, about a quarter of the way up the screen instead of right above the panel. Spawning multiple notifications causes the notifications to gradually climb up the screen until they continually spawn in about the right center of the screen.

Reproducible: Always
Comment 1 enoopt.adams 2015-01-08 00:31:06 UTC
Created attachment 90280 [details]
Glitched starting position
Comment 2 enoopt.adams 2015-01-08 00:31:42 UTC
Created attachment 90281 [details]
Spawning multiple notifications in a row causes them to climb up the screen
Comment 3 Martin Klapetek 2015-01-08 11:26:31 UTC
Does it happen always? If you try restarting plasmashell or log out/in? Is it sill at the wrong position?

And is it from the beginning? Or does it work at first?
Comment 4 enoopt.adams 2015-01-08 17:11:00 UTC
Restarting plasmashell temporarily fixes the problem, but the bug came back after I spawned a bunch of notifications. What happens is that the notifications will be in the correct position above the panel, but occasionally they will start to climb up the screen when more than one is spawned. I spawned enough so that they climbed up to about half the screen hight, (same place as in the second attached picture) then after closing all notifications, if another notification spawns, it's in the incorrect position as shown in the first attachment. The bug persists until plasmashell is restarted.
Comment 5 Martin Klapetek 2015-01-08 17:25:22 UTC
I've tested this with 200 notifications coming from 6 terminals at once, still behaves properly. I really wonder what snaps in your case. The only thing I can think of is wrong screen size being passed to the applet.

Is this on a real hardware or virtualbox? Can you also give me output of 
$ xrandr -q | grep " connected"
Comment 6 enoopt.adams 2015-01-08 17:26:57 UTC
Real hardware. Output is "eDP1 connected 1920x1080+0+0 (normal left inverted right x axis y axis) 500mm x 281mm"
Comment 7 Martin Klapetek 2015-01-08 17:28:38 UTC
Are you able to test patches?
Comment 8 enoopt.adams 2015-01-08 17:30:06 UTC
Sure
Comment 9 Hrvoje Senjan 2015-01-09 16:36:37 UTC
a 'me too' comment, with a top panel
Comment 10 Martin Klapetek 2015-01-09 16:50:19 UTC
Created attachment 90303 [details]
Can you guys try this and post the output please?

It just adds bunch of qdebugs, so apply, rebuild and restart plasmashell from konsole, then spawn couple notifications (for i in {1..10}; do notify-send hello$i; done --should do) and post the debug output please.
Comment 11 enoopt.adams 2015-01-09 21:41:45 UTC
Created attachment 90307 [details]
Output 1

This output is when the bug was not occurring, I'll try and get the bug to occur and post another output. The bug doesn't always occur. Spawning tons of notifications without delay doesn't seem to cause it. If I spawn 10 notifications rapidly, then wait till they all despawn, then spawn ten more and repeat, it will occur seemingly randomly after the fourth notification is spawned on one of the series.
Comment 12 enoopt.adams 2015-01-09 21:51:58 UTC
Created attachment 90308 [details]
Output 2

Problem was occurring here
Comment 13 Martin Klapetek 2015-01-09 22:19:55 UTC
That's what puzzles me, how can it be that random :S

Thanks for the outputs, I'll have a look.
Comment 14 Martin Klapetek 2015-01-15 17:11:42 UTC
Ok I finally know what's wrong. No idea how it happens yet but I know what's up.

Hopefully fix will follow shorty \o/
Comment 15 Martin Klapetek 2015-01-15 17:54:57 UTC
Created attachment 90433 [details]
Can you please try out this patch?

This should fix it for good. Hopefully.
Comment 16 enoopt.adams 2015-01-16 06:58:52 UTC
Seems to fix the problem. I haven't been able to reproduce the bug, but I couldn't reliably reproduce it before. I've spawned hundreds of notifications in the same random patterns as before and the bug doesn't show up.
Comment 17 Martin Klapetek 2015-01-16 11:09:20 UTC
Git commit 20e4064f1ec582b9aacc8d6659efd57fe8c0df7e by Martin Klapetek.
Committed on 16/01/2015 at 11:09.
Pushed by mklapetek into branch 'Plasma/5.2'.

[notifications] Fix notification popups sometimes being misplaced

There were situations when the same notification popup could be be
inserted twice into the available popups list, breaking the positioning
as it would create more notifications than it was able to but they would
never get closed and would offset the whole stack.

One of such scenarios was when user manually closed the popup with the
close button. After it was hidden, the hiding timer still went on to
fire and close it again, causing the above.

Should be all fixed now.

M  +4    -2    applets/notifications/package/contents/ui/NotificationPopup.qml
M  +5    -2    applets/notifications/plugin/notificationshelper.cpp

http://commits.kde.org/plasma-workspace/20e4064f1ec582b9aacc8d6659efd57fe8c0df7e
Comment 18 Hrvoje Senjan 2015-01-16 19:40:56 UTC
still it happens after the patch =(
for quite some time it looked good, but after a while notifications again started to appear too low
Comment 19 Martin Klapetek 2015-01-16 20:18:47 UTC
Can you give me the output with the patch from comment #10?
Comment 20 Hrvoje Senjan 2015-01-17 18:54:51 UTC
i'll provide it if it comes back... 
(/me rebuilt master, but the fix was only in 5.2 branch so-far; and the recompile overwritten your locally applied patch - d'oh!)
Comment 21 Martin Klapetek 2015-02-17 20:05:53 UTC
*** Bug 344291 has been marked as a duplicate of this bug. ***
Comment 22 tromzy 2015-03-04 16:00:18 UTC
Created attachment 91422 [details]
Misplaced notification
Comment 23 tromzy 2015-03-04 16:00:39 UTC
I can confirm this bug too on Plasma 5.2.0 / 5.2.1.
Comment 24 Martin Klapetek 2015-03-04 16:04:46 UTC
Can you provide a series of steps leading to that? Also, are you able to apply patches?
Comment 25 tromzy 2015-03-04 16:06:55 UTC
Sorry, I don't know how to patch my system... But, it seems (I'm not sure though) that it is related to something else : today it started to happen after a notification did not close automatically ; I had to close it with the cross icon on the popup. After that, the misplaced notification bug started. Coincidence ? Or related ?
Comment 26 tromzy 2015-03-04 16:08:28 UTC
But I see in one of your earlier posts that you already noticed that.
Comment 27 Patrick Auernig 2015-04-30 18:59:38 UTC
Created attachment 92346 [details]
an example with a top panel
Comment 28 Patrick Auernig 2015-04-30 19:02:24 UTC
Comment on attachment 92346 [details]
an example with a top panel

Using Plasma 5.3 on Arch Linux x86_64, 4.0.1 kernel
Comment 29 Martin Klapetek 2015-05-01 12:34:51 UTC
Patrick - do you have a set of reproducible steps for that?
Comment 30 Patrick Auernig 2015-05-01 12:41:34 UTC
(In reply to Martin Klapetek from comment #29)
> Patrick - do you have a set of reproducible steps for that?

Steps to reproduce:
1. Start plasmashell
2. Make a notification appear
3. Close the notification manually
4. Next time a notification appears it will be misplaced

terminating and restarting plasmashell fixes that
Comment 31 Martin Klapetek 2015-05-01 12:56:15 UTC
Git commit 83ec35b632ee495df4b3c6f33f7ca33bca398a8f by Martin Klapetek.
Committed on 01/05/2015 at 12:51.
Pushed by mklapetek into branch 'Plasma/5.3'.

[notifications] Always check first if the dispatch timer isn't running already

That should prevent various mis-queueings. If the timer is running, the
queue will get processed once the timer times out.

M  +20   -5    applets/notifications/plugin/notificationshelper.cpp

http://commits.kde.org/plasma-workspace/83ec35b632ee495df4b3c6f33f7ca33bca398a8f
Comment 32 Martin Klapetek 2015-05-01 12:56:16 UTC
Git commit af3081abe2337c691cd2d310951ffd20f21da00d by Martin Klapetek.
Committed on 01/05/2015 at 12:54.
Pushed by mklapetek into branch 'Plasma/5.3'.

[notifications] Clear notification from show queue if it's closed before it's shown

It can happen that a notification is placed in the show queue and then
it's closed (eg. programatically) before it was even shown. In this case
the notification must be cleared from the show queue otherwise it will
get displayed and hidden but the popup is never freed for reuse,
resulting in notificaions starting at higher position from the panel.

M  +16   -0    applets/notifications/plugin/notificationshelper.cpp

http://commits.kde.org/plasma-workspace/af3081abe2337c691cd2d310951ffd20f21da00d
Comment 33 Martin Klapetek 2015-05-01 12:57:01 UTC
Ok, the fix should come with Plasma 5.3.1, please reopen if the problem still persists.

Thank you.
Comment 34 Martin Klapetek 2015-05-01 12:57:41 UTC
Git commit 08415c47d9c3c6a322b4fcd8403fc275b8f0ade2 by Martin Klapetek.
Committed on 01/05/2015 at 12:57.
Pushed by mklapetek into branch 'master'.

[notifications] Always check first if the dispatch timer isn't running already

That should prevent various mis-queueings. If the timer is running, the
queue will get processed once the timer times out.

M  +20   -5    applets/notifications/plugin/notificationshelper.cpp

http://commits.kde.org/plasma-workspace/08415c47d9c3c6a322b4fcd8403fc275b8f0ade2
Comment 35 Martin Klapetek 2015-05-01 12:57:42 UTC
Git commit e1388789ffc5239587f88ec29bc0fa83bbeadfa3 by Martin Klapetek.
Committed on 01/05/2015 at 12:57.
Pushed by mklapetek into branch 'master'.

[notifications] Clear notification from show queue if it's closed before it's shown

It can happen that a notification is placed in the show queue and then
it's closed (eg. programatically) before it was even shown. In this case
the notification must be cleared from the show queue otherwise it will
get displayed and hidden but the popup is never freed for reuse,
resulting in notificaions starting at higher position from the panel.

M  +16   -0    applets/notifications/plugin/notificationshelper.cpp

http://commits.kde.org/plasma-workspace/e1388789ffc5239587f88ec29bc0fa83bbeadfa3
Comment 36 Patrick Auernig 2015-05-27 10:18:20 UTC
Still happening in version 5.3.1 on Arch Linux x86_64
Comment 37 Hrvoje Senjan 2015-05-27 10:27:08 UTC
As Martin confirmed recently on IRC, the issue is still happening after dismissing/closing job notifications
Comment 38 Martin Klapetek 2015-05-27 14:01:54 UTC
Yes, unfortunately so.

The reason being that the job notifications completely circumvent all the notification routines and display directly, so when you close it, the system responsible for the positioning the popups has no idea what you just closed because it does not know it even existed in the first place.
Comment 39 Martin Klapetek 2015-05-28 15:33:57 UTC
Git commit a12bb76502952749c069b9ab70ac61ee1353079b by Martin Klapetek.
Committed on 28/05/2015 at 15:33.
Pushed by mklapetek into branch 'Plasma/5.3'.

Reuse the existing Notify method for Notification's DataEngine createNotification call

REVIEW: 123923
FIXED-IN: 5.3.2

M  +13   -12   applets/notifications/package/contents/ui/Jobs.qml
M  +7    -0    applets/notifications/package/contents/ui/Notifications.qml
M  +3    -3    dataengines/notifications/notificationaction.cpp
M  +4    -1    dataengines/notifications/notifications.operations
M  +5    -13   dataengines/notifications/notificationsengine.cpp
M  +2    -1    dataengines/notifications/notificationsengine.h

http://commits.kde.org/plasma-workspace/a12bb76502952749c069b9ab70ac61ee1353079b
Comment 40 Michael D 2015-11-29 09:18:26 UTC
I'm on Plasma 5.4.3 and on two of my systems, this bug has just showed its ugly face. If I restart plasmashell it goes away for a bit but then comes back. Could it depend on the plasma theme because I'm not using Breeze, the default?
Comment 41 Ondřej Hruška 2016-09-16 08:57:31 UTC
Plasma 5.7.5 (on Arch), this bug still occurs. Is there anything I can try to get rid of it? 
Also it probably should be re-opened.