Skip to content

#47 Stage 1: move struct App + ShellApp impl out of src/gtk/ into a backend-neutral src/app.rs #785

Description

@JDonaghy

Stage 1 of #47 (native macOS GUI), split out because it is the only stage this fleet can build and verify. #47 stays open as the tracking issue; stages 2–4 (the macOS wrapper itself, MacDriver) need an Apple SDK / objc2 toolchain that no machine in this fleet has.

Blocked on quadraui#699 (Backend Rc-handle symmetry) and on the pin bump in #767 — both must land first.

What

Move struct App, its impl App blocks and impl quadraui::ShellApp for App out of src/gtk/mod.rs into a backend-neutral src/app.rs, leaving src/gtk/mod.rs with only run(), build_shell_config() and genuinely GTK-only helpers.

This is the concrete next step of the north star in GOALS.md: the backends shrink to thin event-to-engine wiring. src/gtk/mod.rs is 7,684 production lines — 38% of both backends' remaining mass — and the 2026-09-03 audit found it is already mostly portable.

Why it is mostly mechanical

From the #47 re-audit (44882e9, full text in PLAN.md → "#47 re-audit findings"):

  • Of the ~6,700 lines spanning struct Appimpl ShellApp for App, only ~40 lines touch gtk4:: / gio:: / pangocairo:: / glib:: directly.
  • map_gtk_key_name, gtk_key_name_to_quadraui, map_gtk_key_with_unicode look GTK-specific but take and return plain &str / quadraui::UiEventzero gtk4 dependency. They move verbatim.
  • setup_gtk_clipboard is already #[cfg]-branched for target_os = "macos" internally and never touches gtk4. Moves verbatim.

The four platform-typed fields

Field Type Disposition
settings_monitor Option<gio::FileMonitor> #[cfg(feature = "gui")], ~1 call site
window Option<gtk4::Window> #[cfg(feature = "gui")], ~15 call sites, all window-chrome (resize/maximize/CSD)
css_provider Option<gtk4::CssProvider> #[cfg(feature = "gui")], ~3 call sites, colorscheme reload
backend Rc<RefCell<GtkBackend>> Switch to whatever shape quadraui#699 lands on — this is the blocker

Re-derive all of these at pickup; src/gtk/mod.rs churns heavily and the counts above were measured at 44882e9.

Files

  • src/gtk/mod.rs
  • src/app.rs (new)
  • src/lib.rs

Acceptance

  • cargo build --no-default-features and cargo build --features gui both green.
  • cargo test --features gui,test-support green — in particular the GtkDriver black-box suite in src/gtk/testing.rs, which exercises the moved dispatch paths through production code.
  • src/gtk/mod.rs production line count drops materially; state the before/after using python3 scripts/prod_lines.py src/gtk src/tui_main src/render.rs in the PR.
  • No new #[cfg(feature = "gui")] inside src/app.rs beyond the three fields named above — if more is needed, that is a finding to report, not to route around (Platform-Neutrality Rule).

Not in scope

src/macos/, MacDriver, anything requiring an Apple toolchain. Pure refactor: no behaviour change, so no new black-box test is required — say so explicitly in the PR per CLAUDE.md's testing bar.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    coordTracked by coord-tui pipelinestatus:readyRefined and ready to enter the work pipeline

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions