Skip to content

feat(ui): input-event trio — mouse modifiers, canvas drag capture, wheel seam (#567 #568 #569)#582

Merged
InauguralPhysicist merged 1 commit into
mainfrom
ui-input-event-trio
Jul 13, 2026
Merged

feat(ui): input-event trio — mouse modifiers, canvas drag capture, wheel seam (#567 #568 #569)#582
InauguralPhysicist merged 1 commit into
mainfrom
ui-input-event-trio

Conversation

@InauguralPhysicist

Copy link
Copy Markdown
Collaborator

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 attaches shift/ctrl/alt (0/1) to mousemove, mousedown, mouseup, and wheel events via SDL_GetModState() (loaded as an optional symbol; missing symbol reads as no modifiers), mirroring exactly what key events already exposed from keysym.mod. The mask encoding is shared in one poll_set_mods helper. 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:

  • Each built-in draggable type (slider, vslider, knob, scrollbar, waveform_view, splitter, color_picker) registers an on_drag(w, ev) handler in its own widget file; dispatch just consults the registry.
  • New public API claim_drag of w / release_drag of null: a mousedown handler (e.g. a canvas on_mouse) claims the pointer, and the widget then receives every drag mousemove and the terminating mouseup through its on_mouse(w, ev) callback — press-move-release gestures complete on a canvas.
  • Hover mousemoves (no capture) are also delivered to any widget exposing on_mouse, with the full event dict (modifiers included). Branch on ev.type.
  • The sharp edge is fixed explicitly: a claimant outside the old type list no longer falls into _update_drag's type_mismatch; a claimant with no handler at all is a silent no-op.

#569 — wheel seam + scroll_panel _ax staleness

  • A widget under the cursor exposing on_wheel(w, ev) consumes wheel input before the _find_scrollable_at walk (ev.x/ev.y are 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.
  • The _ax staleness note reproduced: _layout cached scroll_panel children's _ax/_ay without the scroll offset while render and hit-test subtract it. _layout now subtracts scroll_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

  • All seven built-in draggable types keep byte-identical drag math (handlers moved, not changed) — covered by new dispatch-level regression tests for each.
  • Existing canvas consumers (ui_demo, deslan_shell, debugger examples) now also receive hover mousemoves in on_mouse; the debugger already branches on ev.type, the other two just update status text. No consumer breaks.
  • Event dicts gained fields only; dispatch still accepts modifier-less synthesized events.
  • Wheel behavior without on_wheel is unchanged.

Tests / demo / docs

  • UI suite [63] extended 81 → 115 checks: canvas hover + full gesture capture (the lib/ui: canvas on_mouse never receives mousemove — no drag interactions possible on a custom-painted widget #567 repro), modifier passthrough, the handler-less-claimant sharp edge, per-type drag back-compat (all seven types via dispatch), wheel consume + fallback + modifier pairing, scroll-offset _ax/_ay cache.
  • New minimal demo 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.
  • Docs: BUILTINS.md gfx_poll row, STDLIB.md UI-toolkit seams paragraph, lib/ui.eigs header, canvas constructor doc, CHANGELOG.

Gates

  • make test release: 2837/2837
  • make asan + ASAN_OPTIONS=detect_leaks=1 full suite: 2841/2841, leak tally 0
  • make jit-smoke: pass
  • make 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

…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>
@InauguralPhysicist InauguralPhysicist merged commit 2eabce9 into main Jul 13, 2026
17 checks passed
@InauguralPhysicist InauguralPhysicist deleted the ui-input-event-trio branch July 13, 2026 00:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant