summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
authorAndrey Kleshchev <andreykproductengine@lindenlab.com>2022-03-04 22:24:59 +0200
committerAndrey Kleshchev <andreykproductengine@lindenlab.com>2022-03-04 22:27:38 +0200
commitfc90fee5087c91bb8c4c93b5e9508706e46bd409 (patch)
treeeb27f26bcd2c0effc19d843f919fd12da85947ed /indra/newview
parent76a1b181e6fd6ddaf89b53eab4de80477e11fa3d (diff)
SL-16976 SL-443 Keybindings: Backward compatibility #3
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/llkeyconflict.cpp17
-rw-r--r--indra/newview/llviewerinput.cpp49
2 files changed, 49 insertions, 17 deletions
diff --git a/indra/newview/llkeyconflict.cpp b/indra/newview/llkeyconflict.cpp
index 4c58c9e68c..d3ba18525b 100644
--- a/indra/newview/llkeyconflict.cpp
+++ b/indra/newview/llkeyconflict.cpp
@@ -376,23 +376,6 @@ bool LLKeyConflictHandler::loadFromSettings(const ESourceMode &load_mode, const
LL_ERRS() << "Not implememted mode " << load_mode << LL_ENDL;
break;
}
-
- // verify version
- if (keys.xml_version < 1)
- {
- // Updating from a version that was not aware of LMouse bindings.
- // Assign defaults.
- //
- // mDefaultsMap is always going to have correct version so
- // registerControl is usable, but using 'destination' just in case.
- LLKeyConflict &type_data = (*destination)[script_mouse_handler_name];
- LLKeyData data(CLICK_LEFT, KEY_NONE, MASK_NONE, true);
- type_data.mKeyBind.replaceKeyData(data, 0);
-
- // Mark this mode for an update, once user clicks 'OK' in preferences
- // it should get saved
- mHasUnsavedChanges = true;
- }
}
return res;
}
diff --git a/indra/newview/llviewerinput.cpp b/indra/newview/llviewerinput.cpp
index 1a08b1a56c..43b9cd90bd 100644
--- a/indra/newview/llviewerinput.cpp
+++ b/indra/newview/llviewerinput.cpp
@@ -1371,6 +1371,55 @@ S32 LLViewerInput::loadBindingsXML(const std::string& filename)
{
mLMouseDefaultHandling[i] = true;
}
+
+ // fix missing values
+ KeyBinding mouse_binding;
+ mouse_binding.key = "";
+ mouse_binding.mask = "NONE";
+ mouse_binding.mouse = "LMB";
+ mouse_binding.command = script_mouse_handler_name;
+
+ if (keys.third_person.isProvided())
+ {
+ keys.third_person.bindings.add(mouse_binding);
+ }
+
+ if (keys.first_person.isProvided())
+ {
+ keys.first_person.bindings.add(mouse_binding);
+ }
+
+ if (keys.sitting.isProvided())
+ {
+ keys.sitting.bindings.add(mouse_binding);
+ }
+
+ if (keys.edit_avatar.isProvided())
+ {
+ keys.edit_avatar.bindings.add(mouse_binding);
+ }
+
+ // fix version
+ keys.xml_version.set(keybindings_xml_version, true);
+
+ // Write the resulting XML to file
+ LLXMLNodePtr output_node = new LLXMLNode("keys", false);
+ LLXUIParser write_parser;
+ write_parser.writeXUI(output_node, keys);
+
+ if (!output_node->isNull())
+ {
+ // file in app_settings is supposed to be up to date
+ // this is only for the file from user_settings
+ LL_INFOS("ViewerInput") << "Updating file " << filename << " to a newer version" << LL_ENDL;
+ LLFILE *fp = LLFile::fopen(filename, "w");
+ if (fp != NULL)
+ {
+ LLXMLNode::writeHeaderToFile(fp);
+ output_node->writeToFile(fp);
+ fclose(fp);
+ }
+ }
}
}
return binding_count;