From 2a4dea528f670b9bb1f77ef27a8a1dd16603d114 Mon Sep 17 00:00:00 2001 From: Jacek Antonelli Date: Fri, 15 Aug 2008 23:45:50 -0500 Subject: Second Life viewer sources 1.20.7 --- linden/indra/newview/llviewerjoystick.cpp | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'linden/indra/newview/llviewerjoystick.cpp') diff --git a/linden/indra/newview/llviewerjoystick.cpp b/linden/indra/newview/llviewerjoystick.cpp index e9690f8..cf9d8a1 100644 --- a/linden/indra/newview/llviewerjoystick.cpp +++ b/linden/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 -- cgit v1.1