Bug 134324

Summary: Add HID-based gamepad implementation for Mac
Product: WebKit Reporter: Brady Eidson <beidson>
Component: WebCore Misc.Assignee: Brady Eidson <beidson>
Status: RESOLVED FIXED    
Severity: Normal CC: bunhere, cdumez, commit-queue, dino, gyuyoung.kim, rniwa, sergio, syoichi
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: All   
OS: All   
Bug Depends on:    
Bug Blocks: 134076    
Attachments:
Description Flags
Patch v1
dino: review+
Patch for landing v1
beidson: commit-queue+
Patch for landing v2 - Fix *one* style complaint, remove stale #include that will fix the build none

Description Brady Eidson 2014-06-25 19:23:31 PDT
Add HID-based gamepad implementation for Mac

This also hooks up the platform abstractions to the actual Gamepad mechanisms.

This gets the gamepad API working in WK1, and the pieces for WK2 support are also there for later use.
Comment 1 Brady Eidson 2014-06-25 19:54:13 PDT
Created attachment 233867 [details]
Patch v1

I don't expect this to pass EWS yet because it relies on the patch in bug 134325 landing first.

But it's ready for review.
Comment 2 Dean Jackson 2014-06-25 20:07:49 PDT
Comment on attachment 233867 [details]
Patch v1

View in context: https://bugs.webkit.org/attachment.cgi?id=233867&action=review

> Source/WebCore/Modules/gamepad/Gamepad.cpp:45
> +    for (unsigned i = 0; i < platformGamepad.buttonValues().size(); ++i)
> +        m_buttons.append(GamepadButton::create());

Can this be a C++11 for loop?

> Source/WebCore/Modules/gamepad/GamepadManager.cpp:71
> +    // connectect/disconnected event listeners.

Nit: typo connected

> Source/WebCore/Modules/gamepad/GamepadManager.cpp:83
> +    // connectect/disconnected event listeners.

Ditto
Comment 3 Brady Eidson 2014-06-25 20:09:42 PDT
(In reply to comment #2)
> (From update of attachment 233867 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=233867&action=review
> 
> > Source/WebCore/Modules/gamepad/Gamepad.cpp:45
> > +    for (unsigned i = 0; i < platformGamepad.buttonValues().size(); ++i)
> > +        m_buttons.append(GamepadButton::create());
> 
> Can this be a C++11 for loop?

Yes.

> 
> > Source/WebCore/Modules/gamepad/GamepadManager.cpp:71
> > +    // connectect/disconnected event listeners.
> 
> Nit: typo connected
> 
> > Source/WebCore/Modules/gamepad/GamepadManager.cpp:83
> > +    // connectect/disconnected event listeners.
> 
> Ditto

Got it.

Thanks!
Comment 4 Brady Eidson 2014-06-25 21:02:00 PDT
Created attachment 233875 [details]
Patch for landing v1
Comment 5 WebKit Commit Bot 2014-06-25 21:04:22 PDT
Attachment 233875 [details] did not pass style-queue:


ERROR: Source/WebCore/Modules/gamepad/Gamepad.h:60:  The parameter name "platformGamepad" adds no information, so it should be removed.  [readability/parameter_name] [5]
ERROR: Source/WebCore/platform/mac/HIDGamepad.cpp:64:  Use 0 instead of NULL.  [readability/null] [5]
Total errors found: 2 in 20 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 6 Brady Eidson 2014-06-25 21:17:49 PDT
Created attachment 233878 [details]
Patch for landing v2 - Fix *one* style complaint, remove stale #include that will fix the build
Comment 7 WebKit Commit Bot 2014-06-25 21:19:13 PDT
Attachment 233878 [details] did not pass style-queue:


ERROR: Source/WebCore/platform/mac/HIDGamepad.cpp:64:  Use 0 instead of NULL.  [readability/null] [5]
Total errors found: 1 in 20 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 8 WebKit Commit Bot 2014-06-25 21:49:58 PDT
Comment on attachment 233878 [details]
Patch for landing v2 - Fix *one* style complaint, remove stale #include that will fix the build

Clearing flags on attachment: 233878

Committed r170465: <http://trac.webkit.org/changeset/170465>
Comment 9 WebKit Commit Bot 2014-06-25 21:50:03 PDT
All reviewed patches have been landed.  Closing bug.
Comment 10 Ryosuke Niwa 2014-06-25 22:31:33 PDT
Build fix attempt landed in http://trac.webkit.org/changeset/170468.