diff --git a/libtaskmanager/xwindowtasksmodel.cpp b/libtaskmanager/xwindowtasksmodel.cpp --- a/libtaskmanager/xwindowtasksmodel.cpp +++ b/libtaskmanager/xwindowtasksmodel.cpp @@ -62,7 +62,7 @@ QVector windows; QSet transients; - QHash transientsDemandingAttention; + QMultiHash transientsDemandingAttention; QHash windowInfoCache; QHash appDataCache; QHash delegateGeometries; @@ -257,22 +257,10 @@ } else { // Could be a transient. // Removing a transient might change the demands attention state of the leader. if (transients.remove(window)) { - QMutableHashIterator i(transientsDemandingAttention); - WId leader = 0; + const WId leader = transientsDemandingAttention.key(window, XCB_WINDOW_NONE); - while (i.hasNext()) { - i.next(); - - if (i.value() == window) { - if (leader == 0) { - leader = i.key(); - } - - i.remove(); - } - } - - if (leader != 0) { + if (leader != XCB_WINDOW_NONE) { + transientsDemandingAttention.remove(leader, window); dataChanged(leader, QVector{IsDemandingAttention}); } } @@ -307,14 +295,13 @@ const KWindowInfo info(window, NET::WMState | NET::XAWMState, NET::WM2TransientFor); if (info.hasState(NET::DemandsAttention)) { - QMutableHashIterator i(transientsDemandingAttention); + const WId oldLeader = transientsDemandingAttention.key(window, XCB_WINDOW_NONE); - if (i.findNext(window)) { + if (oldLeader != XCB_WINDOW_NONE) { const WId leader = info.transientFor(); - const WId oldLeader = i.key(); if (leader != oldLeader) { - i.remove(); + transientsDemandingAttention.remove(oldLeader, window); transientsDemandingAttention.insertMulti(leader, window); dataChanged(oldLeader, QVector{IsDemandingAttention}); dataChanged(leader, QVector{IsDemandingAttention});