diff options
| author | Ivan Molodetskikh <yalterz@gmail.com> | 2024-08-23 18:51:47 +0300 |
|---|---|---|
| committer | Ivan Molodetskikh <yalterz@gmail.com> | 2024-08-23 19:09:18 +0300 |
| commit | 28a8a9ace2804bd5e9c9c9d74761d5f0b4034f98 (patch) | |
| tree | 4244913b48c9f8b61e61e4643cc2da253c35ad50 | |
| parent | a4f1caab1d1274083f67f7cb110feac0cf7a6f93 (diff) | |
| download | niri-28a8a9ace2804bd5e9c9c9d74761d5f0b4034f98.tar.gz niri-28a8a9ace2804bd5e9c9c9d74761d5f0b4034f98.tar.bz2 niri-28a8a9ace2804bd5e9c9c9d74761d5f0b4034f98.zip | |
Register deadline timer for closing transaction
| -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(); } |
