diff options
author | Fabien Proriol <fabien.proriol@kazoe.org> | 2025-05-25 17:58:09 +0200 |
---|---|---|
committer | Fabien Proriol <fabien.proriol@kazoe.org> | 2025-05-26 18:01:49 +0200 |
commit | 49daa163530ceabc9eaa8911ab96b5f799cfb552 (patch) | |
tree | 080d0b31eafd138cd8d47d5c2a52b75d3cfa6f28 /src/waylandentries.h |
Initial Commit
Diffstat (limited to 'src/waylandentries.h')
-rw-r--r-- | src/waylandentries.h | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/src/waylandentries.h b/src/waylandentries.h new file mode 100644 index 0000000..ce98ade --- /dev/null +++ b/src/waylandentries.h @@ -0,0 +1,53 @@ +#ifndef WAYLANDENTRIES_H +#define WAYLANDENTRIES_H + +#include <QAbstractListModel> +#include <QRecursiveMutex> +#include <QObject> + +class QWaylandXdgSurface; + +class WaylandEntries : public QAbstractListModel +{ + Q_OBJECT + Q_PROPERTY(int nbApps READ nbApps NOTIFY nbAppsChanged) + + + QList<QWaylandXdgSurface *> m_surfaces; + QList<QWaylandXdgSurface *> m_surfaces_hidden; + QList<qint64> m_hidden; + mutable QRecursiveMutex m_lock; + +public: + explicit WaylandEntries(QObject *parent = nullptr); + + enum WaylandEntryRoles { + SurfaceRole = Qt::UserRole + 1, + TitleRole, + PidRole, + AppIdRole + }; + + int rowCount(const QModelIndex &parent = QModelIndex()) const override; + QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override; + QHash<int, QByteArray> roleNames() const override; + + static WaylandEntries* getInstance(); + + int nbApps() const; + void setNbApps(int newNbApps); + +public slots: + void addSurface(QObject *obj); + void addHidePid(qint64 pid); + void surfaceDestroyed(); + void stop(int pid); + QObject *getSurface(int pid); + +signals: + void nbAppsChanged(); + void topWindowRegistered(QObject *surface, QString appid); + void topWindowDestroyed(QObject *surface, QString appid); +}; + +#endif // WAYLANDENTRIES_H |