Fix handling leave event to one widget after enter for another

This commit is contained in:
Ian Douglas Scott 2024-05-02 12:53:09 -07:00
parent 0f237155bf
commit 30b0cfe17b
2 changed files with 11 additions and 5 deletions

View file

@ -122,7 +122,7 @@ enum Msg {
Vec<String>,
(f32, f32),
),
DndWorkspaceLeave,
DndWorkspaceLeave(ZcosmicWorkspaceHandleV1, wl_output::WlOutput),
DndWorkspaceDrop,
DndWorkspaceData(String, Vec<u8>),
SourceFinished,
@ -523,9 +523,12 @@ impl Application for App {
]);
}
}
Msg::DndWorkspaceLeave => {
// XXX Doesn't work since leave for a widget may come after enter for another
self.drop_target = None;
Msg::DndWorkspaceLeave(handle, output) => {
// Currently in iced-sctk, a `DndOfferEvent::Motion` may cause a leave event after
// an enter event, based on which widget handles it first. So we need a test here.
if self.drop_target == Some((handle, output)) {
self.drop_target = None;
}
return accept_mime_type(None);
}
Msg::DndWorkspaceDrop => {