diff options
author | Marc Mutz <marc.mutz@kdab.com> | 2016-03-05 21:19:15 +0100 |
---|---|---|
committer | Marc Mutz <marc.mutz@kdab.com> | 2016-03-08 08:42:35 +0000 |
commit | bb53183d4089a9f764b69dfbc47d8b91433af4f4 (patch) | |
tree | 7611716ecdeddeaa8785e58e8d3b5faa7e57eced /src/plugins | |
parent | 567c0a3f11ac2752d1bb8796bc9c52546d95b2b3 (diff) |
QEvdevGamepadDevice: use std::abs() instead of fabs()
Both includes were missing, so GCC complained that fabs() was not
declared.
Fix by including <cmath> and using std::abs() instead.
Change-Id: Ifc717bd68d3572e114937712c867c3d004c1fa2e
Reviewed-by: BogDan Vatra <bogdan@kdab.com>
Diffstat (limited to 'src/plugins')
-rw-r--r-- | src/plugins/gamepads/evdev/qevdevgamepadbackend.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/plugins/gamepads/evdev/qevdevgamepadbackend.cpp b/src/plugins/gamepads/evdev/qevdevgamepadbackend.cpp index 4ba299c..1ad6b46 100644 --- a/src/plugins/gamepads/evdev/qevdevgamepadbackend.cpp +++ b/src/plugins/gamepads/evdev/qevdevgamepadbackend.cpp @@ -41,6 +41,8 @@ #include <QtCore/private/qcore_unix_p.h> #include <linux/input.h> +#include <cmath> + QT_BEGIN_NAMESPACE Q_LOGGING_CATEGORY(lcEGB, "qt.gamepad") @@ -76,7 +78,7 @@ void QEvdevGamepadDevice::EvdevAxisInfo::setAbsInfo(int fd, int abs) minValue = absInfo.minimum; maxValue = absInfo.maximum; if (maxValue - minValue) - flat = fabs(absInfo.flat / double(maxValue - minValue)); + flat = std::abs(absInfo.flat / double(maxValue - minValue)); } } @@ -443,7 +445,7 @@ void QEvdevGamepadDevice::processInputEvent(input_event *e) } else if (e->type == EV_ABS) { if (m_configureAxis != QGamepadManager::AxisInvalid) { EvdevAxisInfo inf(m_fd, e->code, -32768, 32767, m_configureAxis); - if (fabs(inf.normalized(e->value)) == 1) { + if (std::abs(inf.normalized(e->value)) == 1) { m_axisMap.insert(e->code, EvdevAxisInfo(m_fd, e->code, -32768, 32767, m_configureAxis)); QGamepadManager::GamepadAxis axis = m_configureAxis; @@ -503,7 +505,7 @@ void QEvdevGamepadDevice::processInputEvent(input_event *e) if (info.gamepadMaxButton == info.gamepadMinButton && info.gamepadMaxButton != QGamepadManager::ButtonInvalid) { if (val) - emit m_backend->gamepadButtonPressed(m_productId, info.gamepadMaxButton, fabs(val)); + emit m_backend->gamepadButtonPressed(m_productId, info.gamepadMaxButton, std::abs(val)); else emit m_backend->gamepadButtonReleased(m_productId, info.gamepadMaxButton); } else { |