feat(window): surface the unsaved-changes prompt on close

A close signal can arrive while the app is backgrounded, leaving the
in-window unsaved-changes prompt unseen behind other windows. Funnel the
prompt opener through gain_focus + a Critical user-attention request so
the window raises (Windows/macOS/X11) or at least flags for attention
(Wayland via xdg_activation). Every unsaved-dialog caller shares this path.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
This commit is contained in:
Hakan SevenandClaude Opus 4.8 committed 2026-06-20 13:40:47 +03:00
1 parent 1ed3315e50
commit 7e70a2a97c
1 file changed
+16 -1
+16 -1
View File
@@ -8896,7 +8896,22 @@ impl OpenCADStudio {
fn open_unsaved_dialog_window(&mut self) -> Task<Message> {
self.active_modal = Some(super::ModalKind::Unsaved);
Task::none()
// The unsaved-changes prompt renders inside the main window, so bring
// that window to the foreground — a close signal can arrive while the
// app is backgrounded, leaving the prompt unseen behind other windows.
// `gain_focus` alone is ignored by most Linux WMs (focus-stealing
// prevention), so pair it with an urgency hint so the window is at
// least flagged for attention when the compositor blocks the raise.
match self.main_window {
Some(id) => Task::batch([
iced::window::gain_focus(id),
iced::window::request_user_attention(
id,
Some(iced::window::UserAttention::Critical),
),
]),
None => Task::none(),
}
}
fn close_unsaved_dialog_window(&mut self) -> Task<Message> {