Skip to content

Fix clicks firing on hidden and disabled GUI elements - #5398

Open
Flashmyname wants to merge 1 commit into
multitheftauto:masterfrom
Flashmyname:fix/1178-gui-capture-on-hide
Open

Flashmyname wants to merge 1 commit into
multitheftauto:masterfrom
Flashmyname:fix/1178-gui-capture-on-hide

Conversation

@Flashmyname

Copy link
Copy Markdown
Contributor

Summary

System::getTargetWindow returns the capture window unconditionally, skipping the visibility and
enabled tests, and nothing clears the capture when a window stops being eligible for input. A
widget that took the mouse on button-down therefore still fires its click after a script hides or
disables it.

SetVisible and SetEnabled now release the capture when this element or a descendant holds it.
Kept in the wrapper so CEGUI's own internal hides are untouched.

Motivation

Fixes #1178.

Test plan

With the resource attached to the issue: hold LMB on the button, leave the marker so the window
hides, enter the second marker so the cursor returns, press RMB. Before: button clicked is
printed. After: nothing. Same for the disabled path.

Checklist

  • Your code should follow the coding guidelines.
  • Smaller pull requests are easier to review. If your pull request is beefy, your pull request should be reviewable commit-by-commit.

CEGUI routes captured mouse input straight to the capture window, so an
element that took the mouse on button-down still fired its click after a
script had hidden or disabled it. SetVisible and SetEnabled now release
the capture when this element or one of its descendants holds it.

Fixes multitheftauto#1178.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CEGUI buttons trigger even when they are hidden or disabled

1 participant