Commit 9d38f57d authored by Xaver Hugl's avatar Xaver Hugl
Browse files

waylandserver: only signal lockScreenShown once it has actually been shown

When the system goes to suspend and screen locking for suspend is enabled,
suspend is inhibited until ScreenLocker::KSldApp::self()->lockScreenShown()
gets called, in order to make sure that the lockscreen is shown before the
system goes to standby, and thus also when the system wakes (instead of
potentially sensitive user information).
However, signalling that when the lockscreen gets mapped can't work reliably,
as it's then a matter of timing whether or not KWin actually presents an
image with the lockscreen before suspending. To fix that, this commit replaces
that logic with only calling lockScreenShown once every output actually got a
lockscreen presented.
parent 7f2891ed
Pipeline #157185 passed with stage
in 14 minutes and 44 seconds
......@@ -213,10 +213,6 @@ KWaylandServer::ClientConnection *WaylandServer::inputMethodConnection() const
void WaylandServer::registerShellClient(AbstractClient *client)
if (client->isLockScreen()) {
if (client->readyForPainting()) {
Q_EMIT shellClientAdded(client);
} else {
......@@ -623,6 +619,8 @@ void WaylandServer::initScreenLocker()
m_screenLockerClientConnection = nullptr;
new LockScreenPresentationWatcher(this);
const QVector<SeatInterface *> seatIfaces = m_display->seats();
for (auto *seat : seatIfaces) {
disconnect(seat, &KWaylandServer::SeatInterface::timestampChanged,
......@@ -797,4 +795,23 @@ QString WaylandServer::socketName() const
return QString();
WaylandServer::LockScreenPresentationWatcher::LockScreenPresentationWatcher(WaylandServer *server)
connect(server, &WaylandServer::shellClientAdded, this, [this](AbstractClient *client) {
if (client->isLockScreen()) {
connect(client->output()->renderLoop(), &RenderLoop::framePresented, this, [this, client]() {
// only signal lockScreenShown once all outputs have been presented at least once
m_signaledOutputs << client->output();
if (m_signaledOutputs.size() == kwinApp()->platform()->enabledOutputs().size()) {
delete this;
QTimer::singleShot(1000, this, [this]() {
delete this;
......@@ -243,6 +243,16 @@ private:
void handleOutputRemoved(AbstractOutput *output);
void handleOutputEnabled(AbstractOutput *output);
void handleOutputDisabled(AbstractOutput *output);
class LockScreenPresentationWatcher : public QObject
LockScreenPresentationWatcher(WaylandServer *server);
QSet<AbstractOutput *> m_signaledOutputs;
KWaylandServer::Display *m_display = nullptr;
KWaylandServer::CompositorInterface *m_compositor = nullptr;
KWaylandServer::SeatInterface *m_seat = nullptr;
Supports Markdown
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