Skip to content

A fast file manager for Windows and macOS that never freezes: tabs, dual panes, archives as folders, Quick Look-style previews. A File Explorer and Finder alternative written in Rust.

Fix file drags that leave the list on their first move

teebee13370d4a1246592f
diff --git a/crates/rf-app/src/folder_view.rs b/crates/rf-app/src/folder_view.rs
index 5b7c5ea0..2dc6d449 100644
--- a/crates/rf-app/src/folder_view.rs
+++ b/crates/rf-app/src/folder_view.rs
@@ -6739,28 +6739,6 @@ impl FolderView {
this.show_context_menu(true, window, cx);
}),
)
- .on_mouse_move(cx.listener(|this, ev: &MouseMoveEvent, window, cx| {
- if let Some(at) = this.right_press {
- if ev.pressed_button != Some(MouseButton::Right) {
- this.right_press = None;
- } else if (ev.position - at).x.abs() + (ev.position - at).y.abs() > px(8.) {
- // (Windows' drag follows the button that is down: the right one, so the drop asks what to do)
- this.right_press = None;
- this.start_drag_out(window, cx);
- }
- return;
- }
- if this.marquee.is_some() {
- if ev.pressed_button == Some(MouseButton::Left) {
- this.update_marquee(ev.position, cx);
- } else {
- this.marquee = None;
- cx.notify();
- }
- return;
- }
- this.on_drag_motion(ev, window, cx)
- }))
.on_mouse_up(
MouseButton::Right,
cx.listener(|this, _: &MouseUpEvent, window, cx| {
@@ -6798,9 +6776,10 @@ impl FolderView {
canvas(
|_, _, _| {},
move |bounds, _, window, _| {
- // a selection box follows the pointer everywhere, not only over the list (`marquee_moved`)
+ // Follow a held press even when its first move lands over the preview pane, sidebar or outside
+ // the window. A list-only listener missed that move, leaving the file selected but never dragged.
let view = me.clone();
- window.on_mouse_event(move |ev: &MouseMoveEvent, phase, _, cx| {
+ window.on_mouse_event(move |ev: &MouseMoveEvent, phase, window, cx| {
if phase != DispatchPhase::Capture {
return;
}
@@ -6809,6 +6788,19 @@ impl FolderView {
if std::mem::take(&mut v.pointer_away) {
cx.notify();
}
+ if let Some(at) = v.right_press {
+ if ev.pressed_button != Some(MouseButton::Right) {
+ v.right_press = None;
+ } else if (ev.position - at).x.abs() + (ev.position - at).y.abs() > px(8.) {
+ // Windows follows the right button too, so the drop asks what to do.
+ v.right_press = None;
+ v.start_drag_out(window, cx);
+ }
+ return;
+ }
+ if v.marquee.is_none() {
+ v.on_drag_motion(ev, window, cx);
+ }
if v.marquee.is_none() {
return;
}