diff --git a/widget/src/dnd_listener.rs b/widget/src/dnd_listener.rs index 0bc310607d..eac05a4d99 100644 --- a/widget/src/dnd_listener.rs +++ b/widget/src/dnd_listener.rs @@ -414,6 +414,10 @@ fn update( Event::PlatformSpecific(PlatformSpecific::Wayland( event::wayland::Event::DndOffer(DndOfferEvent::Leave), )) => { + if matches!(state.dnd, DndState::None | DndState::External(..)) { + return event::Status::Ignored; + } + if !matches!(state.dnd, DndState::Dropped) { state.dnd = DndState::None; } @@ -428,10 +432,10 @@ fn update( )) => { if matches!(state.dnd, DndState::Hovered(..)) { state.dnd = DndState::Dropped; - } - if let Some(message) = widget.on_drop.clone() { - shell.publish(message); - return event::Status::Captured; + if let Some(message) = widget.on_drop.clone() { + shell.publish(message); + return event::Status::Captured; + } } } Event::PlatformSpecific(PlatformSpecific::Wayland( @@ -479,6 +483,10 @@ fn update( action, )), )) => { + if matches!(state.dnd, DndState::None | DndState::External(..)) { + return event::Status::Ignored; + } + if let Some(message) = widget.on_selected_action.as_ref() { shell.publish(message(*action)); return event::Status::Captured;