Cocoa: Fix handling of analog joystick buttons

The reported state was not clamped to [0,1], i.e. GLFW_RELEASE and
GLFW_PRESS.

Fixes #1385.
This commit is contained in:
Camilla Löwy
2019-01-31 01:54:06 +01:00
parent 51ca41dd9f
commit 463ef7eb71
2 changed files with 3 additions and 1 deletions
+2 -1
View File
@@ -426,7 +426,8 @@ int _glfwPlatformPollJoystick(_GLFWjoystick* js, int mode)
_GLFWjoyelementNS* button = (_GLFWjoyelementNS*)
CFArrayGetValueAtIndex(js->ns.buttons, i);
const char value = getElementValue(js, button) - button->minimum;
_glfwInputJoystickButton(js, (int) i, value);
const int state = (value > 0) ? GLFW_PRESS : GLFW_RELEASE;
_glfwInputJoystickButton(js, (int) i, state);
}
for (i = 0; i < CFArrayGetCount(js->ns.hats); i++)