Only remove + announce if leader change actually occured, avoid excessive loop.

Reviewers: #plasma, graesslin

Subscribers: plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D4652
wilder-5.14
Eike Hein 9 years ago
parent b82d364536
commit ee9f966dd5
  1. 19
      libtaskmanager/xwindowtasksmodel.cpp

@ -307,24 +307,19 @@ void XWindowTasksModel::Private::transientChanged(WId window, NET::Properties pr
const KWindowInfo info(window, NET::WMState | NET::XAWMState, NET::WM2TransientFor); const KWindowInfo info(window, NET::WMState | NET::XAWMState, NET::WM2TransientFor);
if (info.hasState(NET::DemandsAttention)) { if (info.hasState(NET::DemandsAttention)) {
WId oldLeader = info.transientFor();
QMutableHashIterator<WId, WId> i(transientsDemandingAttention); QMutableHashIterator<WId, WId> i(transientsDemandingAttention);
while (i.hasNext()) { if (i.findNext(window)) {
i.next(); const WId leader = info.transientFor();
const WId oldLeader = i.key();
if (i.value() == window) { if (leader != oldLeader) {
oldLeader = i.key();
i.remove(); i.remove();
transientsDemandingAttention.insertMulti(leader, window);
dataChanged(oldLeader, QVector<int>{IsDemandingAttention});
dataChanged(leader, QVector<int>{IsDemandingAttention});
} }
} }
if (oldLeader != 0) {
const WId leader = info.transientFor();
transientsDemandingAttention.insertMulti(leader, window);
dataChanged(oldLeader, QVector<int>{IsDemandingAttention});
dataChanged(leader, QVector<int>{IsDemandingAttention});
}
} }
} }
} }

Loading…
Cancel
Save