Skip to content

fix(linux): wait for GtkPaned layout before restoring split ratio - #56

Merged
melonamin merged 3 commits into
melonamin:linux-portfrom
Gnu-Gorets:fix/linux-split-ratio-layout
Nov 7, 2026
Merged

melonamin merged 3 commits into
melonamin:linux-portfrom
Gnu-Gorets:fix/linux-split-ratio-layout

Conversation

@Gnu-Gorets

@Gnu-Gorets Gnu-Gorets commented Nov 4, 2026 •

Copy link
Copy Markdown

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

  • Swift 6.3.2, Ubuntu Noble/GTK 4.14, freshly built repository-pinned Ghostty and zmx runtimes.
  • All 4,959 shared-core/CLI tests and 581 Linux-package tests pass.
  • Strict SwiftLint 0.65.0, Python syntax checks, core-boundary check, CLI-drift check, and git diff --check pass.
  • Real GTK split-ratio-restore and split-primary-exit scenarios pass under isolated Xvfb/D-Bus, HOME, state, and socket. The prior head failed the cold-restoration measurement; the correction renders 0.652 for a requested 0.65.
  • Full GTK CI on the updated head is pending. Native desktop acceptance was not rerun.

Keep hidden split ratios pending until GtkPaned maps, then apply after frame. Route control resize through same path.
@Gnu-Gorets
Gnu-Gorets requested a review from melonamin as a code owner November 4, 2026 23:36
Fix Linux app build failure in the GtkPaned map callback by guarding its optional widget pointer before passing it to the restore coordinator.
@Gnu-Gorets

Copy link
Copy Markdown
Author

@melonamin could you help, please, did you get it? It's pretty nasty

  1. Actual result (bug). it should have split terminal, 2 areas. But it doesn't work for 100%
image
  1. Expected result
image

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.
@melonamin

Copy link
Copy Markdown
Owner

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.

@melonamin
melonamin merged commit 6db162b into melonamin:linux-port Nov 7, 2026
5 checks passed
@Gnu-Gorets
Gnu-Gorets deleted the fix/linux-split-ratio-layout branch November 7, 2026 23:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants