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:
		| @ -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; | ||||
| } | ||||
|  | ||||
|  | ||||
| @ -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 { | ||||
|  | ||||
		Reference in New Issue
	
	Block a user