aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorIvan Molodetskikh <yalterz@gmail.com>2023-08-10 14:06:32 +0400
committerIvan Molodetskikh <yalterz@gmail.com>2023-08-10 14:50:51 +0400
commit18b9d0dfccc0917ffcc2cf8017d0a346a8df143b (patch)
tree98fda53cbea837a07f35473ff6ded91a449bb9a6 /src
parentd9b34bb326bfbff7183c46bd6a5f5823a3f0cb46 (diff)
downloadniri-18b9d0dfccc0917ffcc2cf8017d0a346a8df143b.tar.gz
niri-18b9d0dfccc0917ffcc2cf8017d0a346a8df143b.tar.bz2
niri-18b9d0dfccc0917ffcc2cf8017d0a346a8df143b.zip
Replace Timer::immediate() with idle
Currently the former causes a delay due to a calloop issue.
Diffstat (limited to 'src')
-rw-r--r--src/niri.rs22
1 files changed, 10 insertions, 12 deletions
diff --git a/src/niri.rs b/src/niri.rs
index a8fea4fa..98a21d01 100644
--- a/src/niri.rs
+++ b/src/niri.rs
@@ -12,7 +12,6 @@ use smithay::input::keyboard::XkbConfig;
use smithay::input::{Seat, SeatState};
use smithay::output::Output;
use smithay::reexports::calloop::generic::Generic;
-use smithay::reexports::calloop::timer::{TimeoutAction, Timer};
use smithay::reexports::calloop::{Interest, LoopHandle, LoopSignal, Mode, PostAction};
use smithay::reexports::wayland_server::backend::{ClientData, ClientId, DisconnectReason};
use smithay::reexports::wayland_server::protocol::wl_surface::WlSurface;
@@ -151,17 +150,16 @@ impl Niri {
self.redraw_queued = true;
- self.event_loop
- .insert_source(Timer::immediate(), |_, _, data| {
- let backend: &mut dyn Backend = if let Some(tty) = &mut data.tty {
- tty
- } else {
- data.winit.as_mut().unwrap()
- };
- data.niri.redraw(backend);
- TimeoutAction::Drop
- })
- .unwrap();
+ // Timer::immediate() adds a millisecond of delay for some reason.
+ // This should be fixed in calloop v0.11: https://github.com/Smithay/calloop/issues/142
+ self.event_loop.insert_idle(|data| {
+ let backend: &mut dyn Backend = if let Some(tty) = &mut data.tty {
+ tty
+ } else {
+ data.winit.as_mut().unwrap()
+ };
+ data.niri.redraw(backend);
+ });
}
fn redraw(&mut self, backend: &mut dyn Backend) {