summaryrefslogtreecommitdiff
path: root/indra/llcommon/llkeybind.cpp
diff options
context:
space:
mode:
authorandreykproductengine <andreykproductengine@lindenlab.com>2019-11-10 19:06:03 +0200
committerAndrey Kleshchev <andreykproductengine@lindenlab.com>2020-06-23 14:50:05 +0300
commit5568018bd20a43c30caca0c6288e63bfae29a2e3 (patch)
treea5d81dbebe5601230d95b8a1c45dc1b2a577e6ca /indra/llcommon/llkeybind.cpp
parente7d383be8a9734a5008690b8a7e1b179e2f2a718 (diff)
SL-6109 Better key and table localization support and fix for key-replacing
Diffstat (limited to 'indra/llcommon/llkeybind.cpp')
-rw-r--r--indra/llcommon/llkeybind.cpp31
1 files changed, 6 insertions, 25 deletions
diff --git a/indra/llcommon/llkeybind.cpp b/indra/llcommon/llkeybind.cpp
index 46a3230240..ecfc289cb3 100644
--- a/indra/llcommon/llkeybind.cpp
+++ b/indra/llcommon/llkeybind.cpp
@@ -340,43 +340,24 @@ bool LLKeyBind::addKeyData(const LLKeyData& data)
void LLKeyBind::replaceKeyData(EMouseClickType mouse, KEY key, MASK mask, bool ignore, U32 index)
{
- if (mouse != CLICK_NONE || key != KEY_NONE )
- {
- // if both click and key are none, we are inserting a placeholder, we don't want to reset anything
- // otherwise reset identical key
- for (data_vector_t::iterator iter = mData.begin(); iter != mData.end(); iter++)
- {
- if (iter->mKey == key
- && iter->mMouse == mouse
- && iter->mIgnoreMasks == ignore
- && (iter->mIgnoreMasks || iter->mMask == mask))
- {
- iter->reset();
- break;
- }
- }
- }
- if (mData.size() > index)
- {
- mData[index] = LLKeyData(mouse, key, mask, ignore);
- }
- else
- {
- mData.push_back(LLKeyData(mouse, key, mask, ignore));
- }
+ replaceKeyData(LLKeyData(mouse, key, mask, ignore), index);
}
void LLKeyBind::replaceKeyData(const LLKeyData& data, U32 index)
{
if (!data.isEmpty())
{
+ // if both click and key are none (isEmpty()), we are inserting a placeholder, we don't want to reset anything
+ // otherwise reset identical key
for (data_vector_t::iterator iter = mData.begin(); iter != mData.end(); iter++)
{
if (iter->mKey == data.mKey
&& iter->mMouse == data.mMouse
&& iter->mIgnoreMasks == data.mIgnoreMasks
- && (iter->mIgnoreMasks || iter->mMask == data.mMask))
+ && iter->mMask == data.mMask)
{
+ // Replacing only fully equal combinations even in case 'ignore' is set
+ // Reason: Simplicity and user might decide to do a 'move' command as W and Shift+Ctrl+W, and 'run' as Shift+W
iter->reset();
break;
}