diff --git a/river/LockManager.zig b/river/LockManager.zig index 1fb897d..0c108fc 100644 --- a/river/LockManager.zig +++ b/river/LockManager.zig @@ -95,6 +95,8 @@ fn handleLock(listener: *wl.Listener(*wlr.SessionLockV1), lock: *wlr.SessionLock manager.lock_surfaces_timer.timerUpdate(200) catch { log.err("error setting lock surfaces timer, imperfect frames may be shown", .{}); 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; } diff --git a/river/Output.zig b/river/Output.zig index b14247a..2e22524 100644 --- a/river/Output.zig +++ b/river/Output.zig @@ -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 // already been added. 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 {