fix: the sidebar button follows the panel, and the wish survives having no source
The toolbar button was the panel's only input: `update_side_visibility()` derived the panel from the button and never the other way, so the button went on saying "shown" in two cases where the panel was off -- while there were no signals to show, and after anything else moved the split view's state. Binding the two together is not the fix. AdwOverlaySplitView writes `show-sidebar` itself, at startup and when it collapses, with no user involved; a binding pushes that into the button, the button's handler reads it as the user's wish, and the sidebar then never comes back when a source connects -- a worse bug than the one reported, and one that a "was this our own write" flag does not catch either, because the toggle's signal may fire after the write returns. So the direction is stated instead of inferred: `show-sidebar` is an output, the button is the only input, and `App::sidebar_wanted` holds the wish between them. The wish is written by the toggle's handler alone (guarded while we set the button ourselves), the no-signals case forces the panel off without touching the wish, and tick() re-asserts both from the wish when the widget disagrees -- so a hide gesture does not stick either. [sidebar-probe] now reads the pair (shown vs button) in both states and against a hide that did not come from the button; shown=1 button=1 with a source, shown=0 button=0 without, and the source reconnecting brings both back is the reading this exists for.
This commit is contained in:
1 parent
bb01278d88
commit
2d9f327da7
5 files changed
+95
-16
No files matched your search
@@ -408,6 +408,16 @@ struct App {
|
||||
/// The split view the sidebar lives in. Its width, its collapse and its overlay are that widget's
|
||||
/// business -- `AdwOverlaySplitView` -- and not a paned position's.
|
||||
GtkWidget* side_view = nullptr;
|
||||
/// Whether the user wants the sidebar: their last word on the toolbar's button. Kept apart from the
|
||||
/// button's own state because that state now *follows* the panel, and the panel is forced off while
|
||||
/// there is nothing to show -- without this, connecting a source would leave the sidebar closed.
|
||||
bool sidebar_wanted = true;
|
||||
/// Set while we are writing the split view's or the button's state ourselves. A *binding* cannot
|
||||
/// express this: the widget moves `show-sidebar` on its own when it collapses, the binding pushes that
|
||||
/// into the button, and the button's handler then records it as the user's wish -- so the sidebar never
|
||||
/// comes back when a source connects. An explicit flag is reliable precisely because our writes go
|
||||
/// through `update_side_visibility`, which sets the flag around them.
|
||||
bool sidebar_syncing = false;
|
||||
|
||||
GtkBuilder* window_ui = nullptr;
|
||||
bool comparing = false;
|
||||
|
||||
Reference in new issue
Block a user