finalize and enable Gamepad API

VERIFIED FIXED in Firefox 29

Status

()

Core
DOM: Events
VERIFIED FIXED
4 years ago
3 years ago

People

(Reporter: vlad, Assigned: ted)

Tracking

(Blocks: 2 bugs, {dev-doc-complete, feature})

unspecified
mozilla28
dev-doc-complete, feature
Points:
---
Dependency tree / graph

Firefox Tracking Flags

(firefox28 disabled, firefox29 fixed, relnote-firefox 29+)

Details

(Whiteboard: [games:p1])

Attachments

(1 attachment)

We need to finalize the Gamepad API and get it enabled everywhere.  We're close, but there's a mess currently.
(Assignee)

Comment 1

4 years ago
I have a bunch of outstanding patches and spec work I need to finish up. In no particular order, here are the ones I can remember off the top of my head:

Patches:
bug 851547 - make Gamepad API preffable. Waiting on a patch from smaug so that it can make the event types not visible to content
bug 860413 - allow setting standard mapping
bug 860409 - Allow passing both an analog and digital value for buttons
bug 690937 - XInput backend for Windows
(unfiled)  - hook up gamepad mappings from a static list

Spec work:
* Figure out how to expose analog+digital buttons
* Figure out how to expose button names
* Spec buttonpress/release events
* https://www.w3.org/Bugs/Public/show_bug.cgi?id=21434 - Spec liveness of Gamepad objects
* Might want to change spec to use navigator.gamepads.get() instead of navigator.getGamepads()

Updated

4 years ago
Duplicate of this bug: 878903

Comment 3

