feat(ui): input-event trio — mouse modifiers, canvas drag capture, wheel seam (#567 #568 #569)#582
Merged
Merged
Conversation
…eel seam (#567 #568 #569) First-consumer findings from the DeslanStudio arrangement timeline. #568 (foundation): gfx_poll now attaches shift/ctrl/alt (0/1) to mousemove/mousedown/mouseup/wheel events via SDL_GetModState (optional symbol, defaults 0), mirroring the key-event fields. Additive dict fields only. #567: dispatch's drag-in-progress path is registry-driven instead of a hardcoded type list — the seven built-in draggable types register on_drag(w, ev) handlers, and a custom widget that claimed the pointer (new claim_drag/release_drag API) receives drag mousemoves and the terminating mouseup through its own on_mouse(w, ev). Hover mousemoves are also delivered to on_mouse. The sharp edge is fixed: a claimant outside the old type list no longer throws type_mismatch in the slider updater; a handler-less claimant is a silent no-op. #569: a widget under the cursor exposing on_wheel(w, ev) consumes wheel input before the scroll_panel walk. Also fixes the scroll_panel _ax/_ay staleness: _layout now subtracts the scroll offset when caching child absolute positions, matching render and hit-test. Tests: UI suite [63] 81 -> 115 checks (canvas gesture capture, modifier passthrough, per-type drag back-compat for all seven draggable types, wheel consume + fallback, scroll-offset cache). New demo examples/ui_canvas_events.eigs exercises all three seams. Docs: BUILTINS.md gfx_poll row, STDLIB.md UI seams paragraph, lib headers. Closes #567 Closes #568 Closes #569 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.
First-consumer findings from the DeslanStudio milestone-4c arrangement timeline (#561–#566 series continuation).
#568 — mouse events carry modifier state (foundation)
gfx_poll(src/ext_gfx.c) now attachesshift/ctrl/alt(0/1) to mousemove, mousedown, mouseup, and wheel events viaSDL_GetModState()(loaded as an optional symbol; missing symbol reads as no modifiers), mirroring exactly what key events already exposed fromkeysym.mod. The mask encoding is shared in onepoll_set_modshelper. Additive dict fields only — no signature changes; headless tests that synthesize event dicts are unaffected (absent keys read null).#567 — canvas drag/mousemove seam
ui.dispatch's drag-in-progress path is now registry-driven instead of the hardcoded slider-family type chain:on_drag(w, ev)handler in its own widget file; dispatch just consults the registry.claim_drag of w/release_drag of null: a mousedown handler (e.g. a canvason_mouse) claims the pointer, and the widget then receives every drag mousemove and the terminating mouseup through itson_mouse(w, ev)callback — press-move-release gestures complete on a canvas.on_mouse, with the full event dict (modifiers included). Branch onev.type._update_drag'stype_mismatch; a claimant with no handler at all is a silent no-op.#569 — wheel seam + scroll_panel
_axstalenesson_wheel(w, ev)consumes wheel input before the_find_scrollable_atwalk (ev.x/ev.yare the scroll deltas; gfx/lib/ui: mouse events carry no modifier state — shift/ctrl-click semantics impossible #568 modifiers ride along for ctrl+wheel zoom / shift+wheel horizontal). Unconsumed wheel input falls through to the scroll_panel path unchanged._axstaleness note reproduced:_layoutcached scroll_panel children's_ax/_aywithout the scroll offset while render and hit-test subtract it._layoutnow subtractsscroll_x/scroll_y, so a canvas inside a scrolled panel keeps correct mouse math (cache refreshes each frame's layout pass, as before).Back-compat
ui_demo,deslan_shell,debuggerexamples) now also receive hover mousemoves inon_mouse; the debugger already branches onev.type, the other two just update status text. No consumer breaks.dispatchstill accepts modifier-less synthesized events.on_wheelis unchanged.Tests / demo / docs
dispatch), wheel consume + fallback + modifier pairing, scroll-offset_ax/_aycache.examples/ui_canvas_events.eigs: timeline-style canvas with clip drag-move, rubber-band select, ctrl+click selection toggle, wheel pan, ctrl+wheel zoom-at-cursor — all three seams in ~200 lines.gfx_pollrow, STDLIB.md UI-toolkit seams paragraph, lib/ui.eigs header, canvas constructor doc, CHANGELOG.Gates
make testrelease: 2837/2837make asan+ASAN_OPTIONS=detect_leaks=1full suite: 2841/2841, leak tally 0make jit-smoke: passmake gfx: builds clean (and the full suite passes against the gfx binary)make freestanding-check: pass (gfx not in the freestanding surface)Closes #567
Closes #568
Closes #569
🤖 Generated with Claude Code