summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2019-01-07 10:06:36 +0100
committerStanislaw Halik <sthalik@misaki.pl>2019-01-16 07:48:45 +0100
commit442c6251669a387b1b8b75b9cb90eec6ee9a8b9b (patch)
treedf221594100fb8bdf0ff5c25fb7357e7bbdaf174
parent9cc9dfcce12cc39cc2dc916982d13f63e10311c7 (diff)
cruft only
-rw-r--r--filter-accela/ftnoir_filter_accela.cpp4
-rw-r--r--options/value-traits.hpp5
-rw-r--r--proto-mouse/ftnoir_protocol_mouse.cpp42
-rw-r--r--tracker-steamvr/steamvr.cpp4
4 files changed, 24 insertions, 31 deletions
diff --git a/filter-accela/ftnoir_filter_accela.cpp b/filter-accela/ftnoir_filter_accela.cpp
index db7ea279..56ac9b5c 100644
--- a/filter-accela/ftnoir_filter_accela.cpp
+++ b/filter-accela/ftnoir_filter_accela.cpp
@@ -139,8 +139,7 @@ void accela::filter(const double* input, double *output)
void settings_accela::make_splines(spline& rot, spline& pos)
{
- rot = spline();
- pos = spline();
+ rot.clear(); pos.clear();
for (const auto& val : rot_gains)
rot.add_point(QPointF(val.x, val.y));
@@ -150,4 +149,3 @@ void settings_accela::make_splines(spline& rot, spline& pos)
}
OPENTRACK_DECLARE_FILTER(accela, dialog_accela, accelaDll)
-
diff --git a/options/value-traits.hpp b/options/value-traits.hpp
index 765740f6..21e00d80 100644
--- a/options/value-traits.hpp
+++ b/options/value-traits.hpp
@@ -3,12 +3,11 @@
#include "slider.hpp"
#include "export.hpp"
-#include <QString>
-
#include <cmath>
-#include <cinttypes>
#include <type_traits>
+#include <QString>
+
namespace options::detail {
template<typename t, typename Enable = void>
diff --git a/proto-mouse/ftnoir_protocol_mouse.cpp b/proto-mouse/ftnoir_protocol_mouse.cpp
index 9d582bce..60c04cbe 100644
--- a/proto-mouse/ftnoir_protocol_mouse.cpp
+++ b/proto-mouse/ftnoir_protocol_mouse.cpp
@@ -29,33 +29,31 @@ void mouse::pose(const double* headpose)
int mouse_x = 0, mouse_y = 0;
- if (axis_x >= 0 && axis_x < 6)
- {
+ if (axis_x == clamp(axis_x, Axis_MIN, Axis_MAX))
mouse_x = get_value(headpose[axis_x] * invert[axis_x],
- s.sensitivity_x(),
+ *s.sensitivity_x,
axis_x >= 3);
- }
- if (axis_y >= 0 && axis_y < 6)
+ if (axis_y == clamp(axis_y, Axis_MIN, Axis_MAX))
mouse_y = get_value(headpose[axis_y] * invert[axis_y],
- s.sensitivity_y(),
+ *s.sensitivity_y,
axis_y >= 3);
- MOUSEINPUT mi;
- mi.dx = get_delta(mouse_x, last_x);
- mi.dy = get_delta(mouse_y, last_y);
- mi.mouseData = 0;
- mi.dwFlags = MOUSEEVENTF_MOVE | MOUSEEVENTF_MOVE_NOCOALESCE;
- mi.time = 0;
- mi.dwExtraInfo = 0;
- INPUT input;
- input.type = INPUT_MOUSE;
- input.mi = mi;
- if (mi.dx || mi.dy)
+ const int dx = get_delta(mouse_x, last_x),
+ dy = get_delta(mouse_y, last_y);
+
+ if (dx || dy)
{
- (void) SendInput(1, &input, sizeof(INPUT));
- last_x = mouse_x;
- last_y = mouse_y;
+ INPUT input;
+ input.type = INPUT_MOUSE;
+ MOUSEINPUT& mi = input.mi;
+ mi = {};
+ mi.dx = dx;
+ mi.dy = dy;
+ mi.dwFlags = MOUSEEVENTF_MOVE | MOUSEEVENTF_MOVE_NOCOALESCE;
+
+ (void)SendInput(1, &input, sizeof(input));
+ last_x = mouse_x; last_y = mouse_y;
}
}
@@ -66,9 +64,7 @@ QString mouse::game_name()
int mouse::get_delta(int val, int prev)
{
- using std::abs;
-
- const int a = abs(val - prev), b = abs(val + prev);
+ const int a = std::abs(val - prev), b = std::abs(val + prev);
if (b < a)
return val + prev;
else
diff --git a/tracker-steamvr/steamvr.cpp b/tracker-steamvr/steamvr.cpp
index 04ae691e..4c40d1a1 100644
--- a/tracker-steamvr/steamvr.cpp
+++ b/tracker-steamvr/steamvr.cpp
@@ -59,13 +59,13 @@ void device_list::fill_device_specs(QList<device_spec>& list)
{
if (v->GetTrackedDeviceClass(k) == vr::ETrackedDeviceClass::TrackedDeviceClass_Invalid)
{
- qDebug() << "no device with index";
+ qDebug() << "steamvr: no device with index";
continue;
}
if (!device_states[k].bDeviceIsConnected)
{
- qDebug() << "device not connected but proceeding";
+ qDebug() << "steamvr: device not connected but proceeding";
continue;
}