4 years ago
(In reply to Ted Mielczarek [:ted.mielczarek] from comment #1)
> bug 851547 - make Gamepad API preffable. Waiting on a patch from smaug so
> that it can make the event types not visible to content
My patch to let generated events to use webidl is still waiting for review.
(Assignee)

Comment 4

4 years ago
bug 690935 is navigator.getGamepads().
(Assignee)

Comment 5

4 years ago
I buckled down and got a bunch of those landed. We can ship it preffed off in 24 now, which is an improvement (since people can actually test it in release builds).

I'd still like to get XInput landed, and there's another bug (maybe not filed) about how we don't currently notice DirectInput devices being connected or disconnected on Windows that we really ought to fix.

I would like to get a few of those spec issues nailed down before we commit to shipping it preffed on.

Comment 6

4 years ago
Is this still shipping prefed off in 24?
(Assignee)

Comment 7

4 years ago
Yes, it's behind the dom.gamepad.enabled pref.
Blocks: 710398

Comment 8

4 years ago
Shouldnt this be added to the release notes? Aurora release notes does not currently display this:
http://www.mozilla.org/en-US/firefox/24.0a2/auroranotes/
(Assignee)

Comment 9

4 years ago
It's behind a pref at the moment, but we could relnote it.
Blocks: 901284
(Assignee)

Updated

4 years ago
Depends on: 921565
Blocks: 802882

Comment 10

4 years ago
(In reply to Ted Mielczarek [:ted.mielczarek] from comment #1)
> bug 690937 - XInput backend for Windows
> (unfiled)  - hook up gamepad mappings from a static list

These are not in the dependancy list (others as well, but they're fixed now). Can somebody add them, please (and file the missing bug)?

Also, are there still changes expected for the API (i.e. how stable is the API)? I'm asking because of Bug 802882 and I may file a bug for HTML5Test.com to exclude the API from the current (upcoming) set of tests (at least exclude it from counting towards the total score).
(Assignee)

Comment 11

4 years ago
The two open blockers are the only things we need to fix to ship this. Anything else is just gravy.
Depends on: 926091
(Assignee)

Updated

4 years ago
Depends on: 936104
(Assignee)

Comment 12

4 years ago
I landed a patch for 936104, so I think I'd be pretty comfortable with enabling the Gamepad API by default in Firefox 28.
(Assignee)

Comment 13

4 years ago
(In reply to Florian Bender from comment #10)
> Also, are there still changes expected for the API (i.e. how stable is the
> API)? I'm asking because of Bug 802882 and I may file a bug for
> HTML5Test.com to exclude the API from the current (upcoming) set of tests
> (at least exclude it from counting towards the total score).

bug 926091 was the last breaking change I intend to make to the spec, it changed Gamepad.buttons[] to be an array of GamepadButton instead of just double. Any future spec changes should be backwards-compatible.
(Assignee)

Comment 14

4 years ago
Created attachment 8343701 [details] [diff] [review]
Enable Gamepad API by default

Here's the simple patch that enables the Gamepad API by default.
(Assignee)

Updated

4 years ago
Assignee: nobody → ted
Status: NEW → ASSIGNED
(Assignee)

Comment 15

4 years ago
I posted an intent to ship message to dev.platform:
https://groups.google.com/forum/#!topic/mozilla.dev.platform/JjuTCr2VYUA
(Assignee)

Comment 16

4 years ago
Comment on attachment 8343701 [details] [diff] [review]
Enable Gamepad API by default

smaug suggested that this might want a superreview? I'm not sure what the current policy is.
Attachment #8343701 - Flags: review?(bugs)
Keywords: dev-doc-needed

Comment 17

4 years ago
Alright, thanks for the info!
relnote-firefox: --- → ?
Keywords: feature
Comment on attachment 8343701 [details] [diff] [review]
Enable Gamepad API by default

I was thinking this kind of sr :)

As far as I know, we could enable the API.
Attachment #8343701 - Flags: superreview+
Attachment #8343701 - Flags: review?(bugs)
Attachment #8343701 - Flags: review+
(Assignee)

Comment 19

4 years ago
https://hg.mozilla.org/integration/mozilla-inbound/rev/3bc9cffda68a
https://hg.mozilla.org/mozilla-central/rev/3bc9cffda68a
Status: ASSIGNED → RESOLVED
Last Resolved: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla28
We already have this:

https://developer.mozilla.org/en-US/docs/API/Gamepad/Using_Gamepad_API

Not sure how up to date it is.
(Assignee)

Comment 22

4 years ago
It's a bit out of date, but it could be fixed to be useful. The events are now just "gamepadconnected" and "gamepaddisconnected". The button/axis events are not currently in the spec. The Gamepad object has a few more properties, and the buttons property is slightly different. The whole "DOM implementation" section is no longer accurate (and of questionable utility anyway).

You can refer to the latest editor's draft of the spec for more:
https://dvcs.w3.org/hg/gamepad/raw-file/default/gamepad.html
(Assignee)

Comment 23

4 years ago
I also have a draft Hacks article that's 95% complete that we should be publishing this week.
Thanks for the info Ted; I'll start working on the guide update and API reference pages for this straight away.

For testing purposes, I've found out my old PS2 controller, and now I'm guessing I just need to buy a PS2 -> USB adaptor. None of them mention Mac support - will they 'just work' on Mac? Are some of them better than others?

(In reply to Ted Mielczarek [:ted.mielczarek] from comment #22)
> It's a bit out of date, but it could be fixed to be useful. The events are
> now just "gamepadconnected" and "gamepaddisconnected". The button/axis
> events are not currently in the spec. The Gamepad object has a few more
> properties, and the buttons property is slightly different. The whole "DOM
> implementation" section is no longer accurate (and of questionable utility
> anyway).
> 
> You can refer to the latest editor's draft of the spec for more:
> https://dvcs.w3.org/hg/gamepad/raw-file/default/gamepad.html
(Assignee)

Comment 25

4 years ago
Almost any USB controller will "just work" on Mac, Windows or Linux. The biggest current exception is the PS3 DualShock 3 controller, which doesn't have a driver for Windows, and may not work out of the box on Mac. Wired Xbox 360 controllers work fine everywhere, wireless ones need an adapter (that you can still buy but isn't manufactured anymore, AFAIK). Any dirt-cheap USB gamepad you can buy anywhere has a high probability of working fine.
I have updated the Gamepad API guide to be more up to date:

https://developer.mozilla.org/en-US/docs/Web/Guide/API/Gamepad

Quite a bit of it is stolen out of your MDN article, because the examples there are very concise and nicely written ;-) My PS2 controller was giving some funny results, but I think it might be slightly dodgy; I have ordered a new Wired XBox 360 controller so I can do a comparison and check what's going on.

Let me know if these is anything obviously wrong. I'll be adding some more examples soon.

Next step will be to create a proper API reference. I'll keep going.
Draft landing page for the whole API:

https://developer.mozilla.org/en-US/docs/Gamepad

Updated

3 years ago
Depends on: 963053

Comment 28

3 years ago
Tested Gamepad feature for pre-beta sign off on latest Aurora (Build ID: 20140122004004) on: Windows 7 64bit, Windows XP 64bit, Mac OSX 10.9 and Ubuntu 13.10 32bit.
Status: RESOLVED → VERIFIED
QA Contact: alexandra.lucinet
relnote-firefox: ? → 28+

Updated

3 years ago
Depends on: 980876
Updating status flags as per:
http://hg.mozilla.org/releases/mozilla-release/file/c6c843644fbf
status-firefox28: --- → disabled
status-firefox29: --- → fixed
(In reply to Anthony Hughes, QA Mentor (:ashughes) from comment #29)
> Updating status flags as per:
> http://hg.mozilla.org/releases/mozilla-release/file/c6c843644fbf

Not sure whether relnote should be changed in kind.
Flags: needinfo?(lsblakk)
Gamepad API reference docs need a technical review:

https://developer.mozilla.org/en-US/docs/Gamepad

Could someone check these out for me? thanks in advance ;-)

Comment 32

3 years ago
Mozilla/5.0 (Windows NT 6.1; WOW64; rv:28.0) Gecko/20100101 Firefox/28.0
Mozilla/5.0 (X11; Linux x86_64; rv:28.0) Gecko/20100101 Firefox/28.0
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:28.0) Gecko/20100101 Firefox/28.0

Gamepad API is properly disabled on Firefox 28 RC (Build ID: 20140310174439): dom.gamepad.enabled is set to false by default.
We're going to remove the Gamepad API note as it has been disabled, so this will go back to FF29
relnote-firefox: 28+ → 29+
Flags: needinfo?(lsblakk)
Depends on: 985967
Keywords: dev-doc-needed → dev-doc-complete
You need to log in before you can comment on or make changes to this bug.