1 /* 2 KWin - the KDE window manager 3 This file is part of the KDE project. 4 5 SPDX-FileCopyrightText: 2013 Martin Gräßlin <mgraesslin@kde.org> 6 7 SPDX-License-Identifier: GPL-2.0-or-later 8 */ 9 #ifndef KWIN_SCREENLOCKERWATCHER_H 10 #define KWIN_SCREENLOCKERWATCHER_H 11 12 #include <QObject> 13 14 #include <kwinglobals.h> 15 16 class OrgFreedesktopScreenSaverInterface; 17 class OrgKdeScreensaverInterface; 18 class QDBusServiceWatcher; 19 class QDBusPendingCallWatcher; 20 21 namespace KWin 22 { 23 24 class KWIN_EXPORT ScreenLockerWatcher : public QObject 25 { 26 Q_OBJECT 27 public: 28 ~ScreenLockerWatcher() override; isLocked()29 bool isLocked() const { 30 return m_locked; 31 } 32 Q_SIGNALS: 33 void locked(bool locked); 34 void aboutToLock(); 35 private Q_SLOTS: 36 void setLocked(bool activated); 37 void activeQueried(QDBusPendingCallWatcher *watcher); 38 void serviceOwnerChanged(const QString &serviceName, const QString &oldOwner, const QString &newOwner); 39 void serviceRegisteredQueried(); 40 void serviceOwnerQueried(); 41 private: 42 void initialize(); 43 OrgFreedesktopScreenSaverInterface *m_interface = nullptr; 44 OrgKdeScreensaverInterface *m_kdeInterface = nullptr; 45 QDBusServiceWatcher *m_serviceWatcher; 46 bool m_locked; 47 48 KWIN_SINGLETON(ScreenLockerWatcher) 49 }; 50 } 51 52 #endif 53