From fb5dbc811bf7de74a69e34d0dff0f80e0631dc68 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sun, 3 Feb 2019 20:16:47 +0530 Subject: [PATCH] Cocoa: Fix handling of analog joystick buttons From upstream: https://github.com/glfw/glfw/commit/463ef7eb71268f57790fdb67f26d328b45d3346e --- glfw/cocoa_joystick.m | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/glfw/cocoa_joystick.m b/glfw/cocoa_joystick.m index b7586056b..38d4bc033 100644 --- a/glfw/cocoa_joystick.m +++ b/glfw/cocoa_joystick.m @@ -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++)