Skip to content

GTK4: 4 styling FFI gaps surfaced by #185 Phase B audit #202

Description

@proggeramlug

Context

The styling matrix added in #185 Phase A (crates/perry-ui/src/styling_matrix.rs) audits which styling FFIs are wired on each backend. After Phase B closures (v0.5.297–v0.5.303), every Apple platform + Android + Web is at 43/43 Wired. GTK4 sits at 39/43, with 4 real implementation gaps that can't be reasonably verified from the macOS dev host (no GTK4 toolchain) and warrant a focused Linux-side closure.

The 4 Missing rows

Generated from docs/src/ui/styling-matrix.md:

Prop FFI symbol Recommendation
widget.on_click perry_ui_widget_set_on_click widget.add_controller(GestureClick::new()) with connect_pressed invoking the registered closure
button.content_tint_color perry_ui_button_set_content_tint_color CSS color override on Button > image selector via per-handle CssProvider (mirrors set_corner_radius pattern)
button.image_position perry_ui_button_set_image_position Button::set_child(&Box) with image+label ordered by direction; or Button::child().downcast::<Box>().reorder_child_after()
stack.detaches_hidden perry_ui_stack_set_detaches_hidden GTK4 already auto-detaches hidden children from layout; could be a no-op stub OR reuse Box::set_visible cascade — needs Linux verification

What's needed

For each row above:

  1. Implementation in crates/perry-ui-gtk4/src/widgets/mod.rs (or appropriate sub-module — button.rs for the button-specific ones).
  2. FFI export in crates/perry-ui-gtk4/src/lib.rs#[no_mangle] pub extern \"C\" fn perry_ui_<symbol>(...).
  3. Matrix flip in crates/perry-ui/src/styling_matrix.rs from MissingWired for the GTK4 cell. Drift integration test (cargo test -p perry-ui) catches mismatches at CI time.

Why a separate issue

The macOS dev host can't easily cross-compile GTK4 (pkg-config for pango/gtk via system, libmimalloc-sys build issues). The CI ubuntu-22.04 runner has GTK4 system libs and can build cleanly. A Linux contributor or a CI-only PR is the natural path.

Verification

Once landed, cargo test -p perry-ui must remain green (the styling matrix integration test scans crates/perry-ui-gtk4/src/lib.rs for the new FFI exports and fails on drift).

Quick verification flow:

# After implementing each FFI export:
./target/debug/styling-matrix --check    # validates lib.rs vs matrix
./target/debug/styling-matrix --gen      # regenerates docs/src/ui/styling-matrix.md
git diff --exit-code -- docs/src/ui/styling-matrix.md  # CI guard

Closes

Once landed: GTK4 reaches 43/43 Wired alongside Apple+Android+Web. Only Windows-deferred-paint family (5 stubs) remains for full Phase B styling closure on issue #185.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew capability or improvement

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions