forge
Explore
Log in

Don't you dare go Hollow

Register deadline timer for closing transaction

Browse files at this commit

28a8a9ace2804bd5e9c9c9d74761d5f0b4034f98Ivan MolodetskikhParent: a4f1caa
src/handlers/compositor.rsmodified+7 -1
@@ -219,9 +219,15 @@ impl CompositorHandler for State {
219 id: u64::from(id.get()),219 id: u64::from(id.get()),
220 });220 });
221 221
222- self.niri.layout.remove_window(&window, transaction);222+ self.niri.layout.remove_window(&window, transaction.clone());
223 self.add_default_dmabuf_pre_commit_hook(surface);223 self.add_default_dmabuf_pre_commit_hook(surface);
224 224
225+ // If this is the only instance, then this transaction will complete
226+ // immediately, so no need to set the timer.
227+ if !transaction.is_last() {
228+ transaction.register_deadline_timer(&self.niri.event_loop);
229+ }
230+
225 if was_active {231 if was_active {
226 self.maybe_warp_cursor_to_focus();232 self.maybe_warp_cursor_to_focus();
227 }233 }
src/handlers/xdg_shell.rsmodified+7 -1
@@ -498,9 +498,15 @@ impl XdgShellHandler for State {
498 let active_window = self.niri.layout.active_window().map(|(m, _)| &m.window);498 let active_window = self.niri.layout.active_window().map(|(m, _)| &m.window);
499 let was_active = active_window == Some(&window);499 let was_active = active_window == Some(&window);
500 500
501- self.niri.layout.remove_window(&window, transaction);501+ self.niri.layout.remove_window(&window, transaction.clone());
502 self.add_default_dmabuf_pre_commit_hook(surface.wl_surface());502 self.add_default_dmabuf_pre_commit_hook(surface.wl_surface());
503 503
504+ // If this is the only instance, then this transaction will complete immediately, so no
505+ // need to set the timer.
506+ if !transaction.is_last() {
507+ transaction.register_deadline_timer(&self.niri.event_loop);
508+ }
509+
504 if was_active {510 if was_active {
505 self.maybe_warp_cursor_to_focus();511 self.maybe_warp_cursor_to_focus();
506 }512 }