From 0ff87e603f2b721a732ccf96c12c7cd9d950db66 Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Wed, 3 Nov 2021 16:15:41 -0600 Subject: [PATCH] Give the MouseEventHandlers for each tab bar their own id This fixes a beachball where we oscillate back and forth between hovered and unhovered due to confusing two different tab bars as the same tab bar. --- crates/gpui/src/app.rs | 4 ++++ crates/workspace/src/pane.rs | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/crates/gpui/src/app.rs b/crates/gpui/src/app.rs index a41ec8c96b..7692b2586a 100644 --- a/crates/gpui/src/app.rs +++ b/crates/gpui/src/app.rs @@ -2418,6 +2418,10 @@ impl<'a, T: View> RenderContext<'a, T> { pub fn handle(&self) -> WeakViewHandle { WeakViewHandle::new(self.window_id, self.view_id) } + + pub fn view_id(&self) -> usize { + self.view_id + } } impl AsRef for &AppContext { diff --git a/crates/workspace/src/pane.rs b/crates/workspace/src/pane.rs index a18674a1e4..ebbc73c3b9 100644 --- a/crates/workspace/src/pane.rs +++ b/crates/workspace/src/pane.rs @@ -182,7 +182,7 @@ impl Pane { let theme = &settings.theme; enum Tabs {} - let tabs = MouseEventHandler::new::(0, cx, |mouse_state, cx| { + let tabs = MouseEventHandler::new::(cx.view_id(), cx, |mouse_state, cx| { let mut row = Flex::row(); for (ix, item) in self.items.iter().enumerate() { let is_active = ix == self.active_item;