summaryrefslogtreecommitdiff
path: root/indra/newview/llviewerjoystick.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llviewerjoystick.cpp')
-rw-r--r--indra/newview/llviewerjoystick.cpp30
1 files changed, 30 insertions, 0 deletions
diff --git a/indra/newview/llviewerjoystick.cpp b/indra/newview/llviewerjoystick.cpp
index c109ca10a0..1717153810 100644
--- a/indra/newview/llviewerjoystick.cpp
+++ b/indra/newview/llviewerjoystick.cpp
@@ -228,8 +228,38 @@ void LLViewerJoystick::init(bool autoenable)
mDriverState = JDS_UNINITIALIZED;
}
}
+
+ // Autoenable the joystick for recognized devices if nothing was connected previously
+ if (!autoenable)
+ {
+ autoenable = gSavedSettings.getString("JoystickInitialized").empty() ? true : false;
+ }
updateEnabled(autoenable);
+ if (mDriverState == JDS_INITIALIZED)
+ {
+ // A Joystick device is plugged in
+ if (isLikeSpaceNavigator())
+ {
+ // It's a space navigator, we have defaults for it.
+ if (gSavedSettings.getString("JoystickInitialized") != "SpaceNavigator")
+ {
+ // Only set the defaults if we haven't already (in case they were overridden)
+ setSNDefaults();
+ gSavedSettings.setString("JoystickInitialized", "SpaceNavigator");
+ }
+ }
+ else
+ {
+ // It's not a Space Navigator
+ gSavedSettings.setString("JoystickInitialized", "UnknownDevice");
+ }
+ }
+ else
+ {
+ // No device connected, don't change any settings
+ }
+
llinfos << "ndof: mDriverState=" << mDriverState << "; mNdofDev="
<< mNdofDev << "; libinit=" << libinit << llendl;
#endif