File indexing completed on 2024-05-05 17:44:55

0001 /*
0002     SPDX-FileCopyrightText: 2017 David Edmundson <davidedmundson@kde.org>
0003 
0004     SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
0005 */
0006 
0007 #pragma once
0008 
0009 #include <QObject>
0010 
0011 #include <KWindowSystem>
0012 #include <QHash>
0013 
0014 /*
0015  * Relay class for KWindowSystem events that batches updates
0016  */
0017 class XWindowSystemEventBatcher : public QObject
0018 {
0019     Q_OBJECT
0020 public:
0021     XWindowSystemEventBatcher(QObject *parent);
0022 Q_SIGNALS:
0023     void windowAdded(WId window);
0024     void windowRemoved(WId window);
0025     void windowChanged(WId window, NET::Properties properties, NET::Properties2 properties2);
0026 
0027 protected:
0028     void timerEvent(QTimerEvent *event) override;
0029 
0030 private:
0031     struct AllProps {
0032         NET::Properties properties = {};
0033         NET::Properties2 properties2 = {};
0034     };
0035     QHash<WId, AllProps> m_cache;
0036     int m_timerId = 0;
0037 };