diff options
| author | Ivan Molodetskikh <yalterz@gmail.com> | 2023-10-09 17:37:15 +0400 |
|---|---|---|
| committer | Ivan Molodetskikh <yalterz@gmail.com> | 2023-10-09 17:40:28 +0400 |
| commit | d91d5d674c5b456d25f2e865b28d99aa57f4db4f (patch) | |
| tree | da60d8a9dd2efed784e096aca9697561b764df26 | |
| parent | 05b5ba0555dfb202970ce17b03ce889326214854 (diff) | |
| download | niri-d91d5d674c5b456d25f2e865b28d99aa57f4db4f.tar.gz niri-d91d5d674c5b456d25f2e865b28d99aa57f4db4f.tar.bz2 niri-d91d5d674c5b456d25f2e865b28d99aa57f4db4f.zip | |
Set redraw state to idle on early returns
Haven't hit any problems due to this yet, but I suspect that it's
possible.
| -rw-r--r-- | src/niri.rs | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/niri.rs b/src/niri.rs index a276b643..328f4aae 100644 --- a/src/niri.rs +++ b/src/niri.rs @@ -1236,20 +1236,22 @@ impl Niri { fn redraw(&mut self, backend: &mut Backend, output: &Output) { let _span = tracy_client::span!("Niri::redraw"); + let state = self.output_state.get_mut(output).unwrap(); + assert!(matches!( + state.redraw_state, + RedrawState::Queued(_) | RedrawState::WaitingForEstimatedVBlankAndQueued(_) + )); + if !backend.is_active() { + state.redraw_state = RedrawState::Idle; return; } let Some(renderer) = backend.renderer() else { + state.redraw_state = RedrawState::Idle; return; }; - let state = self.output_state.get_mut(output).unwrap(); - assert!(matches!( - state.redraw_state, - RedrawState::Queued(_) | RedrawState::WaitingForEstimatedVBlankAndQueued(_) - )); - let presentation_time = state.frame_clock.next_presentation_time(); // Update from the config and advance the animations. |
