Repository navigation
fix(linux): wait for GtkPaned layout before restoring split ratio - #56
Conversation
Keep hidden split ratios pending until GtkPaned maps, then apply after frame. Route control resize through same path.
Fix Linux app build failure in the GtkPaned map callback by guarding its optional widget pointer before passing it to the restore coordinator.
|
@melonamin could you help, please, did you get it? It's pretty nasty
|
The initial map can fire before gWindows contains the new controller. Resume mapped pending restores after registration, and cover cold restore plus hidden control resizing with rendered pane proportions.
|
Focused GTK acceptance found an additional cold-start bug: the snapshot and control tree retained a 0.65 split ratio, but the restored horizontal split rendered at 0.50. The initial GtkPaned map occurs inside AppController.init, before openWindow inserts the controller into gWindows, so onPanedMapped cannot resolve its owner and leaves the restore pending. The follow-up resumes already-mapped pending restores immediately after window registration. It preserves the existing map/frame-callback path for hidden sessions and does not reparent terminal widgets. Added the split-ratio-restore scenario to the full GTK smoke suite. It checks actual red/blue pane areas after cold restoration, selection of a restored hidden split, and hidden control resizing in both orientations. The earlier PR head failed the cold-restoration assertion; with the correction, rendered primary shares were 0.652, 0.298, 0.402, and 0.600 for requested 0.65, 0.30, 0.40, and 0.60. The split-primary-exit scenario also passes. Local validation uses Swift 6.3.2, Ubuntu Noble/GTK 4.14, and freshly built repository-pinned Ghostty/zmx runtimes. All 4,959 shared-core/CLI tests and 581 Linux-package tests pass, along with strict SwiftLint 0.65.0, Python syntax checks, core-boundary and CLI-drift checks. The first core run used a custom scratch directory, which broke one fixture's standard .build helper lookup; the full rerun with the standard layout passed. Full GTK CI and native desktop acceptance remain separate gates. |


Problem
Saved split restoration can set the divider on an unmapped GtkPaned with stale nonzero size, leaving terminal panes blank. Initial mapping can also fire inside AppController.init before the controller enters the window registry, leaving a saved ratio unapplied: the model reports 65/35 while GTK renders 50/50.
Fix
Keep restores pending until the paned maps, then apply the saved ratio through a frame callback after layout. Resume already-mapped pending restores immediately after window registration so the first map cannot be lost. Control-driven resizing uses the same path, with generation-safe cancellation and no terminal reparenting.
Add split-ratio-restore to the real GTK smoke suite. It measures painted pane proportions after cold restoration, selection of a restored hidden split, and control-driven resizing while hidden in both orientations. Update the main-loop contract and visual-validation documentation.
Validation