summaryrefslogtreecommitdiff
path: root/user/kscreenlocker/optional-wayland.patch
diff options
context:
space:
mode:
Diffstat (limited to 'user/kscreenlocker/optional-wayland.patch')
-rw-r--r--user/kscreenlocker/optional-wayland.patch448
1 files changed, 448 insertions, 0 deletions
diff --git a/user/kscreenlocker/optional-wayland.patch b/user/kscreenlocker/optional-wayland.patch
new file mode 100644
index 000000000..eee3cb10e
--- /dev/null
+++ b/user/kscreenlocker/optional-wayland.patch
@@ -0,0 +1,448 @@
+--- kscreenlocker-5.12.9/CMakeLists.txt.old 2019-09-10 10:30:52.000000000 +0000
++++ kscreenlocker-5.12.9/CMakeLists.txt 2019-12-29 16:39:31.945860585 +0000
+@@ -73,16 +73,16 @@
+
+ find_package(Qt5 ${QT_MIN_VERSION} CONFIG REQUIRED COMPONENTS X11Extras)
+
+-find_package(KF5Wayland CONFIG REQUIRED)
++find_package(KF5Wayland)
+ set_package_properties(KF5Wayland PROPERTIES
+- TYPE REQUIRED
+- PURPOSE "Required for building screenlocker")
++ TYPE OPTIONAL
++ PURPOSE "Required for building Wayland screenlocker")
+ find_package(WaylandScanner)
+ find_package(Wayland 1.3 COMPONENTS Client Server)
+
+ set_package_properties(Wayland PROPERTIES
+- TYPE REQUIRED
+- PURPOSE "Required for building screenlocker")
++ TYPE OPTIONAL
++ PURPOSE "Required for building Wayland screenlocker")
+
+ find_package(loginctl)
+ set_package_properties(loginctl PROPERTIES
+@@ -138,9 +138,7 @@
+ interface.cpp
+ globalaccel.cpp
+ x11locker.cpp
+- waylandlocker.cpp
+ logind.cpp
+- waylandserver.cpp
+ powermanagement.cpp
+ powermanagement_inhibition.cpp
+ )
+@@ -149,10 +147,20 @@
+ kconfig_add_kcfg_files(ksld_SRCS kcfg/kscreensaversettings.kcfgc)
+ qt5_add_dbus_interface(ksld_SRCS ${powerdevilpolicyagent_xml} powerdevilpolicyagent)
+
++if(KF5Wayland_FOUND)
++list(APPEND ksld_SRCS
++ waylandlocker.cpp
++ waylandserver.cpp
++)
+ ecm_add_wayland_server_protocol(ksld_SRCS
+ PROTOCOL protocols/ksld.xml
+ BASENAME ksld
+ )
++set(OPT_WL_LIBRARIES
++ KF5::WaylandServer
++ Wayland::Server
++)
++endif(KF5Wayland_FOUND)
+
+ add_library(KScreenLocker SHARED ${ksld_SRCS})
+
+@@ -171,8 +179,7 @@
+ ${X11_LIBRARIES}
+ XCB::XCB
+ XCB::KEYSYMS
+- KF5::WaylandServer
+- Wayland::Server
++ ${OPT_WL_LIBRARIES}
+ )
+
+ if (X11_Xinput_FOUND)
+--- kscreenlocker-5.12.9/ksldapp.cpp.old 2019-09-10 10:30:16.000000000 +0000
++++ kscreenlocker-5.12.9/ksldapp.cpp 2019-12-29 17:00:37.930322855 +0000
+@@ -38,9 +38,11 @@
+ #include <KNotification>
+ #include <KGlobalAccel>
+
++#ifdef WAYLAND_FOUND
+ //kwayland
+ #include <KWayland/Server/display.h>
+ #include <KWayland/Server/clientconnection.h>
++#endif
+
+ // Qt
+ #include <QAction>
+@@ -84,8 +86,10 @@
+ , m_lockState(Unlocked)
+ , m_lockProcess(NULL)
+ , m_lockWindow(NULL)
++#ifdef WAYLAND_FOUND
+ , m_waylandServer(new WaylandServer(this))
+ , m_waylandDisplay(nullptr)
++#endif /* WAYLAND_FOUND */
+ , m_lockedTimer(QElapsedTimer())
+ , m_idleId(0)
+ , m_lockGrace(0)
+@@ -96,8 +100,12 @@
+ , m_greeterEnv(QProcessEnvironment::systemEnvironment())
+ , m_powerManagementInhibition(new PowerManagementInhibition(this))
+ {
++#ifdef WAYLAND_FOUND
+ m_isX11 = QX11Info::isPlatformX11();
+ m_isWayland = QCoreApplication::instance()->property("platformName").toString().startsWith( QLatin1String("wayland"), Qt::CaseInsensitive);
++#else
++ m_isX11 = true;
++#endif
+ }
+
+ KSldApp::~KSldApp()
+@@ -215,9 +223,11 @@
+ auto finishedSignal = static_cast<void (QProcess::*)(int, QProcess::ExitStatus)>(&QProcess::finished);
+ connect(m_lockProcess, finishedSignal, this,
+ [this](int exitCode, QProcess::ExitStatus exitStatus) {
++#ifdef WAYLAND_FOUND
+ if (m_isWayland && m_waylandDisplay && m_greeterClientConnection) {
+ m_greeterClientConnection->destroy();
+ }
++#endif /* WAYLAND_FOUND */
+ if ((!exitCode && exitStatus == QProcess::NormalExit) || s_graceTimeKill || s_logindExit) {
+ // unlock process finished successfully - we can remove the lock grab
+ s_graceTimeKill = false;
+@@ -240,7 +250,9 @@
+ [this](QProcess::ProcessError error) {
+ if (error == QProcess::FailedToStart) {
+ doUnlock();
++#ifdef WAYLAND_FOUND
+ m_waylandServer->stop();
++#endif /* WAYLAND_FOUND */
+ qCritical() << "Greeter Process not available";
+ }
+ }
+@@ -533,7 +545,9 @@
+ m_lockedTimer.invalidate();
+ m_greeterCrashedCounter = 0;
+ endGraceTime();
++#ifdef WAYLAND_FOUND
+ m_waylandServer->stop();
++#endif /* WAYLAND_FOUND */
+ KNotification::event(QStringLiteral("unlocked"),
+ i18n("Screen unlocked"),
+ QPixmap(),
+@@ -553,6 +567,7 @@
+ {
+ QProcessEnvironment env = m_greeterEnv;
+
++#ifdef WAYLAND_FOUND
+ if (m_isWayland && m_waylandDisplay) {
+ int sx[2];
+ if (socketpair(AF_UNIX, SOCK_STREAM | SOCK_CLOEXEC, 0, sx) < 0) {
+@@ -576,6 +591,7 @@
+ env.insert("WAYLAND_SOCKET", QByteArray::number(socket));
+ }
+ }
++#endif /* WAYLAND_FOUND */
+ QStringList args;
+ if (establishLock == EstablishLock::Immediate) {
+ args << QStringLiteral("--immediateLock");
+@@ -596,6 +612,7 @@
+ env.insert(s_qtQuickBackend, QStringLiteral("software"));
+ }
+
++#ifdef WAYLAND_FOUND
+ // start the Wayland server
+ int fd = m_waylandServer->start();
+ if (fd == -1) {
+@@ -605,10 +622,13 @@
+
+ args << QStringLiteral("--ksldfd");
+ args << QString::number(fd);
++#endif /* WAYLAND_FOUND */
+
+ m_lockProcess->setProcessEnvironment(env);
+ m_lockProcess->start(QStringLiteral(KSCREENLOCKER_GREET_BIN), args);
++#ifdef WAYLAND_FOUND
+ close(fd);
++#endif
+ }
+
+ void KSldApp::showLockWindow()
+@@ -617,9 +637,11 @@
+ if (m_isX11) {
+ m_lockWindow = new X11Locker(this);
+ }
++#ifdef WAYLAND_FOUND
+ if (m_isWayland) {
+ m_lockWindow = new WaylandLocker(m_waylandDisplay, this);
+ }
++#endif /* WAYLAND_FOUND */
+ if (!m_lockWindow) {
+ return;
+ }
+@@ -637,7 +659,9 @@
+ lockScreenShown();
+ }
+ , Qt::QueuedConnection);
++#ifdef WAYLAND_FOUND
+ connect(m_waylandServer, &WaylandServer::x11WindowAdded, m_lockWindow, &AbstractLocker::addAllowedWindow);
++#endif /* WAYLAND_FOUND */
+ }
+ m_lockWindow->showLockWindow();
+ if (m_isX11) {
+@@ -702,12 +726,14 @@
+ }
+ }
+
++#ifdef WAYLAND_FOUND
+ void KSldApp::setWaylandDisplay(KWayland::Server::Display *display)
+ {
+ if (m_waylandDisplay != display) {
+ m_waylandDisplay = display;
+ }
+ }
++#endif /* WAYLAND_FOUND */
+
+ void KSldApp::lockScreenShown()
+ {
+@@ -723,9 +749,11 @@
+ void KSldApp::setGreeterEnvironment(const QProcessEnvironment &env)
+ {
+ m_greeterEnv = env;
++#ifdef WAYLAND_FOUND
+ if (m_isWayland) {
+ m_greeterEnv.insert(QStringLiteral("QT_QPA_PLATFORM"), QStringLiteral("wayland"));
+ }
++#endif /* WAYLAND_FOUND */
+ }
+
+ bool KSldApp::event(QEvent *event)
+--- kscreenlocker-5.12.9/autotests/CMakeLists.txt.old 2019-09-10 10:30:16.000000000 +0000
++++ kscreenlocker-5.12.9/autotests/CMakeLists.txt 2019-12-29 17:16:10.540254516 +0000
+@@ -55,6 +55,7 @@
+ add_test(ksmserver-x11LockerTest x11LockerTest)
+ ecm_mark_as_test(x11LockerTest)
+
++if(KF5Wayland_FOUND)
+ #######################################
+ # NoScreensTest
+ #######################################
+@@ -67,3 +68,4 @@
+ )
+ add_test(ksld-noScreensTest noScreensTest)
+ ecm_mark_as_test(noScreensTest)
++endif()
+--- kscreenlocker-5.12.9/greeter/greeterapp.cpp.old 2019-09-10 10:30:16.000000000 +0000
++++ kscreenlocker-5.12.9/greeter/greeterapp.cpp 2019-12-29 17:14:57.458241696 +0000
+@@ -26,6 +26,7 @@
+ #include "lnf_integration.h"
+
+ #include <config-kscreenlocker.h>
++#include <config-workspace.h>
+
+ // KDE
+ #include <KAuthorized>
+@@ -40,12 +41,14 @@
+ #include <KPackage/Package>
+ #include <KPackage/PackageStructure>
+ #include <KPackage/PackageLoader>
++#ifdef WAYLAND_FOUND
+ // KWayland
+ #include <KWayland/Client/connection_thread.h>
+ #include <KWayland/Client/event_queue.h>
+ #include <KWayland/Client/plasmashell.h>
+ #include <KWayland/Client/registry.h>
+ #include <KWayland/Client/surface.h>
++#endif
+ // Qt
+ #include <QClipboard>
+ #include <QAbstractNativeEventFilter>
+@@ -63,9 +66,11 @@
+ #include <QQmlExpression>
+
+ #include <QX11Info>
++#ifdef WAYLAND_FOUND
+ // Wayland
+ #include <wayland-client.h>
+ #include <wayland-ksld-client-protocol.h>
++#endif
+ // X11
+ #include <X11/Xatom.h>
+ #include <X11/Xlib.h>
+@@ -137,6 +142,7 @@
+ }
+ qDeleteAll(m_views);
+
++#ifdef WAYLAND_FOUND
+ if (m_ksldInterface) {
+ org_kde_ksld_destroy(m_ksldInterface);
+ }
+@@ -148,6 +154,7 @@
+ m_ksldConnectionThread->quit();
+ m_ksldConnectionThread->wait();
+ }
++#endif /* WAYLAND_FOUND */
+ }
+
+ Authenticator *UnlockApp::createAuthenticator()
+@@ -165,7 +172,10 @@
+
+ void UnlockApp::initialize()
+ {
++#ifdef WAYLAND_FOUND
+ initializeWayland();
++#endif /* WAYLAND_FOUND */
++
+ // set up the request ignore timeout, so that multiple requests to sleep/suspend/shutdown
+ // are not processed in quick (and confusing) succession)
+ m_resetRequestIgnoreTimer->setSingleShot(true);
+@@ -205,6 +215,7 @@
+ if (!platformName().startsWith(QLatin1String("wayland"), Qt::CaseInsensitive)) {
+ return;
+ }
++#ifdef WAYLAND_FOUND
+ using namespace KWayland::Client;
+ auto *c = ConnectionThread::fromApplication(this);
+ if (!c) {
+@@ -219,6 +230,7 @@
+ return;
+ }
+ m_plasmaShell = r->createPlasmaShell(i.name, i.version, this);
++#endif /* WAYLAND_FOUND */
+ }
+
+ void UnlockApp::loadWallpaperPlugin(KQuickAddons::QuickViewSharedEngine *view)
+@@ -281,6 +293,7 @@
+ }
+ }
+
++#ifdef WAYLAND_FOUND
+ if (m_ksldInterface) {
+ view->create();
+ org_kde_ksld_x11window(m_ksldInterface, view->winId());
+@@ -294,6 +307,7 @@
+ view->setProperty("plasmaShellSurface", QVariant::fromValue(shellSurface));
+ }
+ }
++#endif /* WAYLAND_FOUND */
+
+ // engine stuff
+ QQmlContext* context = view->engine()->rootContext();
+@@ -353,10 +367,14 @@
+
+ auto screen = QGuiApplication::screens()[i];
+ view->setGeometry(screen->geometry());
++#ifdef WAYLAND_FOUND
+ KWayland::Client::PlasmaShellSurface *plasmaSurface = view->property("plasmaShellSurface").value<KWayland::Client::PlasmaShellSurface *>();
+ if (plasmaSurface) {
+ plasmaSurface->setPosition(view->geometry().topLeft());
+ }
++#else
++ void *plasmaSurface = nullptr;
++#endif /* WAYLAND_FOUND */
+ if (auto object = view->property("wallpaperGraphicsObject").value<KDeclarative::QmlObjectSharedEngine*>()) {
+ //initialize with our size to avoid as much resize events as possible
+ object->completeInitialization({
+@@ -370,9 +388,11 @@
+ view,
+ [view, plasmaSurface](const QRect &geo) {
+ view->setGeometry(geo);
++#ifdef WAYLAND_FOUND
+ if (plasmaSurface) {
+ plasmaSurface->setPosition(view->geometry().topLeft());
+ }
++#endif /* WAYLAND_FOUND */
+ }
+ );
+
+@@ -477,6 +497,7 @@
+
+ void UnlockApp::suspendToRam()
+ {
++#ifdef WAYLAND_FOUND
+ if (m_ignoreRequests) {
+ return;
+ }
+@@ -485,11 +506,12 @@
+ m_resetRequestIgnoreTimer->start();
+
+ org_kde_ksld_suspendSystem(m_ksldInterface);
+-
++#endif /* WAYLAND_FOUND */
+ }
+
+ void UnlockApp::suspendToDisk()
+ {
++#ifdef WAYLAND_FOUND
+ if (m_ignoreRequests) {
+ return;
+ }
+@@ -498,6 +520,7 @@
+ m_resetRequestIgnoreTimer->start();
+
+ org_kde_ksld_hibernateSystem(m_ksldInterface);
++#endif /* WAYLAND_FOUND */
+ }
+
+ void UnlockApp::setTesting(bool enable)
+@@ -626,7 +649,7 @@
+ m_defaultToSwitchUser = defaultToSwitchUser;
+ }
+
+-
++#ifdef WAYLAND_FOUND
+ static void osdProgress(void *data, org_kde_ksld *org_kde_ksld, const char *icon, int32_t percent, const char *text)
+ {
+ Q_UNUSED(org_kde_ksld)
+@@ -657,9 +680,11 @@
+ canSuspend,
+ canHibernate
+ };
++#endif /* WAYLAND_FOUND */
+
+ void UnlockApp::setKsldSocket(int socket)
+ {
++#ifdef WAYLAND_FOUND
+ using namespace KWayland::Client;
+ m_ksldConnection = new ConnectionThread;
+ m_ksldConnection->setSocketFd(socket);
+@@ -697,6 +722,7 @@
+ m_ksldConnection->moveToThread(m_ksldConnectionThread);
+ m_ksldConnectionThread->start();
+ m_ksldConnection->initConnection();
++#endif /* WAYLAND_FOUND */
+ }
+
+ void UnlockApp::osdProgress(const QString &icon, int percent, const QString &additionalText)
+--- kscreenlocker-5.12.9/greeter/CMakeLists.txt.old 2019-09-10 10:30:16.000000000 +0000
++++ kscreenlocker-5.12.9/greeter/CMakeLists.txt 2019-12-29 17:29:44.832222068 +0000
+@@ -24,10 +24,16 @@
+ qt5_add_resources(kscreenlocker_greet_SRCS fallbacktheme.qrc)
+ kconfig_add_kcfg_files(kscreenlocker_greet_SRCS ${CMAKE_CURRENT_SOURCE_DIR}/../kcfg/kscreensaversettings.kcfgc)
+
++if(KF5Wayland_FOUND)
+ ecm_add_wayland_client_protocol(kscreenlocker_greet_SRCS
+ PROTOCOL ../protocols/ksld.xml
+ BASENAME ksld
+ )
++set(OPT_WL_CLI_LIBRARIES
++ KF5::WaylandClient
++ Wayland::Client
++)
++endif()
+
+ add_executable(kscreenlocker_greet ${kscreenlocker_greet_SRCS})
+
+@@ -43,8 +49,7 @@
+ Qt5::Qml
+ Qt5::X11Extras
+ ${X11_LIBRARIES}
+- KF5::WaylandClient
+- Wayland::Client
++ ${OPT_WL_CLI_LIBRARIES}
+ )
+ if(HAVE_SECCOMP)
+ target_link_libraries(kscreenlocker_greet Qt5::DBus Seccomp::Seccomp)