Move periodic tasks to event loop closure
Browse files at this commitf9c7fe4112e91754d6866f105384eb12f27aa5ebParent: 3959d1e2 changed files +10 -6
- src/main.rs +10 -3
- src/niri.rs +0 -3
src/main.rsmodified+10 -3
| @@ -105,9 +105,16 @@ fn main() { | |||
| 105 | 105 | ||
| 106 | event_loop | 106 | event_loop |
| 107 | .run(None, &mut data, move |data| { | 107 | .run(None, &mut data, move |data| { |
| 108 | - // niri is running. | 108 | + let _span = tracy_client::span!("loop callback"); |
| 109 | - let _span = tracy_client::span!("flush_clients"); | 109 | + |
| 110 | - data.display.flush_clients().unwrap(); | 110 | + // These should be called periodically, before flushing the clients. |
| 111 | + data.niri.space.refresh(); | ||
| 112 | + data.niri.popups.cleanup(); | ||
| 113 | + | ||
| 114 | + { | ||
| 115 | + let _span = tracy_client::span!("flush_clients"); | ||
| 116 | + data.display.flush_clients().unwrap(); | ||
| 117 | + } | ||
| 111 | }) | 118 | }) |
| 112 | .unwrap(); | 119 | .unwrap(); |
| 113 | } | 120 | } |
src/niri.rsmodified+0 -3
| @@ -225,9 +225,6 @@ impl Niri { | |||
| 225 | |_, _| Some(output.clone()), | 225 | |_, _| Some(output.clone()), |
| 226 | ) | 226 | ) |
| 227 | }); | 227 | }); |
| 228 | - | ||
| 229 | - self.space.refresh(); | ||
| 230 | - self.popups.cleanup(); | ||
| 231 | } | 228 | } |
| 232 | } | 229 | } |
| 233 | 230 | ||