diff --git a/crates/ui/src/docking/native_tests.rs b/crates/ui/src/docking/native_tests.rs index f872ddae..70d69498 100644 --- a/crates/ui/src/docking/native_tests.rs +++ b/crates/ui/src/docking/native_tests.rs @@ -493,6 +493,16 @@ fn dragging_the_bar_moves_the_os_window() { assert!(d.host().commands.iter().any(|(_, c)| *c == ViewportCommand::StartDrag)); } +#[test] +fn a_native_window_names_its_panel_in_its_tab_only() { + // As the in-window floating window does: the bar has no title. + let mut d = driver(layout(true)); + d.settle(); + let viewport = d.viewport(window(&d, 5).id); + let texts = texts(&d.host().windows[&viewport].shapes); + assert_eq!(texts.iter().filter(|t| *t == "Panel 5").count(), 1, "{texts:?}"); +} + fn id_of(d: &DockDriver) -> u64 { window(d, 5).id } diff --git a/crates/ui/src/docking/render/native.rs b/crates/ui/src/docking/render/native.rs index f27f6058..c2144269 100644 --- a/crates/ui/src/docking/render/native.rs +++ b/crates/ui/src/docking/render/native.rs @@ -780,7 +780,8 @@ impl Renderer<'_, P> { Some(key) } - /// The bar at the top of a native window: its title and ×. Dragging it moves the window. + /// The bar at the top of a native window: its ×, but no title, as the tab names the panel. + /// Dragging it moves the window. /// Returns the rects of its buttons. fn native_bar(&mut self, ui: &mut Ui, window: &Floating

) -> Vec { let Some(first) = window.panels().next().cloned() else { return Vec::new() }; @@ -792,10 +793,9 @@ impl Renderer<'_, P> { let movable = window.panels().all(|p| self.permissions(p).movable); let closable = self.style.close_button && window.panels().all(|p| self.permissions(p).closable); let (move_label, close_label) = (self.style.move_window_label.clone(), self.style.close_window_label.clone()); - let title = crate::docking::dock_model::first_active(&window.root).map(|p| self.label_of(p)).unwrap_or_default(); // On macOS the bar keeps the arrow, as native title bars do: AppKit's resize areas // cover its ends and top edge, and a cursor set over them flickers with AppKit's. - let mut bar = TitleBar::new(self.id.with(("native-bar", window.id)), &move_label).title(title).movable(movable && !OS_RESIZES); + let mut bar = TitleBar::new(self.id.with(("native-bar", window.id)), &move_label).movable(movable && !OS_RESIZES); if closable { bar = bar.close(&close_label).close_at(close_hit, close_glyph); }