Lines Matching defs:js
50 static void handleKeyEvent(_GLFWjoystick* js, int code, int value)
52 _glfwInputJoystickButton(js,
53 js->linjs.keyMap[code - BTN_MISC],
59 static void handleAbsEvent(_GLFWjoystick* js, int code, int value)
61 const int index = js->linjs.absMap[code];
74 int* state = js->linjs.hats[hat];
85 _glfwInputJoystickHat(js, index, stateMap[state[0]][state[1]]);
89 const struct input_absinfo* info = &js->linjs.absInfo[code];
101 _glfwInputJoystickAxis(js, index, normalized);
107 static void pollAbsState(_GLFWjoystick* js)
111 if (js->linjs.absMap[code] < 0)
114 struct input_absinfo* info = &js->linjs.absInfo[code];
116 if (ioctl(js->linjs.fd, EVIOCGABS(code), info) < 0)
119 handleAbsEvent(js, code, info->value);
225 _GLFWjoystick* js =
227 if (!js)
234 memcpy(&js->linjs, &linjs, sizeof(linjs));
236 pollAbsState(js);
238 _glfwInputJoystick(js, GLFW_CONNECTED);
246 static void closeJoystick(_GLFWjoystick* js)
248 _glfwInputJoystick(js, GLFW_DISCONNECTED);
249 close(js->linjs.fd);
250 _glfwFreeJoystick(js);
369 _GLFWjoystick* js = _glfw.joysticks + jid;
370 if (js->connected)
371 closeJoystick(js);
386 GLFWbool _glfwPollJoystickLinux(_GLFWjoystick* js, int mode)
394 if (read(js->linjs.fd, &e, sizeof(e)) < 0)
398 closeJoystick(js);
410 pollAbsState(js);
418 handleKeyEvent(js, e.code, e.value);
420 handleAbsEvent(js, e.code, e.value);
423 return js->connected;