more dbg

Smit Barmase created

Change summary

crates/gpui/src/app.rs            | 2 ++
crates/gpui/src/window.rs         | 3 ++-
crates/workspace/src/workspace.rs | 3 +++
3 files changed, 7 insertions(+), 1 deletion(-)

Detailed changes

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();
                                 }
                             })

crates/gpui/src/window.rs 🔗

@@ -227,7 +227,7 @@ pub(crate) type FocusMap = RwLock<SlotMap<FocusId, AtomicUsize>>;
 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;
     }

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(&center_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::<Workspace>().unwrap();