ui: park the slide-over stack only when the dying signal page is the visible one

This commit is contained in:
Martino Ferrari committed 2026-11-03 01:11:06 +01:00
1 parent 3b1cda50e5
commit ad5e30f338
2 files changed
+36 -6

No files matched your search

+32 -4
View File
@@ -232,8 +232,11 @@ void signal_pages_sync(App& app) {
if (signal_index(app, it->first) == std::string::npos) {
if (slideover_page(app) == page_id(it->first)) slideover_close(app);
// The stack keeps showing the dying page through the close animation; park it on the list so that
// removing the page does not let another signal's page take its place for those frames.
if (slideover_has_page(app, "signals")) {
// removing the page does not let another signal's page take its place for those frames. Only when it
// is the page on show: parking while the slide-over is open on another page would switch the stack
// away from the page that slideover_page(), the title and the badge marker still name.
const char* shown = gtk_stack_get_visible_child_name(GTK_STACK(app.slideover.stack));
if (shown != nullptr && std::string(shown) == page_id(it->first) && slideover_has_page(app, "signals")) {
gtk_stack_set_visible_child_name(GTK_STACK(app.slideover.stack), "signals");
}
slideover_remove_page(app, page_id(it->first));
@@ -417,13 +420,38 @@ gboolean signal_page_probe(gpointer user) {
}
}
slideover_close(a);
// A page that is not on show is pruned while another panel is open: the slide-over stays on that panel.
int other_page_kept = -1;
if (slideover_has_page(a, "trigger")) {
slideover_open(a, "trigger");
const std::size_t before = a.math.size();
add_math_channel(a);
if (a.math.size() == before + 1) {
const std::string mname = a.math.back().name;
if (signal_page_ensure(a, mname)) {
const bool on_trigger = slideover_page(a) == "trigger";
a.math.pop_back();
apply_math_channels(a);
const char* shown = gtk_stack_get_visible_child_name(GTK_STACK(a.slideover.stack));
other_page_kept = on_trigger && a.signal_pages.count(mname) == 0 && slideover_page(a) == "trigger" &&
shown != nullptr && std::string(shown) == "trigger"
? 1
: 0;
} else {
a.math.pop_back();
apply_math_channels(a);
}
}
slideover_close(a);
}
std::fprintf(stderr,
"[signalpage] name=%s open=%d pages=%d enable_visible=%d plot_buttons=%d plot_on_row0=%d "
"plot_on_row0_disabled=%d locked_enable_sensitive=%d "
"removed=%d btn_row0=%d back_to_list=%d row_opens=%d pruned=%d rows=%d\n",
"removed=%d btn_row0=%d back_to_list=%d row_opens=%d pruned=%d other_page_kept=%d rows=%d\n",
name.c_str(), open, pages, enable_visible, plot_buttons, plot_on_row0, plot_on_row0_disabled,
locked_enable_sensitive, removed, btn_row0, back_to_list, row_opens, pruned,
a.rows->row_count());
other_page_kept, a.rows->row_count());
return G_SOURCE_REMOVE;
}