Fix handling leave event to one widget after enter for another
This commit is contained in:
parent
0f237155bf
commit
30b0cfe17b
2 changed files with 11 additions and 5 deletions
11
src/main.rs
11
src/main.rs
|
|
@ -122,7 +122,7 @@ enum Msg {
|
||||||
Vec<String>,
|
Vec<String>,
|
||||||
(f32, f32),
|
(f32, f32),
|
||||||
),
|
),
|
||||||
DndWorkspaceLeave,
|
DndWorkspaceLeave(ZcosmicWorkspaceHandleV1, wl_output::WlOutput),
|
||||||
DndWorkspaceDrop,
|
DndWorkspaceDrop,
|
||||||
DndWorkspaceData(String, Vec<u8>),
|
DndWorkspaceData(String, Vec<u8>),
|
||||||
SourceFinished,
|
SourceFinished,
|
||||||
|
|
@ -523,9 +523,12 @@ impl Application for App {
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Msg::DndWorkspaceLeave => {
|
Msg::DndWorkspaceLeave(handle, output) => {
|
||||||
// XXX Doesn't work since leave for a widget may come after enter for another
|
// Currently in iced-sctk, a `DndOfferEvent::Motion` may cause a leave event after
|
||||||
self.drop_target = None;
|
// 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);
|
return accept_mime_type(None);
|
||||||
}
|
}
|
||||||
Msg::DndWorkspaceDrop => {
|
Msg::DndWorkspaceDrop => {
|
||||||
|
|
|
||||||
|
|
@ -177,7 +177,10 @@ fn workspace_sidebar_entry<'a>(
|
||||||
.on_enter(|actions, mime, pos| {
|
.on_enter(|actions, mime, pos| {
|
||||||
Msg::DndWorkspaceEnter(workspace.handle.clone(), output.clone(), actions, mime, pos)
|
Msg::DndWorkspaceEnter(workspace.handle.clone(), output.clone(), actions, mime, pos)
|
||||||
})
|
})
|
||||||
.on_exit(Msg::DndWorkspaceLeave)
|
.on_exit(Msg::DndWorkspaceLeave(
|
||||||
|
workspace.handle.clone(),
|
||||||
|
output.clone(),
|
||||||
|
))
|
||||||
.on_drop(Msg::DndWorkspaceDrop)
|
.on_drop(Msg::DndWorkspaceDrop)
|
||||||
.on_data(Msg::DndWorkspaceData)
|
.on_data(Msg::DndWorkspaceData)
|
||||||
//)
|
//)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue