diff --git a/src/handlers/compositor.rs b/src/handlers/compositor.rs index ceb22b78..28437d9d 100644 --- a/src/handlers/compositor.rs +++ b/src/handlers/compositor.rs @@ -19,8 +19,8 @@ use smithay::{delegate_compositor, delegate_shm}; use super::xdg_shell::add_mapped_toplevel_pre_commit_hook; use crate::niri::{ClientState, State}; -use crate::utils::send_scale_transform; use crate::utils::transaction::Transaction; +use crate::utils::{get_monotonic_time, send_scale_transform}; use crate::window::{InitialConfigureState, Mapped, ResolvedWindowRules, Unmapped}; impl CompositorHandler for State { @@ -72,6 +72,9 @@ impl CompositorHandler for State { .root_surface .insert(surface.clone(), root_surface.clone()); + // We might be about to start some animations, need up-to-date time. + self.niri.advance_animations(get_monotonic_time()); + if surface == &root_surface { // This is a root surface commit. It might have mapped a previously-unmapped toplevel. if let Entry::Occupied(entry) = self.niri.unmapped_windows.entry(surface.clone()) { diff --git a/src/handlers/xdg_shell.rs b/src/handlers/xdg_shell.rs index 0ac82d79..bbd60446 100644 --- a/src/handlers/xdg_shell.rs +++ b/src/handlers/xdg_shell.rs @@ -577,6 +577,9 @@ impl XdgShellHandler for State { return; } + // We're about to start some animations on the layout, need up-to-date time. + self.niri.advance_animations(get_monotonic_time()); + let win_out = self .niri .layout