Repository navigation
Ariadne: right-click menus, context_menu: (shell phase SH8) - #1512
Merged
Merged
Conversation
context_menu: on a window, a group, a viewport (any custom widget) and
the document's top level (the main view): a menu's items, as a list or
{ id, items }. The innermost menu under the pointer, or around the
focus, opens. Its items get an `event` dict taken when it opens: what
it is over and that widget's id, the menu's id, how and where, and
over a scene view the pick there plus the node's tags (a list). Their
visible_when: reads it; results that read it are never cached.
- Backend: begin_context_area / end_context_area around what a menu is
over, then begin_context_menu / end_context_menu; Capabilities::
context_menu and the requires: token ui.context_menu.
- ImGui: a popup, opened on a right-click released without a drag (a
right-drag pans a view), a touch long press when the finger lifts,
or the Menu key / Shift+F10 at the pointer; an item's area is a group
whose inner last item is kept for on_click and tooltips.
- FTXUI and tvision: the Menu key or Shift+F10 opens the menu around
the focus, a right-click the one under the pointer; worked like a
dropdown. Shift+F10 decoded from CSI 21;2~ and kbShiftF10.
- cvcGL: a viewport's CustomEdit::context_pick and the main view's
Runtime::set_main_view_pick (SceneViews::main_pick_fields); pick_at's
cell pick factored into pick_props; picks gain `tags`.
- The menu id is parsed and kept for SH9's contributes:; nothing adds
to a menu yet. kAriSchema learns context_menu.
Docs: ARIADNE.md 5.28, the token, the pick's tags. Tests: runtime,
loader, FTXUI, cvcgl_imgui_context_menu, cvcgl_ariadne_pick, the
context_menu golden, and ari_run_context_menu_ftxui / _tvision (tmux).
…ext_menu:) Master's #1476 gave every backend a built-in context menu on text (Cut, Copy, Paste, Select text..., ARIADNE.md 5.28) and 5.29 a picture's Save. SH8's context_menu: now joins that menu instead of running beside it: - One request opens one menu. Over a widget with entries of its own (a field, a text, a picture) those come first, then under a rule the items of the innermost context_menu: around it; over anything else inside one, its items alone; with none around, #1476's menu as is. - ImGui: the document's areas live in #1476's ContextMenus. A menu a text or field opens remembers the innermost area, which appends its items to the same popup; elsewhere the area opens one through the same open()/begin() (its long press, Escape, one claim a frame). - FTXUI: #1476's ctx menu holds the leaf's entries and keeps the area's items as rows after them; one Shift+F10 / Menu path, one right-click path. The duplicate key decoding is gone (master had it). - tvision: Options::host_draws_context_menu; hosted_context_menu() and pick_context_entry() let the bridge show the menu with popupMenu at its place, so a short window no longer cuts it off. That was the failing ari_run_context_menu_tvision: a two-row window drew the menu as an empty frame. - The section is ARIADNE.md 5.30; 5.28 points to it. The closed schema (ari.v1.schema.json, from #1464) learns context_menu on the document, groups, panels, windows, overlays, custom widgets and include sites, and kBuiltinBlocks lists it. - Picks: pick_props takes master's node map (id and node, for a node's own on_pick:); CustomEdit keeps both events and context_pick. The ImGui test for SH8 is cvcgl_imgui_document_menu (master's cvcgl_imgui_context_menu keeps its name); FTXUI gains AFieldInACardOffersItsOwnEntriesThenTheCards and AHostedContextMenuIsAModelForTheHost; the context_menu golden now shows the text's Copy and Select text... above the card's items.
ari_run_context_menu_tvision now opened the menu (tvision's popup) but
Enter picked nothing: TMenuPopup::execute clears the menu's default
entry on purpose ("would look ugly"), so a popup starts with nothing
lit and Enter does nothing until an arrow key. The context menu's popup
is now a ContextPopup, a TMenuPopup that lights the first enabled entry
when a key opened it (HostedContextMenu::by_key), placed as popupMenu
places its own; opened by the pointer it keeps tvision's look.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Phase SH8 of the Ariadne shell design (
docs/roadmap/ARIADNE_SHELL.md§4.7, gap 4): a document's own right-click menus,context_menu:. Documented asdocs/ARIADNE.md§5.30. Master is merged in, including #1476 (§5.28, the built-in context menu on text: Cut, Copy, Paste, Select text...) and §5.29 (a picture's Save). SH8 is now part of that one menu rather than a second system. SH9 (contributes: context_menus:) builds on it.What it adds
context_menu:on a window (and an overlay), a group (and a panel), aviewport(any custom widget; a viewport adds its pick) and the document's top level (the main view). Its items are a menu'sitems:. It is written as a list, or as{ id: <name>, items: [...] }. The loader warns about it anywhere else, and ignores a loaded document's top-level one with a warning (the main view belongs to the outermost document).context_menu:around it follow, under a rule.context_menu:'s items alone.context_menu:around it, the menu is ariadne: a context menu on text in every backend: Cut, Copy, Paste, Select all (§5.28) #1476's, unchanged.context_menu:adds nothing over its widgets.eventis taken when the menu opens and kept while it stays open:on:group,window,main, or a custom widget's type.idandmenu: the widget's id and the menu's id.via:pointer,touchorkey.px/py: where the menu opened.input: pickviewport writes (node,hit,x,y,z,i,j,k,value,axis,view,mods) as strings, plustags, the node's own tags as a list.(get-attr event "node")never throws.visible_when:(and enabled/disabled_when) readevent. A read-lane result that read it is never cached.CustomEdit::context_pick, which picks at the pointer only on the frame the menu opens. The main view's pick comes fromRuntime::set_main_view_pick, which AriRuntime wires toSceneViews::main_pick_fields(it leaves out whatmain_view:hides). A viewport's pick key and itson_pick:event gaintags.idis parsed and kept for SH9. Nothing adds items to a menu yet, and a menu without an id takes items from no one.requires:tokenui.context_menu: ImGui, FTXUI, tvision..arischema (ari.v1.schema.json, Ariadne: a closed .ari schema every load checks, and ari validate #1464) learnscontext_menuon the document, groups, panels, windows, overlays, custom widgets and include sites, andkBuiltinBlockslists it.Backends
ContextMenus.open()/begin(), so it gets ariadne: a context menu on text in every backend: Cut, Copy, Paste, Select all (§5.28) #1476's long press (it opens with the finger down and takes no tap until the finger lifts), Escape, and one claim per frame.on_click:and tooltips behave as before.Options::host_draws_context_menu, the bridge readshosted_context_menu(), shows the menu with tvision'spopupMenuat its place, and returns the choice throughpick_context_entry(). This fixes the failingari_run_context_menu_tvision: the "Cards" window fits its two rows, so the menu drawn inside its body came out as an empty frame. ariadne: a context menu on text in every backend: Cut, Copy, Paste, Select all (§5.28) #1476's text menu gets the same popup on tvision. A menu opened by a key starts with its first entry lit (aTMenuPopupsubclass), so Shift+F10 then Enter picks it; tvision's own popups light nothing until an arrow key, which was the second CI failure.Choices to review
px/py, sincex/y/zare the pick's world point.viewport.Tests
Run locally on Windows/MSVC, built with FTXUI and with tvision (from
.deps/tray-term):ariadne_runtime_test: 368 pass, including 4 for SH8:eventover a group;visible_when:readseventand is not cached across menus;ariadne_loader_test: 272 pass, including 2 for SH8.ariadne_ftxui_test: 126 pass. Six are SH8's, including the field-in-a-card merge and the hosted model a host reads.ariadne_requires_test20 andariadne_schema_test13: all pass.cvcgl_imgui_document_menu(SH8's ImGui test): passes. It covers a text in a card (its Copy, then the card's items), the window's and the main view's menus, a right-drag opening nothing, the long press, and the Menu key.cvcgl_ariadne_pick: 38/38. It coverstagsunder the pick key and real right-clicks on a viewport and on the main view.context_menu: regenerated under Mesa llvmpipe. It shows the text's Copy and Select text... above the card's items, with the scene-node item hidden.cvcgl_imgui_context_menu: its 16 clipboard checks fail in this session because the Windows clipboard itself is refused here (Set-Clipboardfails). Its menu checks pass, and that test reaches none of SH8's code paths. CI's Windows job runs it with a clipboard.ari_run_context_menu_ftxui/_tvision(src/ari/tests/context_menu_test.sh) run only in the Linux CI jobs; this box has no tmux. Before this push,_ftxuipassed in CI and_tvisionfailed as described above.Not in this PR
contributes:(SH9).