summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
Diffstat (limited to 'indra')
-rw-r--r--indra/newview/app_settings/key_bindings.xml2
-rw-r--r--indra/newview/llkeyconflict.cpp22
-rw-r--r--indra/newview/llkeyconflict.h4
-rw-r--r--indra/newview/llviewerinput.cpp13
-rw-r--r--indra/newview/llviewerinput.h2
5 files changed, 38 insertions, 5 deletions
diff --git a/indra/newview/app_settings/key_bindings.xml b/indra/newview/app_settings/key_bindings.xml
index ffc1b2e7cc..5c32ed9afd 100644
--- a/indra/newview/app_settings/key_bindings.xml
+++ b/indra/newview/app_settings/key_bindings.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
-<keys>
+<keys version="1">
<first_person>
<binding key="A" mask="NONE" command="slide_left"/>
<binding key="D" mask="NONE" command="slide_right"/>
diff --git a/indra/newview/llkeyconflict.cpp b/indra/newview/llkeyconflict.cpp
index 58a740e16a..3d3d652aa3 100644
--- a/indra/newview/llkeyconflict.cpp
+++ b/indra/newview/llkeyconflict.cpp
@@ -376,6 +376,22 @@ bool LLKeyConflictHandler::loadFromSettings(const ESourceMode &load_mode, const
LL_ERRS() << "Not implememted mode " << load_mode << LL_ENDL;
break;
}
+
+ // verify version
+ if (keys.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
+ mHasUnsavedChanges = true;
+ }
}
return res;
}
@@ -416,6 +432,12 @@ void LLKeyConflictHandler::loadFromSettings(ESourceMode load_mode)
}
}
mLoadMode = load_mode;
+
+ if (mHasUnsavedChanges)
+ {
+ // We ended up with some settings assigned due to changes in version, resave
+ saveToSettings(false);
+ }
}
void LLKeyConflictHandler::saveToSettings(bool temporary)
diff --git a/indra/newview/llkeyconflict.h b/indra/newview/llkeyconflict.h
index e78d2fa33b..e60d6d27b7 100644
--- a/indra/newview/llkeyconflict.h
+++ b/indra/newview/llkeyconflict.h
@@ -129,14 +129,14 @@ public:
// resets current mode to defaults
void resetToDefaults();
- bool empty() { return mControlsMap.empty(); }
+ bool empty() const { return mControlsMap.empty(); }
void clear();
// reloads bindings from last valid user's xml or from default xml
// to keyboard's handler
static void resetKeyboardBindings();
- bool hasUnsavedChanges() { return mHasUnsavedChanges; }
+ bool hasUnsavedChanges() const { return mHasUnsavedChanges; }
void setLoadMode(ESourceMode mode) { mLoadMode = mode; }
ESourceMode getLoadMode() { return mLoadMode; }
diff --git a/indra/newview/llviewerinput.cpp b/indra/newview/llviewerinput.cpp
index f163e871c3..dff199d791 100644
--- a/indra/newview/llviewerinput.cpp
+++ b/indra/newview/llviewerinput.cpp
@@ -1212,7 +1212,8 @@ LLViewerInput::Keys::Keys()
: first_person("first_person"),
third_person("third_person"),
sitting("sitting"),
- edit_avatar("edit_avatar")
+ edit_avatar("edit_avatar"),
+ version("version", 0)
{}
void LLViewerInput::resetBindings()
@@ -1240,6 +1241,16 @@ S32 LLViewerInput::loadBindingsXML(const std::string& filename)
binding_count += loadBindingMode(keys.third_person, MODE_THIRD_PERSON);
binding_count += loadBindingMode(keys.sitting, MODE_SITTING);
binding_count += loadBindingMode(keys.edit_avatar, MODE_EDIT_AVATAR);
+
+ // verify version
+ if (keys.version < 1)
+ {
+ // updating from a version that was not aware of LMouse bindings
+ for (S32 i = 0; i < MODE_COUNT; i++)
+ {
+ mLMouseDefaultHandling[i] = true;
+ }
+ }
}
return binding_count;
}
diff --git a/indra/newview/llviewerinput.h b/indra/newview/llviewerinput.h
index 32dd3c0e28..5340ec5fd0 100644
--- a/indra/newview/llviewerinput.h
+++ b/indra/newview/llviewerinput.h
@@ -101,7 +101,7 @@ public:
third_person,
sitting,
edit_avatar;
-
+ Optional<U32> version;
Keys();
};