Skip to content

#459: [rework-1] Migrate context menu dispatch to ModalStack (platform-neutral) - #576

Merged
JDonaghy merged 1 commit into
developfrom
issue-459-migrate-context-menu-dispatch-to-modalst
Jul 12, 2026
Merged

#459: [rework-1] Migrate context menu dispatch to ModalStack (platform-neutral)#576
JDonaghy merged 1 commit into
developfrom
issue-459-migrate-context-menu-dispatch-to-modalst

Conversation

@JDonaghy

Copy link
Copy Markdown
Owner

Closes #459

Automated merge from the coordinator for assignment 73b88d3e3359 on issue #459.

Worker branch: issue-459-migrate-context-menu-dispatch-to-modalstdevelop.

…tral)

Right-clicking a file in the explorer opens the context menu correctly
(#451), but the four panel-specific mouse intercepts in mod.rs (debug
sidebar, extensions sidebar, debug toolbar, explorer tree) still gated
on the per-backend `engine.context_menu.is_none()` boolean (#456) to
decide whether an open context menu should intercept a click before
the panel underneath sees it. That's an ad hoc TUI-only mechanism —
GTK gets the same priority for free via native z-ordering.

This migrates the gate to `quadraui::ModalStack`, the same
platform-neutral primitive already used for the editor hover popup
(#216):

- `mouse.rs`: reconcile the open context menu's bounds onto the modal
  stack at the top of `handle_mouse`, pushing/popping the
  `"context_menu"` widget id to match `context_menu_layout`. Matches
  the naming the GTK backend already uses for its own modal-stack
  entry (#546).
- `mod.rs`: compute `ctx_blocks_event` once per event by hit-testing
  the modal stack against the event's position, and use
  `!ctx_blocks_event` in place of the four `engine.context_menu.is_none()`
  gates — geometric (does this click land inside a floating modal?)
  rather than boolean (is any menu open at all?).
- `tests/context_menu.rs`: regression test pinning the ModalStack
  push/hit_test/pop contract the gate relies on.

Note: empirical testing (tmux + synthetic SGR mouse sequences) surfaced
a real timing gap — the modal-stack push only happens reactively
inside `handle_mouse`, so the very first click after a context menu
opens can still be swallowed by a panel intercept before the stack
catches up (repro + analysis reported separately). Filing as a
follow-up rather than expanding this mechanical migration's scope.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.

Migrate context menu dispatch to ModalStack (platform-neutral)

1 participant