Skip to content

#544: [retry] #448-D: GTK ShellApp migration — click-handling logic largely not working (follow-up bugs from #540) - #668

Merged
JDonaghy merged 2 commits into
developfrom
issue-544-448-d-gtk-shellapp-migration-click-handl
Aug 26, 2026
Merged

#544: [retry] #448-D: GTK ShellApp migration — click-handling logic largely not working (follow-up bugs from #540)#668
JDonaghy merged 2 commits into
developfrom
issue-544-448-d-gtk-shellapp-migration-click-handl

Conversation

@JDonaghy

Copy link
Copy Markdown
Owner

Closes #544

Automated PR opened by coordinator for review of issue #544.

#448-D follow-up. Under the ShellApp runner every sidebar panel except the
file explorer silently dropped mouse input: search, git, debug, extensions
and settings presses fell through `ShellApp::handle` to the editor click
path, matched no editor zone, and were discarded.

Cause: the Relm4 build gave each panel its own `DrawingArea` and GDK
delivered clicks straight to it. #540 collapsed all 14 DAs into the runner's
single surface, so panels are now painted by `render_content` into
`layout.sidebar_content_bounds` and every event arrives at
`ShellApp::handle`. Only the explorer was re-wired there
(`try_route_sidebar_mouse_event`); the rest were never reconnected, and the
legacy `Msg::SettingsClick` / `Msg::ScSidebarClick` handlers they would have
used read their geometry off `*_da_ref` widgets that are `None` for the whole
life of a ShellApp run.

`try_route_sidebar_mouse_event` now matches the active panel exactly the way
`render_content` does and hands the event to the very shared controller that
painted it, at the rect it painted into:

  explorer   -> TreeController        (unchanged)
  search     -> SidebarSystem         `handle_search_sidebar_ui_event`
  git        -> band split + SidebarPanelLayout + SidebarSystem
  debug      -> action-bar StatusBarLayout + SidebarSystem
  extensions -> SidebarSystem         `handle_ext_sidebar_ui_event`
  ext:*      -> same (plugin panels)
  settings   -> FormController        `render::handle_settings_form_ui_event`

No new GTK hit-test: the geometry already lives in the shared controllers,
the same way `tui_main::shell_app`'s equivalent intercepts use them.

Shared (backend-neutral) additions in `render.rs`:

- `sc_sidebar_bands` splits the git panel content rect into header /
  commit-input / toolbar-slab. `render_content` and the click router now read
  one derivation instead of two — the old click path assumed DrawingArea-local
  coordinates with the panel top at `y == 0`, which the ShellApp painter never
  produces, so every band test landed in the wrong band.
- `handle_settings_form_ui_event` drives the settings panel through the same
  `FormController` that painted it (rows, scroll offset, scrollbar gutter),
  replacing the `line_height * 1.4` + DA-width arithmetic that can no longer
  work. Activation policy is unchanged: toggles and category headers act on a
  single click, value rows select on single and activate on double.

Also: a press claimed by a panel now captures the rest of the gesture
(`sidebar_pointer_captured`), so panel scrollbar thumbs and tree drags track
the pointer even when it leaves the sidebar — while an *unclaimed* move or
release is still left alone, so an editor text-drag that wanders over the
sidebar finalises in the editor. Wheel notches no longer steal panel focus.

Bugs 1a (tab-slot recovery), 1b (single-group `local_x`) and 3 (nerd-font
glyphs) from the issue body already landed on develop via #549/#551/#553 and
`render::sync_nerd_fonts`; verified, not re-fixed.

Tests: six in-crate headless GTK harness tests (`gtk::testing::
sidebar_panel_clicks`) covering settings click + wheel, search query focus,
git commit-box vs header bands, debug focus, and the editor-drag holdout.
`Harness::painted_sidebar_bounds` is published so they aim at the rect the
frame actually painted rather than guessed offsets.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
…ds, doc/test nits

- Blocking: try_route_sidebar_mouse_event referenced EXT_PANEL_ID_PREFIX,
  which was never defined anywhere in the tree (compile error). Use the
  existing "ext:" literal / is_ext_panel_id() helper the rest of the file
  already relies on for the same id shape.
- Non-blocking: clear cached_sc_bands when the git panel is active but
  screen.source_control is None, so a stray click can't be resolved
  against stale geometry from the last time a repo was open.
- Non-blocking: document why handle_settings_form_ui_event's bool return
  is deliberately discarded (position is already confirmed inside the
  sidebar, so it must not leak to the editor either way).
- Nit: reword the "1-3 lines per panel" doc comment to acknowledge the
  larger settings/extensions/debug/git arms.
- Nit: add a_sidebar_drag_keeps_its_grab_once_it_crosses_into_the_editor,
  which actually exercises the captured-drag-outside-bounds path the
  existing regression test's doc comment claimed to cover but didn't.
@JDonaghy
JDonaghy merged commit 16d637d into develop Aug 26, 2026
2 checks passed
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.

#448-D: GTK ShellApp migration — click-handling logic largely not working (follow-up bugs from #540)

1 participant