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

LMB in ui_accept no longer working with OptionButton #64578

Closed
esap120 opened this issue Aug 18, 2022 · 7 comments · Fixed by #64635 or #64636
Closed

LMB in ui_accept no longer working with OptionButton #64578

esap120 opened this issue Aug 18, 2022 · 7 comments · Fixed by #64635 or #64636

Comments

@esap120
Copy link

esap120 commented Aug 18, 2022

Godot version

3.5 stable

System information

Windows 10, GLES3

Issue description

Possible regression where having left mouse button under the "ui_accept" input action breaks the OptionButton since the popup menu no longer displays. It works fine in 3.4.5 but in 3.5 it now seems to swallow the mouse input. If I remove LMB from ui_accept it works again.

This could be happening with other controls, but this is the one I have noticed. Clicking still focuses the button but the popup does not appear.

Setting Input.set_use_accumulated_input(false) does not change the result, LMB will still not work

Steps to reproduce

Create a scene with an OptionButton and add Left Mouse Button to "ui_accept" under InputMap in project settings. Try to mouse click on OptionButton to get an popup menu to appear

Minimal reproduction project

test_project.zip

@Calinou
Copy link
Member

Calinou commented Aug 18, 2022

@esap120 Can you reproduce this in any of the 3.5 betas and RCs to determine when the regression started?

@esap120
Copy link
Author

esap120 commented Aug 18, 2022

@Calinou looks like since RC 1 after trying them out. Could be related to the PRs that made improvements to the OptionButton:

#61102
#61185

I'll see if I can build from source to confirm though

This issue may also be relevant: #64176

@esap120
Copy link
Author

esap120 commented Aug 19, 2022

I was able to build from source and after trying out a bunch of builds it looks like this is the PR that caused the regression: #57643 specifically this section of code: https://github.com/godotengine/godot/pull/57643/files#diff-f53516902cc0ae0bcdff8847d815c5644836b1fc138517b47b6cb5f0b807ae38R114-R119

I think the assumption that lines like Input::get_singleton()->is_action_just_pressed("ui_accept") mean that no mouse was pressed is a bit faulty. Nothing stops a user from adding mouse presses to "ui_accept" in the InputMap

@Calinou
Copy link
Member

Calinou commented Aug 19, 2022

cc @YeldhamDev

@YeldhamDev YeldhamDev added this to the 4.0 milestone Aug 19, 2022
@YeldhamDev YeldhamDev self-assigned this Aug 19, 2022
@esap120
Copy link
Author

esap120 commented Aug 19, 2022

@YeldhamDev I don't write much c++ or do any godot engine development but would something like this make sense?: 3.x...esap120:godot:mouse-button-fix

Basically just inspecting if the ui_accept action is an InputEventMouseButton in _gui_input.

Testing the change locally that seemed to fix the issue

Also I might need to update my sample project, I noticed when testing with the visual studio debugger and running the test scene directly it would use the default InputMap actions and not the ones defined in the project. I added a script to the scene that manually adds the lmb press and that made it easier to test:

func _ready() -> void:
	var left_click: InputEventMouseButton = InputEventMouseButton.new()
	left_click.factor = 1
	left_click.button_index = 1
	left_click.button_mask = 0
	InputMap.action_add_event("ui_accept", left_click)

@YeldhamDev
Copy link
Member

@esap120 I'm already planning a fix that should hopefully be less hacky than that. I just need a little more time.

@akien-mga
Copy link
Member

Fixed by #64636.

@akien-mga akien-mga modified the milestones: 4.0, 3.6 Aug 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment