[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
This commit is contained in:
Bhushan Shah 2015-11-06 19:38:13 +05:30
parent cbbd684430
commit 3a1371989e
4 changed files with 29 additions and 0 deletions

View file

@ -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();

View file

@ -101,6 +101,8 @@ public:
return m_windowId;
}
bool isInternal() const;
bool isLockScreen() const;
bool isInputMethod() const;
QWindow *internalWindow() const {
return m_internalWindow;
}

View file

@ -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);
}

View file

@ -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;