diff --git a/crates/gpui/src/elements/mouse_event_handler.rs b/crates/gpui/src/elements/mouse_event_handler.rs index 52e701b0514fabc4f055f3e4826de2374780602e..78dbfd65b7cc12d89d6b102d7fbb497316a2b353 100644 --- a/crates/gpui/src/elements/mouse_event_handler.rs +++ b/crates/gpui/src/elements/mouse_event_handler.rs @@ -44,6 +44,11 @@ impl MouseEventHandler { self } + pub fn capture_all(mut self) -> Self { + self.handlers = HandlerSet::capture_all(); + self + } + pub fn on_move( mut self, handler: impl Fn(MoveRegionEvent, &mut EventContext) + 'static, diff --git a/crates/gpui/src/presenter.rs b/crates/gpui/src/presenter.rs index 42dac6d2072d2fc7a803aed151c8cae0763983d1..d3acaf72e5e407b56921c9b1d021a47a079763e9 100644 --- a/crates/gpui/src/presenter.rs +++ b/crates/gpui/src/presenter.rs @@ -79,7 +79,6 @@ impl Presenter { self.rendered_views.remove(view_id); } for view_id in &invalidation.updated { - dbg!(view_id); self.rendered_views.insert( *view_id, cx.render_view(RenderParams { @@ -152,7 +151,6 @@ impl Presenter { if cx.window_is_active(self.window_id) { if let Some(event) = self.last_mouse_moved_event.clone() { - println!("Redispatching mouse moved"); self.dispatch_event(event, true, cx); } } diff --git a/crates/gpui/src/scene/mouse_region.rs b/crates/gpui/src/scene/mouse_region.rs index 5919d09180bb484234364b8dc296150a6a55d390..9a73c499f6882a256ef9acfa6cb65a92f13970f7 100644 --- a/crates/gpui/src/scene/mouse_region.rs +++ b/crates/gpui/src/scene/mouse_region.rs @@ -46,7 +46,7 @@ impl MouseRegion { view_id, discriminant, bounds, - handlers: HandlerSet::handle_all(), + handlers: HandlerSet::capture_all(), } } @@ -129,7 +129,7 @@ pub struct HandlerSet { } impl HandlerSet { - pub fn handle_all() -> Self { + pub fn capture_all() -> Self { #[allow(clippy::type_complexity)] let mut set: HashMap< (Discriminant, Option), diff --git a/crates/workspace/src/workspace.rs b/crates/workspace/src/workspace.rs index fa81cd9f112b0d456ab7fec3685b07b3b9cc4ae4..c71f21ccdc8b23053dcfac2ccb2ce69d17c847ac 100644 --- a/crates/workspace/src/workspace.rs +++ b/crates/workspace/src/workspace.rs @@ -2071,11 +2071,11 @@ impl Workspace { } } - fn render_disconnected_overlay(&self, cx: &AppContext) -> Option { + fn render_disconnected_overlay(&self, cx: &mut RenderContext) -> Option { if self.project.read(cx).is_read_only() { - let theme = &cx.global::().theme; Some( - EventHandler::new( + MouseEventHandler::new::(0, cx, |_, cx| { + let theme = &cx.global::().theme; Label::new( "Your connection to the remote project has been lost.".to_string(), theme.workspace.disconnected_overlay.text.clone(), @@ -2083,9 +2083,9 @@ impl Workspace { .aligned() .contained() .with_style(theme.workspace.disconnected_overlay.container) - .boxed(), - ) - .capture_all::(0) + .boxed() + }) + .capture_all() .boxed(), ) } else {