WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
[patch]
Tentative WIP patch
bug-217226-20201002184916.patch (text/plain), 7.76 KB, created by
Adrian Perez
on 2020-10-02 08:49:17 PDT
(
hide
)
Description:
Tentative WIP patch
Filename:
MIME Type:
Creator:
Adrian Perez
Created:
2020-10-02 08:49:17 PDT
Size:
7.76 KB
patch
obsolete
>Subversion Revision: 267879 >diff --git a/Source/WebCore/platform/gamepad/manette/ManetteGamepad.cpp b/Source/WebCore/platform/gamepad/manette/ManetteGamepad.cpp >index 434c11db066b210e300bfe2fac9722a7fb16e83d..c3d7a1cc9a617d9c23cf8f3cb3cf51dcdf9941ab 100644 >--- a/Source/WebCore/platform/gamepad/manette/ManetteGamepad.cpp >+++ b/Source/WebCore/platform/gamepad/manette/ManetteGamepad.cpp >@@ -132,8 +132,13 @@ ManetteGamepad::ManetteGamepad(ManetteDevice* device, unsigned index) > m_id = String::fromUTF8(manette_device_get_name(m_device.get())); > m_mapping = String::fromUTF8("standard"); > >- m_axisValues.fill(0, static_cast<size_t>(StandardGamepadAxis::Count)); >- m_buttonValues.fill(0, static_cast<size_t>(StandardGamepadButton::Count)); >+ m_axisValues.resize(static_cast<size_t>(StandardGamepadAxis::Count)); >+ for (auto& value : m_axisValues) >+ value.setValue(0.0); >+ >+ m_buttonValues.resize(static_cast<size_t>(StandardGamepadButton::Count)); >+ for (auto& value : m_buttonValues) >+ value.setValue(0.0); > > g_signal_connect(device, "button-press-event", G_CALLBACK(onButtonPressEvent), this); > g_signal_connect(device, "button-release-event", G_CALLBACK(onButtonReleaseEvent), this); >@@ -151,7 +156,7 @@ void ManetteGamepad::buttonPressedOrReleased(ManetteDevice*, StandardGamepadButt > return; > > m_lastUpdateTime = MonotonicTime::now(); >- m_buttonValues[static_cast<int>(button)] = pressed ? 1.0 : 0.0; >+ m_buttonValues[static_cast<int>(button)].setValue(pressed ? 1.0 : 0.0); > > ManetteGamepadProvider::singleton().gamepadHadInput(*this, pressed ? ManetteGamepadProvider::ShouldMakeGamepadsVisible::Yes : ManetteGamepadProvider::ShouldMakeGamepadsVisible::No); > } >@@ -162,7 +167,7 @@ void ManetteGamepad::absoluteAxisChanged(ManetteDevice*, StandardGamepadAxis axi > return; > > m_lastUpdateTime = MonotonicTime::now(); >- m_axisValues[static_cast<int>(axis)] = value; >+ m_axisValues[static_cast<int>(axis)].setValue(value); > > ManetteGamepadProvider::singleton().gamepadHadInput(*this, ManetteGamepadProvider::ShouldMakeGamepadsVisible::No); > } >diff --git a/Source/WebCore/platform/gamepad/manette/ManetteGamepad.h b/Source/WebCore/platform/gamepad/manette/ManetteGamepad.h >index 3fa5974b77cbb7d0beaf03d008f14cd93464c1f5..22f580d67f6baebcd3b38b0fe975f84f6dc407cd 100644 >--- a/Source/WebCore/platform/gamepad/manette/ManetteGamepad.h >+++ b/Source/WebCore/platform/gamepad/manette/ManetteGamepad.h >@@ -70,8 +70,8 @@ public: > ManetteGamepad(ManetteDevice*, unsigned index); > virtual ~ManetteGamepad(); > >- const Vector<double>& axisValues() const final { return m_axisValues; } >- const Vector<double>& buttonValues() const final { return m_buttonValues; } >+ const Vector<SharedGamepadValue>& axisValues() const final { return m_axisValues; } >+ const Vector<SharedGamepadValue>& buttonValues() const final { return m_buttonValues; } > > void absoluteAxisChanged(ManetteDevice*, StandardGamepadAxis, double value); > void buttonPressedOrReleased(ManetteDevice*, StandardGamepadButton, bool pressed); >@@ -79,8 +79,8 @@ public: > private: > GRefPtr<ManetteDevice> m_device; > >- Vector<double> m_buttonValues; >- Vector<double> m_axisValues; >+ Vector<SharedGamepadValue> m_buttonValues; >+ Vector<SharedGamepadValue> m_axisValues; > }; > > } // namespace WebCore >diff --git a/Source/WebCore/platform/gamepad/manette/ManetteGamepadProvider.cpp b/Source/WebCore/platform/gamepad/manette/ManetteGamepadProvider.cpp >index 0082490ecff84180d79b91136f1f6ec572fbbff1..b68b18307cd2285c04f978eb141959c81e8b9740 100644 >--- a/Source/WebCore/platform/gamepad/manette/ManetteGamepadProvider.cpp >+++ b/Source/WebCore/platform/gamepad/manette/ManetteGamepadProvider.cpp >@@ -37,7 +37,6 @@ > > namespace WebCore { > >-static const Seconds connectionDelayInterval { 500_ms }; > static const Seconds inputNotificationDelay { 50_ms }; > > ManetteGamepadProvider& ManetteGamepadProvider::singleton() >@@ -58,7 +57,6 @@ static void onDeviceDisconnected(ManetteMonitor*, ManetteDevice* device, Manette > > ManetteGamepadProvider::ManetteGamepadProvider() > : m_monitor(adoptGRef(manette_monitor_new())) >- , m_connectionDelayTimer(RunLoop::current(), this, &ManetteGamepadProvider::connectionDelayTimerFired) > , m_inputNotificationTimer(RunLoop::current(), this, &ManetteGamepadProvider::inputNotificationTimerFired) > { > g_signal_connect(m_monitor.get(), "device-connected", G_CALLBACK(onDeviceConnected), this); >@@ -87,9 +85,6 @@ void ManetteGamepadProvider::startMonitoringGamepads(GamepadProviderClient& clie > > ASSERT(m_gamepadVector.isEmpty()); > ASSERT(m_gamepadMap.isEmpty()); >- >- m_shouldDispatchCallbacks = false; >- m_connectionDelayTimer.startOneShot(connectionDelayInterval); > } > > void ManetteGamepadProvider::stopMonitoringGamepads(GamepadProviderClient& client) >@@ -100,7 +95,6 @@ void ManetteGamepadProvider::stopMonitoringGamepads(GamepadProviderClient& clien > if (shouldCloseAndUnscheduleManager) { > m_gamepadVector.clear(); > m_gamepadMap.clear(); >- m_connectionDelayTimer.stop(); > } > } > >@@ -128,21 +122,8 @@ void ManetteGamepadProvider::deviceConnected(ManetteDevice* device) > m_gamepadVector[index] = gamepad.get(); > m_gamepadMap.set(device, WTFMove(gamepad)); > >- if (!m_shouldDispatchCallbacks) { >- // This added device is the result of us starting to monitor gamepads. >- // We'll get notified of all connected devices during this current spin of the runloop >- // and we don't want to tell the client about any of them. >- // The m_connectionDelayTimer fires in a subsequent spin of the runloop after which >- // any connection events are actual new devices. >- m_connectionDelayTimer.startOneShot(0_s); >- >- LOG(Gamepad, "Device %p was added while suppressing callbacks, so this should be an 'already connected' event", device); >- >- return; >- } >- > for (auto& client : m_clients) >- client->platformGamepadConnected(*m_gamepadVector[index]); >+ client->platformGamepadConnected(*m_gamepadVector[index], EventMakesGamepadsVisible::Yes); > } > > void ManetteGamepadProvider::deviceDisconnected(ManetteDevice* device) >@@ -152,10 +133,6 @@ void ManetteGamepadProvider::deviceDisconnected(ManetteDevice* device) > std::unique_ptr<ManetteGamepad> removedGamepad = removeGamepadForDevice(device); > ASSERT(removedGamepad); > >- // Any time we get a device removed callback we know it's a real event and not an 'already connected' event. >- // We should always stop suppressing callbacks when we receive such an event. >- m_shouldDispatchCallbacks = true; >- > for (auto& client : m_clients) > client->platformGamepadDisconnected(*removedGamepad); > } >@@ -169,19 +146,8 @@ unsigned ManetteGamepadProvider::indexForNewlyConnectedDevice() > return index; > } > >-void ManetteGamepadProvider::connectionDelayTimerFired() >-{ >- m_shouldDispatchCallbacks = true; >- >- for (auto* client : m_clients) >- client->setInitialConnectedGamepads(m_gamepadVector); >-} >- > void ManetteGamepadProvider::inputNotificationTimerFired() > { >- if (!m_shouldDispatchCallbacks) >- return; >- > dispatchPlatformGamepadInputActivity(); > } > >diff --git a/Source/WebCore/platform/gamepad/manette/ManetteGamepadProvider.h b/Source/WebCore/platform/gamepad/manette/ManetteGamepadProvider.h >index bf7a7dded36de503da28183dd21e73fecbfada69..6632d0f009bf15c4bbeba251c4d77812ae84a438 100644 >--- a/Source/WebCore/platform/gamepad/manette/ManetteGamepadProvider.h >+++ b/Source/WebCore/platform/gamepad/manette/ManetteGamepadProvider.h >@@ -70,7 +70,6 @@ private: > bool m_shouldDispatchCallbacks { false }; > > GRefPtr<ManetteMonitor> m_monitor; >- RunLoop::Timer<ManetteGamepadProvider> m_connectionDelayTimer; > RunLoop::Timer<ManetteGamepadProvider> m_inputNotificationTimer; > }; >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 217226
:
410326
|
410887
|
410889
|
410967