mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-12-01 10:51:11 +01:00
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.
This commit is contained in:
1 parent
2a5dbc479f
commit
6172b742bf
1 file changed
+7
-1
@@ -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
|
||||
|
||||
Reference in new issue
Block a user