debugui: don't let a collapsed window capture clicks on its hidden body - #56
Closed
iamhuman-cheolheelee wants to merge 1 commit into
Closed
iamhuman-cheolheelee wants to merge 1 commit into
iamhuman-cheolheelee wants to merge 1 commit into
Conversation
hoveringRootContainer hit-tested root containers against their full Bounds even when collapsed, so a collapsed window kept winning clicks over the windows underneath it and they could never be brought to front. Use the title-bar-only area for collapsed windows in both hoveringRootContainer and the InputCapturingStateHover check. The latter used the last BodyBounds, which becomes stale when a collapsed window is dragged; derive the title bar from Bounds and titleHeight instead. Closes ebitengine#55 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Member
|
Sorry but I've already fixed this (just a few minutes ago!) |
Author
|
No problem, thanks for the quick fix and for letting me know! |
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.
What issue is this addressing?
Closes #55
What type of issue is this addressing?
bug
What this PR does | solves
Root cause
hoveringRootContainer(container.go:370) hit-tests root containers againstcnt.layout.Boundsregardless ofcnt.collapsed. A collapsed window on top therefore still owns its whole (invisible) body area:endUpdatenever brings the window underneath to front, andpointingOver(widget.go:62) rejects every widget of the lower window because the hovering root is the collapsed one.update()already clipped collapsed windows to the title bar forInputCapturingStateHover(context.go:117), but it usedBodyBounds.Min.Y, which is only refreshed while the window is expanded, so it goes stale once a collapsed window is dragged.Fix
rootContainerHitBounds: for a collapsed window, the hit area isBoundsclipped toBounds.Min.Y + style.titleHeight(the title bar drawn indoWindow). Only windows with a title bar can be collapsed, so this is always the visible area.hoveringRootContainerdelegates to a newrootContainerAt(p)that uses it; the hover check inupdate()uses the same helper, so both paths agree.Invariant: a point is attributed to a root container only if it lies inside the part of that container that is drawn. Expanded windows and non-collapsible windows behave exactly as before. No public API change; cost stays O(number of root containers) per frame with no allocations.
Tests
TestCollapsedWindowDoesNotCoverWindowsBelow(uses the issue's layout) checks, through a test-only export ofrootContainerAt:Before the fix, the test fails on the three "collapsed body / below title bar" cases (got the top window). After:
go vet -vettool=./vettool ./...andgo test -vet=all -race ./...pass on macOS/arm64. I did not add a cursor-driven test because the pointer is read from Ebitengine globals.AI-assisted: I used Claude Code while investigating; I reviewed, ran and verified every change myself.
cc @hajimehoshi @venning