Skip to content

Fix gamepad connect/disconnect event listener on HTML5#2062

Open
Digivorix wants to merge 1 commit into
openfl:developfrom
Digivorix:html5-gamepad-event-fix
Open

Fix gamepad connect/disconnect event listener on HTML5#2062
Digivorix wants to merge 1 commit into
openfl:developfrom
Digivorix:html5-gamepad-event-fix

Conversation

@Digivorix
Copy link
Copy Markdown

The gamepadconnected and gamepaddisconnected event listeners on HTML5 need to be added using Browser.window.addEventListener instead of element.addEventListener in order to work properly.

Connected joysticks were still recognized, but it appears the event handler function in HTML5Window.hx (handleGamepadEvent) wasn't receiving any connect or disconnect events. As a consequence, the disconnect event for a connected gamepad would never fire.

Both the issue and the fix were tested in Firefox 150 and Microsoft Edge 148 on Windows 10 with a wireless Xbox 360 Controller connected via the official Wireless Receiver.

The event listeners need to be added to Browser.window in order to work properly.
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.

1 participant