File indexing completed on 2024-05-05 05:38:39

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 #include <netwm_def.h>
0014 
0015 /*
0016  * Relay class for KWindowSystem events that batches updates
0017  */
0018 class XWindowSystemEventBatcher : public QObject
0019 {
0020     Q_OBJECT
0021 public:
0022     XWindowSystemEventBatcher(QObject *parent);
0023 Q_SIGNALS:
0024     void windowAdded(WId window);
0025     void windowRemoved(WId window);
0026     void windowChanged(WId window, NET::Properties properties, NET::Properties2 properties2);
0027 
0028 protected:
0029     void timerEvent(QTimerEvent *event) override;
0030 
0031 private:
0032     struct AllProps {
0033         NET::Properties properties = {};
0034         NET::Properties2 properties2 = {};
0035     };
0036     QHash<WId, AllProps> m_cache;
0037     int m_timerId = 0;
0038 };