diff options
| author | Ivan Molodetskikh <yalterz@gmail.com> | 2023-08-14 15:53:24 +0400 |
|---|---|---|
| committer | Ivan Molodetskikh <yalterz@gmail.com> | 2023-08-14 15:53:24 +0400 |
| commit | c65a4f162405d1b8c780925b723feeb481c87919 (patch) | |
| tree | ba18ba0bcafc2bbf2c0014179679479325441fdb /src/niri.rs | |
| parent | 529a24cc14859890029ad20ba07a589f4b3bc559 (diff) | |
| download | niri-c65a4f162405d1b8c780925b723feeb481c87919.tar.gz niri-c65a4f162405d1b8c780925b723feeb481c87919.tar.bz2 niri-c65a4f162405d1b8c780925b723feeb481c87919.zip | |
Add frame clock
Tracks the presentation time and allows querying the next presentation
time.
Diffstat (limited to 'src/niri.rs')
| -rw-r--r-- | src/niri.rs | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/niri.rs b/src/niri.rs index a55811f6..905f0738 100644 --- a/src/niri.rs +++ b/src/niri.rs @@ -1,6 +1,7 @@ use std::collections::HashMap; use std::os::unix::io::AsRawFd; use std::sync::Arc; +use std::time::Duration; use smithay::backend::renderer::element::render_elements; use smithay::backend::renderer::element::solid::{SolidColorBuffer, SolidColorRenderElement}; @@ -27,6 +28,7 @@ use smithay::wayland::shm::ShmState; use smithay::wayland::socket::ListeningSocketSource; use crate::backend::Backend; +use crate::frame_clock::FrameClock; use crate::layout::MonitorSet; use crate::LoopData; @@ -71,6 +73,7 @@ pub struct OutputState { // Set to `true` when the output was redrawn and is waiting for a VBlank. Upon VBlank a redraw // will always be queued, so you cannot queue a redraw while waiting for a VBlank. pub waiting_for_vblank: bool, + pub frame_clock: FrameClock, } impl Niri { @@ -164,7 +167,7 @@ impl Niri { } } - pub fn add_output(&mut self, output: Output) { + pub fn add_output(&mut self, output: Output, refresh_interval: Option<Duration>) { let x = self .global_space .outputs() @@ -180,6 +183,7 @@ impl Niri { global: output.create_global::<Niri>(&self.display_handle), queued_redraw: None, waiting_for_vblank: false, + frame_clock: FrameClock::new(refresh_interval), }; let rv = self.output_state.insert(output, state); assert!(rv.is_none(), "output was already tracked"); |
