diff --git a/crates/gpui2/src/elements/div.rs b/crates/gpui2/src/elements/div.rs index cc82ff3cb09dbba6c5b5fff18795f27ef3b8c77a..fa8ef50bbb749a0430887e62139f71438e74b2d3 100644 --- a/crates/gpui2/src/elements/div.rs +++ b/crates/gpui2/src/elements/div.rs @@ -748,10 +748,10 @@ impl Interactivity { cx.with_z_index(style.z_index.unwrap_or(0), |cx| cx.add_opaque_layer(bounds)) } - let interactive_bounds = Rc::new(InteractiveBounds { + let interactive_bounds = InteractiveBounds { bounds: bounds.intersect(&cx.content_mask().bounds), stacking_order: cx.stacking_order().clone(), - }); + }; if let Some(mouse_cursor) = style.mouse_cursor { let mouse_position = &cx.mouse_position(); @@ -784,28 +784,28 @@ impl Interactivity { for listener in self.mouse_down_listeners { let interactive_bounds = interactive_bounds.clone(); cx.on_mouse_event(move |event: &MouseDownEvent, phase, cx| { - listener(event, &*interactive_bounds, phase, cx); + listener(event, &interactive_bounds, phase, cx); }) } for listener in self.mouse_up_listeners { let interactive_bounds = interactive_bounds.clone(); cx.on_mouse_event(move |event: &MouseUpEvent, phase, cx| { - listener(event, &*interactive_bounds, phase, cx); + listener(event, &interactive_bounds, phase, cx); }) } for listener in self.mouse_move_listeners { let interactive_bounds = interactive_bounds.clone(); cx.on_mouse_event(move |event: &MouseMoveEvent, phase, cx| { - listener(event, &*interactive_bounds, phase, cx); + listener(event, &interactive_bounds, phase, cx); }) } for listener in self.scroll_wheel_listeners { let interactive_bounds = interactive_bounds.clone(); cx.on_mouse_event(move |event: &ScrollWheelEvent, phase, cx| { - listener(event, &*interactive_bounds, phase, cx); + listener(event, &interactive_bounds, phase, cx); }) } diff --git a/crates/gpui2/src/window.rs b/crates/gpui2/src/window.rs index 31e9afc695378b4dfe974173a02ea1a2a371113b..d43263f815749eb66d55760e935721bb1d781c88 100644 --- a/crates/gpui2/src/window.rs +++ b/crates/gpui2/src/window.rs @@ -46,29 +46,17 @@ const ACTIVE_DRAG_Z_INDEX: u8 = 1; pub struct StackingOrder { #[deref] #[deref_mut] - z_indices: Arc>, + z_indices: SmallVec<[u8; 32]>, } impl Default for StackingOrder { fn default() -> Self { StackingOrder { - z_indices: Arc::new(SmallVec::new()), + z_indices: SmallVec::new(), } } } -impl StackingOrder { - /// Pushes a new z-index onto the stacking order. - pub fn push(&mut self, z_index: u8) { - Arc::make_mut(&mut self.z_indices).push(z_index); - } - - /// Pops the last z-index off the stacking order. - pub fn pop(&mut self) { - Arc::make_mut(&mut self.z_indices).pop(); - } -} - /// Represents the two different phases when dispatching events. #[derive(Default, Copy, Clone, Debug, Eq, PartialEq)] pub enum DispatchPhase {