summaryrefslogtreecommitdiff
path: root/indra/newview/llviewerinput.cpp
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/llviewerinput.cpp
parent76a1b181e6fd6ddaf89b53eab4de80477e11fa3d (diff)
SL-16976 SL-443 Keybindings: Backward compatibility #3
Diffstat (limited to 'indra/newview/llviewerinput.cpp')
-rw-r--r--indra/newview/llviewerinput.cpp49
1 files changed, 49 insertions, 0 deletions
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;