int LipstickCompositor::windowIdForLink(QWaylandSurface *s, uint link) const { for (QHash<int, LipstickCompositorWindow *>::ConstIterator iter = m_mappedSurfaces.begin(); iter != m_mappedSurfaces.end(); ++iter) { QWaylandSurface *windowSurface = iter.value()->surface(); if (windowSurface && windowSurface->processId() == s->processId() && windowSurface->windowProperties().value("WINID", uint(0)).toUInt() == link) return iter.value()->windowId(); } return 0; }
QVariant WindowModel::data(const QModelIndex &index, int role) const { int idx = index.row(); if (idx < 0 || idx >= m_items.count()) return QVariant(); LipstickCompositor *c = LipstickCompositor::instance(); if (role == Qt::UserRole + 1) { return m_items.at(idx); } else if (role == Qt::UserRole + 2) { QWaylandSurface *s = c->surfaceForId(m_items.at(idx)); return s?s->processId():0; } else if (role == Qt::UserRole + 3) { LipstickCompositorWindow *w = static_cast<LipstickCompositorWindow *>(c->windowForId(m_items.at(idx))); return w->title(); } else { return QVariant(); } }