diff options
| author | Andrey Lihatskiy <alihatskiy@productengine.com> | 2020-06-24 00:08:35 +0300 |
|---|---|---|
| committer | Andrey Lihatskiy <alihatskiy@productengine.com> | 2020-06-24 00:08:35 +0300 |
| commit | b8127f80c7e305b0c5af7a824b45c81432a8e6b8 (patch) | |
| tree | ed34b16459488ce3e6293f84447f04c31ce4887a /indra/newview/llvoiceclient.cpp | |
| parent | aabb0bbc49aa15b100dc8c2cbf286202cb084646 (diff) | |
| parent | 05f3287512557cd4cb41de7a8fe3f5171a48481d (diff) | |
Merge branch 'DRTVWR-501-maint' into DRTVWR-503-maint
# Conflicts:
# indra/llcommon/llkeybind.cpp
# indra/llcommon/llkeybind.h
Diffstat (limited to 'indra/newview/llvoiceclient.cpp')
| -rw-r--r-- | indra/newview/llvoiceclient.cpp | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/indra/newview/llvoiceclient.cpp b/indra/newview/llvoiceclient.cpp index fca8de7410..cc590fc947 100644 --- a/indra/newview/llvoiceclient.cpp +++ b/indra/newview/llvoiceclient.cpp @@ -200,6 +200,8 @@ const LLVoiceVersionInfo LLVoiceClient::getVersion() void LLVoiceClient::updateSettings() { setUsePTT(gSavedSettings.getBOOL("PTTCurrentlyEnabled")); + std::string keyString = gSavedSettings.getString("PushToTalkButton"); + setPTTKey(keyString); setPTTIsToggle(gSavedSettings.getBOOL("PushToTalkToggle")); mDisableMic = gSavedSettings.getBOOL("VoiceDisableMic"); @@ -635,6 +637,32 @@ bool LLVoiceClient::getPTTIsToggle() return mPTTIsToggle; } +void LLVoiceClient::setPTTKey(std::string &key) +{ + // Value is stored as text for readability + if(key == "MiddleMouse") + { + mPTTMouseButton = LLMouseHandler::CLICK_MIDDLE; + } + else if(key == "MouseButton4") + { + mPTTMouseButton = LLMouseHandler::CLICK_BUTTON4; + } + else if (key == "MouseButton5") + { + mPTTMouseButton = LLMouseHandler::CLICK_BUTTON5; + } + else + { + mPTTMouseButton = 0; + if(!LLKeyboard::keyFromString(key, &mPTTKey)) + { + // If the call failed, don't match any key. + key = KEY_NONE; + } + } +} + void LLVoiceClient::inputUserControlState(bool down) { if(mPTTIsToggle) @@ -655,6 +683,43 @@ void LLVoiceClient::toggleUserPTTState(void) setUserPTTState(!getUserPTTState()); } +void LLVoiceClient::keyDown(KEY key, MASK mask) +{ + if (gKeyboard->getKeyRepeated(key)) + { + // ignore auto-repeat keys + return; + } + + if (mPTTMouseButton == 0 && LLAgent::isActionAllowed("speak") && (key == mPTTKey)) + { + bool down = gKeyboard->getKeyDown(mPTTKey); + if (down) + { + inputUserControlState(down); + } + } + +} +void LLVoiceClient::keyUp(KEY key, MASK mask) +{ + if (mPTTMouseButton == 0 && (key == mPTTKey)) + { + bool down = gKeyboard->getKeyDown(mPTTKey); + if (!down) + { + inputUserControlState(down); + } + } +} +void LLVoiceClient::updateMouseState(S32 click, bool down) +{ + if(mPTTMouseButton == click && LLAgent::isActionAllowed("speak")) + { + inputUserControlState(down); + } +} + //------------------------------------------- // nearby speaker accessors |
