Skip to content

InputEventAction remains pressed #95680

@viraelin

Description

@viraelin

Tested versions

  • Reproducible in v4.3.stable.official [77dcf97], not in v4.2.2.stable.official [15073af]

System information

Godot v4.3.stable - Arch Linux

Issue description

InputEventAction with pressed set to true when sent through Input.parse_input_event() continues emitting as pressed until that event_index real key/button is released (or pressed then released if it was not pressed) or until window focus is lost.

This was not the case in 4.2.2, is it intended for action to remain pressed when sending fake InputEventAction?

If it is intentional, is sending another event such as the code below then the intended solution? By the documentation for InputEventAction.event_index, it reads as if it is not:

"The real event index in action this event corresponds to (from events defined for this action in the InputMap). If -1, a unique ID will be used and actions pressed with this ID will need to be released with another InputEventAction."

if event.is_action_pressed(&"ui_up"):
	var ev: = InputEventAction.new()
	ev.action = &"ui_down"
	ev.pressed = true
	ev.event_index = 0
	Input.parse_input_event(ev)
	var ev2: = InputEventAction.new()
	ev2.action = &"ui_down"
	ev2.pressed = false
	ev2.event_index = 0
	Input.parse_input_event(ev2)

Steps to reproduce

  1. download MRP/open project/run project, for 4.3
  2. press and release ui_up key (up arrow)
  3. one InputEventAction should be printed to console as well as continuous stream of true until focus is lost or ui_down is pressed and released

If testing in 4.2.2, the ev.event_index = 0 line will need to be commented.

Minimal reproduction project (MRP)

43_input_event_action.zip

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions