1
0
Fork 0

In joystick configurations, fall back to <unix> if no <mac> entry was provided, since the number is frequently identical.

This commit is contained in:
James Turner 2011-09-15 09:54:00 +01:00
parent 633b07dedc
commit 2de3872d66
2 changed files with 23 additions and 3 deletions

View file

@ -18,6 +18,17 @@ set(SOURCES
input.cxx
)
set(HEADERS
FGButton.hxx
FGCommonInput.hxx
FGDeviceConfigurationMap.hxx
FGEventInput.hxx
FGJoystickInput.hxx
FGKeyboardInput.hxx
FGMouseInput.hxx
input.hxx
)
if(EVENT_INPUT)
list(APPEND SOURCES ${EVENT_INPUT_SOURCES})
include_directories(${DBUS_INCLUDE_DIR} ${DBUS_ARCH_INCLUDE_DIR})
@ -43,6 +54,6 @@ target_link_libraries(js_demo
${PLIB_LIBRARIES}
${SIMGEAR_CORE_LIBRARY_DEPENDENCIES})
flightgear_component(Input "${SOURCES}")
flightgear_component(Input "${SOURCES}" "${HEADERS}")
install(TARGETS fgjs js_demo RUNTIME DESTINATION bin)

View file

@ -217,11 +217,20 @@ void FGJoystickInput::postinit()
if (num_node != 0) {
n_axis = num_node->getIntValue(TGT_PLATFORM, -1);
#ifdef SG_MAC
// Mac falls back to Unix by default - avoids specifying many
// duplicate <mac> entries in joystick config files
if (n_axis < 0) {
n_axis = num_node->getIntValue("unix", -1);
}
#endif
// Silently ignore platforms that are not specified within the
// <number></number> section
if (n_axis < 0)
if (n_axis < 0) {
continue;
}
}
if (n_axis >= naxes) {
SG_LOG(SG_INPUT, SG_DEBUG, "Dropping bindings for axis " << n_axis);