This commit is contained in:
Marianne Gagnon 2015-08-09 21:40:05 -04:00
commit bc67f4f503
3 changed files with 27 additions and 5 deletions

View File

@ -2081,11 +2081,13 @@ void CIrrDeviceLinux::pollJoysticks()
for (u32 j= 0; j< ActiveJoysticks.size(); ++j)
{
JoystickInfo & info = ActiveJoysticks[j];
bool event_received = false;
#ifdef __FreeBSD__
struct joystick js;
if (read(info.fd, &js, sizeof(js)) == sizeof(js))
{
event_received = true;
info.persistentData.JoystickEvent.ButtonStates = js.b1 | (js.b2 << 1); /* should be a two-bit field */
info.persistentData.JoystickEvent.Axis[0] = js.x; /* X axis */
info.persistentData.JoystickEvent.Axis[1] = js.y; /* Y axis */
@ -2098,14 +2100,23 @@ void CIrrDeviceLinux::pollJoysticks()
{
case JS_EVENT_BUTTON:
if (event.value)
info.persistentData.JoystickEvent.ButtonStates |= (1 << event.number);
{
event_received = true;
info.persistentData.JoystickEvent.ButtonStates |= (1 << event.number);
}
else
info.persistentData.JoystickEvent.ButtonStates &= ~(1 << event.number);
{
event_received = true;
info.persistentData.JoystickEvent.ButtonStates &= ~(1 << event.number);
}
break;
case JS_EVENT_AXIS:
if (event.number < SEvent::SJoystickEvent::NUMBER_OF_AXES)
{
event_received = true;
info.persistentData.JoystickEvent.Axis[event.number] = event.value;
}
break;
default:
@ -2116,6 +2127,13 @@ void CIrrDeviceLinux::pollJoysticks()
// Send an irrlicht joystick event once per ::run() even if no new data were received.
(void)postEventFromUser(info.persistentData);
#ifdef _IRR_COMPILE_WITH_X11_
if (event_received)
{
XResetScreenSaver(display);
}
#endif
}
#endif // _IRR_COMPILE_WITH_JOYSTICK_EVENTS_
}

View File

@ -171,16 +171,19 @@ void EditGPScreen::init()
if (edit->getResult())
{
bool reverse = edit->getTrack()->reverseAvailable() ?
edit->getReverse() : false;
if (m_action == "add")
{
m_gp->addTrack(edit->getTrack(), edit->getLaps(), edit->getReverse(),
m_selected);
m_gp->addTrack(edit->getTrack(), edit->getLaps(), reverse,
m_selected);
setSelected(m_selected + 1);
}
else if (m_action == "edit")
{
m_gp->editTrack(m_selected, edit->getTrack(), edit->getLaps(),
edit->getReverse());
reverse);
}
setModified(true);
}

View File

@ -291,6 +291,7 @@ void GrandPrixEditorScreen::onNewGPWithName(const stringw& newName)
{
m_selection->setName(newName);
m_selection->writeToFile();
setSelection(grand_prix_manager->getGrandPrix(m_selection->getId()));
}
else if (m_action == "new")
{