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

fix error caused by orphaned released events. #19

Merged
merged 1 commit into from
Apr 25, 2022

Conversation

Splizard
Copy link
Contributor

@Splizard Splizard commented Apr 21, 2022

I've turned "Emulate Mouse From Touch" off in the Godot settings and for
some reason, Button controls like to steal/consume the initial touch
pressed event and then ignore the released event. What does this result
in?

Well this causes the InputManager to break because it expects every
pressed to have a matching released. Perhaps this assumption/issue needs
to be sorted out but I've made a quick patch that ignores released
events when there is no matching pressed event.

Because of godotengine/godot#24589
Buttons don't really work with touch so in my project, I've added a
custom script. I noticed @Calinou commented on this issue referring to
Godot Touch Input Manager as a possible solution. Should Godot Touch
Input Manager have some sort of GUI Controls integration that fixes
this? or is this a Godot engine issue? something to think about.

I've turned "Emulate Mouse From Touch" off in the Godot settings and for
some reason, Button controls like to steal/consume the initial touch
pressed event and then ignore the released event. What does this result
in?

Well this causes the InputManager to break because it expects every
pressed to have a matching released. Perhaps this assumption/issue needs
to be sorted out but I've made a quick patch that ignores released
events when there is no matching pressed event.

Because of godotengine/godot#24589
Buttons don't really work with touch so in my project, I've added a
custom script. I noticed @Calinou commented on this issue referring to
Godot Touch Input Manager as a possible solution. Should Godot Touch
Input Manager have some sort of GUI Controls integration that fixes
this? or is this an engine issue? something to think about.
@Federico-Ciuffardi
Copy link
Owner

I've turned "Emulate Mouse From Touch" off in the Godot settings and for
some reason, Button controls like to steal/consume the initial touch
pressed event and then ignore the released event.

I guess this has to do with:

  1. InputManager.gd uses _unhandled_input to process touch input so it is possible that the button is consuming the press and thus not be processed by _unhandled_input.

  2. It seemed strange to me that it only happened with the press and not the release but I found this issue that may explain it.

What does this result in?

Well this causes the InputManager to break because it expects every
pressed to have a matching released. Perhaps this assumption/issue needs
to be sorted out but I've made a quick patch that ignores released
events when there is no matching pressed event.

For now, I'll merge this PR and then make some minor changes to the implementation.

I think a better solution though might be to change from _unhandled_input to _input in InputManager.gd. Although this can lead to problems as gesture detection in the GUI may not be desirable and I don't see this being reasonably achievable using _input due to custom input events not being consumed by control nodes. While on the other hand it is farily easy to stop ignoring gestures when using _unhandled_input (see issue #8). It remains to be seen if it is possible to get the control nodes to consume the custom input events for it to be viable to use _input.

Because of godotengine/godot#24589
Buttons don't really work with touch so in my project, I've added a
custom script. I noticed @Calinou commented on this issue referring to
Godot Touch Input Manager as a possible solution. Should Godot Touch
Input Manager have some sort of GUI Controls integration that fixes
this? or is this a Godot engine issue? something to think about.

Maybe @Calinou is talking only about gesture detection. I think godotengine/godot#24589 is mostly a Godot problem, especially regarding native touch events. Regarding the custom events of GDTIM, I don't know if there is a way to make them work correctly with the control nodes, if it exists it would be good to implement it.

@Federico-Ciuffardi Federico-Ciuffardi merged commit 707cfff into Federico-Ciuffardi:master Apr 25, 2022
@Splizard Splizard deleted the fixbuttons branch April 25, 2022 06:26
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.

None yet

2 participants