File indexing completed on 2024-12-29 05:06:05
0001 // SPDX-FileCopyrightText: 2022 Devin Lin <devin@kde.org> 0002 // SPDX-License-Identifier: GPL-2.0-or-later 0003 0004 #pragma once 0005 0006 #include <QList> 0007 #include <QObject> 0008 0009 #include <KWayland/Client/connection_thread.h> 0010 #include <KWayland/Client/plasmawindowmanagement.h> 0011 #include <KWayland/Client/registry.h> 0012 #include <KWayland/Client/surface.h> 0013 0014 class WindowListener : public QObject 0015 { 0016 Q_OBJECT 0017 0018 public: 0019 WindowListener(QObject *parent = nullptr); 0020 0021 static WindowListener *instance(); 0022 0023 QList<KWayland::Client::PlasmaWindow *> windowsFromStorageId(QString &storageId) const; 0024 0025 public Q_SLOTS: 0026 void windowCreated(KWayland::Client::PlasmaWindow *window); 0027 0028 Q_SIGNALS: 0029 void windowChanged(QString storageId); 0030 0031 private: 0032 KWayland::Client::PlasmaWindowManagement *m_windowManagement = nullptr; 0033 QHash<QString, QList<KWayland::Client::PlasmaWindow *>> m_windows; // <storageId, window> 0034 };