diff options
| author | Ivan Molodetskikh <yalterz@gmail.com> | 2024-02-21 07:40:50 +0400 |
|---|---|---|
| committer | Ivan Molodetskikh <yalterz@gmail.com> | 2024-02-21 07:40:50 +0400 |
| commit | 82fffdea80170571eb5ad176cf0b23eb24b0bc5d (patch) | |
| tree | f1d8120dda75838d2d50801258bd081145f6cf80 /src | |
| parent | 5b3bfd95d9fb97a5e2e5e8332881c6eed13fbaa6 (diff) | |
| download | niri-82fffdea80170571eb5ad176cf0b23eb24b0bc5d.tar.gz niri-82fffdea80170571eb5ad176cf0b23eb24b0bc5d.tar.bz2 niri-82fffdea80170571eb5ad176cf0b23eb24b0bc5d.zip | |
Fix locking with DPMS-inactive monitors
This both enables locking while monitors are powered off (they have no
buffer attached at that point on a TTY, so no sensitive content can
become visible), and fixes the condition below to check even if the
rendering was skipped.
Diffstat (limited to 'src')
| -rw-r--r-- | src/niri.rs | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/src/niri.rs b/src/niri.rs index d88893a9..ec9444b9 100644 --- a/src/niri.rs +++ b/src/niri.rs @@ -2080,8 +2080,12 @@ impl Niri { } else { RedrawState::Idle }; - } else { - // Update the lock render state on successful render. + } + + // Update the lock render state on successful render, or if monitors are inactive. When + // monitors are inactive on a TTY, they have no framebuffer attached, so no sensitive data + // from a last render will be visible. + if res != RenderResult::Skipped || !self.monitors_active { state.lock_render_state = if is_locked { LockRenderState::Locked } else { @@ -2092,27 +2096,23 @@ impl Niri { // If we're in process of locking the session, check if the requirements were met. match mem::take(&mut self.lock_state) { LockState::Locking(confirmation) => { - if res == RenderResult::Skipped { - if state.lock_render_state == LockRenderState::Unlocked { - // We needed to render a locked frame on this output but failed. - self.unlock(); - } else { - // Rendering failed but this output is already locked, so it's fine. - self.lock_state = LockState::Locking(confirmation); - } + if state.lock_render_state == LockRenderState::Unlocked { + // We needed to render a locked frame on this output but failed. + self.unlock(); } else { - // Rendering succeeded, check if this was the last output. + // Check if all outputs are now locked. let all_locked = self .output_state .values() .all(|state| state.lock_render_state == LockRenderState::Locked); if all_locked { + // All outputs are locked, report success. let lock = confirmation.ext_session_lock().clone(); confirmation.lock(); self.lock_state = LockState::Locked(lock); } else { - // Still waiting. + // Still waiting for other outputs. self.lock_state = LockState::Locking(confirmation); } } |
