1
0
mirror of https://github.com/KDE/latte-dock.git synced 2025-01-08 01:18:21 +03:00
latte-dock/app/plasma/extended/screengeometries.h
Michail Vourlakos 0c1e29bf4e plasmageometry:remove workarounds for activities
--remove workarounds for plasma desktop not respecting
geometries sent from Latte for activities that are not
the current one
2021-11-14 14:08:41 +02:00

78 lines
1.7 KiB
C++

/*
SPDX-FileCopyrightText: 2020 Michail Vourlakos <mvourlakos@gmail.com>
SPDX-License-Identifier: GPL-2.0-or-later
*/
#ifndef PLASMASCREENGEOMETRIES_H
#define PLASMASCREENGEOMETRIES_H
// local
#include <coretypes.h>
// Qt
#include <QDBusServiceWatcher>
#include <QHash>
#include <QObject>
#include <QTimer>
namespace Latte {
class Corona;
class View;
}
namespace Latte {
namespace PlasmaExtended {
class ScreenGeometries: public QObject
{
Q_OBJECT
public:
ScreenGeometries(Latte::Corona *parent);
~ScreenGeometries() override;
private slots:
void availableScreenGeometryChangedFrom(Latte::View *origin);
void init();
void updateGeometries();
void clearGeometries();
void onBroadcastToPlasmaChanged();
private slots:
bool screenIsActive(const QString &screenName) const;
void setPlasmaAvailableScreenRect(const QString &screenName, const QRect &rect);
void setPlasmaAvailableScreenRegion(const QString &screenName, const QRegion &region);
private:
bool m_plasmaInterfaceAvailable{false};
//! this is needed in order to avoid too many costly calculations for available screen geometries
QTimer m_publishTimer;
//! this is needed in order to check if Plasma>=5.18 is running
QTimer m_startupInitTimer;
Latte::Corona *m_corona{nullptr};
QList<Latte::Types::Visibility> m_ignoreModes{
Latte::Types::AutoHide,
Latte::Types::SidebarOnDemand,
Latte::Types::SidebarAutoHide
};
QStringList m_lastScreenNames;
QHash<QString, QRect> m_lastAvailableRect;
QHash<QString, QRegion> m_lastAvailableRegion;
QDBusServiceWatcher *m_plasmaServiceWatcher{nullptr};
};
}
}
#endif