diff --git a/media-layer/core/dependencies/glfw/CMakeLists.txt b/media-layer/core/dependencies/glfw/CMakeLists.txt index 3d9aa60f..1a03909e 100644 --- a/media-layer/core/dependencies/glfw/CMakeLists.txt +++ b/media-layer/core/dependencies/glfw/CMakeLists.txt @@ -21,6 +21,15 @@ add_subdirectory(src EXCLUDE_FROM_ALL) # Ensure Build 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(TARGETS glfw DESTINATION "${MCPI_LIB_DIR}") if(BUILD_ARM_COMPONENTS) diff --git a/media-layer/core/src/media.c b/media-layer/core/src/media.c index b57a5306..0d5851d3 100644 --- a/media-layer/core/src/media.c +++ b/media-layer/core/src/media.c @@ -679,6 +679,12 @@ void _media_handle_SDL_PollEvent() { // Process GLFW Events glfwPollEvents(); + // Fix Joystick Detection While Running (Remove When glfw/glfw#2198 Is Merged) + extern void _glfwDetectJoystickConnectionLinux(void); + if (glfwGetPlatform() == GLFW_PLATFORM_WAYLAND) { + _glfwDetectJoystickConnectionLinux(); + } + // Controller update_controller_state();