From 6172b742bf21237b4dc2b7d3a71b8b75b16ff6fd Mon Sep 17 00:00:00 2001 From: Cyb3rDudu Date: Wed, 25 Nov 2026 14:10:02 +0700 Subject: [PATCH] fix(ui): act on the title bar's Close caption click The app bar discarded the title bar's output, so a click on the caption Close button was reported and never acted on: on a desktop that shows the app's own frame (GNOME/Wayland), the button did nothing. Send the viewport Close command when the bar reports it, as the page band's Close does. The unsaved-changes prompt runs from the close request the command raises, as an OS close does. --- crates/ui-egui/src/chrome.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/crates/ui-egui/src/chrome.rs b/crates/ui-egui/src/chrome.rs index 52d92c7df6..8d32f185c0 100644 --- a/crates/ui-egui/src/chrome.rs +++ b/crates/ui-egui/src/chrome.rs @@ -139,11 +139,17 @@ pub fn app_bar(ui: &mut Ui, _cx: &mut BodyCx<'_>, app: &mut VectorcraftApp) { let end = |ui: &mut Ui, _: &mut BodyCx<'_>| trailing(ui, &mut app.borrow_mut()); // A nightly's window and Dock entry carry its own name, so they never read as the stable app's. let title = if crate::os_window::stable_services_allowed() { tl!("VectorCraft") } else { crate::os_window::name() }; - let _ = if titled { + let out = if titled { TitleBar::new().surface(SurfaceKind::Background).show_titled(ui, Title::new(title), start, end) } else { TitleBar::new().surface(SurfaceKind::Background).show_fitted(ui, start, end) }; + // The title bar reports a caption Close click in its output and never acts on it; acting here + // keeps the click from being dropped (the unsaved-changes prompt runs from the close request + // the command raises, as an OS close does). + if out.close_requested { + ui.ctx().send_viewport_cmd(egui::ViewportCommand::Close); + } } /// The OS window title: the active document's name suffixed with the app name (a `*` prefix