diff options
| author | Ivan Molodetskikh <yalterz@gmail.com> | 2023-10-10 07:55:31 +0400 |
|---|---|---|
| committer | Ivan Molodetskikh <yalterz@gmail.com> | 2023-10-10 07:55:31 +0400 |
| commit | 2508d3e08e5e918d351ef6e6daf1d983ff2a999e (patch) | |
| tree | 4bb6e52d0bf3d35a04044f253c2b533aaed65f9c | |
| parent | 189d1bd97b7aa241b5ad651145ca4d3ef483f505 (diff) | |
| download | niri-2508d3e08e5e918d351ef6e6daf1d983ff2a999e.tar.gz niri-2508d3e08e5e918d351ef6e6daf1d983ff2a999e.tar.bz2 niri-2508d3e08e5e918d351ef6e6daf1d983ff2a999e.zip | |
Move refresh calls into State
| -rw-r--r-- | src/main.rs | 15 | ||||
| -rw-r--r-- | src/niri.rs | 15 |
2 files changed, 16 insertions, 14 deletions
diff --git a/src/main.rs b/src/main.rs index 2403a20d..66616c7b 100644 --- a/src/main.rs +++ b/src/main.rs @@ -111,19 +111,6 @@ fn main() { } event_loop - .run(None, &mut state, move |state| { - let _span = tracy_client::span!("loop callback"); - - // These should be called periodically, before flushing the clients. - state.niri.layout.refresh(); - state.niri.refresh_pointer_outputs(); - state.niri.popups.cleanup(); - state.update_focus(); - - { - let _span = tracy_client::span!("flush_clients"); - state.niri.display_handle.flush_clients().unwrap(); - } - }) + .run(None, &mut state, |state| state.refresh_and_flush_clients()) .unwrap(); } diff --git a/src/niri.rs b/src/niri.rs index f47f97ae..eb737d1f 100644 --- a/src/niri.rs +++ b/src/niri.rs @@ -223,6 +223,21 @@ impl State { Self { backend, niri } } + pub fn refresh_and_flush_clients(&mut self) { + let _span = tracy_client::span!("refresh_and_flush_clients"); + + // These should be called periodically, before flushing the clients. + self.niri.layout.refresh(); + self.niri.refresh_pointer_outputs(); + self.niri.popups.cleanup(); + self.update_focus(); + + { + let _span = tracy_client::span!("flush_clients"); + self.niri.display_handle.flush_clients().unwrap(); + } + } + pub fn move_cursor(&mut self, location: Point<f64, Logical>) { let under = self.niri.surface_under_and_global_space(location); let pointer = &self.niri.seat.get_pointer().unwrap(); |
