Skip to content

GTK action menu opens at button row, not below it (engine-drawn migration regression) #434

Description

@JDonaghy

Problem

After #395/PR #427 migrated the editor tab bar action menu from native gtk4::PopoverMenu to the engine-drawn quadraui ContextMenu path, the menu opens at the row of the button, overlapping the tab bar, instead of sitting below the button.

Root cause

src/gtk/click.rs:324-329:

ClickTarget::ActionMenuButton(group_id) => {
    let col = (x / char_width.max(1.0)) as u16;
    let row = (y / line_height.max(1.0)) as u16;
    engine.open_editor_action_menu(group_id, col, row);
    ...
}

The (col, row) derived here is the click point itself — i.e. the cell at which the user clicked the button. This becomes screen_x / screen_y on ContextMenuState, then cm.screen_col * char_width / cm.screen_row * line_height as the anchor pixel coords in src/gtk/draw.rs:1955-1956.

src/render.rs::context_menu_panel_to_quadraui_context_menu doesn't set placement, so quadraui defaults to ContextMenuPlacement::AnchorPoint, which puts the menu's top-left at the anchor. Result: menu top-left == click position, so the menu starts at the button row and extends downward, overlapping the tab bar's first row.

Native popover behavior (pre-#395)

The native gtk4::PopoverMenu knew the trigger widget's bounds and auto-positioned itself just below the button. Migration lost that.

Fix options

  1. (Preferred) Use ContextMenuPlacement::Below with the button's bounds. Engine-side change:

    • Extend open_editor_action_menu(group_id, x, y, height) (or similar) so the engine knows the trigger's height.
    • Adapter context_menu_panel_to_quadraui_context_menu sets placement = Below and calls layout_at(Rect::new(anchor_x, anchor_y, anchor_w, anchor_h), ...) in draw.rs.
    • Quadraui auto-flips to Above if there's no room below.
    • Platform-neutral; works for any future "menu-from-button" surface.
  2. Quick hack: advance y by one cell in click.rs (let row = (y / line_height) as u16 + 1). 3-line GTK-only change but doesn't generalise.

Related

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

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions