From 22f56cce920f7c3a7e0e5badf57df654870566c3 Mon Sep 17 00:00:00 2001 From: Armin Weatherwax Date: Thu, 1 Jul 2010 12:12:48 +0200 Subject: retry joystick detection when opening prefs-input-joystick --- linden/indra/newview/llfloaterjoystick.cpp | 4 ++++ linden/indra/newview/llviewerjoystick.cpp | 6 ++++-- linden/indra/newview/llviewerjoystick.h | 2 +- 3 files changed, 9 insertions(+), 3 deletions(-) (limited to 'linden/indra') diff --git a/linden/indra/newview/llfloaterjoystick.cpp b/linden/indra/newview/llfloaterjoystick.cpp index e581167..05e0564 100644 --- a/linden/indra/newview/llfloaterjoystick.cpp +++ b/linden/indra/newview/llfloaterjoystick.cpp @@ -57,6 +57,10 @@ LLFloaterJoystick::LLFloaterJoystick(const LLSD& data) void LLFloaterJoystick::draw() { bool joystick_inited = LLViewerJoystick::getInstance()->isJoystickInitialized(); + if (!joystick_inited) + { + joystick_inited = LLViewerJoystick::getInstance()->init(false); + } childSetEnabled("enable_joystick", joystick_inited); childSetEnabled("joystick_type", joystick_inited); std::string desc = LLViewerJoystick::getInstance()->getDescription(); diff --git a/linden/indra/newview/llviewerjoystick.cpp b/linden/indra/newview/llviewerjoystick.cpp index d955a80..617ef13 100644 --- a/linden/indra/newview/llviewerjoystick.cpp +++ b/linden/indra/newview/llviewerjoystick.cpp @@ -175,10 +175,11 @@ LLViewerJoystick::~LLViewerJoystick() } // ----------------------------------------------------------------------------- -void LLViewerJoystick::init(bool autoenable) +bool LLViewerJoystick::init(bool autoenable) { -#if LIB_NDOF + static bool libinit = false; +#if LIB_NDOF mDriverState = JDS_INITIALIZING; if (libinit == false) @@ -275,6 +276,7 @@ void LLViewerJoystick::init(bool autoenable) llinfos << "ndof: mDriverState=" << mDriverState << "; mNdofDev=" << mNdofDev << "; libinit=" << libinit << llendl; #endif + return libinit; } // ----------------------------------------------------------------------------- diff --git a/linden/indra/newview/llviewerjoystick.h b/linden/indra/newview/llviewerjoystick.h index 6be9db3..3718831 100644 --- a/linden/indra/newview/llviewerjoystick.h +++ b/linden/indra/newview/llviewerjoystick.h @@ -55,7 +55,7 @@ public: LLViewerJoystick(); virtual ~LLViewerJoystick(); - void init(bool autoenable); + bool init(bool autoenable); void updateStatus(); void scanJoystick(); void moveObjects(bool reset = false); -- cgit v1.1