Return back Windows menu (#22339)

Follow-up of https://github.com/zed-industries/zed/pull/21873

Release Notes:

- N/A
This commit is contained in:
Kirill Bulatov 2024-12-22 00:03:17 +02:00 committed by GitHub
parent dbb76100e5
commit b51a28b75f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 23 additions and 13 deletions

View file

@ -134,18 +134,19 @@ impl Render for TitleBar {
.child(
h_flex()
.gap_1()
.when_some(self.application_menu.clone(), |this, menu| {
let is_any_menu_deployed = menu.read(cx).is_any_deployed();
this.child(menu).when(!is_any_menu_deployed, |this| {
this.children(self.render_project_host(cx))
.child(self.render_project_name(cx))
.children(self.render_project_branch(cx))
})
})
.when(self.application_menu.is_none(), |this| {
this.children(self.render_project_host(cx))
.child(self.render_project_name(cx))
.children(self.render_project_branch(cx))
.map(|title_bar| {
let mut render_project_items = true;
title_bar
.when_some(self.application_menu.clone(), |title_bar, menu| {
render_project_items = !menu.read(cx).is_any_deployed();
title_bar.child(menu)
})
.when(render_project_items, |title_bar| {
title_bar
.children(self.render_project_host(cx))
.child(self.render_project_name(cx))
.children(self.render_project_branch(cx))
})
})
.on_mouse_down(MouseButton::Left, |_, cx| cx.stop_propagation()),
)