File indexing completed on 2025-03-16 05:05:13
0001 /* 0002 SPDX-FileCopyrightText: 2020 Michail Vourlakos <mvourlakos@gmail.com> 0003 SPDX-License-Identifier: GPL-2.0-or-later 0004 */ 0005 0006 #ifndef PLASMASCREENGEOMETRIES_H 0007 #define PLASMASCREENGEOMETRIES_H 0008 0009 // local 0010 #include <coretypes.h> 0011 0012 // Qt 0013 #include <QDBusServiceWatcher> 0014 #include <QHash> 0015 #include <QObject> 0016 #include <QTimer> 0017 0018 0019 namespace Latte { 0020 class Corona; 0021 class View; 0022 } 0023 0024 namespace Latte { 0025 namespace PlasmaExtended { 0026 0027 class ScreenGeometries: public QObject 0028 { 0029 Q_OBJECT 0030 0031 public: 0032 ScreenGeometries(Latte::Corona *parent); 0033 ~ScreenGeometries() override; 0034 0035 private slots: 0036 void availableScreenGeometryChangedFrom(Latte::View *origin); 0037 0038 void init(); 0039 void updateGeometries(); 0040 void clearGeometries(); 0041 0042 void onBroadcastToPlasmaChanged(); 0043 0044 private slots: 0045 bool screenIsActive(const QString &screenName) const; 0046 void setPlasmaAvailableScreenRect(const QString &screenName, const QRect &rect); 0047 void setPlasmaAvailableScreenRegion(const QString &screenName, const QRegion ®ion); 0048 0049 private: 0050 bool m_plasmaInterfaceAvailable{false}; 0051 0052 //! this is needed in order to avoid too many costly calculations for available screen geometries 0053 QTimer m_publishTimer; 0054 0055 //! this is needed in order to check if Plasma>=5.18 is running 0056 QTimer m_startupInitTimer; 0057 0058 Latte::Corona *m_corona{nullptr}; 0059 0060 QList<Latte::Types::Visibility> m_ignoreModes{ 0061 Latte::Types::AutoHide, 0062 Latte::Types::SidebarOnDemand, 0063 Latte::Types::SidebarAutoHide 0064 }; 0065 0066 QStringList m_lastScreenNames; 0067 0068 QHash<QString, QRect> m_lastAvailableRect; 0069 QHash<QString, QRegion> m_lastAvailableRegion; 0070 0071 QDBusServiceWatcher *m_plasmaServiceWatcher{nullptr}; 0072 }; 0073 0074 } 0075 } 0076 0077 #endif