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
-
(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.
-
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
Problem
After #395/PR #427 migrated the editor tab bar
…action menu from nativegtk4::PopoverMenuto the engine-drawn quadrauiContextMenupath, 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:The
(col, row)derived here is the click point itself — i.e. the cell at which the user clicked the…button. This becomesscreen_x/screen_yonContextMenuState, thencm.screen_col * char_width/cm.screen_row * line_heightas the anchor pixel coords insrc/gtk/draw.rs:1955-1956.src/render.rs::context_menu_panel_to_quadraui_context_menudoesn't setplacement, so quadraui defaults toContextMenuPlacement::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::PopoverMenuknew the trigger widget's bounds and auto-positioned itself just below the button. Migration lost that.Fix options
(Preferred) Use
ContextMenuPlacement::Belowwith the button's bounds. Engine-side change:open_editor_action_menu(group_id, x, y, height)(or similar) so the engine knows the trigger's height.context_menu_panel_to_quadraui_context_menusetsplacement = Belowand callslayout_at(Rect::new(anchor_x, anchor_y, anchor_w, anchor_h), ...)in draw.rs.Quick hack: advance
yby one cell inclick.rs(let row = (y / line_height) as u16 + 1). 3-line GTK-only change but doesn't generalise.Related