diff --git a/crates/gpui/src/window.rs b/crates/gpui/src/window.rs index e9145bd9f5..32c8c9545c 100644 --- a/crates/gpui/src/window.rs +++ b/crates/gpui/src/window.rs @@ -1333,12 +1333,13 @@ impl Window { /// Dispatch the given action on the currently focused element. pub fn dispatch_action(&mut self, action: Box, cx: &mut App) { let focus_id = self.focused(cx).map(|handle| handle.id); - + dbg!(&focus_id); let window = self.handle; cx.defer(move |cx| { window .update(cx, |_, window, cx| { let node_id = window.focus_node_id_in_rendered_frame(focus_id); + dbg!(&node_id); window.dispatch_action_on_node(node_id, action.as_ref(), cx); }) .log_err(); @@ -3757,7 +3758,10 @@ impl Window { .dispatch_tree .focusable_node_id(focus_id) }) - .unwrap_or_else(|| self.rendered_frame.dispatch_tree.root_node_id()) + .unwrap_or_else(|| { + println!("root node id"); + self.rendered_frame.dispatch_tree.root_node_id() + }) } fn dispatch_action_on_node( @@ -3766,7 +3770,11 @@ impl Window { action: &dyn Action, cx: &mut App, ) { + dbg!("dispatch_action_on_node"); + dbg!(action.name()); + dbg!(action.as_any().type_id()); let dispatch_path = self.rendered_frame.dispatch_tree.dispatch_path(node_id); + dbg!(&dispatch_path); // Capture phase for global actions. cx.propagate_event = true; @@ -3774,9 +3782,15 @@ impl Window { .global_action_listeners .remove(&action.as_any().type_id()) { + dbg!( + "Found global listeners for capture phase", + global_listeners.len() + ); for listener in &global_listeners { + dbg!("Executing global listener in capture phase"); listener(action.as_any(), DispatchPhase::Capture, cx); if !cx.propagate_event { + dbg!("Event propagation stopped in global capture phase"); break; } } @@ -3805,9 +3819,11 @@ impl Window { { let any_action = action.as_any(); if action_type == any_action.type_id() { + dbg!("Found window action listener in capture phase", node_id); listener(any_action, DispatchPhase::Capture, self, cx); if !cx.propagate_event { + dbg!("Event propagation stopped in window capture phase"); return; } } @@ -3824,10 +3840,12 @@ impl Window { { let any_action = action.as_any(); if action_type == any_action.type_id() { + dbg!("Found window action listener in bubble phase", node_id); cx.propagate_event = false; // Actions stop propagation by default during the bubble phase listener(any_action, DispatchPhase::Bubble, self, cx); if !cx.propagate_event { + dbg!("Event propagation stopped in window bubble phase"); return; } } @@ -3839,11 +3857,17 @@ impl Window { .global_action_listeners .remove(&action.as_any().type_id()) { + dbg!( + "Found global listeners for bubble phase", + global_listeners.len() + ); for listener in global_listeners.iter().rev() { + dbg!("Executing global listener in bubble phase"); cx.propagate_event = false; // Actions stop propagation by default during the bubble phase listener(action.as_any(), DispatchPhase::Bubble, cx); if !cx.propagate_event { + dbg!("Event propagation stopped in global bubble phase"); break; } } diff --git a/crates/project_panel/src/project_panel.rs b/crates/project_panel/src/project_panel.rs index 0ec9bac33f..d3cdee8ae1 100644 --- a/crates/project_panel/src/project_panel.rs +++ b/crates/project_panel/src/project_panel.rs @@ -288,6 +288,7 @@ pub fn init(cx: &mut App) { cx.observe_new(|workspace: &mut Workspace, _, _| { workspace.register_action(|workspace, _: &ToggleFocus, window, cx| { + println!("this must run"); workspace.toggle_panel_focus::(window, cx); }); diff --git a/crates/workspace/src/dock.rs b/crates/workspace/src/dock.rs index 8fcd55b784..a9039c508d 100644 --- a/crates/workspace/src/dock.rs +++ b/crates/workspace/src/dock.rs @@ -909,6 +909,7 @@ impl Render for PanelButtons { .on_click({ let action = action.boxed_clone(); move |_, window, cx| { + println!("panel button click"); window.dispatch_action(action.boxed_clone(), cx) } })