diff --git a/crates/title_bar/src/application_menu.rs b/crates/title_bar/src/application_menu.rs index 4a8cac2435..ec1640ec19 100644 --- a/crates/title_bar/src/application_menu.rs +++ b/crates/title_bar/src/application_menu.rs @@ -253,14 +253,14 @@ impl ApplicationMenu { cx.defer_in(window, move |_, window, cx| next_handle.show(window, cx)); } - pub fn all_menus_shown(&self, cx: &mut Context) -> bool { + pub fn all_menus_shown(&self, cx: &App) -> bool { show_menus(cx) || self.entries.iter().any(|entry| entry.handle.is_deployed()) || self.pending_menu_open.is_some() } } -pub(crate) fn show_menus(cx: &mut App) -> bool { +pub(crate) fn show_menus(cx: &App) -> bool { TitleBarSettings::get_global(cx).show_menus && (cfg!(not(target_os = "macos")) || option_env!("ZED_USE_CROSS_PLATFORM_MENU").is_some()) } diff --git a/crates/title_bar/src/title_bar.rs b/crates/title_bar/src/title_bar.rs index b84a2800b6..4403dce320 100644 --- a/crates/title_bar/src/title_bar.rs +++ b/crates/title_bar/src/title_bar.rs @@ -138,7 +138,9 @@ impl Render for TitleBar { fn render(&mut self, window: &mut Window, cx: &mut Context) -> impl IntoElement { let title_bar_settings = *TitleBarSettings::get_global(cx); - let show_menus = show_menus(cx); + let mut render_project_items = + title_bar_settings.show_branch_name || title_bar_settings.show_project_items; + let show_separate_menus = show_menus(cx) && render_project_items; let mut children = Vec::new(); @@ -146,14 +148,14 @@ impl Render for TitleBar { h_flex() .gap_1() .map(|title_bar| { - let mut render_project_items = title_bar_settings.show_branch_name - || title_bar_settings.show_project_items; title_bar .when_some( - self.application_menu.clone().filter(|_| !show_menus), + self.application_menu + .clone() + .filter(|_| !show_separate_menus), |title_bar, menu| { render_project_items &= - !menu.update(cx, |menu, cx| menu.all_menus_shown(cx)); + !menu.read_with(cx, |menu, cx| menu.all_menus_shown(cx)); title_bar.child(menu) }, ) @@ -200,7 +202,7 @@ impl Render for TitleBar { .into_any_element(), ); - if show_menus { + if show_separate_menus { self.platform_titlebar.update(cx, |this, _| { this.set_children( self.application_menu