Workaround GLFW Joystick Bugs

This commit is contained in:
TheBrokenRail 2022-10-08 16:08:53 -04:00
parent 5690df3ebe
commit 32cd0c426f
2 changed files with 15 additions and 0 deletions

View File

@ -21,6 +21,15 @@ add_subdirectory(src EXCLUDE_FROM_ALL)
# Ensure Build # Ensure Build
add_custom_target(glfw-build ALL DEPENDS glfw) add_custom_target(glfw-build ALL DEPENDS glfw)
# Remove When glfw/glfw#2192 Is Merged
target_compile_definitions(glfw PRIVATE -D_GLFW_LINUX_JOYSTICK)
# Remove When glfw/glfw#2198 Is Merged
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/publicize-glfw-symbol.h"
"#pragma once\n"
"extern __attribute__((visibility(\"default\"))) void _glfwDetectJoystickConnectionLinux(void);\n"
)
target_compile_options(glfw PRIVATE -include PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/publicize-glfw-symbol.h")
# Install # Install
install(TARGETS glfw DESTINATION "${MCPI_LIB_DIR}") install(TARGETS glfw DESTINATION "${MCPI_LIB_DIR}")
if(BUILD_ARM_COMPONENTS) if(BUILD_ARM_COMPONENTS)

View File

@ -679,6 +679,12 @@ void _media_handle_SDL_PollEvent() {
// Process GLFW Events // Process GLFW Events
glfwPollEvents(); glfwPollEvents();
// Fix Joystick Detection While Running (Remove When glfw/glfw#2198 Is Merged)
extern void _glfwDetectJoystickConnectionLinux(void);
if (glfwGetPlatform() == GLFW_PLATFORM_WAYLAND) {
_glfwDetectJoystickConnectionLinux();
}
// Controller // Controller
update_controller_state(); update_controller_state();