From 77e6e9920938f44b3808b6a9af5ce820fdbacbc1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Tue, 17 Feb 2015 14:09:53 +0100 Subject: [PATCH] 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 --- group.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/group.cpp b/group.cpp index 0be70f69c5..067fa70145 100644 --- a/group.cpp +++ b/group.cpp @@ -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); }