| Summary: | Cleanup GameController framework button binding with some constants | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| Product: | WebKit | Reporter: | Brady Eidson <beidson> | ||||||||
| Component: | WebCore Misc. | Assignee: | Brady Eidson <beidson> | ||||||||
| Status: | RESOLVED FIXED | ||||||||||
| Severity: | Normal | CC: | darin, thorton, webkit-bug-importer | ||||||||
| Priority: | P2 | Keywords: | InRadar | ||||||||
| Version: | WebKit Nightly Build | ||||||||||
| Hardware: | Unspecified | ||||||||||
| OS: | Unspecified | ||||||||||
| Attachments: |
|
||||||||||
|
Description
Brady Eidson
2020-07-10 16:23:52 PDT
Created attachment 404022 [details]
Patch
Comment on attachment 404022 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=404022&action=review > Source/WebCore/platform/gamepad/cocoa/GameControllerGamepad.mm:38 > +enum class GamepadButtons : uint8_t > +{ WebKit coding style puts this on a single line. (In reply to Darin Adler from comment #2) > Comment on attachment 404022 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=404022&action=review > > > Source/WebCore/platform/gamepad/cocoa/GameControllerGamepad.mm:38 > > +enum class GamepadButtons : uint8_t > > +{ > > WebKit coding style puts this on a single line. Yup, in my quick search I saw non-Webkit code's style and copied it. Whoops! Failing to apply because it relied on https://bugs.webkit.org/show_bug.cgi?id=212933 landing Created attachment 404027 [details]
Patch
Comment on attachment 404027 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=404027&action=review > Source/WebCore/platform/gamepad/cocoa/GameControllerGamepad.mm:101 > + m_buttonValues.resize(homeButton ? (size_t)GamepadButtons::CenterClusterCenter + 1 : (size_t)GamepadButtons::CenterClusterCenter); Not thrilled with how this hard-codes which is the last gamepad button 40 lines after the enum. Maybe two named constants right after the enum class would make the relationship clearer? Something like this perhaps: static constexpr auto numGamepadButtonsWithoutHomeButton = static_cast<size_t>(GamepadButtons::CenterClusterCenter) + 1; static constexpr auto numGamepadButtonsWithHomeButton = static_cast<size_t>(GamepadButtons::CenterClusterCenter); Created attachment 404034 [details]
PFL
Committed r264258: <https://trac.webkit.org/changeset/264258> All reviewed patches have been landed. Closing bug and clearing flags on attachment 404034 [details]. |