session-lock: properly handle disabled outputs

Outputs that are part of the layout but currently disabled (e.g. due
to use of wlr-output-power-management) are not correctly handled as
river currently waits for them to present a new locked frame before
sending the locked event.

This new frame never comes however since the output is disabled. Fix
this by maintaining the correct Output.lock_render_state as outputs
are enabled/disabled.

Additionally add missing maybeLock() calls to handle the case that all
outputs in the layout are disabled.
This commit is contained in:
Isaac Freund 2023-01-18 11:41:46 +01:00
parent 8a3530b8a3
commit 6c7586e8d7
No known key found for this signature in database
GPG Key ID: 86DED400DDFD7A11
2 changed files with 17 additions and 0 deletions

View File

@ -95,6 +95,8 @@ fn handleLock(listener: *wl.Listener(*wlr.SessionLockV1), lock: *wlr.SessionLock
manager.lock_surfaces_timer.timerUpdate(200) catch { manager.lock_surfaces_timer.timerUpdate(200) catch {
log.err("error setting lock surfaces timer, imperfect frames may be shown", .{}); log.err("error setting lock surfaces timer, imperfect frames may be shown", .{});
manager.state = .waiting_for_blank; manager.state = .waiting_for_blank;
// This call is necessary in the case that all outputs in the layout are disabled.
manager.maybeLock();
}; };
{ {
@ -138,6 +140,9 @@ fn handleLockSurfacesTimeout(manager: *LockManager) c_int {
} }
} }
// This call is necessary in the case that all outputs in the layout are disabled.
manager.maybeLock();
return 0; return 0;
} }

View File

@ -507,6 +507,18 @@ fn handleEnable(listener: *wl.Listener(*wlr.Output), wlr_output: *wlr.Output) vo
// Add the output to root.outputs and the output layout if it has not // Add the output to root.outputs and the output layout if it has not
// already been added. // already been added.
if (wlr_output.enabled) server.root.addOutput(self); if (wlr_output.enabled) server.root.addOutput(self);
if (wlr_output.enabled) {
switch (server.lock_manager.state) {
.unlocked => self.lock_render_state = .unlocked,
.waiting_for_lock_surfaces, .waiting_for_blank, .locked => {
assert(self.lock_render_state == .blanked);
},
}
} else {
// Disabling and re-enabling an output always blanks it.
self.lock_render_state = .blanked;
}
} }
fn handleFrame(listener: *wl.Listener(*wlr.OutputDamage), _: *wlr.OutputDamage) void { fn handleFrame(listener: *wl.Listener(*wlr.OutputDamage), _: *wlr.OutputDamage) void {