diff options
-rw-r--r-- | indra/newview/app_settings/key_bindings.xml | 10 | ||||
-rw-r--r-- | indra/newview/llkeyconflict.cpp | 37 | ||||
-rw-r--r-- | indra/newview/llkeyconflict.h | 4 | ||||
-rw-r--r-- | indra/newview/llviewerinput.cpp | 12 | ||||
-rw-r--r-- | indra/newview/llviewerinput.h | 9 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/control_table_contents_media.xml | 4 |
6 files changed, 30 insertions, 46 deletions
diff --git a/indra/newview/app_settings/key_bindings.xml b/indra/newview/app_settings/key_bindings.xml index 5c32ed9afd..e527b7f1df 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 version="1"> +<keys xml_version="1"> <first_person> <binding key="A" mask="NONE" command="slide_left"/> <binding key="D" mask="NONE" command="slide_right"/> @@ -34,7 +34,7 @@ <binding key="" mask="NONE" mouse="MMB" command="toggle_voice"/> - <binding key="" mask="NONE" mouse="LMB" command="sript_trigger_lbutton"/> + <binding key="" mask="NONE" mouse="LMB" command="script_trigger_lbutton"/> </first_person> <third_person> <binding key="A" mask="NONE" command="turn_left"/> @@ -130,7 +130,7 @@ <binding key="" mask="NONE" mouse="MMB" command="toggle_voice"/> <binding key="" mask="NONE" mouse="LMB" command="walk_to"/> - <binding key="" mask="NONE" mouse="LMB" command="sript_trigger_lbutton"/> + <binding key="" mask="NONE" mouse="LMB" command="script_trigger_lbutton"/> </third_person> <sitting> <binding key="A" mask="ALT" command="spin_around_cw"/> @@ -229,7 +229,7 @@ <binding key="" mask="NONE" mouse="MMB" command="toggle_voice"/> - <binding key="" mask="NONE" mouse="LMB" command="sript_trigger_lbutton"/> + <binding key="" mask="NONE" mouse="LMB" command="script_trigger_lbutton"/> </sitting> <edit_avatar> <!--Avatar editing camera controls--> @@ -258,6 +258,6 @@ <binding key="" mask="NONE" mouse="MMB" command="toggle_voice"/> - <binding key="" mask="NONE" mouse="LMB" command="sript_trigger_lbutton"/> + <binding key="" mask="NONE" mouse="LMB" command="script_trigger_lbutton"/> </edit_avatar> </keys> diff --git a/indra/newview/llkeyconflict.cpp b/indra/newview/llkeyconflict.cpp index 3d3d652aa3..86f3e2fc37 100644 --- a/indra/newview/llkeyconflict.cpp +++ b/indra/newview/llkeyconflict.cpp @@ -378,7 +378,7 @@ bool LLKeyConflictHandler::loadFromSettings(const ESourceMode &load_mode, const } // verify version - if (keys.version < 1) + if (keys.xml_version < 1) { // Updating from a version that was not aware of LMouse bindings. // Assign defaults. @@ -389,7 +389,8 @@ bool LLKeyConflictHandler::loadFromSettings(const ESourceMode &load_mode, const LLKeyData data(CLICK_LEFT, KEY_NONE, MASK_NONE, true); type_data.mKeyBind.replaceKeyData(data, 0); - // Mark this mode for an update + // Mark this mode for an update, once user clicks 'OK' in preferences + // it should get saved mHasUnsavedChanges = true; } } @@ -432,12 +433,6 @@ 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) @@ -597,6 +592,8 @@ void LLKeyConflictHandler::saveToSettings(bool temporary) break; } + keys.xml_version.set(keybindings_xml_version, true); + if (temporary) { // write to temporary xml and use it for gViewerInput @@ -821,9 +818,9 @@ void LLKeyConflictHandler::resetToDefault(const std::string &control_name) resetToDefaultAndResolve(control_name, false); } -void LLKeyConflictHandler::resetToDefaults(ESourceMode mode) +void LLKeyConflictHandler::resetToDefaultsAndResolve() { - if (mode == MODE_SAVED_SETTINGS) + if (mLoadMode == MODE_SAVED_SETTINGS) { control_map_t::iterator iter = mControlsMap.begin(); control_map_t::iterator end = mControlsMap.end(); @@ -836,7 +833,7 @@ void LLKeyConflictHandler::resetToDefaults(ESourceMode mode) else { mControlsMap.clear(); - generatePlaceholders(mode); + generatePlaceholders(mLoadMode); mControlsMap.insert(mDefaultsMap.begin(), mDefaultsMap.end()); } @@ -847,7 +844,7 @@ void LLKeyConflictHandler::resetToDefaults() { if (!empty()) { - resetToDefaults(mLoadMode); + resetToDefaultsAndResolve(); } else { @@ -857,7 +854,7 @@ void LLKeyConflictHandler::resetToDefaults() // 3. We are loading 'current' only to replace it // but it is reliable and works Todo: consider optimizing. loadFromSettings(mLoadMode); - resetToDefaults(mLoadMode); + resetToDefaultsAndResolve(); } } @@ -890,7 +887,7 @@ void LLKeyConflictHandler::resetKeyboardBindings() void LLKeyConflictHandler::generatePlaceholders(ESourceMode load_mode) { - // These placeholds are meant to cause conflict resolution when user tries to assign same control somewhere else + // These placeholders are meant to cause conflict resolution when user tries to assign same control somewhere else // also this can be used to pre-record controls that should not conflict or to assign conflict groups/masks if (load_mode == MODE_FIRST_PERSON) @@ -1005,18 +1002,6 @@ bool LLKeyConflictHandler::removeConflicts(const LLKeyData &data, U32 conlict_ma S32 index = cntrl_iter->second.mKeyBind.findKeyData(data); if (index >= 0) { - if (cmp_mask != U32_MAX) - { - const LLKeyData cmp_data = cntrl_iter->second.mKeyBind.getKeyData(index); - if ((cmp_mask & CONFLICT_LMOUSE) == 0 - && cmp_data.mMouse == CLICK_LEFT - && cmp_data.mMask == MASK_NONE - && cmp_data.mKey == KEY_NONE) - { - // Does not conflict - continue; - } - } if (cntrl_iter->second.mAssignable) { // Potentially we can have multiple conflict flags conflicting diff --git a/indra/newview/llkeyconflict.h b/indra/newview/llkeyconflict.h index e60d6d27b7..23c1adf1e4 100644 --- a/indra/newview/llkeyconflict.h +++ b/indra/newview/llkeyconflict.h @@ -138,11 +138,11 @@ public: bool hasUnsavedChanges() const { return mHasUnsavedChanges; } void setLoadMode(ESourceMode mode) { mLoadMode = mode; } - ESourceMode getLoadMode() { return mLoadMode; } + ESourceMode getLoadMode() const { return mLoadMode; } private: void resetToDefaultAndResolve(const std::string &control_name, bool ignore_conflicts); - void resetToDefaults(ESourceMode mode); + void resetToDefaultsAndResolve(); // at the moment these kind of control is not savable, but takes part in conflict resolution void registerTemporaryControl(const std::string &control_name, EMouseClickType mouse_ind, KEY key, MASK mask, U32 conflict_mask); diff --git a/indra/newview/llviewerinput.cpp b/indra/newview/llviewerinput.cpp index dff199d791..1ca7d8024a 100644 --- a/indra/newview/llviewerinput.cpp +++ b/indra/newview/llviewerinput.cpp @@ -836,7 +836,7 @@ bool voice_follow_key(EKeystate s) return false; } -bool sript_trigger_lbutton(EKeystate s) +bool script_trigger_lbutton(EKeystate s) { // Check for script overriding/expecting left mouse button. // Note that this does not pass event further and depends onto mouselook. @@ -848,8 +848,6 @@ bool sript_trigger_lbutton(EKeystate s) switch (s) { case KEYSTATE_DOWN: - // at the moment sript_trigger_lbutton is only intended for mouselook - // but handling other modes just in case if (mouselook) { gAgent.setControlFlags(AGENT_CONTROL_ML_LBUTTON_DOWN); @@ -947,7 +945,7 @@ REGISTER_KEYBOARD_ACTION("teleport_to", teleport_to); REGISTER_KEYBOARD_ACTION("walk_to", walk_to); REGISTER_KEYBOARD_ACTION("toggle_voice", toggle_voice); REGISTER_KEYBOARD_ACTION("voice_follow_key", voice_follow_key); -REGISTER_KEYBOARD_ACTION(script_mouse_handler_name, sript_trigger_lbutton); +REGISTER_KEYBOARD_ACTION(script_mouse_handler_name, script_trigger_lbutton); #undef REGISTER_KEYBOARD_ACTION LLViewerInput::LLViewerInput() @@ -1213,7 +1211,7 @@ LLViewerInput::Keys::Keys() third_person("third_person"), sitting("sitting"), edit_avatar("edit_avatar"), - version("version", 0) + xml_version("xml_version", 0) {} void LLViewerInput::resetBindings() @@ -1243,7 +1241,7 @@ S32 LLViewerInput::loadBindingsXML(const std::string& filename) binding_count += loadBindingMode(keys.edit_avatar, MODE_EDIT_AVATAR); // verify version - if (keys.version < 1) + if (keys.xml_version < 1) { // updating from a version that was not aware of LMouse bindings for (S32 i = 0; i < MODE_COUNT; i++) @@ -1602,7 +1600,7 @@ void LLViewerInput::scanMouse() } } -bool LLViewerInput::isMouseBindUsed(const EMouseClickType mouse, const MASK mask, const S32 mode) +bool LLViewerInput::isMouseBindUsed(const EMouseClickType mouse, const MASK mask, const S32 mode) const { S32 size = mMouseBindings[mode].size(); for (S32 index = 0; index < size; index++) diff --git a/indra/newview/llviewerinput.h b/indra/newview/llviewerinput.h index 5340ec5fd0..b0c53b23ee 100644 --- a/indra/newview/llviewerinput.h +++ b/indra/newview/llviewerinput.h @@ -31,7 +31,8 @@ #include "llinitparam.h" const S32 MAX_KEY_BINDINGS = 128; // was 60 -const std::string script_mouse_handler_name = "sript_trigger_lbutton"; +const S32 keybindings_xml_version = 1; +const std::string script_mouse_handler_name = "script_trigger_lbutton"; class LLNamedFunction { @@ -101,7 +102,7 @@ public: third_person, sitting, edit_avatar; - Optional<U32> version; + Optional<S32> xml_version; // 'xml', because 'version' appears to be reserved Keys(); }; @@ -125,8 +126,8 @@ public: BOOL handleMouse(LLWindow *window_impl, LLCoordGL pos, MASK mask, EMouseClickType clicktype, BOOL down); void scanMouse(); - bool isMouseBindUsed(const EMouseClickType mouse, const MASK mask, const S32 mode); - bool isLMouseHandlingDefault(const S32 mode) { return mLMouseDefaultHandling[mode]; } + bool isMouseBindUsed(const EMouseClickType mouse, const MASK mask, const S32 mode) const; + bool isLMouseHandlingDefault(const S32 mode) const { return mLMouseDefaultHandling[mode]; } private: bool scanKey(const std::vector<LLKeyboardBinding> &binding, diff --git a/indra/newview/skins/default/xui/en/control_table_contents_media.xml b/indra/newview/skins/default/xui/en/control_table_contents_media.xml index a97c45dd6f..43e8d730cd 100644 --- a/indra/newview/skins/default/xui/en/control_table_contents_media.xml +++ b/indra/newview/skins/default/xui/en/control_table_contents_media.xml @@ -74,8 +74,8 @@ value="Start Gesture" /> </rows> <rows - name="sript_trigger_lbutton" - value="sript_trigger_lbutton"> + name="script_trigger_lbutton" + value="script_trigger_lbutton"> <columns column="lst_action" font="SansSerif" |