summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
authorAndrey Kleshchev <andreykproductengine@lindenlab.com>2021-07-21 22:15:12 +0300
committerAndrey Kleshchev <andreykproductengine@lindenlab.com>2021-07-21 22:15:12 +0300
commit84a0ae682ab18f0366528d7d6d449ab95a1fb3f9 (patch)
tree4be4fddbef4c7ad016d316fe348aec901e9f70ef /indra/newview
parentb388191062aec4cc1121b69e72c0cad856509b4d (diff)
SL-15611 Do not ignore mask modifiers for mouse-teleporting
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/llfloaterpreference.cpp7
-rw-r--r--indra/newview/llviewerinput.cpp19
-rw-r--r--indra/newview/llviewerinput.h3
3 files changed, 23 insertions, 6 deletions
diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp
index 7676487587..82f01fb747 100644
--- a/indra/newview/llfloaterpreference.cpp
+++ b/indra/newview/llfloaterpreference.cpp
@@ -3206,7 +3206,12 @@ void LLPanelPreferenceControls::setKeyBind(const std::string &control, EMouseCli
break;
}
}
- mConflictHandler[mode].registerControl(control, index, click, key, mask, true);
+ // At the moment 'ignore_mask' mask is mostly ignored, a placeholder
+ // Todo: implement it since it's preferable for things like teleport to match
+ // mask exactly but for things like running to ignore additional masks
+ // Ideally this needs representation in keybindings UI
+ bool ignore_mask = true;
+ mConflictHandler[mode].registerControl(control, index, click, key, mask, ignore_mask);
}
else if (!set)
{
diff --git a/indra/newview/llviewerinput.cpp b/indra/newview/llviewerinput.cpp
index 77b0c8e37b..a43b49a316 100644
--- a/indra/newview/llviewerinput.cpp
+++ b/indra/newview/llviewerinput.cpp
@@ -1068,7 +1068,7 @@ bool LLViewerInput::handleGlobalBindsMouse(EMouseClickType clicktype, MASK mask,
if (down)
{
S32 mode = getMode();
- res = scanMouse(mGlobalMouseBindings[mode], mGlobalMouseBindings[mode].size(), clicktype, mask, MOUSE_STATE_DOWN);
+ res = scanMouse(mGlobalMouseBindings[mode], mGlobalMouseBindings[mode].size(), clicktype, mask, MOUSE_STATE_DOWN, true);
}
return res;
}
@@ -1530,11 +1530,18 @@ BOOL LLViewerInput::handleMouse(LLWindow *window_impl, LLCoordGL pos, MASK mask,
return handled;
}
-bool LLViewerInput::scanMouse(const std::vector<LLMouseBinding> &binding, S32 binding_count, EMouseClickType mouse, MASK mask, EMouseState state) const
+bool LLViewerInput::scanMouse(
+ const std::vector<LLMouseBinding> &binding,
+ S32 binding_count,
+ EMouseClickType mouse,
+ MASK mask,
+ EMouseState state,
+ bool ignore_additional_masks
+) const
{
for (S32 i = 0; i < binding_count; i++)
{
- if (binding[i].mMouse == mouse && (binding[i].mMask & mask) == binding[i].mMask)
+ if (binding[i].mMouse == mouse && (ignore_additional_masks ? (binding[i].mMask & mask) == binding[i].mMask : binding[i].mMask == mask))
{
bool res = false;
switch (state)
@@ -1571,7 +1578,11 @@ bool LLViewerInput::scanMouse(EMouseClickType click, EMouseState state) const
bool res = false;
S32 mode = getMode();
MASK mask = gKeyboard->currentMask(TRUE);
- res = scanMouse(mMouseBindings[mode], mMouseBindings[mode].size(), click, mask, state);
+
+ // By default mouse clicks require exact mask
+ // Todo: support for mIgnoreMasks because some functions like teleports
+ // expect to be canceled, but for voice it's prefered to ignore mask.
+ res = scanMouse(mMouseBindings[mode], mMouseBindings[mode].size(), click, mask, state, false);
// no user defined actions found or those actions can't handle the key/button, handle control if nessesary
if (!res && agent_control_lbutton.canHandle(click, KEY_NONE, mask))
{
diff --git a/indra/newview/llviewerinput.h b/indra/newview/llviewerinput.h
index 8401f8cd95..ca70ac76bf 100644
--- a/indra/newview/llviewerinput.h
+++ b/indra/newview/llviewerinput.h
@@ -156,7 +156,8 @@ private:
S32 binding_count,
EMouseClickType mouse,
MASK mask,
- EMouseState state) const;
+ EMouseState state,
+ bool ignore_additional_masks) const;
S32 loadBindingMode(const LLViewerInput::KeyMode& keymode, S32 mode);
BOOL bindKey(const S32 mode, const KEY key, const MASK mask, const std::string& function_name);