Skip to content

GTK: terminal panel click handlers should use cached hit regions from draw #418

Description

@JDonaghy

Problem

The two terminal panel click handlers in src/gtk/mod.rs (~lines 6873 and 7575) manually compute term_y with ~20 lines of pixel arithmetic each, including a special-case snap for the maximized state. This must exactly match the draw function's layout (src/gtk/draw.rs ~line 503) or clicks land on the wrong zone.

The draw function already caches hit regions:

  • engine.bottom_tab_bar_hits — tab bar ("TERMINAL" / "DEBUG CONSOLE") hit zones
  • engine.terminal_toolbar_hits — toolbar button hit zones

The click handlers should read these cached regions instead of recomputing positions.

Proposed fix

Replace the manual term_y / zone computation in both click handlers with lookups into engine.bottom_tab_bar_hits and engine.terminal_toolbar_hits. This eliminates ~40 lines of bespoke pixel math and guarantees paint/click agreement by construction.

Context

Identified during #386 (extract compute_editor_layout). The PanelChromeDesc row-rounding disagrees with the draw function's pixel-exact maximize snapping — the cached hit regions sidestep this entirely.

Activity

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

Metadata

Metadata

Assignees

Labels

enhancementNew feature or requestinfrastructureBuild, CI, distributionuiUI/rendering

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions