diff --git a/src/iokit_joystick.h b/src/iokit_joystick.h index f90ae1d4..7bff41ee 100644 --- a/src/iokit_joystick.h +++ b/src/iokit_joystick.h @@ -33,7 +33,7 @@ #include #define _GLFW_PLATFORM_LIBRARY_JOYSTICK_STATE \ - _GLFWjoystickIOKit joystick[GLFW_JOYSTICK_LAST + 1] + _GLFWjoystickIOKit iokit_js[GLFW_JOYSTICK_LAST + 1] //======================================================================== diff --git a/src/iokit_joystick.m b/src/iokit_joystick.m index 40721504..bce9838f 100644 --- a/src/iokit_joystick.m +++ b/src/iokit_joystick.m @@ -223,7 +223,7 @@ static void pollJoystickEvents(void) { CFIndex i; int buttonIndex = 0; - _GLFWjoystickIOKit* joystick = _glfw.joystick + joy; + _GLFWjoystickIOKit* joystick = _glfw.iokit_js + joy; if (!joystick->present) continue; @@ -368,7 +368,7 @@ void _glfwInitJoysticks(void) CFRelease(valueRef); } - _GLFWjoystickIOKit* joystick = _glfw.joystick + joy; + _GLFWjoystickIOKit* joystick = _glfw.iokit_js + joy; joystick->present = GL_TRUE; result = IOCreatePlugInInterfaceForService(ioHIDDeviceObject, @@ -450,7 +450,7 @@ void _glfwTerminateJoysticks(void) for (i = 0; i < GLFW_JOYSTICK_LAST + 1; i++) { - _GLFWjoystickIOKit* joystick = &_glfw.joystick[i]; + _GLFWjoystickIOKit* joystick = &_glfw.iokit_js[i]; removeJoystick(joystick); } } @@ -464,12 +464,12 @@ int _glfwPlatformJoystickPresent(int joy) { pollJoystickEvents(); - return _glfw.joystick[joy].present; + return _glfw.iokit_js[joy].present; } const float* _glfwPlatformGetJoystickAxes(int joy, int* count) { - _GLFWjoystickIOKit* joystick = _glfw.joystick + joy; + _GLFWjoystickIOKit* joystick = _glfw.iokit_js + joy; pollJoystickEvents(); @@ -482,7 +482,7 @@ const float* _glfwPlatformGetJoystickAxes(int joy, int* count) const unsigned char* _glfwPlatformGetJoystickButtons(int joy, int* count) { - _GLFWjoystickIOKit* joystick = _glfw.joystick + joy; + _GLFWjoystickIOKit* joystick = _glfw.iokit_js + joy; pollJoystickEvents(); @@ -498,6 +498,6 @@ const char* _glfwPlatformGetJoystickName(int joy) { pollJoystickEvents(); - return _glfw.joystick[joy].name; + return _glfw.iokit_js[joy].name; } diff --git a/src/linux_joystick.c b/src/linux_joystick.c index 81f10f26..5e841686 100644 --- a/src/linux_joystick.c +++ b/src/linux_joystick.c @@ -56,7 +56,7 @@ static int openJoystickDevice(int joy, const char* path) if (fd == -1) return GL_FALSE; - _glfw.joystick[joy].fd = fd; + _glfw.linux_js[joy].fd = fd; // Verify that the joystick driver version is at least 1.0 ioctl(fd, JSIOCGVERSION, &version); @@ -70,18 +70,18 @@ static int openJoystickDevice(int joy, const char* path) if (ioctl(fd, JSIOCGNAME(sizeof(name)), name) < 0) strncpy(name, "Unknown", sizeof(name)); - _glfw.joystick[joy].name = strdup(name); + _glfw.linux_js[joy].name = strdup(name); ioctl(fd, JSIOCGAXES, &axisCount); - _glfw.joystick[joy].axisCount = (int) axisCount; + _glfw.linux_js[joy].axisCount = (int) axisCount; ioctl(fd, JSIOCGBUTTONS, &buttonCount); - _glfw.joystick[joy].buttonCount = (int) buttonCount; + _glfw.linux_js[joy].buttonCount = (int) buttonCount; - _glfw.joystick[joy].axes = calloc(axisCount, sizeof(float)); - _glfw.joystick[joy].buttons = calloc(buttonCount, 1); + _glfw.linux_js[joy].axes = calloc(axisCount, sizeof(float)); + _glfw.linux_js[joy].buttons = calloc(buttonCount, 1); - _glfw.joystick[joy].present = GL_TRUE; + _glfw.linux_js[joy].present = GL_TRUE; #endif // __linux__ return GL_TRUE; @@ -98,21 +98,21 @@ static void pollJoystickEvents(void) for (i = 0; i <= GLFW_JOYSTICK_LAST; i++) { - if (!_glfw.joystick[i].present) + if (!_glfw.linux_js[i].present) continue; // Read all queued events (non-blocking) for (;;) { errno = 0; - result = read(_glfw.joystick[i].fd, &e, sizeof(e)); + result = read(_glfw.linux_js[i].fd, &e, sizeof(e)); if (errno == ENODEV) { - free(_glfw.joystick[i].axes); - free(_glfw.joystick[i].buttons); - free(_glfw.joystick[i].name); - _glfw.joystick[i].present = GL_FALSE; + free(_glfw.linux_js[i].axes); + free(_glfw.linux_js[i].buttons); + free(_glfw.linux_js[i].name); + _glfw.linux_js[i].present = GL_FALSE; } if (result == -1) @@ -124,12 +124,12 @@ static void pollJoystickEvents(void) switch (e.type) { case JS_EVENT_AXIS: - _glfw.joystick[i].axes[e.number] = + _glfw.linux_js[i].axes[e.number] = (float) e.value / 32767.0f; break; case JS_EVENT_BUTTON: - _glfw.joystick[i].buttons[e.number] = + _glfw.linux_js[i].buttons[e.number] = e.value ? GLFW_PRESS : GLFW_RELEASE; break; @@ -204,14 +204,14 @@ void _glfwTerminateJoysticks(void) for (i = 0; i <= GLFW_JOYSTICK_LAST; i++) { - if (_glfw.joystick[i].present) + if (_glfw.linux_js[i].present) { - close(_glfw.joystick[i].fd); - free(_glfw.joystick[i].axes); - free(_glfw.joystick[i].buttons); - free(_glfw.joystick[i].name); + close(_glfw.linux_js[i].fd); + free(_glfw.linux_js[i].axes); + free(_glfw.linux_js[i].buttons); + free(_glfw.linux_js[i].name); - _glfw.joystick[i].present = GL_FALSE; + _glfw.linux_js[i].present = GL_FALSE; } } #endif // __linux__ @@ -226,35 +226,35 @@ int _glfwPlatformJoystickPresent(int joy) { pollJoystickEvents(); - return _glfw.joystick[joy].present; + return _glfw.linux_js[joy].present; } const float* _glfwPlatformGetJoystickAxes(int joy, int* count) { pollJoystickEvents(); - if (!_glfw.joystick[joy].present) + if (!_glfw.linux_js[joy].present) return NULL; - *count = _glfw.joystick[joy].axisCount; - return _glfw.joystick[joy].axes; + *count = _glfw.linux_js[joy].axisCount; + return _glfw.linux_js[joy].axes; } const unsigned char* _glfwPlatformGetJoystickButtons(int joy, int* count) { pollJoystickEvents(); - if (!_glfw.joystick[joy].present) + if (!_glfw.linux_js[joy].present) return NULL; - *count = _glfw.joystick[joy].buttonCount; - return _glfw.joystick[joy].buttons; + *count = _glfw.linux_js[joy].buttonCount; + return _glfw.linux_js[joy].buttons; } const char* _glfwPlatformGetJoystickName(int joy) { pollJoystickEvents(); - return _glfw.joystick[joy].name; + return _glfw.linux_js[joy].name; } diff --git a/src/linux_joystick.h b/src/linux_joystick.h index 5c03c286..56089221 100644 --- a/src/linux_joystick.h +++ b/src/linux_joystick.h @@ -28,7 +28,7 @@ #define _linux_joystick_h_ #define _GLFW_PLATFORM_LIBRARY_JOYSTICK_STATE \ - _GLFWjoystickLinux joystick[GLFW_JOYSTICK_LAST + 1] + _GLFWjoystickLinux linux_js[GLFW_JOYSTICK_LAST + 1] //======================================================================== diff --git a/src/winmm_joystick.c b/src/winmm_joystick.c index 789b0c3a..ad5a67f5 100644 --- a/src/winmm_joystick.c +++ b/src/winmm_joystick.c @@ -63,7 +63,7 @@ void _glfwTerminateJoysticks(void) int i; for (i = 0; i < GLFW_JOYSTICK_LAST; i++) - free(_glfw.joystick[i].name); + free(_glfw.winmm_js[i].name); } @@ -85,7 +85,7 @@ const float* _glfwPlatformGetJoystickAxes(int joy, int* count) { JOYCAPS jc; JOYINFOEX ji; - float* axes = _glfw.joystick[joy].axes; + float* axes = _glfw.winmm_js[joy].axes; if (_glfw_joyGetDevCaps(joy, &jc, sizeof(JOYCAPS)) != JOYERR_NOERROR) return NULL; @@ -118,7 +118,7 @@ const unsigned char* _glfwPlatformGetJoystickButtons(int joy, int* count) { JOYCAPS jc; JOYINFOEX ji; - unsigned char* buttons = _glfw.joystick[joy].buttons; + unsigned char* buttons = _glfw.winmm_js[joy].buttons; if (_glfw_joyGetDevCaps(joy, &jc, sizeof(JOYCAPS)) != JOYERR_NOERROR) return NULL; @@ -169,9 +169,9 @@ const char* _glfwPlatformGetJoystickName(int joy) if (_glfw_joyGetDevCaps(joy, &jc, sizeof(JOYCAPS)) != JOYERR_NOERROR) return NULL; - free(_glfw.joystick[joy].name); - _glfw.joystick[joy].name = _glfwCreateUTF8FromWideString(jc.szPname); + free(_glfw.winmm_js[joy].name); + _glfw.winmm_js[joy].name = _glfwCreateUTF8FromWideString(jc.szPname); - return _glfw.joystick[joy].name; + return _glfw.winmm_js[joy].name; } diff --git a/src/winmm_joystick.h b/src/winmm_joystick.h index 19d1bbb5..52c3558a 100644 --- a/src/winmm_joystick.h +++ b/src/winmm_joystick.h @@ -28,7 +28,7 @@ #define _winmm_joystick_h_ #define _GLFW_PLATFORM_LIBRARY_JOYSTICK_STATE \ - _GLFWjoystickWinMM joystick[GLFW_JOYSTICK_LAST + 1] + _GLFWjoystickWinMM winmm_js[GLFW_JOYSTICK_LAST + 1] //========================================================================