summaryrefslogtreecommitdiff
path: root/Source/Core/InputCommon/ControllerInterface/Xlib/XInput2.cpp
diff options
context:
space:
mode:
authorMarkus Wick <degasus@users.noreply.github.com>2016-09-06 10:26:26 +0200
committerGitHub <noreply@github.com>2016-09-06 10:26:26 +0200
commit18030ebfb40eb4190663a501be93767453ca0950 (patch)
tree82ce0e795612b6bc0d6d426ba94e284a4a6256fb /Source/Core/InputCommon/ControllerInterface/Xlib/XInput2.cpp
parentdddd88aace046ee2443db6eef52e7e7b4caf7287 (diff)
parent928d05ec47a3dd46c6968088e934ff1555fc7fc5 (diff)
Merge pull request #4179 from magcius/xinput2-default
Remove the old Xlib backend
Diffstat (limited to 'Source/Core/InputCommon/ControllerInterface/Xlib/XInput2.cpp')
-rw-r--r--Source/Core/InputCommon/ControllerInterface/Xlib/XInput2.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/Source/Core/InputCommon/ControllerInterface/Xlib/XInput2.cpp b/Source/Core/InputCommon/ControllerInterface/Xlib/XInput2.cpp
index 59a1c64047..de3490f2e0 100644
--- a/Source/Core/InputCommon/ControllerInterface/Xlib/XInput2.cpp
+++ b/Source/Core/InputCommon/ControllerInterface/Xlib/XInput2.cpp
@@ -216,12 +216,10 @@ void KeyboardMouse::UpdateInput()
{
XFlush(m_display);
- // Get the absolute position of the mouse pointer
- UpdateCursor();
-
// for the axis controls
float delta_x = 0.0f, delta_y = 0.0f;
double delta_delta;
+ bool mouse_moved = false;
// Iterate through the event queue - update the axis controls, mouse
// button controls, and keyboard controls.
@@ -256,6 +254,8 @@ void KeyboardMouse::UpdateInput()
m_state.keyboard[dev_event->detail / 8] &= ~(1 << (dev_event->detail % 8));
break;
case XI_RawMotion:
+ mouse_moved = true;
+
// always safe because there is always at least one byte in
// raw_event->valuators.mask, and if a bit is set in the mask,
// then the value in raw_values is also available.
@@ -286,6 +286,10 @@ void KeyboardMouse::UpdateInput()
m_state.axis.y *= MOUSE_AXIS_SMOOTHING;
m_state.axis.y += delta_y;
m_state.axis.y /= MOUSE_AXIS_SMOOTHING + 1.0f;
+
+ // Get the absolute position of the mouse pointer
+ if (mouse_moved)
+ UpdateCursor();
}
std::string KeyboardMouse::GetName() const