Changeset View
Changeset View
Standalone View
Standalone View
libtaskmanager/xwindowtasksmodel.cpp
Show First 20 Lines • Show All 56 Lines • ▼ Show 20 Line(s) | |||||
57 | class XWindowTasksModel::Private | 57 | class XWindowTasksModel::Private | ||
58 | { | 58 | { | ||
59 | public: | 59 | public: | ||
60 | Private(XWindowTasksModel *q); | 60 | Private(XWindowTasksModel *q); | ||
61 | ~Private(); | 61 | ~Private(); | ||
62 | 62 | | |||
63 | QVector<WId> windows; | 63 | QVector<WId> windows; | ||
64 | QSet<WId> transients; | 64 | QSet<WId> transients; | ||
65 | QHash<WId, WId> transientsDemandingAttention; | 65 | QMultiHash<WId, WId> transientsDemandingAttention; | ||
66 | QHash<WId, KWindowInfo*> windowInfoCache; | 66 | QHash<WId, KWindowInfo*> windowInfoCache; | ||
67 | QHash<WId, AppData> appDataCache; | 67 | QHash<WId, AppData> appDataCache; | ||
68 | QHash<WId, QRect> delegateGeometries; | 68 | QHash<WId, QRect> delegateGeometries; | ||
69 | WId activeWindow = -1; | 69 | WId activeWindow = -1; | ||
70 | KSharedConfig::Ptr rulesConfig; | 70 | KSharedConfig::Ptr rulesConfig; | ||
71 | KDirWatch *configWatcher = nullptr; | 71 | KDirWatch *configWatcher = nullptr; | ||
72 | QTimer sycocaChangeTimer; | 72 | QTimer sycocaChangeTimer; | ||
73 | 73 | | |||
▲ Show 20 Lines • Show All 178 Lines • ▼ Show 20 Line(s) | 249 | if (row != -1) { | |||
252 | transientsDemandingAttention.remove(window); | 252 | transientsDemandingAttention.remove(window); | ||
253 | windowInfoCache.remove(window); | 253 | windowInfoCache.remove(window); | ||
254 | appDataCache.remove(window); | 254 | appDataCache.remove(window); | ||
255 | delegateGeometries.remove(window); | 255 | delegateGeometries.remove(window); | ||
256 | q->endRemoveRows(); | 256 | q->endRemoveRows(); | ||
257 | } else { // Could be a transient. | 257 | } else { // Could be a transient. | ||
258 | // Removing a transient might change the demands attention state of the leader. | 258 | // Removing a transient might change the demands attention state of the leader. | ||
259 | if (transients.remove(window)) { | 259 | if (transients.remove(window)) { | ||
260 | QMutableHashIterator<WId, WId> i(transientsDemandingAttention); | 260 | const WId leader = transientsDemandingAttention.key(window, XCB_WINDOW_NONE); | ||
261 | WId leader = 0; | | |||
262 | 261 | | |||
263 | while (i.hasNext()) { | 262 | if (leader != XCB_WINDOW_NONE) { | ||
264 | i.next(); | 263 | transientsDemandingAttention.remove(leader, window); | ||
265 | | ||||
266 | if (i.value() == window) { | | |||
267 | if (leader == 0) { | | |||
268 | leader = i.key(); | | |||
269 | } | | |||
270 | | ||||
271 | i.remove(); | | |||
272 | } | | |||
273 | } | | |||
274 | | ||||
275 | if (leader != 0) { | | |||
276 | dataChanged(leader, QVector<int>{IsDemandingAttention}); | 264 | dataChanged(leader, QVector<int>{IsDemandingAttention}); | ||
277 | } | 265 | } | ||
278 | } | 266 | } | ||
279 | } | 267 | } | ||
280 | 268 | | |||
281 | if (activeWindow == window) { | 269 | if (activeWindow == window) { | ||
282 | activeWindow = -1; | 270 | activeWindow = -1; | ||
283 | } | 271 | } | ||
Show All 18 Lines | 277 | if (properties & (NET::WMState | NET::XAWMState)) { | |||
302 | } else if (transientsDemandingAttention.remove(window)) { | 290 | } else if (transientsDemandingAttention.remove(window)) { | ||
303 | dataChanged(leader, QVector<int>{IsDemandingAttention}); | 291 | dataChanged(leader, QVector<int>{IsDemandingAttention}); | ||
304 | } | 292 | } | ||
305 | // Leader might have changed. | 293 | // Leader might have changed. | ||
306 | } else if (properties2 & NET::WM2TransientFor) { | 294 | } else if (properties2 & NET::WM2TransientFor) { | ||
307 | const KWindowInfo info(window, NET::WMState | NET::XAWMState, NET::WM2TransientFor); | 295 | const KWindowInfo info(window, NET::WMState | NET::XAWMState, NET::WM2TransientFor); | ||
308 | 296 | | |||
309 | if (info.hasState(NET::DemandsAttention)) { | 297 | if (info.hasState(NET::DemandsAttention)) { | ||
310 | QMutableHashIterator<WId, WId> i(transientsDemandingAttention); | 298 | const WId oldLeader = transientsDemandingAttention.key(window, XCB_WINDOW_NONE); | ||
311 | 299 | | |||
312 | if (i.findNext(window)) { | 300 | if (oldLeader != XCB_WINDOW_NONE) { | ||
313 | const WId leader = info.transientFor(); | 301 | const WId leader = info.transientFor(); | ||
314 | const WId oldLeader = i.key(); | | |||
315 | 302 | | |||
316 | if (leader != oldLeader) { | 303 | if (leader != oldLeader) { | ||
317 | i.remove(); | 304 | transientsDemandingAttention.remove(oldLeader, window); | ||
318 | transientsDemandingAttention.insertMulti(leader, window); | 305 | transientsDemandingAttention.insertMulti(leader, window); | ||
319 | dataChanged(oldLeader, QVector<int>{IsDemandingAttention}); | 306 | dataChanged(oldLeader, QVector<int>{IsDemandingAttention}); | ||
320 | dataChanged(leader, QVector<int>{IsDemandingAttention}); | 307 | dataChanged(leader, QVector<int>{IsDemandingAttention}); | ||
321 | } | 308 | } | ||
322 | } | 309 | } | ||
323 | } | 310 | } | ||
324 | } | 311 | } | ||
325 | } | 312 | } | ||
▲ Show 20 Lines • Show All 1011 Lines • Show Last 20 Lines |