mirror of
https://github.com/zed-industries/zed.git
synced 2024-12-28 03:25:59 +00:00
Merge pull request #2173 from zed-industries/tab-bar-background-focus-pane
Focus pane when clicking on tab bar background
This commit is contained in:
commit
8bd20d8c3a
1 changed files with 22 additions and 5 deletions
|
@ -1420,23 +1420,40 @@ impl View for Pane {
|
|||
Stack::new()
|
||||
.with_child(
|
||||
MouseEventHandler::<MouseNavigationHandler>::new(0, cx, |_, cx| {
|
||||
let active_item_index = self.active_item_index;
|
||||
|
||||
if let Some(active_item) = self.active_item() {
|
||||
Flex::column()
|
||||
.with_child({
|
||||
let theme = cx.global::<Settings>().theme.clone();
|
||||
|
||||
let mut stack = Stack::new();
|
||||
|
||||
enum TabBarEventHandler {}
|
||||
stack.add_child(
|
||||
MouseEventHandler::<TabBarEventHandler>::new(0, cx, |_, _| {
|
||||
Flex::row()
|
||||
.contained()
|
||||
.with_style(theme.workspace.tab_bar.container)
|
||||
.boxed()
|
||||
})
|
||||
.on_click(MouseButton::Left, move |_, cx| {
|
||||
cx.dispatch_action(ActivateItem(active_item_index));
|
||||
})
|
||||
.boxed(),
|
||||
);
|
||||
|
||||
let mut tab_row = Flex::row()
|
||||
.with_child(self.render_tabs(cx).flex(1., true).named("tabs"));
|
||||
|
||||
// Render pane buttons
|
||||
let theme = cx.global::<Settings>().theme.clone();
|
||||
if self.is_active {
|
||||
tab_row.add_child(self.render_tab_bar_buttons(&theme, cx))
|
||||
}
|
||||
|
||||
tab_row
|
||||
stack.add_child(tab_row.boxed());
|
||||
stack
|
||||
.constrained()
|
||||
.with_height(theme.workspace.tab_bar.height)
|
||||
.contained()
|
||||
.with_style(theme.workspace.tab_bar.container)
|
||||
.flex(1., false)
|
||||
.named("tab bar")
|
||||
})
|
||||
|
|
Loading…
Reference in a new issue