Use NETWinInfo overload for icons in Group::icon

Reduces number of possible roundtrips by fetching the NETWinInfo for
the leader_wid once and passing it to KWindowSystem::icon. This way
the NETWinInfo can be shared for all sizes instead of having
KWindowSystem::icon create a new instance with roundtrips for each
size.

REVIEW: 122605
This commit is contained in:
Martin Gräßlin 2015-02-17 14:09:53 +01:00
parent 6a4070155f
commit 77e6e99209

View file

@ -223,8 +223,9 @@ QIcon Group::icon() const
return leader_client->icon();
else if (leader_wid != None) {
QIcon ic;
auto readIcon = [&ic, this](int size, bool scale = true) {
const QPixmap pix = KWindowSystem::icon(leader_wid, size, size, scale, KWindowSystem::NETWM | KWindowSystem::WMHints);
NETWinInfo info(connection(), leader_wid, rootWindow(), NET::WMIcon, NET::WM2IconPixmap);
auto readIcon = [&ic, &info, this](int size, bool scale = true) {
const QPixmap pix = KWindowSystem::icon(leader_wid, size, size, scale, KWindowSystem::NETWM | KWindowSystem::WMHints, &info);
if (!pix.isNull()) {
ic.addPixmap(pix);
}