Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Formspec: Don't start a button click when the pointer isn't on top #9332

Merged
merged 1 commit into from Jan 22, 2020
Merged

Formspec: Don't start a button click when the pointer isn't on top #9332

merged 1 commit into from Jan 22, 2020

Conversation

ghost
Copy link

@ghost ghost commented Jan 21, 2020

Partially resolves #9330 by preventing buttons from entering pressed state from a click event if the mouse is somewhere else. The GUIButton code already checks if the mouse is over it on release, so I've simply added a second check on press.

Limitations

As mentioned above, this fix is only for buttons. I expect that any formspec element receiving mouse clicks can be affected by this (I can confirm that this affects dropdown elements as well, which appear to be a builtin Irrlicht gui element), and honestly the ideal would be to fix the issue at the source... However, I get the impression that this might be an Irrlicht bug so workarounds might be the best we can do.

Testing

To test, just open a formspec and click any button once to make it active. After that, click outside of the formspec window and remark that it doesn't get pressed. I've taken the liberty of testing how this interacts with buttons clipping with the window, this works on my end but you should probably test it as well.

Copy link
Member

@SmallJoker SmallJoker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@nerzhul
Copy link
Member

nerzhul commented Jan 22, 2020

i understand that point, i don't want to clic on button if i release outside of button :) approved

@nerzhul nerzhul merged commit 3dfb6ec into minetest:master Jan 22, 2020
MoNTE48 pushed a commit to MoNTE48/minetest that referenced this pull request Feb 19, 2020
aldum pushed a commit to banyamesterseg/minetest that referenced this pull request Apr 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Formspec elements can be pressed without clicking on them.
3 participants