Skip to content

Conversation

@ceyusa
Copy link
Contributor

@ceyusa ceyusa commented Sep 23, 2021

Gamepad API in libwpe is middleware between WPEWebKit and the application, such as cog.

The application is reponsible to provide the gamepad backend, by offering the functions for providers and gamepads. While WPEWebkit shall provide event callbacks.

Original patch by Eugene Mutavchi Ievgen_Mutavchi@comcast.com (in MR #69)

@aperezdc
Copy link
Contributor

We are late in the current development cycle to add new features (I am going to release 1.12.0 in the coming days), so let's slate this for 1.14 🕐

@aperezdc aperezdc added this to the 1.14 milestone Sep 28, 2021
@aperezdc aperezdc mentioned this pull request Sep 28, 2021
@ceyusa
Copy link
Contributor Author

ceyusa commented Feb 10, 2022

v2:

  • Added API to provide the view_backend from application to webkit

@donny-dont
Copy link
Contributor

I'm wondering if like in #94 there should be a WPE_ENABLE_GAMEPAD along with this PR so it can be toggled on and off

@aperezdc
Copy link
Contributor

@ceyusa This would need a rebase, bonus points if #99 could be merged first so we would get the new checks on the code touched by this PR already 😉

Copy link
Contributor

@aperezdc aperezdc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall approach looks fine, but I have a bunch of small nits (please bear with me! 🐻)

@ceyusa
Copy link
Contributor Author

ceyusa commented Apr 7, 2022

I'm wondering if like in #94 there should be a WPE_ENABLE_GAMEPAD along with this PR so it can be toggled on and off

I don't think it's the case since xkbcommon meant a dependency, and it this case there's no new dependencies.

@ceyusa ceyusa force-pushed the gamepad branch 2 times, most recently from bba235d to 5b43554 Compare April 19, 2022 15:44
Copy link
Contributor

@aperezdc aperezdc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have only a minor nit before landing this, thanks for the update!

Also, the style checker is complaining. This can be used to apply its suggestions to your work branch:

./scripts/check-style master | git apply -p0

@ceyusa ceyusa force-pushed the gamepad branch 2 times, most recently from 896d166 to cd2790a Compare May 9, 2022 09:39
@ceyusa
Copy link
Contributor Author

ceyusa commented May 9, 2022

Also, the style checker is complaining. This can be used to apply its suggestions to your work branch:

Sorry! I lost track of this. I'm terrible juggling with context switching :)

Copy link
Contributor

@donny-dont donny-dont left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just had one nit. Other than that would be great to land this.

Gamepad API in libwpe is middleware between WPEWebKit and the application,
such as cog.

The application is reponsible to provide the gamepad backend by offering
the functions for providers and gamepads.

WPEWebkit shall provide event callbacks.

Original patch by Eugene Mutavchi <Ievgen_Mutavchi@comcast.com>
Copy link
Contributor

@aperezdc aperezdc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From my point of view, this is ready to merge. I'll leave some time for others to comment beforehand, just in case there might be objections (unlikely, I suppose!)

@donny-dont
Copy link
Contributor

I'm positive on this change as well. Thanks @ceyusa can't wait to use it.

Could we potentially have a dev release cut after this lands?

@aperezdc
Copy link
Contributor

I'm positive on this change as well. Thanks @ceyusa can't wait to use it.

Could we potentially have a dev release cut after this lands?

SGTM, I can put out a development release right after.

@aperezdc
Copy link
Contributor

There hasn't been further comments for a couple of days, so let's get this merged. Note that if we wanted (or needed) to refine these changes, we still have time to make follow-up fixes until September 2022 when the next stable series is due.

@aperezdc aperezdc merged commit dad8942 into WebPlatformForEmbedded:master May 12, 2022
@ceyusa ceyusa deleted the gamepad branch May 23, 2022 12:25
webkit-early-warning-system pushed a commit to ceyusa/WebKit that referenced this pull request Aug 24, 2022
https://bugs.webkit.org/show_bug.cgi?id=230630

With gamepad support in libwpe[1] is possible to communicate gamepads events between the
application (cog, for example) and WPEWebKit. This patch are the changes required to attend that
communication and enable the gamepad support in WPE port.

1. WebPlatformForEmbedded/libwpe#88

Reviewed by Adrian Perez de Castro.

* LayoutTests/platform/wpe/TestExpectations: Enable skipped tests.
* Source/WebCore/PlatformWPE.cmake: Add headers if enabled.
* Source/WebCore/SourcesWPE.txt: Add source files.
* Source/WebCore/platform/gamepad/wpe/WPEGamepad.cpp: Added.
(WebCore::WPEGamepad::WPEGamepad):
(WebCore::WPEGamepad::~WPEGamepad):
(WebCore::WPEGamepad::buttonPressedOrReleased):
(WebCore::WPEGamepad::absoluteAxisChanged):
* Source/WebCore/platform/gamepad/wpe/WPEGamepad.h: Added.
* Source/WebCore/platform/gamepad/wpe/WPEGamepadProvider.cpp: Added.
(WebCore::WPEGamepadProvider::singleton):
(WebCore::WPEGamepadProvider::WPEGamepadProvider):
(WebCore::WPEGamepadProvider::~WPEGamepadProvider):
(WebCore::WPEGamepadProvider::startMonitoringGamepads):
(WebCore::WPEGamepadProvider::stopMonitoringGamepads):
(WebCore::WPEGamepadProvider::gamepadConnected):
(WebCore::WPEGamepadProvider::gamepadDisconnected):
(WebCore::WPEGamepadProvider::indexForNewlyConnectedDevice):
(WebCore::WPEGamepadProvider::removeGamepadForId):
(WebCore::WPEGamepadProvider::initialGamepadsConnectedTimerFired):
(WebCore::WPEGamepadProvider::inputNotificationTimerFired):
(WebCore::WPEGamepadProvider::scheduleInputNotification):
(WebCore::WPEGamepadProvider::inputView):
* Source/WebCore/platform/gamepad/wpe/WPEGamepadProvider.h: Added.
* Source/WebKit/SourcesWPE.txt: Add source files.
* Source/WebKit/UIProcess/API/wpe/WPEView.cpp: Reports the view where gamepad currently operates.
(WKWPE::m_backend):
(WKWPE::View::~View):
(WKWPE::View::setViewState):
(WKWPE::View::platformWebPageProxyForGamepadInput):
* Source/WebKit/UIProcess/API/wpe/WPEView.h:
* Source/WebKit/UIProcess/Gamepad/UIGamepadProvider.cpp:
* Source/WebKit/UIProcess/Gamepad/wpe/UIGamepadProviderWPE.cpp: Added.
(WebKit::UIGamepadProvider::platformSetDefaultGamepadProvider):
(WebKit::UIGamepadProvider::platformWebPageProxyForGamepadInput):
(WebKit::UIGamepadProvider::platformStopMonitoringInput):
(WebKit::UIGamepadProvider::platformStartMonitoringInput):
* Source/cmake/OptionsWPE.cmake:

Canonical link: https://commits.webkit.org/253720@main
aperezdc pushed a commit to WebKit/WebKit that referenced this pull request Aug 24, 2022
https://bugs.webkit.org/show_bug.cgi?id=230630

With gamepad support in libwpe[1] is possible to communicate gamepads events between the
application (cog, for example) and WPEWebKit. This patch are the changes required to attend that
communication and enable the gamepad support in WPE port.

1. WebPlatformForEmbedded/libwpe#88

Reviewed by Adrian Perez de Castro.

* LayoutTests/platform/wpe/TestExpectations: Enable skipped tests.
* Source/WebCore/PlatformWPE.cmake: Add headers if enabled.
* Source/WebCore/SourcesWPE.txt: Add source files.
* Source/WebCore/platform/gamepad/wpe/WPEGamepad.cpp: Added.
(WebCore::WPEGamepad::WPEGamepad):
(WebCore::WPEGamepad::~WPEGamepad):
(WebCore::WPEGamepad::buttonPressedOrReleased):
(WebCore::WPEGamepad::absoluteAxisChanged):
* Source/WebCore/platform/gamepad/wpe/WPEGamepad.h: Added.
* Source/WebCore/platform/gamepad/wpe/WPEGamepadProvider.cpp: Added.
(WebCore::WPEGamepadProvider::singleton):
(WebCore::WPEGamepadProvider::WPEGamepadProvider):
(WebCore::WPEGamepadProvider::~WPEGamepadProvider):
(WebCore::WPEGamepadProvider::startMonitoringGamepads):
(WebCore::WPEGamepadProvider::stopMonitoringGamepads):
(WebCore::WPEGamepadProvider::gamepadConnected):
(WebCore::WPEGamepadProvider::gamepadDisconnected):
(WebCore::WPEGamepadProvider::indexForNewlyConnectedDevice):
(WebCore::WPEGamepadProvider::removeGamepadForId):
(WebCore::WPEGamepadProvider::initialGamepadsConnectedTimerFired):
(WebCore::WPEGamepadProvider::inputNotificationTimerFired):
(WebCore::WPEGamepadProvider::scheduleInputNotification):
(WebCore::WPEGamepadProvider::inputView):
* Source/WebCore/platform/gamepad/wpe/WPEGamepadProvider.h: Added.
* Source/WebKit/SourcesWPE.txt: Add source files.
* Source/WebKit/UIProcess/API/wpe/WPEView.cpp: Reports the view where gamepad currently operates.
(WKWPE::m_backend):
(WKWPE::View::~View):
(WKWPE::View::setViewState):
(WKWPE::View::platformWebPageProxyForGamepadInput):
* Source/WebKit/UIProcess/API/wpe/WPEView.h:
* Source/WebKit/UIProcess/Gamepad/UIGamepadProvider.cpp:
* Source/WebKit/UIProcess/Gamepad/wpe/UIGamepadProviderWPE.cpp: Added.
(WebKit::UIGamepadProvider::platformSetDefaultGamepadProvider):
(WebKit::UIGamepadProvider::platformWebPageProxyForGamepadInput):
(WebKit::UIGamepadProvider::platformStopMonitoringInput):
(WebKit::UIGamepadProvider::platformStartMonitoringInput):
* Source/cmake/OptionsWPE.cmake:

Canonical link: https://commits.webkit.org/253720@main

(cherry picked from commit ab0e247)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

3 participants