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>,
|
||||
(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 => {
|
||||
|
|
|
|||
|
|
@ -177,7 +177,10 @@ fn workspace_sidebar_entry<'a>(
|
|||
.on_enter(|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_data(Msg::DndWorkspaceData)
|
||||
//)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue