Skip to content

Commit

Permalink
[DNM] hasty fix drag-n-drop on Wayland, Linux
Browse files Browse the repository at this point in the history
No idea how to do it right. Do a dirty hack to make it works.

See tauri-apps#1256 for details.
  • Loading branch information
xingrz committed May 27, 2024
1 parent aa4bc60 commit cc801bf
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions src/webkitgtk/drag_drop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,22 +93,19 @@ pub(crate) fn connect_drag_event(webview: &WebView, handler: Box<dyn Fn(DragDrop
{
let controller = controller.clone();
webview.connect_drag_drop(move |_, _, x, y, _| {
if controller.has_entered() {
if let Some(paths) = controller.take_paths() {
controller.leave();
return controller.call(DragDropEvent::Drop {
paths,
position: (x, y),
});
}
if let Some(paths) = controller.take_paths() {
return controller.call(DragDropEvent::Drop {
paths,
position: (x, y),
});
}

false
});
}

webview.connect_drag_leave(move |_, _, time| {
if time == 0 {
if controller.has_entered() {
controller.leave();
controller.call(DragDropEvent::Leave);
}
Expand Down

0 comments on commit cc801bf

Please sign in to comment.