The network management icon is repainted quite often when a wireless connection is the default connection, ~2-3 times every few seconds. My guess is that changes in wireless signal strength cause the repaint. Note that the icon itself does not change. This has a negative effect on laptop battery time. Reproducible: Always Steps to Reproduce: 1. Connect to a wireless network. 2. Activate the "Show paint area" kwin effect. 3. Wait a few second.
I activated the "Show paint" effect and the systray icon does not repaint that often here. Actually it only repaint when changing the signal strengh, which does not happen that often either. The Konversation icon is the one that repaints very often here. Maybe it depends on the GPU ou have.
The repaints match the changes in signal strength here as well (checked using dbus-monitor). The problem is that those changes happen every ~2 seconds on my system (maybe that interval depends on the wifi driver). The real problem is that the icon gets repainted even though it doesn't actually change - most changes in signal strength don't result in a change of icon. If the icon stays the same, this should not result in a repaint, however.
Created attachment 71772 [details] Do not update systray if not needed. Please try this patch and see if it solves this problem.
Git commit 088e25f575b36e9542c11f19d205f35c27ec0a29 by Lamarque V. Souza. Committed on 12/06/2012 at 21:00. Pushed by lvsouza into branch 'master'. Do not unnecessarily update the systray icon to prevent undesired repaints. M +22 -13 applet/networkmanager.cpp M +2 -0 applet/networkmanager.h http://commits.kde.org/networkmanagement/088e25f575b36e9542c11f19d205f35c27ec0a29
Git commit ad39b3b977ee3a4925573c101fa530c2d2d99cd9 by Lamarque V. Souza. Committed on 12/06/2012 at 21:00. Pushed by lvsouza into branch 'nm09'. Do not unnecessarily update the systray icon to prevent undesired repaints. M +13 -3 applet/networkmanager.cpp M +2 -0 applet/networkmanager.h http://commits.kde.org/networkmanagement/ad39b3b977ee3a4925573c101fa530c2d2d99cd9
Git commit 0dd41b1c9c73382e6e952047b9031c554fde62d5 by Lamarque V. Souza. Committed on 13/06/2012 at 00:10. Pushed by lvsouza into branch 'master'. Update systray icon when required. M +48 -2 applet/networkmanager.cpp M +13 -0 applet/networkmanager.h http://commits.kde.org/networkmanagement/0dd41b1c9c73382e6e952047b9031c554fde62d5
Git commit 087fbd918c89867458f147807c1c30ecaf61f36a by Lamarque V. Souza. Committed on 13/06/2012 at 00:10. Pushed by lvsouza into branch 'nm09'. Update systray icon when required. M +48 -2 applet/networkmanager.cpp M +13 -0 applet/networkmanager.h http://commits.kde.org/networkmanagement/087fbd918c89867458f147807c1c30ecaf61f36a
Git commit cf1dfc2636a7dce9f31e3b6c9e4ad3a92ae2e188 by Lamarque V. Souza. Committed on 13/06/2012 at 00:22. Pushed by lvsouza into branch 'master'. Small optimization. M +0 -8 applet/networkmanager.cpp http://commits.kde.org/networkmanagement/cf1dfc2636a7dce9f31e3b6c9e4ad3a92ae2e188
Git commit 5047db0d97d00ca802fcdf1c4645a73bfc6851ed by Lamarque V. Souza. Committed on 13/06/2012 at 00:22. Pushed by lvsouza into branch 'nm09'. Small optimization. (cherry picked from commit cf1dfc2636a7dce9f31e3b6c9e4ad3a92ae2e188) M +0 -8 applet/networkmanager.cpp http://commits.kde.org/networkmanagement/5047db0d97d00ca802fcdf1c4645a73bfc6851ed
I retried using nm09 branch. Unfortunately, the problem is not completely gone, it just went from "a bunch of repaints per signal change" to "one repaint per signal change".
If the ap's signal strength changes the icon then I need to update the icon, so there is nothing more I can do about this problem. Unless you want me to add an option to use a static icon like the one for wired connections. That way the icon will never change (at least not until the connection changes or an overlay must be applied).
There seems to be a misunderstanding. There is still one repaint per signal strength change even though the icon itself doesn't change.
Git commit 3e3c88ad00226b40cf50dd47106ee383c17f1da9 by Lamarque V. Souza. Committed on 14/06/2012 at 17:40. Pushed by lvsouza into branch 'master'. Avoid unneeded repaints when updating systray overlay. M +6 -1 applet/networkmanager.cpp http://commits.kde.org/networkmanagement/3e3c88ad00226b40cf50dd47106ee383c17f1da9
Git commit 822f45632632dd90b43751aa281f60572e11375f by Lamarque V. Souza. Committed on 14/06/2012 at 17:40. Pushed by lvsouza into branch 'nm09'. Avoid unneeded repaints when updating systray overlay. (cherry picked from commit 3e3c88ad00226b40cf50dd47106ee383c17f1da9) M +6 -1 applet/networkmanager.cpp http://commits.kde.org/networkmanagement/822f45632632dd90b43751aa281f60572e11375f
There's something wrong with repaints now. With the latest changes there are no repaints anymore, even when the signal strength crosses the 70% limit (checked by running dbus-monitor --system in parallel). The new icon only gets painted when I click on the icon to open/close the widget.
Well, here it works for me. When my wifi ap changes the signal strength the systray icon changes here (when it should) and is painted correctly. Notice that the icon only changes if the signal strength crosses the limits: 13 | 30 | 50 | 70 | 90. For instance, if the signal strength changes from 89 to 70 the icon stays the same. The last commit just avoids calling QGraphicsWidget::update() when there is no change in the system tray's overlay icon. The commit does not affect the signal strengh icon per si, only the overlay icon.
It seems to be working Ok here. I will close this bug.
Comment #15 still seems to be present, I'll open a new bug for that one later.
I prefer not to add a new bug entry if it is regression caused by change to fix this bug. Anyway, the icon is correctly updated here, have you read my comment #16? The icon does not change all the time, only when the signal strengh transpass one of the values I wrote in comment #16. If the signal strengtt is in beetween 70 and 89 then the icon is not going to change, that is the correct behaviour.
I've read comment #16, that's not the problem. My signal strength passes 70% quite often (I verified this via dbus-monitor). However, after adding some debug info, it looks like paintInterface is not called when the access point signal strength changes, but when I click on the icon. (Any chance only the 0.9 branch is affected?)
This part of the source code is the same for master and nm09 branches. I have just checked here and the icon changes here for nm09 as well.
A hunch: I have the feeling the wireless icon gets repainted when the mobile broadband signal strength changes, will do some proper testing later.