Skip to content

Commit aeb8783

Browse files
Use analogButtonChanged with proper libwpe
analogButtonChanged can be used only with libwpe >= 1.16.1
1 parent 77edceb commit aeb8783

2 files changed

Lines changed: 11 additions & 4 deletions

File tree

Source/WebCore/platform/gamepad/wpe/WPEGamepad.cpp

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
#if ENABLE(GAMEPAD)
3131

3232
#include "WPEGamepadProvider.h"
33-
#include <wpe/wpe.h>
3433

3534
namespace WebCore {
3635

@@ -58,12 +57,15 @@ WPEGamepad::WPEGamepad(struct wpe_gamepad_provider* provider, uintptr_t gamepadI
5857
auto& self = *static_cast<WPEGamepad*>(data);
5958
self.absoluteAxisChanged(static_cast<unsigned>(axis), value);
6059
},
60+
#if WPE_CHECK_VERSION(1, 16, 1)
6161
// analog_button_value
62-
[](void* data, enum wpe_gamepad_button button, double value) {
62+
[](void* data, enum wpe_gamepad_button button, double value) {1111
6363
auto& self = *static_cast<WPEGamepad*>(data);
6464
self.analogButtonChanged(static_cast<unsigned>(button), value);
65-
},
66-
nullptr, nullptr,
65+
}, nullptr, nullptr
66+
#else
67+
nullptr, nullptr, nullptr
68+
#endif
6769
};
6870
wpe_gamepad_set_client(m_gamepad.get(), &s_client, this);
6971
}
@@ -89,6 +91,7 @@ void WPEGamepad::absoluteAxisChanged(unsigned axis, double value)
8991
WPEGamepadProvider::singleton().scheduleInputNotification(*this, WPEGamepadProvider::ShouldMakeGamepadsVisible::Yes);
9092
}
9193

94+
#if WPE_CHECK_VERSION(1, 16, 1)
9295
void WPEGamepad::analogButtonChanged(unsigned button, double value)
9396
{
9497
m_lastUpdateTime = MonotonicTime::now();
@@ -97,6 +100,7 @@ void WPEGamepad::analogButtonChanged(unsigned button, double value)
97100
WPEGamepadProvider::singleton().scheduleInputNotification(*this, WPEGamepadProvider::ShouldMakeGamepadsVisible::Yes);
98101

99102
}
103+
#endif
100104

101105
} // namespace WebCore
102106

Source/WebCore/platform/gamepad/wpe/WPEGamepad.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
#if ENABLE(GAMEPAD)
3030

3131
#include "PlatformGamepad.h"
32+
#include <wpe/wpe.h>
3233

3334
struct wpe_gamepad;
3435
struct wpe_gamepad_provider;
@@ -48,7 +49,9 @@ class WPEGamepad final : public PlatformGamepad {
4849
private:
4950
void buttonPressedOrReleased(unsigned, bool);
5051
void absoluteAxisChanged(unsigned, double);
52+
#if WPE_CHECK_VERSION(1, 16, 1)
5153
void analogButtonChanged(unsigned, double);
54+
#endif
5255

5356
Vector<SharedGamepadValue> m_buttonValues;
5457
Vector<SharedGamepadValue> m_axisValues;

0 commit comments

Comments
 (0)