fix(app): keep pointer events within window bounds - #220
Conversation
f952f05 to
bc42a15
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
kolkov
left a comment
There was a problem hiding this comment.
REQUEST CHANGES (1 lint issue)
Strong work on event handling. The gate logic is correct: handleBridgeMouseMove drops ordinary moves when outside window bounds with no buttons held, but preserves captured drags. Synthetic MouseLeave with leaveDispatched deduplication is well-designed. Focus-loss cancellation via cancelPointerState delivers synthetic releases per button at an outside-widget position.
Coverage is excellent: 137/137 changed statements (100%), ~65% of added lines are tests. The TestWindow_FocusLossCancelsSliderDrag end-to-end test against real slider.New is particularly good.
Lint failure (blocking):
app/window.go:417--HandleEventcyclomatic complexity = 22 (threshold 20). Extract the early button-ownership tracking block into a private helper method (e.g.,trackButtonOwnershiporupdateMouseButtonState).
After the gocyclo fix, this is ready to merge.
ce90c2c to
3b9dbf9
Compare
kolkov
left a comment
There was a problem hiding this comment.
Lint fix confirmed — HandleEvent complexity resolved by extracting pointInWindow and handleBridgeMouseMove helpers. CI 9/9 pass. APPROVE.
Summary
Why
Pointer events can arrive after the cursor leaves a native window. Passing ordinary moves and wheel events through caused stale hover/selection/scroll behavior, while simply dropping every outside event would break legitimate captured drags. The bridge now distinguishes those cases at the shared boundary and cleans up incomplete pointer sequences when focus is lost.
Verification
go test ./... -count=1CGO_ENABLED=0 go build ./...go build ./...go vet ./app/... ./event/... ./core/listview/...gofmtandgit diff --checkA pre-existing test-only race in
TestWindow_AnimPumper_StartsOnInvalidationstill prevents a clean fullgo test -race ./...; the changed focused packages expose no new race.Fixes #179
Local CI and Codecov preflight
main(273cc1e)go test ./... -count=1: passTestWindow_AnimPumper_StartsOnInvalidationmock race noted abovego build ./...,go vet ./...,gofmt, and diff checks: passapp/event_bridge.go92/92,app/window.go31/31,core/listview/event.go14/14); overall coverage 86.4%Upstream CI run approval is still external to this branch: GitHub marked the fork workflow
action_requiredwith zero jobs. Agogpumaintainer must approve the workflow before Actions and the configured Codecov upload/bot can run.Review follow-up (2026-08-12)
Extracted mouse-button ownership tracking into the private
trackMouseButtonOwnershiphelper, reducingHandleEventbelow the configured cyclomatic-complexity limit without changing event ordering.