summaryrefslogtreecommitdiff
path: root/indra/newview/llfloaterjoystick.cpp
diff options
context:
space:
mode:
authornat-goodspeed <nat@lindenlab.com>2024-09-05 15:40:12 -0400
committerGitHub <noreply@github.com>2024-09-05 15:40:12 -0400
commit04568da18d2261f3f7b851cf5341b766c9648204 (patch)
tree83d5db1c173636bb77ebb33e860fac77ab5d79e8 /indra/newview/llfloaterjoystick.cpp
parent18d81e20f0b0044c16615953d7b69d7fb34d3449 (diff)
parentff2d79906ccef217194d5d9ec9d7025db03592a8 (diff)
Merge pull request #2513 from secondlife/lua-merge-dev
Merge develop branch into Lua project branch.
Diffstat (limited to 'indra/newview/llfloaterjoystick.cpp')
-rw-r--r--indra/newview/llfloaterjoystick.cpp33
1 files changed, 26 insertions, 7 deletions
diff --git a/indra/newview/llfloaterjoystick.cpp b/indra/newview/llfloaterjoystick.cpp
index 7db3621a4b..68b11ec92b 100644
--- a/indra/newview/llfloaterjoystick.cpp
+++ b/indra/newview/llfloaterjoystick.cpp
@@ -93,8 +93,9 @@ BOOL CALLBACK di8_list_devices_callback(LPCDIDEVICEINSTANCE device_instance_ptr,
#endif
LLFloaterJoystick::LLFloaterJoystick(const LLSD& data)
- : LLFloater(data),
- mHasDeviceList(false)
+ : LLFloater(data)
+ , mHasDeviceList(false)
+ , mJoystickInitialized(false)
{
if (!LLViewerJoystick::getInstance()->isJoystickInitialized())
{
@@ -108,7 +109,10 @@ void LLFloaterJoystick::draw()
{
LLViewerJoystick* joystick(LLViewerJoystick::getInstance());
bool joystick_inited = joystick->isJoystickInitialized();
- if (joystick_inited != mHasDeviceList)
+ if (!mHasDeviceList
+ || mJoystickInitialized != joystick_inited
+ || (joystick->isDeviceUUIDSet() && joystick->getDeviceUUID().asUUID() != mCurrentDeviceId)
+ || (!joystick->isDeviceUUIDSet() && mCurrentDeviceId.notNull()))
{
refreshListOfDevices();
}
@@ -290,15 +294,16 @@ void LLFloaterJoystick::refreshListOfDevices()
mHasDeviceList = true;
}
- bool is_device_id_set = LLViewerJoystick::getInstance()->isDeviceUUIDSet();
+ LLViewerJoystick* joystick = LLViewerJoystick::getInstance();
+ bool is_device_id_set = joystick->isDeviceUUIDSet();
- if (LLViewerJoystick::getInstance()->isJoystickInitialized() &&
+ if (joystick->isJoystickInitialized() &&
(!mHasDeviceList || !is_device_id_set))
{
#if LL_WINDOWS && !LL_MESA_HEADLESS
LL_WARNS() << "NDOF connected to device without using SL provided handle" << LL_ENDL;
#endif
- std::string desc = LLViewerJoystick::getInstance()->getDescription();
+ std::string desc = joystick->getDescription();
if (!desc.empty())
{
LLSD value = LLSD::Integer(1); // value for selection
@@ -311,11 +316,13 @@ void LLFloaterJoystick::refreshListOfDevices()
{
if (is_device_id_set)
{
- LLSD guid = LLViewerJoystick::getInstance()->getDeviceUUID();
+ LLSD guid = joystick->getDeviceUUID();
+ mCurrentDeviceId = guid.asUUID();
mJoysticksCombo->selectByValue(guid);
}
else
{
+ mCurrentDeviceId.setNull();
mJoysticksCombo->selectByValue(LLSD::Integer(1));
}
}
@@ -323,6 +330,18 @@ void LLFloaterJoystick::refreshListOfDevices()
{
mJoysticksCombo->selectByValue(LLSD::Integer(0));
}
+
+ // Update tracking
+ if (is_device_id_set)
+ {
+ LLSD guid = joystick->getDeviceUUID();
+ mCurrentDeviceId = guid.asUUID();
+ }
+ else
+ {
+ mCurrentDeviceId.setNull();
+ }
+ mJoystickInitialized = joystick->isJoystickInitialized();
}
void LLFloaterJoystick::cancel()