forge
Explore
Log in

Don't you dare go Hollow

Move refresh calls into State

Browse files at this commit

2508d3e08e5e918d351ef6e6daf1d983ff2a999eIvan MolodetskikhParent: 189d1bd
src/main.rsmodified+1 -14
@@ -111,19 +111,6 @@ fn main() {
111111 }
112112
113113 event_loop
114- .run(None, &mut state, move |state| {
115- let _span = tracy_client::span!("loop callback");
116-
117- // These should be called periodically, before flushing the clients.
118- state.niri.layout.refresh();
119- state.niri.refresh_pointer_outputs();
120- state.niri.popups.cleanup();
121- state.update_focus();
122-
123- {
124- let _span = tracy_client::span!("flush_clients");
125- state.niri.display_handle.flush_clients().unwrap();
126- }
127- })
114+ .run(None, &mut state, |state| state.refresh_and_flush_clients())
128115 .unwrap();
129116 }
src/niri.rsmodified+15 -0
@@ -223,6 +223,21 @@ impl State {
223223 Self { backend, niri }
224224 }
225225
226+ pub fn refresh_and_flush_clients(&mut self) {
227+ let _span = tracy_client::span!("refresh_and_flush_clients");
228+
229+ // These should be called periodically, before flushing the clients.
230+ self.niri.layout.refresh();
231+ self.niri.refresh_pointer_outputs();
232+ self.niri.popups.cleanup();
233+ self.update_focus();
234+
235+ {
236+ let _span = tracy_client::span!("flush_clients");
237+ self.niri.display_handle.flush_clients().unwrap();
238+ }
239+ }
240+
226241 pub fn move_cursor(&mut self, location: Point<f64, Logical>) {
227242 let under = self.niri.surface_under_and_global_space(location);
228243 let pointer = &self.niri.seat.get_pointer().unwrap();