From d54723cbf297ab847ab51df4c44db401a8d0b977 Mon Sep 17 00:00:00 2001 From: Kai Uwe Broulik Date: Wed, 23 Feb 2022 14:27:05 +0100 Subject: [PATCH] Add KWIN_BUILD_SCREENLOCKER option Allows to build KWin without lockscreen support and thus drops the kscreenlocker dependency. Signed-off-by: Eike Hein --- CMakeLists.txt | 15 +++++++++------ autotests/integration/CMakeLists.txt | 4 +++- .../integration/modifier_only_shortcut_test.cpp | 3 +++ autotests/integration/plasmawindow_test.cpp | 6 ++++++ autotests/integration/test_helpers.cpp | 7 +++++++ src/CMakeLists.txt | 14 ++++++++++---- src/config-kwin.h.cmake | 1 + src/effects.cpp | 10 ++++++++++ src/input.cpp | 5 +++++ src/inputmethod.cpp | 5 +++++ src/keyboard_input.cpp | 6 +++++- src/main.cpp | 5 +++++ src/main_wayland.cpp | 4 ++++ src/modifier_only_shortcuts.cpp | 7 +++++++ src/pointer_input.cpp | 7 +++++++ src/screenedge.cpp | 8 ++++++++ src/tablet_input.cpp | 2 -- src/touch_input.cpp | 5 +++++ src/wayland_server.cpp | 13 +++++++++++++ 19 files changed, 113 insertions(+), 14 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0cc7a4d9b5..c321632b7c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -136,12 +136,6 @@ set_package_properties(KF5Kirigami2 PROPERTIES find_package(KDecoration2 ${PROJECT_VERSION} CONFIG REQUIRED) -find_package(KScreenLocker CONFIG REQUIRED) -set_package_properties(KScreenLocker PROPERTIES - TYPE REQUIRED - PURPOSE "For screenlocker integration in kwin_wayland" -) - find_package(KWaylandServer ${PROJECT_VERSION} CONFIG REQUIRED) set_package_properties(KWaylandServer PROPERTIES TYPE REQUIRED @@ -341,6 +335,7 @@ include(CMakeDependentOption) option(KWIN_BUILD_DECORATIONS "Enable building of KWin decorations." ON) option(KWIN_BUILD_KCMS "Enable building of KWin configuration modules." ON) +option(KWIN_BUILD_SCREENLOCKER "Enable building of KWin lockscreen functionality" ON) option(KWIN_BUILD_TABBOX "Enable building of KWin Tabbox functionality" ON) cmake_dependent_option(KWIN_BUILD_ACTIVITIES "Enable building of KWin with kactivities support" ON "KF5Activities_FOUND" OFF) cmake_dependent_option(KWIN_BUILD_RUNNERS "Enable building of KWin with krunner support" ON "KF5Runner_FOUND" OFF) @@ -396,6 +391,14 @@ add_feature_info("SCHED_RESET_ON_FORK" pkg_check_modules(PipeWire IMPORTED_TARGET libpipewire-0.3>=0.3.29) add_feature_info(PipeWire PipeWire_FOUND "Required for Wayland screencasting") +if (KWIN_BUILD_SCREENLOCKER) + find_package(KScreenLocker CONFIG REQUIRED) + set_package_properties(KScreenLocker PROPERTIES + TYPE REQUIRED + PURPOSE "For screenlocker integration in kwin_wayland" + ) +endif() + ########### global ############### include_directories(BEFORE diff --git a/autotests/integration/CMakeLists.txt b/autotests/integration/CMakeLists.txt index 9dc8c9a2f9..25cdac4411 100644 --- a/autotests/integration/CMakeLists.txt +++ b/autotests/integration/CMakeLists.txt @@ -78,7 +78,9 @@ function(integrationTest) endfunction() integrationTest(NAME testDontCrashGlxgears SRCS dont_crash_glxgears.cpp) -integrationTest(NAME testLockScreen SRCS lockscreen.cpp) +if (KWIN_BUILD_SCREENLOCKER) + integrationTest(NAME testLockScreen SRCS lockscreen.cpp) +endif() integrationTest(WAYLAND_ONLY NAME testDecorationInput SRCS decoration_input_test.cpp) integrationTest(WAYLAND_ONLY NAME testInternalWindow SRCS internal_window.cpp) integrationTest(WAYLAND_ONLY NAME testTouchInput SRCS touch_input_test.cpp) diff --git a/autotests/integration/modifier_only_shortcut_test.cpp b/autotests/integration/modifier_only_shortcut_test.cpp index d01ff019f8..cde9b9fdce 100644 --- a/autotests/integration/modifier_only_shortcut_test.cpp +++ b/autotests/integration/modifier_only_shortcut_test.cpp @@ -6,6 +6,7 @@ SPDX-License-Identifier: GPL-2.0-or-later */ +#include #include "kwin_wayland_test.h" #include "cursor.h" #include "input.h" @@ -223,6 +224,7 @@ void ModifierOnlyShortcutTest::testTrigger() kwinApp()->platform()->keyboardKeyReleased(modifier, timestamp++); QCOMPARE(triggeredSpy.count(), 2); +#ifdef KWIN_BUILD_SCREENLOCKER // now try to lock the screen while modifier key is pressed kwinApp()->platform()->keyboardKeyPressed(modifier, timestamp++); QVERIFY(Test::lockScreen()); @@ -235,6 +237,7 @@ void ModifierOnlyShortcutTest::testTrigger() QCOMPARE(triggeredSpy.count(), 2); QVERIFY(Test::unlockScreen()); +#endif } void ModifierOnlyShortcutTest::testCapsLock() diff --git a/autotests/integration/plasmawindow_test.cpp b/autotests/integration/plasmawindow_test.cpp index f1923212bc..db93ba4351 100644 --- a/autotests/integration/plasmawindow_test.cpp +++ b/autotests/integration/plasmawindow_test.cpp @@ -20,7 +20,9 @@ #include #include //screenlocker +#ifdef KWIN_BUILD_SCREENLOCKER #include +#endif #include #include @@ -256,6 +258,7 @@ void PlasmaWindowTest::testPopupWindowNoPlasmaWindow() void PlasmaWindowTest::testLockScreenNoPlasmaWindow() { +#ifdef KWIN_BUILD_SCREENLOCKER // this test verifies that lock screen windows are not exposed to PlasmaWindow QSignalSpy plasmaWindowCreatedSpy(m_windowManagement, &PlasmaWindowManagement::windowCreated); QVERIFY(plasmaWindowCreatedSpy.isValid()); @@ -284,6 +287,9 @@ void PlasmaWindowTest::testLockScreenNoPlasmaWindow() } QVERIFY(lockStateChangedSpy.wait()); QVERIFY(!waylandServer()->isScreenLocked()); +#else + QSKIP("KWin was built without lockscreen support"); +#endif } void PlasmaWindowTest::testDestroyedButNotUnmapped() diff --git a/autotests/integration/test_helpers.cpp b/autotests/integration/test_helpers.cpp index 0062b9330c..e46cc781a4 100644 --- a/autotests/integration/test_helpers.cpp +++ b/autotests/integration/test_helpers.cpp @@ -6,8 +6,11 @@ SPDX-License-Identifier: GPL-2.0-or-later */ +#include #include "kwin_wayland_test.h" +#ifdef KWIN_BUILD_SCREENLOCKER #include "screenlockerwatcher.h" +#endif #include "wayland_server.h" #include "workspace.h" #include "inputmethod.h" @@ -32,7 +35,9 @@ #include //screenlocker +#ifdef KWIN_BUILD_SCREENLOCKER #include +#endif #include @@ -893,6 +898,7 @@ bool waitForWindowDestroyed(AbstractClient *client) return destroyedSpy.wait(); } +#ifdef KWIN_BUILD_SCREENLOCKER bool lockScreen() { if (waylandServer()->isScreenLocked()) { @@ -959,6 +965,7 @@ bool unlockScreen() } return true; } +#endif // KWIN_BUILD_LOCKSCREEN void initWaylandWorkspace() { diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 2d4dda8536..db010259c6 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -104,7 +104,6 @@ target_sources(kwin PRIVATE rules.cpp scene.cpp screenedge.cpp - screenlockerwatcher.cpp screens.cpp scripting/v2/clientmodel.cpp scripting/v3/clientmodel.cpp @@ -185,7 +184,6 @@ target_link_libraries(kwin KDecoration2::KDecoration KDecoration2::KDecoration2Private - PW::KScreenLocker Plasma::KWaylandServer XCB::COMPOSITE @@ -230,8 +228,11 @@ qt_add_dbus_adaptor(kwin_dbus_SRCS org.kde.KWin.VirtualDesktopManager.xml dbusin qt_add_dbus_adaptor(kwin_dbus_SRCS org.kde.KWin.Session.xml sm.h KWin::SessionManager) qt_add_dbus_adaptor(kwin_dbus_SRCS org.kde.KWin.Plugins.xml dbusinterface.h KWin::PluginManagerDBusInterface) -qt_add_dbus_interface(kwin_dbus_SRCS ${KSCREENLOCKER_DBUS_INTERFACES_DIR}/kf5_org.freedesktop.ScreenSaver.xml screenlocker_interface) -qt_add_dbus_interface(kwin_dbus_SRCS ${KSCREENLOCKER_DBUS_INTERFACES_DIR}/org.kde.screensaver.xml kscreenlocker_interface) +if (KWIN_BUILD_SCREENLOCKER) + qt_add_dbus_interface(kwin_dbus_SRCS ${KSCREENLOCKER_DBUS_INTERFACES_DIR}/kf5_org.freedesktop.ScreenSaver.xml screenlocker_interface) + qt_add_dbus_interface(kwin_dbus_SRCS ${KSCREENLOCKER_DBUS_INTERFACES_DIR}/org.kde.screensaver.xml kscreenlocker_interface) +endif() + qt_add_dbus_interface(kwin_dbus_SRCS org.kde.kappmenu.xml appmenu_interface) target_sources(kwin PRIVATE @@ -255,6 +256,11 @@ if (KWIN_BUILD_ACTIVITIES) target_link_libraries(kwin KF5::Activities) endif() +if (KWIN_BUILD_SCREENLOCKER) + target_sources(kwin PRIVATE screenlockerwatcher.cpp) + target_link_libraries(kwin PW::KScreenLocker) +endif() + if (KWIN_BUILD_TABBOX) target_sources(kwin PRIVATE tabbox/clientmodel.cpp diff --git a/src/config-kwin.h.cmake b/src/config-kwin.h.cmake index 2dd1e5dbff..9ef17819fd 100644 --- a/src/config-kwin.h.cmake +++ b/src/config-kwin.h.cmake @@ -1,6 +1,7 @@ #define KWIN_PLUGIN_VERSION_STRING "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}" #cmakedefine KWIN_BUILD_DECORATIONS 1 +#cmakedefine KWIN_BUILD_SCREENLOCKER 1 #cmakedefine KWIN_BUILD_TABBOX 1 #cmakedefine KWIN_BUILD_ACTIVITIES 1 #cmakedefine KWIN_BUILD_CMS 1 diff --git a/src/effects.cpp b/src/effects.cpp index 2c75e1cba6..dde9ae4c1c 100644 --- a/src/effects.cpp +++ b/src/effects.cpp @@ -10,6 +10,8 @@ #include "effects.h" +#include + #include "abstract_output.h" #include "effectsadaptor.h" #include "effectloader.h" @@ -32,7 +34,9 @@ #include "screenedge.h" #include "scripting/scriptedeffect.h" #include "screens.h" +#ifdef KWIN_BUILD_SCREENLOCKER #include "screenlockerwatcher.h" +#endif #include "virtualdesktops.h" #include "window_property_notify_x11_filter.h" #include "workspace.h" @@ -209,8 +213,10 @@ EffectsHandlerImpl::EffectsHandlerImpl(Compositor *compositor, Scene *scene) connect(tabBox, &TabBox::TabBox::tabBoxKeyEvent, this, &EffectsHandler::tabBoxKeyEvent); #endif connect(ScreenEdges::self(), &ScreenEdges::approaching, this, &EffectsHandler::screenEdgeApproaching); +#ifdef KWIN_BUILD_SCREENLOCKER connect(ScreenLockerWatcher::self(), &ScreenLockerWatcher::locked, this, &EffectsHandler::screenLockingChanged); connect(ScreenLockerWatcher::self(), &ScreenLockerWatcher::aboutToLock, this, &EffectsHandler::screenAboutToLock); +#endif connect(kwinApp(), &Application::x11ConnectionChanged, this, [this] { @@ -1607,7 +1613,11 @@ QString EffectsHandlerImpl::supportInformation(const QString &name) const bool EffectsHandlerImpl::isScreenLocked() const { +#ifdef KWIN_BUILD_SCREENLOCKER return ScreenLockerWatcher::self()->isLocked(); +#else + return false; +#endif } QString EffectsHandlerImpl::debug(const QString& name, const QString& parameter) const diff --git a/src/input.cpp b/src/input.cpp index 84f9b5cf8c..375acbe926 100644 --- a/src/input.cpp +++ b/src/input.cpp @@ -8,6 +8,7 @@ SPDX-License-Identifier: GPL-2.0-or-later */ +#include #include "input.h" #include "backends/fakeinput/fakeinputbackend.h" #include "backends/libinput/connection.h" @@ -53,7 +54,9 @@ #include //screenlocker +#ifdef KWIN_BUILD_SCREENLOCKER #include +#endif // Qt #include #include @@ -381,11 +384,13 @@ public: // send event to KSldApp for global accel // if event is set to accepted it means a whitelisted shortcut was triggered // in that case we filter it out and don't process it further +#ifdef KWIN_BUILD_SCREENLOCKER event->setAccepted(false); QCoreApplication::sendEvent(ScreenLocker::KSldApp::self(), event); if (event->isAccepted()) { return true; } +#endif // continue normal processing input()->keyboard()->update(); diff --git a/src/inputmethod.cpp b/src/inputmethod.cpp index 91a4f4c06b..d81ab5e20d 100644 --- a/src/inputmethod.cpp +++ b/src/inputmethod.cpp @@ -6,6 +6,7 @@ SPDX-License-Identifier: GPL-2.0-or-later */ +#include #include "inputmethod.h" #include "abstract_client.h" #include "virtualkeyboard_dbus.h" @@ -16,7 +17,9 @@ #include "screens.h" #include "wayland_server.h" #include "workspace.h" +#ifdef KWIN_BUILD_SCREENLOCKER #include "screenlockerwatcher.h" +#endif #include "deleted.h" #include "touch_input.h" #include "tablet_input.h" @@ -76,7 +79,9 @@ void InputMethod::init() connect(&m_inputMethodCrashTimer, &QTimer::timeout, this, [this] { m_inputMethodCrashes = 0; }); +#ifdef KWIN_BUILD_SCREENLOCKER connect(ScreenLockerWatcher::self(), &ScreenLockerWatcher::aboutToLock, this, &InputMethod::hide); +#endif new VirtualKeyboardDBus(this); qCDebug(KWIN_VIRTUALKEYBOARD) << "Registering the DBus interface"; diff --git a/src/keyboard_input.cpp b/src/keyboard_input.cpp index 51e7b8ba6a..556bfd3ff5 100644 --- a/src/keyboard_input.cpp +++ b/src/keyboard_input.cpp @@ -6,6 +6,7 @@ SPDX-License-Identifier: GPL-2.0-or-later */ +#include #include "keyboard_input.h" #include "abstract_client.h" #include "input_event.h" @@ -14,7 +15,6 @@ #include "keyboard_layout.h" #include "keyboard_repeat.h" #include "modifier_only_shortcuts.h" -#include "screenlockerwatcher.h" #include "toplevel.h" #include "utils/common.h" #include "wayland_server.h" @@ -24,7 +24,9 @@ #include #include //screenlocker +#ifdef KWIN_BUILD_SCREENLOCKER #include +#endif // Frameworks #include // Qt @@ -141,9 +143,11 @@ void KeyboardInputRedirection::init() update(); } ); +#ifdef KWIN_BUILD_SCREENLOCKER if (waylandServer()->hasScreenLockerIntegration()) { connect(ScreenLocker::KSldApp::self(), &ScreenLocker::KSldApp::lockStateChanged, this, &KeyboardInputRedirection::update); } +#endif reconfigure(); } diff --git a/src/main.cpp b/src/main.cpp index 086c982f58..51fabbb68b 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -8,6 +8,7 @@ SPDX-License-Identifier: GPL-2.0-or-later */ +#include #include "main.h" // kwin #include "platform.h" @@ -22,7 +23,9 @@ #include "options.h" #include "pluginmanager.h" #include "screens.h" +#ifdef KWIN_BUILD_SCREENLOCKER #include "screenlockerwatcher.h" +#endif #include "sm.h" #include "utils/xcbutils.h" #include "workspace.h" @@ -284,7 +287,9 @@ void Application::createWorkspace() void Application::createInput() { +#ifdef KWIN_BUILD_SCREENLOCKER ScreenLockerWatcher::create(this); +#endif auto input = InputRedirection::create(this); input->init(); m_platform->createPlatformCursor(this); diff --git a/src/main_wayland.cpp b/src/main_wayland.cpp index 8e740cd0c4..0a9afd0b97 100644 --- a/src/main_wayland.cpp +++ b/src/main_wayland.cpp @@ -506,6 +506,7 @@ int main(int argc, char * argv[]) i18n("List all available backends and quit.")); parser.addOption(listBackendsOption); +#ifdef KWIN_BUILD_SCREENLOCKER QCommandLineOption screenLockerOption(QStringLiteral("lockscreen"), i18n("Starts the session in locked mode.")); parser.addOption(screenLockerOption); @@ -513,6 +514,7 @@ int main(int argc, char * argv[]) QCommandLineOption noScreenLockerOption(QStringLiteral("no-lockscreen"), i18n("Starts the session without lock screen support.")); parser.addOption(noScreenLockerOption); +#endif QCommandLineOption noGlobalShortcutsOption(QStringLiteral("no-global-shortcuts"), i18n("Starts the session without global shortcuts support.")); @@ -634,11 +636,13 @@ int main(int argc, char * argv[]) KWin::WaylandServer *server = KWin::WaylandServer::create(&a); KWin::WaylandServer::InitializationFlags flags; +#ifdef KWIN_BUILD_SCREENLOCKER if (parser.isSet(screenLockerOption)) { flags = KWin::WaylandServer::InitializationFlag::LockScreen; } else if (parser.isSet(noScreenLockerOption)) { flags = KWin::WaylandServer::InitializationFlag::NoLockScreenIntegration; } +#endif if (parser.isSet(noGlobalShortcutsOption)) { flags |= KWin::WaylandServer::InitializationFlag::NoGlobalShortcuts; } diff --git a/src/modifier_only_shortcuts.cpp b/src/modifier_only_shortcuts.cpp index 47da93b1e6..049f5c4955 100644 --- a/src/modifier_only_shortcuts.cpp +++ b/src/modifier_only_shortcuts.cpp @@ -6,10 +6,13 @@ SPDX-License-Identifier: GPL-2.0-or-later */ +#include #include "modifier_only_shortcuts.h" #include "input_event.h" #include "options.h" +#ifdef KWIN_BUILD_SCREENLOCKER #include "screenlockerwatcher.h" +#endif #include "wayland_server.h" #include "workspace.h" @@ -24,7 +27,9 @@ ModifierOnlyShortcuts::ModifierOnlyShortcuts() : QObject() , InputEventSpy() { +#ifdef KWIN_BUILD_SCREENLOCKER connect(ScreenLockerWatcher::self(), &ScreenLockerWatcher::locked, this, &ModifierOnlyShortcuts::reset); +#endif } ModifierOnlyShortcuts::~ModifierOnlyShortcuts() = default; @@ -38,7 +43,9 @@ void ModifierOnlyShortcuts::keyEvent(KeyEvent *event) const bool wasEmpty = m_pressedKeys.isEmpty(); m_pressedKeys.insert(event->nativeScanCode()); if (wasEmpty && m_pressedKeys.size() == 1 && +#ifdef KWIN_BUILD_SCREENLOCKER !ScreenLockerWatcher::self()->isLocked() && +#endif m_pressedButtons == Qt::NoButton && m_cachedMods == Qt::NoModifier) { m_modifier = Qt::KeyboardModifier(int(event->modifiersRelevantForGlobalShortcuts())); diff --git a/src/pointer_input.cpp b/src/pointer_input.cpp index 21ef9b9893..f51493d22c 100644 --- a/src/pointer_input.cpp +++ b/src/pointer_input.cpp @@ -8,6 +8,7 @@ SPDX-License-Identifier: GPL-2.0-or-later */ +#include #include "pointer_input.h" #include "abstract_output.h" #include "platform.h" @@ -31,7 +32,9 @@ #include #include // screenlocker +#ifdef KWIN_BUILD_SCREENLOCKER #include +#endif #include @@ -140,6 +143,7 @@ void PointerInputRedirection::init() Q_EMIT m_cursor->changed(); connect(screens(), &Screens::changed, this, &PointerInputRedirection::updateAfterScreenChange); +#ifdef KWIN_BUILD_SCREENLOCKER if (waylandServer()->hasScreenLockerIntegration()) { connect(ScreenLocker::KSldApp::self(), &ScreenLocker::KSldApp::lockStateChanged, this, [this] { @@ -151,6 +155,7 @@ void PointerInputRedirection::init() } ); } +#endif connect(workspace(), &QObject::destroyed, this, [this] { setInited(false); }); connect(waylandServer(), &QObject::destroyed, this, [this] { setInited(false); }); connect(waylandServer()->seat(), &KWaylandServer::SeatInterface::dragEnded, this, @@ -948,9 +953,11 @@ CursorImage::CursorImage(PointerInputRedirection *parent) reevaluteSource(); } ); +#ifdef KWIN_BUILD_SCREENLOCKER if (waylandServer()->hasScreenLockerIntegration()) { connect(ScreenLocker::KSldApp::self(), &ScreenLocker::KSldApp::lockStateChanged, this, &CursorImage::reevaluteSource); } +#endif connect(m_pointer, &PointerInputRedirection::decorationChanged, this, &CursorImage::updateDecoration); // connect the move resize of all window auto setupMoveResizeConnection = [this] (AbstractClient *c) { diff --git a/src/screenedge.cpp b/src/screenedge.cpp index 569415ed17..b8daf9fc9c 100644 --- a/src/screenedge.cpp +++ b/src/screenedge.cpp @@ -19,6 +19,7 @@ #include "screenedge.h" // KWin +#include #include "abstract_output.h" #include "gestures.h" #include @@ -29,10 +30,13 @@ #include #include "virtualdesktops.h" // DBus generated +#ifdef KWIN_BUILD_SCREENLOCKER #include "screenlocker_interface.h" +#endif // frameworks #include // Qt +#include #include #include #include @@ -329,6 +333,7 @@ bool Edge::handleAction(ElectricBorderAction action) return true; } case ElectricActionLockScreen: { // Lock the screen +#ifdef KWIN_BUILD_SCREENLOCKER OrgFreedesktopScreenSaverInterface interface(QStringLiteral("org.freedesktop.ScreenSaver"), QStringLiteral("/ScreenSaver"), QDBusConnection::sessionBus()); @@ -336,6 +341,9 @@ bool Edge::handleAction(ElectricBorderAction action) interface.Lock(); } return true; +#else + return false; +#endif } case ElectricActionKRunner: { // open krunner QDBusConnection::sessionBus().asyncCall( diff --git a/src/tablet_input.cpp b/src/tablet_input.cpp index ad149f9d5f..a6472c0bfa 100644 --- a/src/tablet_input.cpp +++ b/src/tablet_input.cpp @@ -20,8 +20,6 @@ // KWayland #include #include -// screenlocker -#include // Qt #include #include diff --git a/src/touch_input.cpp b/src/touch_input.cpp index a1d75555c8..01ac1bb15d 100644 --- a/src/touch_input.cpp +++ b/src/touch_input.cpp @@ -7,6 +7,7 @@ SPDX-License-Identifier: GPL-2.0-or-later */ +#include #include "touch_input.h" #include "abstract_client.h" #include "pointer_input.h" @@ -20,7 +21,9 @@ // KWayland #include // screenlocker +#ifdef KWIN_BUILD_SCREENLOCKER #include +#endif // Qt #include #include @@ -45,6 +48,7 @@ void TouchInputRedirection::init() setInited(true); InputDeviceHandler::init(); +#ifdef KWIN_BUILD_SCREENLOCKER if (waylandServer()->hasScreenLockerIntegration()) { connect(ScreenLocker::KSldApp::self(), &ScreenLocker::KSldApp::lockStateChanged, this, [this] { @@ -54,6 +58,7 @@ void TouchInputRedirection::init() } ); } +#endif connect(workspace(), &QObject::destroyed, this, [this] { setInited(false); }); connect(waylandServer(), &QObject::destroyed, this, [this] { setInited(false); }); } diff --git a/src/wayland_server.cpp b/src/wayland_server.cpp index 9fcdf11c7d..831ae1ebe1 100644 --- a/src/wayland_server.cpp +++ b/src/wayland_server.cpp @@ -6,6 +6,7 @@ SPDX-License-Identifier: GPL-2.0-or-later */ +#include #include "wayland_server.h" #include "abstract_wayland_output.h" #include "x11client.h" @@ -80,7 +81,9 @@ #include //screenlocker +#ifdef KWIN_BUILD_SCREENLOCKER #include +#endif using namespace KWaylandServer; @@ -587,6 +590,7 @@ void WaylandServer::initWorkspace() void WaylandServer::initScreenLocker() { +#ifdef KWIN_BUILD_SCREENLOCKER auto *screenLockerApp = ScreenLocker::KSldApp::self(); ScreenLocker::KSldApp::self()->setGreeterEnvironment(kwinApp()->processStartupEnvironment()); @@ -639,6 +643,7 @@ void WaylandServer::initScreenLocker() if (m_initFlags.testFlag(InitializationFlag::LockScreen)) { ScreenLocker::KSldApp::self()->lock(ScreenLocker::EstablishLock::Immediate); } +#endif } WaylandServer::SocketPairConnection WaylandServer::createConnection() @@ -746,16 +751,24 @@ XdgSurfaceClient *WaylandServer::findXdgSurfaceClient(SurfaceInterface *surface) bool WaylandServer::isScreenLocked() const { +#ifdef KWIN_BUILD_SCREENLOCKER if (!hasScreenLockerIntegration()) { return false; } return ScreenLocker::KSldApp::self()->lockState() == ScreenLocker::KSldApp::Locked || ScreenLocker::KSldApp::self()->lockState() == ScreenLocker::KSldApp::AcquiringLock; +#else + return false; +#endif } bool WaylandServer::hasScreenLockerIntegration() const { +#ifdef KWIN_BUILD_SCREENLOCKER return !m_initFlags.testFlag(InitializationFlag::NoLockScreenIntegration); +#else + return false; +#endif } bool WaylandServer::hasGlobalShortcutSupport() const