Activate Zed window on external file drop

Kirill Bulatov created

Change summary

crates/gpui2/src/interactive.rs | 6 ++++++
crates/gpui2/src/window.rs      | 1 +
2 files changed, 7 insertions(+)

Detailed changes

crates/gpui2/src/interactive.rs 🔗

@@ -193,6 +193,12 @@ impl Deref for MouseExitEvent {
 #[derive(Debug, Clone, Default)]
 pub struct ExternalPaths(pub(crate) SmallVec<[PathBuf; 2]>);
 
+impl ExternalPaths {
+    pub fn paths(&self) -> &[PathBuf] {
+        &self.0
+    }
+}
+
 impl Render for ExternalPaths {
     type Element = Div;
 

crates/gpui2/src/window.rs 🔗

@@ -1284,6 +1284,7 @@ impl<'a> WindowContext<'a> {
                     })
                 }
                 FileDropEvent::Submit { position } => {
+                    self.activate(true);
                     self.window.mouse_position = position;
                     InputEvent::MouseUp(MouseUpEvent {
                         button: MouseButton::Left,