summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEike Hein <hein@kde.org>2017-02-17 17:48:16 (GMT)
committerEike Hein <hein@kde.org>2017-02-17 17:55:04 (GMT)
commitee9f966dd55ce87f75376cae5b90549dace41ea8 (patch)
tree583ed6b5c70c5a2c1281cde55a46da869f5c3b69
parentb82d364536fab6bdeea0c9bc3f8eecfa988e7df3 (diff)
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
-rw-r--r--libtaskmanager/xwindowtasksmodel.cpp19
1 files changed, 7 insertions, 12 deletions
diff --git a/libtaskmanager/xwindowtasksmodel.cpp b/libtaskmanager/xwindowtasksmodel.cpp
index b7febeb..360ac7c 100644
--- a/libtaskmanager/xwindowtasksmodel.cpp
+++ b/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);
if (info.hasState(NET::DemandsAttention)) {
- WId oldLeader = info.transientFor();
QMutableHashIterator<WId, WId> i(transientsDemandingAttention);
- while (i.hasNext()) {
- i.next();
+ if (i.findNext(window)) {
+ const WId leader = info.transientFor();
+ const WId oldLeader = i.key();
- if (i.value() == window) {
- oldLeader = i.key();
+ if (leader != oldLeader) {
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});
- }
}
}
}