Commit 3a137198 authored by Bhushan Shah's avatar Bhushan Shah 📱

[wayland] Introduce ShellClient::isLockScreen method

This allows to check if specific ShellClient is from LockScreen or not,
as well as this adds method to verify if ShellClient is from input
method like maliit.

Now that KWin knows about which window is from Screenlocker it can apply
various security restrictions like no other window then greeter is on
top of it.

Reviewed-By: Martin Gräßlin
parent cbbd6844
......@@ -626,6 +626,16 @@ bool ShellClient::isInternal() const
return m_shellSurface->client() == waylandServer()->internalConnection();
}
bool ShellClient::isLockScreen() const
{
return m_shellSurface->client() == waylandServer()->greeterClientConnection();
}
bool ShellClient::isInputMethod() const
{
return m_shellSurface->client() == waylandServer()->inputMethodConnection();
}
xcb_window_t ShellClient::window() const
{
return windowId();
......
......@@ -101,6 +101,8 @@ public:
return m_windowId;
}
bool isInternal() const;
bool isLockScreen() const;
bool isInputMethod() const;
QWindow *internalWindow() const {
return m_internalWindow;
}
......
......@@ -214,6 +214,19 @@ void WaylandServer::initWorkspace()
ScreenLocker::KSldApp::self();
ScreenLocker::KSldApp::self()->setWaylandDisplay(m_display);
ScreenLocker::KSldApp::self()->initialize();
connect(ScreenLocker::KSldApp::self(), &ScreenLocker::KSldApp::locked, this,
[this] () {
m_screenLockerClientConnection = ScreenLocker::KSldApp::self()->greeterClientConnection();
}
);
connect(ScreenLocker::KSldApp::self(), &ScreenLocker::KSldApp::unlocked, this,
[this] () {
m_screenLockerClientConnection = nullptr;
}
);
if (m_initFlags.testFlag(InitalizationFlag::LockScreen)) {
ScreenLocker::KSldApp::self()->lock(ScreenLocker::EstablishLock::Immediate);
}
......
......@@ -127,6 +127,9 @@ public:
KWayland::Server::ClientConnection *internalConnection() const {
return m_internalConnection.server;
}
KWayland::Server::ClientConnection *screenLockerClientConnection() const {
return m_screenLockerClientConnection;
}
KWayland::Client::ShmPool *internalShmPool() {
return m_internalConnection.shm;
}
......@@ -154,6 +157,7 @@ private:
KWayland::Server::QtSurfaceExtensionInterface *m_qtExtendedSurface = nullptr;
KWayland::Server::ClientConnection *m_xwaylandConnection = nullptr;
KWayland::Server::ClientConnection *m_inputMethodServerConnection = nullptr;
KWayland::Server::ClientConnection *m_screenLockerClientConnection = nullptr;
struct {
KWayland::Server::ClientConnection *server = nullptr;
KWayland::Client::ConnectionThread *client = nullptr;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment