[plasma/kscreenlocker] /: Merge WaylandLocker and AbstractLocker
Nicolas Fella <[email protected]>
| Newsgroups | gmane.comp.kde.cvs |
|---|---|
| Message-ID | <[email protected]> |
Git commit ef65707b6f92a407a411f06d2afc492833988bf9 by Nicolas Fella.
Committed on 22/07/2026 at 18:51.
Pushed by nicolasfella into branch 'master'.
Merge WaylandLocker and AbstractLocker
M +0 -2 CMakeLists.txt
M +25 -1 abstractlocker.cpp
M +3 -1 abstractlocker.h
M +2 -2 ksldapp.cpp
D +0 -53 waylandlocker.cpp
D +0 -35 waylandlocker.h
https://invent.kde.org/plasma/kscreenlocker/-/commit/ef65707b6f92a407a411f06d2afc492833988bf9
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 40cef219..34a6707a 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -156,14 +156,12 @@ set(ksld_SRCS
ksldapp.cpp
interface.cpp
globalaccel.cpp
- waylandlocker.cpp
logind.cpp
powermanagement_inhibition.cpp
abstractlocker.h
ksldapp.h
interface.h
globalaccel.h
- waylandlocker.h
logind.h
powermanagement_inhibition.h
)
diff --git a/abstractlocker.cpp b/abstractlocker.cpp
index b3c78b77..e0e3eeab 100644
--- a/abstractlocker.cpp
+++ b/abstractlocker.cpp
@@ -103,6 +103,19 @@ AbstractLocker::AbstractLocker(QObject *parent)
if (qobject_cast<QGuiApplication *>(QCoreApplication::instance())) {
m_background.reset(new BackgroundWindow(this));
}
+
+ if (m_background) {
+ updateGeometryOfBackground();
+ const auto screens = qApp->screens();
+ for (auto s : screens) {
+ connect(s, &QScreen::geometryChanged, this, &AbstractLocker::updateGeometryOfBackground);
+ }
+ connect(qApp, &QGuiApplication::screenAdded, this, [this](QScreen *s) {
+ connect(s, &QScreen::geometryChanged, this, &AbstractLocker::updateGeometryOfBackground);
+ updateGeometryOfBackground();
+ });
+ connect(qApp, &QGuiApplication::screenRemoved, this, &AbstractLocker::updateGeometryOfBackground);
+ }
}
AbstractLocker::~AbstractLocker()
@@ -119,9 +132,20 @@ void AbstractLocker::emergencyShow()
void AbstractLocker::addAllowedWindow(quint32 windows)
{
- Q_UNUSED(windows);
+ Q_UNUSED(windows)
+ Q_EMIT lockWindowShown();
}
+void AbstractLocker::updateGeometryOfBackground()
+{
+ QRect combined;
+ const auto screens = qApp->screens();
+ for (auto s : screens) {
+ combined = combined.united(s->geometry());
+ }
+ m_background->setGeometry(combined);
+ m_background->update();
+}
}
#include "moc_abstractlocker.cpp"
diff --git a/abstractlocker.h b/abstractlocker.h
index f787b3a5..3a3fb08b 100644
--- a/abstractlocker.h
+++ b/abstractlocker.h
@@ -44,7 +44,7 @@ public:
explicit AbstractLocker(QObject *parent);
~AbstractLocker() override;
- virtual void addAllowedWindow(quint32 window);
+ void addAllowedWindow(quint32 window);
void setGlobalAccel(GlobalAccel *ga)
{
@@ -65,6 +65,8 @@ protected:
QScopedPointer<BackgroundWindow> m_background;
private:
+ void updateGeometryOfBackground();
+
GlobalAccel *m_globalAccel = nullptr;
friend class BackgroundWindow;
diff --git a/ksldapp.cpp b/ksldapp.cpp
index 01ddc0ef..1642aa20 100644
--- a/ksldapp.cpp
+++ b/ksldapp.cpp
@@ -7,12 +7,12 @@
SPDX-License-Identifier: GPL-2.0-or-later
*/
#include "ksldapp.h"
+#include "abstractlocker.h"
#include "globalaccel.h"
#include "interface.h"
#include "kscreensaversettings.h"
#include "logind.h"
#include "powermanagement_inhibition.h"
-#include "waylandlocker.h"
#include "kscreenlocker_logging.h"
#include <config-kscreenlocker.h>
@@ -470,7 +470,7 @@ void KSldApp::showLockWindow()
if (!m_lockWindow) {
qCDebug(KSCREENLOCKER) << "Creating lock window";
- m_lockWindow = new WaylandLocker(this);
+ m_lockWindow = new AbstractLocker(this);
if (!m_lockWindow) {
return;
}
diff --git a/waylandlocker.cpp b/waylandlocker.cpp
deleted file mode 100644
index c32b5e2f..00000000
--- a/waylandlocker.cpp
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- SPDX-FileCopyrightText: 2015 Bhushan Shah <[email protected]>
-
-SPDX-License-Identifier: GPL-2.0-or-later
-*/
-
-#include "waylandlocker.h"
-
-#include <QGuiApplication>
-#include <QScreen>
-
-namespace ScreenLocker
-{
-WaylandLocker::WaylandLocker(QObject *parent)
- : AbstractLocker(parent)
-{
- if (m_background) {
- updateGeometryOfBackground();
- const auto screens = qApp->screens();
- for (auto s : screens) {
- connect(s, &QScreen::geometryChanged, this, &WaylandLocker::updateGeometryOfBackground);
- }
- connect(qApp, &QGuiApplication::screenAdded, this, [this](QScreen *s) {
- connect(s, &QScreen::geometryChanged, this, &WaylandLocker::updateGeometryOfBackground);
- updateGeometryOfBackground();
- });
- connect(qApp, &QGuiApplication::screenRemoved, this, &WaylandLocker::updateGeometryOfBackground);
- }
-}
-
-WaylandLocker::~WaylandLocker()
-{
-}
-
-void WaylandLocker::updateGeometryOfBackground()
-{
- QRect combined;
- const auto screens = qApp->screens();
- for (auto s : screens) {
- combined = combined.united(s->geometry());
- }
- m_background->setGeometry(combined);
- m_background->update();
-}
-
-void WaylandLocker::addAllowedWindow(quint32 window)
-{
- Q_UNUSED(window)
- Q_EMIT lockWindowShown();
-}
-}
-
-#include "moc_waylandlocker.cpp"
diff --git a/waylandlocker.h b/waylandlocker.h
deleted file mode 100644
index 58922b0e..00000000
--- a/waylandlocker.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- SPDX-FileCopyrightText: 2015 Bhushan Shah <[email protected]>
-
-SPDX-License-Identifier: GPL-2.0-or-later
-*/
-
-#pragma once
-
-#include "abstractlocker.h"
-
-namespace KWayland
-{
-namespace Server
-{
-class Display;
-}
-}
-
-namespace ScreenLocker
-{
-class WaylandLocker : public AbstractLocker
-{
- Q_OBJECT
-
-public:
- WaylandLocker(QObject *parent);
- ~WaylandLocker() override;
-
- void addAllowedWindow(quint32 window) override;
-
-private:
- void updateGeometryOfBackground();
-};
-
-}