Fix clicks firing on hidden and disabled GUI elements - #5398
Open
Flashmyname wants to merge 1 commit into
Open
Flashmyname wants to merge 1 commit into
Flashmyname wants to merge 1 commit into
Conversation
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.
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.
Summary
System::getTargetWindowreturns the capture window unconditionally, skipping the visibility andenabled 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.
SetVisibleandSetEnablednow 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 clickedisprinted. After: nothing. Same for the disabled path.
Checklist