diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/handlers/compositor.rs | 8 | ||||
| -rw-r--r-- | src/handlers/xdg_shell.rs | 8 |
2 files changed, 14 insertions, 2 deletions
diff --git a/src/handlers/compositor.rs b/src/handlers/compositor.rs index 9614883d..ebc4a984 100644 --- a/src/handlers/compositor.rs +++ b/src/handlers/compositor.rs @@ -219,9 +219,15 @@ impl CompositorHandler for State { id: u64::from(id.get()), }); - self.niri.layout.remove_window(&window, transaction); + self.niri.layout.remove_window(&window, transaction.clone()); self.add_default_dmabuf_pre_commit_hook(surface); + // If this is the only instance, then this transaction will complete + // immediately, so no need to set the timer. + if !transaction.is_last() { + transaction.register_deadline_timer(&self.niri.event_loop); + } + if was_active { self.maybe_warp_cursor_to_focus(); } diff --git a/src/handlers/xdg_shell.rs b/src/handlers/xdg_shell.rs index b77f566e..b7d267dd 100644 --- a/src/handlers/xdg_shell.rs +++ b/src/handlers/xdg_shell.rs @@ -498,9 +498,15 @@ impl XdgShellHandler for State { let active_window = self.niri.layout.active_window().map(|(m, _)| &m.window); let was_active = active_window == Some(&window); - self.niri.layout.remove_window(&window, transaction); + self.niri.layout.remove_window(&window, transaction.clone()); self.add_default_dmabuf_pre_commit_hook(surface.wl_surface()); + // If this is the only instance, then this transaction will complete immediately, so no + // need to set the timer. + if !transaction.is_last() { + transaction.register_deadline_timer(&self.niri.event_loop); + } + if was_active { self.maybe_warp_cursor_to_focus(); } |
