Replace Timer::immediate() with idle
Browse files at this commit18b9d0dfccc0917ffcc2cf8017d0a346a8df143bParent: d9b34bb1 changed file +10 -12
- src/niri.rs +10 -12
src/niri.rsmodified+10 -12
| @@ -12,7 +12,6 @@ use smithay::input::keyboard::XkbConfig; | |||
| 12 | use smithay::input::{Seat, SeatState}; | 12 | use smithay::input::{Seat, SeatState}; |
| 13 | use smithay::output::Output; | 13 | use smithay::output::Output; |
| 14 | use smithay::reexports::calloop::generic::Generic; | 14 | use smithay::reexports::calloop::generic::Generic; |
| 15 | -use smithay::reexports::calloop::timer::{TimeoutAction, Timer}; | ||
| 16 | use smithay::reexports::calloop::{Interest, LoopHandle, LoopSignal, Mode, PostAction}; | 15 | use smithay::reexports::calloop::{Interest, LoopHandle, LoopSignal, Mode, PostAction}; |
| 17 | use smithay::reexports::wayland_server::backend::{ClientData, ClientId, DisconnectReason}; | 16 | use smithay::reexports::wayland_server::backend::{ClientData, ClientId, DisconnectReason}; |
| 18 | use smithay::reexports::wayland_server::protocol::wl_surface::WlSurface; | 17 | use smithay::reexports::wayland_server::protocol::wl_surface::WlSurface; |
| @@ -151,17 +150,16 @@ impl Niri { | |||
| 151 | 150 | ||
| 152 | self.redraw_queued = true; | 151 | self.redraw_queued = true; |
| 153 | 152 | ||
| 154 | - self.event_loop | 153 | + // Timer::immediate() adds a millisecond of delay for some reason. |
| 155 | - .insert_source(Timer::immediate(), |_, _, data| { | 154 | + // This should be fixed in calloop v0.11: https://github.com/Smithay/calloop/issues/142 |
| 156 | - let backend: &mut dyn Backend = if let Some(tty) = &mut data.tty { | 155 | + self.event_loop.insert_idle(|data| { |
| 157 | - tty | 156 | + let backend: &mut dyn Backend = if let Some(tty) = &mut data.tty { |
| 158 | - } else { | 157 | + tty |
| 159 | - data.winit.as_mut().unwrap() | 158 | + } else { |
| 160 | - }; | 159 | + data.winit.as_mut().unwrap() |
| 161 | - data.niri.redraw(backend); | 160 | + }; |
| 162 | - TimeoutAction::Drop | 161 | + data.niri.redraw(backend); |
| 163 | - }) | 162 | + }); |
| 164 | - .unwrap(); | ||
| 165 | } | 163 | } |
| 166 | 164 | ||
| 167 | fn redraw(&mut self, backend: &mut dyn Backend) { | 165 | fn redraw(&mut self, backend: &mut dyn Backend) { |