diff --git a/crates/gpui/src/app.rs b/crates/gpui/src/app.rs index 6cecfcc0e42b239dc98db9391650f0618530d52c..2ecb61ed8f19e85dbae6b3f4b6cb995800e80ad6 100644 --- a/crates/gpui/src/app.rs +++ b/crates/gpui/src/app.rs @@ -949,10 +949,12 @@ impl App { .write() .retain(|handle_id, count| { if count.load(SeqCst) == 0 { + println!("Dropping {handle_id}"); for window_handle in self.windows() { window_handle .update(self, |_, window, _| { if window.focus == Some(handle_id) { + println!("released focus handle blur"); window.blur(); } }) diff --git a/crates/gpui/src/window.rs b/crates/gpui/src/window.rs index 4e1db1ccd59250adf848a559f1147280f7def0dd..33a9caa6e4d4f9be992763ce1a234ed7979c00b1 100644 --- a/crates/gpui/src/window.rs +++ b/crates/gpui/src/window.rs @@ -227,7 +227,7 @@ pub(crate) type FocusMap = RwLock>; impl FocusId { /// Obtains whether the element associated with this handle is currently focused. pub fn is_focused(&self, window: &Window) -> bool { - window.focus == Some(*self) + dbg!(window.focus) == Some(*self) } /// Obtains whether the element associated with this handle contains the focused @@ -1295,6 +1295,7 @@ impl Window { /// Blur the window and don't allow anything in it to be focused again. pub fn disable_focus(&mut self) { + println!("disable_focus"); self.blur(); self.focus_enabled = false; } diff --git a/crates/workspace/src/workspace.rs b/crates/workspace/src/workspace.rs index 125b5bb98a7dd056880305e631c44bea815a6009..e006f6ff11e043eb1eb7238687ed868193c2ccbc 100644 --- a/crates/workspace/src/workspace.rs +++ b/crates/workspace/src/workspace.rs @@ -1219,6 +1219,7 @@ impl Workspace { .detach(); cx.on_focus_lost(window, |this, window, cx| { + println!("workspace on_focus_lost"); let focus_handle = this.focus_handle(cx); window.focus(&focus_handle); }) @@ -1245,6 +1246,8 @@ impl Workspace { window.focus(¢er_pane.focus_handle(cx)); + // center_pane.focus_handle(cx).is_focused(window); + cx.emit(Event::PaneAdded(center_pane.clone())); let window_handle = window.window_handle().downcast::().unwrap();