Repository: godot
Issue: Can't bind controller trigger axis events (L2, R2) as if buttons (4.0 beta)
Labels: discussion,topic:input

### Godot version

4.0 beta (<=17)

### System information

Arch Linux

### Issue description

In godot 3.5, it was possible to bind a trigger (L2 or R2) event to a `InputEventJoypadButton`. (Through what was `button_index` 6 and 7) this allowed for watching for a trigger press via `InputEvent.is_action_pressed("action")` and `InputEvent.is_action_released("action")`

However, in godot 4 beta (<=17), this functionality has been removed, and you can only bind the triggers as `InputEventJoypadMotion` (axis 4 and 5). You may still monitor events through  `InputEvent.is_action_pressed("action")` and `InputEvent.is_action_released("action")`... However, multiple events will be sent, instead of just one like is done with a button or a key without echo events. This seems to be expected behaviour... (other than that i notice `InputEvent.is_action_released("action")` is  true while slowly SQUEEZING the trigger, not when releasing it.. the only thing I can think there is that whether an event is being pressed or released is being defined by the axis strength < 0.5 as opposed to the axis strength being changed relative to what it was last it was checked.)

A workaround to this behaviour is to use `Input.is_action_just_pressed("action")` and `Input.is_action_just_pressed("action")` instead. However, this is not a complete solution. As this cannot be run inside `_input(event: InputEvent)` given that it seems the Input singleton is only updated once per process frame I think? Meaning that if you want to handle trigger inputs, and want to allow rebinding of controller inputs... you cannot use the `_input(event: InputEvent)` function AT ALL, and must watch all of your inputs through the `Input` Singleton inside of `_process()`

As I see it, there are two solutions to this problem:

1. bring back the option to bind (L2 and R2) as `InputEventJoypadButton` using the same rules they followed in 3.5

2. change the behaviour of `InputEventJoypadMotion.is_action_pressed("action")` to check for having just left the defined deadzone and `InputEventJoypadMotion.is_action_released("action")` to check for having just entered the defined deadzone. Though, I am not sure this would be a desirable change for anyone other than myself, as it would limit the use of InputEvent monitoring through `_input(event: InputEvent)` in a different way.

### Steps to reproduce

I have attached two projects, that try to implement the exact same thing. One is in godot 3.5, while the other uses the 4.0 beta.

You can see the behaviour as it was in 3.5, by using L2 (button 6) which is bound as a `InputEventJoypadButton`
In the 4.0 beta version L2 is not bound, as I can't find a way to bind it as an `InputEventJoypadButton`... and as I said above, I suspect that functionality no longer exists. The script tries looking at all button indexes after 15 to see if any of them happen to bind to L2, and none seem to.

In both versions R2 (axis 7 in 3.5, axis 5 in 4.0 beta ) is bound as an `InputEventJoypadAxis`. This allows looking at an example of the workaround I mention above.

In both you can change from reading input through `_input(event: InputEvent)` to `_process()` and back by pressing button 0 (x on a sony controller)

A parity count is kept based on the number of times a button presses or releases for testing purposes, and each project will print the count along with some other information every time the trigger is pressed or released.

### Minimal reproduction project

[triggers_3_5.zip](https://github.com/godotengine/godot/files/10574279/triggers_3_5.zip)
[triggers_4_beta_17.zip](https://github.com/godotengine/godot/files/10574280/triggers_4_beta_17.zip)