fix: stabilize preview update flows and hud ordering
This folds the recent preview update fixes onto shared apply helpers, keeps HUD order stable after profile restore, and drops the unstable drag path that was still causing native crashes while navigating away.
This commit is contained in:
+13
-9
@@ -29,6 +29,7 @@ pub struct AppState {
|
||||
pub dirty: bool,
|
||||
pub saved_snapshot: AnnotatedConfig,
|
||||
pub redo_snapshot: Option<AnnotatedConfig>,
|
||||
pub auto_disabled_dependents: HashMap<String, HashSet<String>>,
|
||||
}
|
||||
|
||||
pub struct MainWindow {
|
||||
@@ -84,6 +85,7 @@ impl MainWindow {
|
||||
dirty: false,
|
||||
saved_snapshot: initial_config,
|
||||
redo_snapshot: None,
|
||||
auto_disabled_dependents: HashMap::new(),
|
||||
}));
|
||||
let preview = PreviewController::new();
|
||||
|
||||
@@ -1054,6 +1056,15 @@ fn refresh_visible_page(navigation_view: &libadwaita::NavigationView, ctx: &Page
|
||||
};
|
||||
let stable_width = ctx.parent_window.width();
|
||||
let stable_height = ctx.parent_window.height();
|
||||
if let Some(existing) = page.child() {
|
||||
if pages::refresh_page_widget_in_place(tag.as_str(), &existing, ctx) {
|
||||
let ctx_clone = ctx.clone();
|
||||
glib::idle_add_local_once(move || {
|
||||
pages::focus_pending_search_target(&ctx_clone);
|
||||
});
|
||||
return;
|
||||
}
|
||||
}
|
||||
let preserve_scroll = ctx.pending_search_target.borrow().is_none();
|
||||
let scroll_position = if preserve_scroll {
|
||||
page.child()
|
||||
@@ -2788,15 +2799,7 @@ fn reset_app_preferences_to_defaults(settings: Option<&gio::Settings>) {
|
||||
}
|
||||
|
||||
fn apply_preview_current_config(page_ctx: &PageBuildContext) {
|
||||
if page_ctx.preview.running_scene().is_none() {
|
||||
return;
|
||||
}
|
||||
|
||||
let config = pages::current_config_snapshot(page_ctx);
|
||||
let _ = page_ctx
|
||||
.preview
|
||||
.apply_live_config(&config)
|
||||
.or_else(|_| page_ctx.preview.restart(&config));
|
||||
pages::apply_live_preview_now(page_ctx);
|
||||
}
|
||||
|
||||
fn reload_config_from_disk(
|
||||
@@ -3159,6 +3162,7 @@ mod tests {
|
||||
dirty: true,
|
||||
saved_snapshot: saved.clone(),
|
||||
redo_snapshot: None,
|
||||
auto_disabled_dependents: HashMap::new(),
|
||||
}));
|
||||
|
||||
assert!(restore_saved_snapshot(&state));
|
||||
|
||||
Reference in New Issue
Block a user