Workaround GLFW Joystick Bugs

master
TheBrokenRail 2 months ago
parent 5690df3ebe
commit 32cd0c426f
  1. 9
      media-layer/core/dependencies/glfw/CMakeLists.txt
  2. 6
      media-layer/core/src/media.c

@ -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)

@ -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();

Loading…
Cancel
Save