forge
Explore
Log in

Don't you dare go Hollow

Dropping a file from outside the window imports it

Browse files at this commit

fc7ccc20ccf56441c2a2dfc2bf4629e0014e4433Ahmet Kaan GümüşParent: 42cd182
  • fix
    • dropping a file from outside the window imports it
Show full message
🐛 fix(app): dropping a file from outside the window imports it

stance-centre now answers gpui::ExternalPaths — drag_over tints the
same DARK_RAISED fill every drop target in the darkroom already
uses, on_drop hands every dropped path to Player::import, the one
door argv/Import-button/Paste-path already share and that already
forks .edith vs media (arrival) and refuses mid-export.
crates/app/src/ui/stance.rsmodified+20 -0
@@ -1126,6 +1126,26 @@ pub(crate) fn render(
1126 .min_w(px(0.))1126 .min_w(px(0.))
1127 .flex()1127 .flex()
1128 .flex_col()1128 .flex_col()
1129+ // A file dropped from outside the window (gpui's
1130+ // `ExternalPaths`, Wayland's `text/uri-list`) lands here: the
1131+ // one room-wide surface under everything else drawn below,
1132+ // so a drop anywhere in the darkroom is heard. No prior
1133+ // press starts this -- the drop itself arrives as a
1134+ // `MouseUp` (`window.rs`) -- and the tint is the same
1135+ // raised fill every other drop target in the darkroom
1136+ // answers a drag with, DESIGN §8's affordance without a
1137+ // word of copy on it.
1138+ .drag_over::<gpui::ExternalPaths>(|d, _, _, _| d.bg(rgb(DARK_RAISED())))
1139+ .on_drop(cx.listener(|this, paths: &gpui::ExternalPaths, _, cx| {
1140+ // `Player::import` is the one door a project or media
1141+ // path already goes through (argv, the Import button,
1142+ // Paste path) -- it forks on `.edith` vs everything else
1143+ // itself (`arrival`) and already refuses during an
1144+ // export, so a drop names nothing this loop has to.
1145+ for path in paths.paths() {
1146+ this.import(path, cx);
1147+ }
1148+ }))
1129 .child(screen(player, position, window, cx))1149 .child(screen(player, position, window, cx))
1130 .child(time_band(player, position, cx))1150 .child(time_band(player, position, cx))
1131 .child(divider(Split::Bench, cx))1151 .child(divider(Split::Bench, cx))