diff options
author | andreykproductengine <andreykproductengine@lindenlab.com> | 2019-07-18 19:18:02 +0300 |
---|---|---|
committer | andreykproductengine <andreykproductengine@lindenlab.com> | 2019-07-18 19:18:02 +0300 |
commit | a0bf70b41d84c50da081917f0ec842cca973f45b (patch) | |
tree | 575f309eda23c32bcfcfee9182e4248b543d779c /indra/newview | |
parent | ba2429163af92b510d26444bb33f9f9d941c6dda (diff) |
SL-11592 [Mac] Ability to bind extra mouse buttons for push to talk
Diffstat (limited to 'indra/newview')
-rw-r--r-- | indra/newview/llfloaterpreference.cpp | 47 | ||||
-rw-r--r-- | indra/newview/llviewerwindow.cpp | 4 |
2 files changed, 27 insertions, 24 deletions
diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp index 5f74aaa5dd..27a597a631 100644 --- a/indra/newview/llfloaterpreference.cpp +++ b/indra/newview/llfloaterpreference.cpp @@ -217,7 +217,9 @@ BOOL LLVoiceSetKeyDialog::handleKeyHere(KEY key, MASK mask) BOOL LLVoiceSetKeyDialog::handleAnyMouseClick(S32 x, S32 y, MASK mask, LLMouseHandler::EClickType clicktype, BOOL down) { BOOL result = FALSE; - if (down && clicktype >= 3 && mask == 0) + if (down + && (clicktype == LLMouseHandler::CLICK_MIDDLE || clicktype == LLMouseHandler::CLICK_BUTTON4 || clicktype == LLMouseHandler::CLICK_BUTTON5) + && mask == 0) { mParent->setMouse(clicktype); result = TRUE; @@ -1716,29 +1718,30 @@ void LLFloaterPreference::setKey(KEY key) void LLFloaterPreference::setMouse(LLMouseHandler::EClickType click) { - if (click >= LLMouseHandler::CLICK_MIDDLE) + std::string bt_name; + std::string ctrl_value; + switch (click) + { + case LLMouseHandler::CLICK_MIDDLE: + bt_name = "middle_mouse"; + ctrl_value = MIDDLE_MOUSE_CV; + break; + case LLMouseHandler::CLICK_BUTTON4: + bt_name = "button4_mouse"; + ctrl_value = MOUSE_BUTTON_4_CV; + break; + case LLMouseHandler::CLICK_BUTTON5: + bt_name = "button5_mouse"; + ctrl_value = MOUSE_BUTTON_5_CV; + break; + default: + break; + } + + if (!ctrl_value.empty()) { - std::string bt_name; - std::string ctrl_value; - switch (click) - { - case LLMouseHandler::CLICK_MIDDLE: - bt_name = "middle_mouse"; - ctrl_value = MIDDLE_MOUSE_CV; - break; - case LLMouseHandler::CLICK_BUTTON4: - bt_name = "button4_mouse"; - ctrl_value = MOUSE_BUTTON_4_CV; - break; - case LLMouseHandler::CLICK_BUTTON5: - bt_name = "button5_mouse"; - ctrl_value = MOUSE_BUTTON_5_CV; - break; - default: - break; - } - // We are using text names for readability LLUICtrl* p2t_line_editor = getChild<LLUICtrl>("modifier_combo"); + // We are using text control names for readability and compatibility with voice p2t_line_editor->setControlValue(ctrl_value); LLPanel* advanced_preferences = dynamic_cast<LLPanel*>(p2t_line_editor->getParent()); if (advanced_preferences) diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index 643a011ebc..9afe85a6f5 100644 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -1288,11 +1288,11 @@ BOOL LLViewerWindow::handleOtherMouse(LLWindow *window, LLCoordGL pos, MASK mask { switch (button) { - case 1: + case 4: LLVoiceClient::getInstance()->updateMouseState(LLMouseHandler::CLICK_BUTTON4, down); handleAnyMouseClick(window, pos, mask, LLMouseHandler::CLICK_BUTTON4, down); break; - case 2: + case 5: LLVoiceClient::getInstance()->updateMouseState(LLMouseHandler::CLICK_BUTTON5, down); handleAnyMouseClick(window, pos, mask, LLMouseHandler::CLICK_BUTTON5, down); break; |