Change to reset mouse timer connections on device removal. Don't erase old recent profile list on program exit.

This commit is contained in:
Travis Nickles
2014-02-28 15:31:38 -06:00
parent 7a6e3b2add
commit bbf42b5e80
5 changed files with 45 additions and 8 deletions

View File

@@ -372,6 +372,34 @@ void InputDaemon::quit()
eventWorker = 0;
}
void InputDaemon::resetMouseTimers()
{
if (joysticks->size() > 0)
{
#ifdef USE_SDL_2
QHashIterator<SDL_JoystickID, InputDevice*> iter(*joysticks);
#else
QHashIterator<int, InputDevice*> iter(*joysticks);
#endif
while (iter.hasNext())
{
InputDevice *joystick = iter.next().value();
if (joystick && joystick->getNumberButtons() > 0)
{
// Find first button of first joystick and use it for the
// psuedo-static QTimer calls.
SetJoystick *set = joystick->getActiveSetJoystick();
JoyButton *button = set->getJoyButton(0);
if (button)
{
set->getJoyButton(0)->establishMouseTimerConnections();
iter.toBack();
}
}
}
}
}
#ifdef USE_SDL_2
void InputDaemon::refreshMapping(QString mapping, InputDevice *device)
{
@@ -428,6 +456,7 @@ void InputDaemon::removeDevice(InputDevice *device)
trackjoysticks.remove(deviceID);
trackcontrollers.remove(deviceID);
resetMouseTimers();
refreshIndexes();
emit deviceRemoved(deviceID);