diff --git a/shell_client.cpp b/shell_client.cpp index 6868dfc5a7..929ceed50e 100644 --- a/shell_client.cpp +++ b/shell_client.cpp @@ -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(); diff --git a/shell_client.h b/shell_client.h index 2cf24a3573..35ae084fdf 100644 --- a/shell_client.h +++ b/shell_client.h @@ -101,6 +101,8 @@ public: return m_windowId; } bool isInternal() const; + bool isLockScreen() const; + bool isInputMethod() const; QWindow *internalWindow() const { return m_internalWindow; } diff --git a/wayland_server.cpp b/wayland_server.cpp index aeb819ca42..6cb222c30f 100644 --- a/wayland_server.cpp +++ b/wayland_server.cpp @@ -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); } diff --git a/wayland_server.h b/wayland_server.h index b9bda4df83..e54e39bff0 100644 --- a/wayland_server.h +++ b/wayland_server.h @@ -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;