Skip to content

#592-D: register GTK scroll surfaces + hit-test caches on the live path, then delete src/gtk/draw.rs #672

Description

@JDonaghy

Sub-task 4/4 of #592 — the closer. Depends on #592-A, #592-B and #592-C: src/gtk/draw.rs is the reference implementation those three port from, so it cannot be deleted until they land.

What

Two halves, in order:

1. Re-home the state the dead path was the sole writer of. Per #592, GTK's scroll and
click dispatch currently run against structures nothing live ever fills:

  • engine.scroll_surfaces is written only from dead code (draw.rs:85, :644, :709).
    GTK's dispatch_scroll (mod.rs:1838) and dispatch_click (mod.rs:3577) therefore
    hit-test against a permanently empty list. TUI registers its surfaces every frame.
  • Several hit-test caches are read by live GTK event handlers but written only by the dead
    path — enumerate them from GTK live render path silently drops 13 populated ScreenLayout fields (rest of #587's blast radius) #592's table and from a compile check once draw.rs is gone.

2. Delete src/gtk/draw.rs.

Why this is the payoff

src/gtk/draw.rs is 3,733 lines under a file-level #![allow(dead_code)]. Of its 29
exported pub(super) fns, zero have a live caller (verified on origin/develop
2026-08-26; the one apparent hit on draw_editor is a comment). That file-level allow is
what muted the warning that would have caught #587 and #592 years earlier — deleting the
file removes both ~3.7k lines of dead code and the mechanism that hid the bug.

Design

  • Do the re-homing before the delete, and land it as its own commit, so a regression is
    bisectable to one half.
  • Register scroll surfaces from the live render_content path at paint time, the way TUI
    does — one shared registration path, not a GTK-specific one.
  • Remove the file-level #![allow(dead_code)] from any file that still carries it and let
    the compiler name whatever is left. Anything it flags is either a real orphan (delete) or a
    missed port (a bug in A/B/C — go back and fix it there rather than reviving draw.rs).
  • If deleting draw.rs reveals a surface no one ported, stop and say so rather than
    copying the function back into mod.rs.

Acceptance criteria

  • src/gtk/draw.rs no longer exists.
  • No file under src/gtk/ carries a file-level #![allow(dead_code)].
  • GTK scroll-wheel dispatch and click dispatch hit-test against a surface list that is
    actually populated — proven by a GtkDriver test that scrolls a scrollable surface and
    asserts the content moved, which cannot pass against an empty list.
  • All thirteen GTK live render path silently drops 13 populated ScreenLayout fields (rest of #587's blast radius) #592 surfaces still paint (the A/B/C tests stay green).
  • TUI behaviour unchanged.
  • cargo build && cargo test EXIT=0.

Files

  • src/gtk/draw.rs
  • src/gtk/mod.rs
  • src/gtk/click.rs
  • src/gtk/testing.rs
  • src/render.rs

Out of scope

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

    bugSomething isn't workingcoordTracked by coord-tui pipelineinfrastructureBuild, CI, distributionstatus:readyRefined and ready to enter the work pipelinesub-taskSub-task of a parent issueuiUI/rendering

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions