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() {
111 }111 }
112 112
113 event_loop113 event_loop
114- .run(None, &mut state, move |state| {114+ .run(None, &mut state, |state| state.refresh_and_flush_clients())
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- })
128 .unwrap();115 .unwrap();
129 }116 }
src/niri.rsmodified+15 -0
@@ -223,6 +223,21 @@ impl State {
223 Self { backend, niri }223 Self { backend, niri }
224 }224 }
225 225
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+
226 pub fn move_cursor(&mut self, location: Point<f64, Logical>) {241 pub fn move_cursor(&mut self, location: Point<f64, Logical>) {
227 let under = self.niri.surface_under_and_global_space(location);242 let under = self.niri.surface_under_and_global_space(location);
228 let pointer = &self.niri.seat.get_pointer().unwrap();243 let pointer = &self.niri.seat.get_pointer().unwrap();