diff --git a/src/handlers/mod.rs b/src/handlers/mod.rs index 29fe11be..3532078b 100644 --- a/src/handlers/mod.rs +++ b/src/handlers/mod.rs @@ -384,10 +384,16 @@ impl DndGrabHandler for State { } } } + + fn cancelled(&mut self, _seat: Seat, _location: Point) { + trace!("dnd cancelled"); + + self.niri.on_maybe_dnd_ended(); + } } impl crate::niri::Niri { - pub fn on_maybe_dnd_ended(&mut self) { + fn on_maybe_dnd_ended(&mut self) { self.layout.dnd_end(); self.dnd_icon = None; // FIXME: more granular diff --git a/src/input/mod.rs b/src/input/mod.rs index 30cc80dc..f1ad4932 100644 --- a/src/input/mod.rs +++ b/src/input/mod.rs @@ -499,11 +499,6 @@ impl State { .unwrap_or(false) { pointer.unset_grab(this, serial, time); - - // If this was a DnD, we won't get DndGrabHandler::dropped(), so we need to - // call the cleanup. - this.niri.on_maybe_dnd_ended(); - this.niri.suppressed_keys.insert(key_code); return FilterResult::Intercept(None); } diff --git a/src/niri.rs b/src/niri.rs index 3ffb00c5..466fc509 100644 --- a/src/niri.rs +++ b/src/niri.rs @@ -1321,7 +1321,6 @@ impl State { get_monotonic_time().as_millis() as u32, ); self.niri.popup_grab = None; - self.niri.on_maybe_dnd_ended(); } } @@ -1977,7 +1976,6 @@ impl State { if let Some(touch) = self.niri.seat.get_touch() { touch.unset_grab(self); } - self.niri.on_maybe_dnd_ended(); self.backend.with_primary_renderer(|renderer| { self.niri