diff --git a/greeter/greeterapp.h b/greeter/greeterapp.h index abe6ea7..14c795e 100644 --- a/greeter/greeterapp.h +++ b/greeter/greeterapp.h @@ -1,128 +1,127 @@ /******************************************************************** KSld - the KDE Screenlocker Daemon This file is part of the KDE project. Copyright (C) 2011 Martin Gräßlin This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . *********************************************************************/ #ifndef SCREENLOCKER_GREETERAPP_H #define SCREENLOCKER_GREETERAPP_H #include #include #include namespace KWayland { namespace Client { class ConnectionThread; class Registry; class PlasmaShell; } } namespace KQuickAddons { class QuickViewSharedEngine; } class Authenticator; struct org_kde_ksld; namespace ScreenLocker { -class Unlocker; class WallpaperIntegration; class LnFIntegration; class UnlockApp : public QGuiApplication { Q_OBJECT public: explicit UnlockApp(int &argc, char **argv); ~UnlockApp() override; void setTesting(bool enable); void setTheme(const QString &theme); void setImmediateLock(bool immediateLock); void lockImmediately(); void setGraceTime(int milliseconds); void setNoLock(bool noLock); void setKsldSocket(int socket); void setDefaultToSwitchUser(bool defaultToSwitchUser); void osdProgress(const QString &icon, int percent, const QString &additionalText); void osdText(const QString &icon, const QString &additionalText); void updateCanSuspend(bool set); void updateCanHibernate(bool set); bool supportsSeccomp() const { return m_supportsSeccomp; } public Q_SLOTS: void desktopResized(); protected: bool eventFilter(QObject *obj, QEvent *event) override; private Q_SLOTS: void resetRequestIgnore(); void suspendToRam(); void suspendToDisk(); void getFocus(); void markViewsAsVisible(KQuickAddons::QuickViewSharedEngine *view); void setLockedPropertyOnViews(); private: void initialize(); void initializeWayland(); void shareEvent(QEvent *e, KQuickAddons::QuickViewSharedEngine *from); void loadWallpaperPlugin(KQuickAddons::QuickViewSharedEngine *view); Authenticator *createAuthenticator(); QWindow *getActiveScreen(); QString m_packageName; QUrl m_mainQmlPath; QList m_views; QTimer *m_resetRequestIgnoreTimer; QTimer *m_delayedLockTimer; KPackage::Package m_package; bool m_testing; bool m_ignoreRequests; bool m_immediateLock; bool m_runtimeInitialized; Authenticator *m_authenticator; int m_graceTime; bool m_noLock; bool m_defaultToSwitchUser; bool m_canSuspend = false; bool m_canHibernate = false; KWayland::Client::ConnectionThread *m_ksldConnection = nullptr; KWayland::Client::Registry *m_ksldRegistry = nullptr; QThread *m_ksldConnectionThread = nullptr; org_kde_ksld *m_ksldInterface = nullptr; KWayland::Client::PlasmaShell *m_plasmaShell = nullptr; WallpaperIntegration *m_wallpaperIntegration; LnFIntegration *m_lnfIntegration; bool m_supportsSeccomp = false; }; } // namespace #endif // SCREENLOCKER_GREETERAPP_H diff --git a/greeter/lnf_integration.h b/greeter/lnf_integration.h index f296c93..196cc6e 100644 --- a/greeter/lnf_integration.h +++ b/greeter/lnf_integration.h @@ -1,83 +1,82 @@ /******************************************************************** KSld - the KDE Screenlocker Daemon This file is part of the KDE project. Copyright (C) 2016 Martin Gräßlin Copyright (C) 2017 David Edmundson This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License or (at your option) version 3 or any later version accepted by the membership of KDE e.V. (or its successor approved by the membership of KDE e.V.), which shall act as a proxy defined in Section 14 of version 3 of the license. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . *********************************************************************/ #ifndef KSCREENLOCKER_LNF_INTEGRATION_H #define KSCREENLOCKER_LNF_INTEGRATION_H #include #include class KConfigLoader; namespace KDeclarative { class ConfigPropertyMap; -class QmlObject; } namespace ScreenLocker { class LnFIntegration : public QObject { Q_OBJECT Q_PROPERTY(KDeclarative::ConfigPropertyMap *configuration READ configuration NOTIFY configurationChanged) public: explicit LnFIntegration(QObject *parent); ~LnFIntegration() override; void init(); void setConfig(const KSharedConfig::Ptr &config) { m_config = config; } void setPackage(const KPackage::Package &package) { m_package = package; } KPackage::Package package() const { return m_package; } KDeclarative::ConfigPropertyMap *configuration() const { return m_configuration; } Q_SIGNALS: void packageChanged(); void configurationChanged(); private: KConfigLoader *configScheme(); KPackage::Package m_package; KSharedConfig::Ptr m_config; KConfigLoader *m_configLoader = nullptr; KDeclarative::ConfigPropertyMap *m_configuration = nullptr; }; } #endif diff --git a/greeter/wallpaper_integration.h b/greeter/wallpaper_integration.h index d1b19db..6245e6e 100644 --- a/greeter/wallpaper_integration.h +++ b/greeter/wallpaper_integration.h @@ -1,84 +1,83 @@ /******************************************************************** KSld - the KDE Screenlocker Daemon This file is part of the KDE project. Copyright (C) 2016 Martin Gräßlin This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License or (at your option) version 3 or any later version accepted by the membership of KDE e.V. (or its successor approved by the membership of KDE e.V.), which shall act as a proxy defined in Section 14 of version 3 of the license. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . *********************************************************************/ #ifndef KSCREENLOCKER_WALLPAPER_INTEGRATION_H #define KSCREENLOCKER_WALLPAPER_INTEGRATION_H #include #include class KConfigLoader; namespace KDeclarative { class ConfigPropertyMap; -class QmlObject; } namespace ScreenLocker { class WallpaperIntegration : public QObject { Q_OBJECT Q_PROPERTY(QString pluginName READ pluginName NOTIFY packageChanged) Q_PROPERTY(KDeclarative::ConfigPropertyMap *configuration READ configuration NOTIFY configurationChanged) public: explicit WallpaperIntegration(QObject *parent); ~WallpaperIntegration() override; void init(); void setConfig(const KSharedConfig::Ptr &config) { m_config = config; } QString pluginName() const { return m_pluginName; } void setPluginName(const QString &name); KPackage::Package package() const { return m_package; } KDeclarative::ConfigPropertyMap *configuration() const { return m_configuration; } Q_SIGNALS: void packageChanged(); void configurationChanged(); private: KConfigLoader *configScheme(); QString m_pluginName; KPackage::Package m_package; KSharedConfig::Ptr m_config; KConfigLoader *m_configLoader = nullptr; KDeclarative::ConfigPropertyMap *m_configuration = nullptr; }; } #endif diff --git a/kcm/kcm.h b/kcm/kcm.h index 7273c1f..919357d 100644 --- a/kcm/kcm.h +++ b/kcm/kcm.h @@ -1,115 +1,113 @@ /******************************************************************** KSld - the KDE Screenlocker Daemon This file is part of the KDE project. Copyright (C) 2014 Martin Gräßlin Copyright (C) 2014 Marco Martin This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . *********************************************************************/ #include #include -class QQuickView; -class QStandardItemModel; class KActionCollection; class ScreenLockerKcmForm; namespace ScreenLocker { class WallpaperIntegration; class LnFIntegration; } namespace KDeclarative { class ConfigPropertyMap; } class ScreenLockerKcm : public KCModule { Q_OBJECT public: enum Roles { PluginNameRole = Qt::UserRole +1, ScreenhotRole }; explicit ScreenLockerKcm(QWidget *parent = nullptr, const QVariantList& args = QVariantList()); KDeclarative::ConfigPropertyMap *wallpaperConfiguration() const; KDeclarative::ConfigPropertyMap *lnfConfiguration() const; QString currentWallpaper() const; bool eventFilter(QObject *watched, QEvent *event) override; public Q_SLOTS: void load() override; void save() override; void defaults() override; void test(const QString &plugin); Q_SIGNALS: void wallpaperConfigurationChanged(); void currentWallpaperChanged(); private: void shortcutChanged(const QKeySequence &key); bool shouldSaveShortcut(); void loadWallpapers(); void selectWallpaper(const QString &pluginId); void loadWallpaperConfig(); void loadLnfConfig(); KPackage::Package m_package; KActionCollection *m_actionCollection; ScreenLockerKcmForm *m_ui; ScreenLocker::WallpaperIntegration *m_wallpaperIntegration = nullptr; ScreenLocker::LnFIntegration* m_lnfIntegration = nullptr; }; //see https://bugreports.qt.io/browse/QTBUG-57714, don't expose a QWidget as a context property class ScreenLockerProxy : public QObject { Q_OBJECT Q_PROPERTY(KDeclarative::ConfigPropertyMap *wallpaperConfiguration READ wallpaperConfiguration NOTIFY wallpaperConfigurationChanged) Q_PROPERTY(KDeclarative::ConfigPropertyMap *lnfConfiguration READ lnfConfiguration CONSTANT) Q_PROPERTY(QString currentWallpaper READ currentWallpaper NOTIFY currentWallpaperChanged) public: ScreenLockerProxy(ScreenLockerKcm *parent) : QObject(parent), q(parent) { } KDeclarative::ConfigPropertyMap *wallpaperConfiguration() const { return q->wallpaperConfiguration(); } KDeclarative::ConfigPropertyMap *lnfConfiguration() const { return q->lnfConfiguration(); } QString currentWallpaper() const { return q->currentWallpaper(); } Q_SIGNALS: void wallpaperConfigurationChanged(); void currentWallpaperChanged(); private: ScreenLockerKcm* q; }; diff --git a/x11locker.h b/x11locker.h index 340a6be..4042c0b 100644 --- a/x11locker.h +++ b/x11locker.h @@ -1,77 +1,76 @@ /******************************************************************** KSld - the KDE Screenlocker Daemon This file is part of the KDE project. Copyright (C) 1999 Martin R. Jones Copyright (C) 2002 Luboš Luňák Copyright (C) 2003 Oswald Buddenhagen Copyright (C) 2008 Chani Armitage Copyright (C) 2011 Martin Gräßlin This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . *********************************************************************/ #ifndef SCREENLOCKER_LOCKWINDOW_H #define SCREENLOCKER_LOCKWINDOW_H #include "abstractlocker.h" #include #include #include -class QTimer; namespace ScreenLocker { class AbstractLocker; class X11Locker : public AbstractLocker, public QAbstractNativeEventFilter { Q_OBJECT public: explicit X11Locker(QObject *parent = nullptr); ~X11Locker() override; void showLockWindow() override; void hideLockWindow() override; void addAllowedWindow(quint32 window) override; bool nativeEventFilter(const QByteArray &eventType, void *message, long *result) override; private Q_SLOTS: void updateGeo(); private: void initialize(); void saveVRoot(); void setVRoot(Window win, Window vr); void removeVRoot(Window win); int findWindowInfo(Window w); void fakeFocusIn(WId window); void stayOnTop() override; struct WindowInfo { Window window; bool viewable; }; QList m_windowInfo; QList m_lockWindows; QList m_allowedWindows; WId m_focusedLockWindow; }; } #endif // SCREENLOCKER_LOCKWINDOW_H