Make use of new DndGrabHandler::cancelled()
Browse files at this commite9c182a13c1d12762351ec01ce0ec711d41b0337Parent: cfe059c3 changed files +7 -8
- src/handlers/mod.rs +7 -1
- src/input/mod.rs +0 -5
- src/niri.rs +0 -2
src/handlers/mod.rsmodified+7 -1
| @@ -384,10 +384,16 @@ impl DndGrabHandler for State { | |||
| 384 | } | 384 | } |
| 385 | } | 385 | } |
| 386 | } | 386 | } |
| 387 | + | ||
| 388 | + fn cancelled(&mut self, _seat: Seat<Self>, _location: Point<f64, Logical>) { | ||
| 389 | + trace!("dnd cancelled"); | ||
| 390 | + | ||
| 391 | + self.niri.on_maybe_dnd_ended(); | ||
| 392 | + } | ||
| 387 | } | 393 | } |
| 388 | 394 | ||
| 389 | impl crate::niri::Niri { | 395 | impl crate::niri::Niri { |
| 390 | - pub fn on_maybe_dnd_ended(&mut self) { | 396 | + fn on_maybe_dnd_ended(&mut self) { |
| 391 | self.layout.dnd_end(); | 397 | self.layout.dnd_end(); |
| 392 | self.dnd_icon = None; | 398 | self.dnd_icon = None; |
| 393 | // FIXME: more granular | 399 | // FIXME: more granular |
src/input/mod.rsmodified+0 -5
| @@ -499,11 +499,6 @@ impl State { | |||
| 499 | .unwrap_or(false) | 499 | .unwrap_or(false) |
| 500 | { | 500 | { |
| 501 | pointer.unset_grab(this, serial, time); | 501 | pointer.unset_grab(this, serial, time); |
| 502 | - | ||
| 503 | - // If this was a DnD, we won't get DndGrabHandler::dropped(), so we need to | ||
| 504 | - // call the cleanup. | ||
| 505 | - this.niri.on_maybe_dnd_ended(); | ||
| 506 | - | ||
| 507 | this.niri.suppressed_keys.insert(key_code); | 502 | this.niri.suppressed_keys.insert(key_code); |
| 508 | return FilterResult::Intercept(None); | 503 | return FilterResult::Intercept(None); |
| 509 | } | 504 | } |
src/niri.rsmodified+0 -2
| @@ -1321,7 +1321,6 @@ impl State { | |||
| 1321 | get_monotonic_time().as_millis() as u32, | 1321 | get_monotonic_time().as_millis() as u32, |
| 1322 | ); | 1322 | ); |
| 1323 | self.niri.popup_grab = None; | 1323 | self.niri.popup_grab = None; |
| 1324 | - self.niri.on_maybe_dnd_ended(); | ||
| 1325 | } | 1324 | } |
| 1326 | } | 1325 | } |
| 1327 | 1326 | ||
| @@ -1977,7 +1976,6 @@ impl State { | |||
| 1977 | if let Some(touch) = self.niri.seat.get_touch() { | 1976 | if let Some(touch) = self.niri.seat.get_touch() { |
| 1978 | touch.unset_grab(self); | 1977 | touch.unset_grab(self); |
| 1979 | } | 1978 | } |
| 1980 | - self.niri.on_maybe_dnd_ended(); | ||
| 1981 | 1979 | ||
| 1982 | self.backend.with_primary_renderer(|renderer| { | 1980 | self.backend.with_primary_renderer(|renderer| { |
| 1983 | self.niri | 1981 | self.niri |