[wayland] Start ksldapp from the WaylandServer
This introduces --lockscreen option in kwin_wayland which when used will lock screen immediately. Also dependency to newly created kscreenlocker repo is introduced. REVIEW: 125954
This commit is contained in:
parent
1f9fa64a49
commit
bacfd876fe
4 changed files with 34 additions and 3 deletions
|
@ -116,6 +116,11 @@ set_package_properties(KF5Wayland PROPERTIES
|
||||||
TYPE REQUIRED
|
TYPE REQUIRED
|
||||||
)
|
)
|
||||||
|
|
||||||
|
find_package(KScreenLocker CONFIG REQUIRED)
|
||||||
|
set_package_properties(KScreenLocker PROPERTIES
|
||||||
|
TYPE REQUIRED
|
||||||
|
PURPOSE "For screenlocker integration in kwin_wayland")
|
||||||
|
|
||||||
find_package(EGL)
|
find_package(EGL)
|
||||||
set_package_properties(EGL PROPERTIES
|
set_package_properties(EGL PROPERTIES
|
||||||
TYPE RUNTIME
|
TYPE RUNTIME
|
||||||
|
@ -462,6 +467,7 @@ set(kwin_KDE_LIBS
|
||||||
KF5::WindowSystem
|
KF5::WindowSystem
|
||||||
KDecoration2::KDecoration
|
KDecoration2::KDecoration
|
||||||
KDecoration2::KDecoration2Private
|
KDecoration2::KDecoration2Private
|
||||||
|
PW::KScreenLocker
|
||||||
)
|
)
|
||||||
|
|
||||||
set(kwin_XLIB_LIBS
|
set(kwin_XLIB_LIBS
|
||||||
|
|
|
@ -486,6 +486,10 @@ int main(int argc, char * argv[])
|
||||||
i18n("List all available backends and quit."));
|
i18n("List all available backends and quit."));
|
||||||
parser.addOption(listBackendsOption);
|
parser.addOption(listBackendsOption);
|
||||||
|
|
||||||
|
QCommandLineOption screenLockerOption(QStringLiteral("lockscreen"),
|
||||||
|
i18n("Starts the session in locked mode."));
|
||||||
|
parser.addOption(screenLockerOption);
|
||||||
|
|
||||||
parser.addPositionalArgument(QStringLiteral("applications"),
|
parser.addPositionalArgument(QStringLiteral("applications"),
|
||||||
i18n("Applications to start once Wayland and Xwayland server are started"),
|
i18n("Applications to start once Wayland and Xwayland server are started"),
|
||||||
QStringLiteral("[/path/to/application...]"));
|
QStringLiteral("[/path/to/application...]"));
|
||||||
|
@ -578,7 +582,12 @@ int main(int argc, char * argv[])
|
||||||
|
|
||||||
// TODO: create backend without having the server running
|
// TODO: create backend without having the server running
|
||||||
KWin::WaylandServer *server = KWin::WaylandServer::create(&a);
|
KWin::WaylandServer *server = KWin::WaylandServer::create(&a);
|
||||||
server->init(parser.value(waylandSocketOption).toUtf8());
|
|
||||||
|
KWin::WaylandServer::InitalizationFlags flags;
|
||||||
|
if (parser.isSet(screenLockerOption)) {
|
||||||
|
flags = KWin::WaylandServer::InitalizationFlag::LockScreen;
|
||||||
|
}
|
||||||
|
server->init(parser.value(waylandSocketOption).toUtf8(), flags);
|
||||||
|
|
||||||
if (qobject_cast<KWin::AbstractBackend*>((*pluginIt).instantiate())) {
|
if (qobject_cast<KWin::AbstractBackend*>((*pluginIt).instantiate())) {
|
||||||
#if HAVE_INPUT
|
#if HAVE_INPUT
|
||||||
|
|
|
@ -53,6 +53,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
|
|
||||||
|
//screenlocker
|
||||||
|
#include <KScreenLocker/KsldApp>
|
||||||
|
|
||||||
using namespace KWayland::Server;
|
using namespace KWayland::Server;
|
||||||
|
|
||||||
namespace KWin
|
namespace KWin
|
||||||
|
@ -77,8 +80,9 @@ WaylandServer::~WaylandServer()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void WaylandServer::init(const QByteArray &socketName)
|
void WaylandServer::init(const QByteArray &socketName, InitalizationFlags flags)
|
||||||
{
|
{
|
||||||
|
m_initFlags = flags;
|
||||||
m_display = new KWayland::Server::Display(this);
|
m_display = new KWayland::Server::Display(this);
|
||||||
if (!socketName.isNull() && !socketName.isEmpty()) {
|
if (!socketName.isNull() && !socketName.isEmpty()) {
|
||||||
m_display->setSocketName(QString::fromUtf8(socketName));
|
m_display->setSocketName(QString::fromUtf8(socketName));
|
||||||
|
@ -206,6 +210,10 @@ void WaylandServer::initWorkspace()
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
ScreenLocker::KSldApp::self();
|
||||||
|
if (m_initFlags.testFlag(InitalizationFlag::LockScreen)) {
|
||||||
|
ScreenLocker::KSldApp::self()->lock(ScreenLocker::EstablishLock::Immediate);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void WaylandServer::initOutputs()
|
void WaylandServer::initOutputs()
|
||||||
|
|
|
@ -62,8 +62,15 @@ class KWIN_EXPORT WaylandServer : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
|
enum class InitalizationFlag {
|
||||||
|
NoOptions = 0x0,
|
||||||
|
LockScreen = 0x1
|
||||||
|
};
|
||||||
|
|
||||||
|
Q_DECLARE_FLAGS(InitalizationFlags, InitalizationFlag)
|
||||||
|
|
||||||
virtual ~WaylandServer();
|
virtual ~WaylandServer();
|
||||||
void init(const QByteArray &socketName = QByteArray());
|
void init(const QByteArray &socketName = QByteArray(), InitalizationFlags flags = InitalizationFlag::NoOptions);
|
||||||
void initOutputs();
|
void initOutputs();
|
||||||
|
|
||||||
KWayland::Server::Display *display() {
|
KWayland::Server::Display *display() {
|
||||||
|
@ -159,6 +166,7 @@ private:
|
||||||
QList<ShellClient*> m_clients;
|
QList<ShellClient*> m_clients;
|
||||||
QList<ShellClient*> m_internalClients;
|
QList<ShellClient*> m_internalClients;
|
||||||
QHash<KWayland::Server::ClientConnection*, quint16> m_clientIds;
|
QHash<KWayland::Server::ClientConnection*, quint16> m_clientIds;
|
||||||
|
InitalizationFlags m_initFlags;
|
||||||
KWIN_SINGLETON(WaylandServer)
|
KWIN_SINGLETON(WaylandServer)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue