From 7e70a2a97c52177ec79fd33c513551d90f73918b Mon Sep 17 00:00:00 2001 From: Hakan Seven Date: Sat, 20 Jun 2026 13:40:47 +0300 Subject: [PATCH] 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 --- src/app/update.rs | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/app/update.rs b/src/app/update.rs index 1019e58cd..de30df33e 100644 --- a/src/app/update.rs +++ b/src/app/update.rs @@ -8896,7 +8896,22 @@ impl OpenCADStudio { fn open_unsaved_dialog_window(&mut self) -> Task { 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 {