File indexing completed on 2024-02-18 16:20:14

0001 /*
0002     KWin - the KDE window manager
0003     This file is part of the KDE project.
0004 
0005     SPDX-FileCopyrightText: 2013 Martin Gräßlin <mgraesslin@kde.org>
0006 
0007     SPDX-License-Identifier: GPL-2.0-or-later
0008 */
0009 #pragma once
0010 
0011 #include <QObject>
0012 
0013 #include <kwinglobals.h>
0014 
0015 class OrgFreedesktopScreenSaverInterface;
0016 class OrgKdeScreensaverInterface;
0017 class QDBusServiceWatcher;
0018 class QDBusPendingCallWatcher;
0019 
0020 namespace KWin
0021 {
0022 
0023 class KWIN_EXPORT ScreenLockerWatcher : public QObject
0024 {
0025     Q_OBJECT
0026 public:
0027     explicit ScreenLockerWatcher();
0028 
0029     bool isLocked() const;
0030 Q_SIGNALS:
0031     void locked(bool locked);
0032     void aboutToLock();
0033 private Q_SLOTS:
0034     void setLocked(bool activated);
0035     void activeQueried(QDBusPendingCallWatcher *watcher);
0036     void serviceOwnerChanged(const QString &serviceName, const QString &oldOwner, const QString &newOwner);
0037 
0038 private:
0039     void initialize();
0040     void queryActive();
0041     OrgFreedesktopScreenSaverInterface *m_interface = nullptr;
0042     OrgKdeScreensaverInterface *m_kdeInterface = nullptr;
0043     QDBusServiceWatcher *m_serviceWatcher;
0044     bool m_locked;
0045 };
0046 }