diff options
| author | Isaac Freund <mail@isaacfreund.com> | 2023-01-18 11:41:46 +0100 |
|---|---|---|
| committer | Isaac Freund <mail@isaacfreund.com> | 2023-01-18 12:31:07 +0100 |
| commit | 6c7586e8d7c8c6a59b73864fc3096abf3f60d0ac (patch) | |
| tree | 78b51aa0bd575ec0d1802f162788d2b802829682 | |
| parent | 8a3530b8a3d75aaa294d5cca718fc955d409f598 (diff) | |
| download | river-6c7586e8d7c8c6a59b73864fc3096abf3f60d0ac.tar.gz river-6c7586e8d7c8c6a59b73864fc3096abf3f60d0ac.tar.xz | |
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.
| -rw-r--r-- | river/LockManager.zig | 5 | ||||
| -rw-r--r-- | river/Output.zig | 12 |
2 files changed, 17 insertions, 0 deletions
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 { |
