diff options
Diffstat (limited to 'indra')
-rw-r--r-- | indra/newview/llspeakbutton.cpp | 15 | ||||
-rw-r--r-- | indra/newview/llspeakbutton.h | 6 | ||||
-rw-r--r-- | indra/newview/llvoiceclient.cpp | 45 | ||||
-rw-r--r-- | indra/newview/llvoiceclient.h | 1 |
4 files changed, 30 insertions, 37 deletions
diff --git a/indra/newview/llspeakbutton.cpp b/indra/newview/llspeakbutton.cpp index 312d7050b9..b2c0fcdaf2 100644 --- a/indra/newview/llspeakbutton.cpp +++ b/indra/newview/llspeakbutton.cpp @@ -93,7 +93,8 @@ LLSpeakButton::LLSpeakButton(const Params& p) addChild(mSpeakBtn); LLTransientFloaterMgr::getInstance()->addControlView(mSpeakBtn); - mSpeakBtn->setClickedCallback(boost::bind(&LLSpeakButton::onClick_SpeakBtn, this)); + mSpeakBtn->setMouseDownCallback(boost::bind(&LLSpeakButton::onMouseDown_SpeakBtn, this)); + mSpeakBtn->setMouseUpCallback(boost::bind(&LLSpeakButton::onMouseUp_SpeakBtn, this)); mSpeakBtn->setToggleState(FALSE); LLButton::Params show_params = p.show_button; @@ -131,15 +132,15 @@ LLSpeakButton::~LLSpeakButton() { } -void LLSpeakButton::setSpeakBtnToggleState(bool state) +void LLSpeakButton::onMouseDown_SpeakBtn() { - mSpeakBtn->setToggleState(state); + bool down = true; + gVoiceClient->inputUserControlState(down); // this method knows/care about whether this translates into a toggle-to-talk or down-to-talk } - -void LLSpeakButton::onClick_SpeakBtn() +void LLSpeakButton::onMouseUp_SpeakBtn() { - bool speaking = mSpeakBtn->getToggleState(); - gVoiceClient->setUserPTTState(speaking); + bool down = false; + gVoiceClient->inputUserControlState(down); } void LLSpeakButton::onClick_ShowBtn() diff --git a/indra/newview/llspeakbutton.h b/indra/newview/llspeakbutton.h index 48a4d5880b..e213c562dd 100644 --- a/indra/newview/llspeakbutton.h +++ b/indra/newview/llspeakbutton.h @@ -45,7 +45,6 @@ class LLOutputMonitorCtrl; * clicked. */ class LLSpeakButton : public LLUICtrl - { public: @@ -63,13 +62,12 @@ public: /*virtual*/ ~LLSpeakButton(); /*virtual*/ void draw(); - void setSpeakBtnToggleState(bool state); - protected: friend class LLUICtrlFactory; LLSpeakButton(const Params& p); - void onClick_SpeakBtn(); + void onMouseDown_SpeakBtn(); + void onMouseUp_SpeakBtn(); void onClick_ShowBtn(); diff --git a/indra/newview/llvoiceclient.cpp b/indra/newview/llvoiceclient.cpp index f303f14843..39d4bb0c02 100644 --- a/indra/newview/llvoiceclient.cpp +++ b/indra/newview/llvoiceclient.cpp @@ -5925,8 +5925,6 @@ void LLVoiceClient::setMicGain(F32 volume) void LLVoiceClient::keyDown(KEY key, MASK mask) { -// LL_DEBUGS("Voice") << "key is " << LLKeyboard::stringFromKey(key) << LL_ENDL; - if (gKeyboard->getKeyRepeated(key)) { // ignore auto-repeat keys @@ -5935,44 +5933,39 @@ void LLVoiceClient::keyDown(KEY key, MASK mask) if(!mPTTIsMiddleMouse) { - if(mPTTIsToggle) - { - if(key == mPTTKey) - { - toggleUserPTTState(); - } - } - else if(mPTTKey != KEY_NONE) - { - setUserPTTState(gKeyboard->getKeyDown(mPTTKey)); - } + bool down = (mPTTKey != KEY_NONE) + && gKeyboard->getKeyDown(mPTTKey); + inputUserControlState(down); } } void LLVoiceClient::keyUp(KEY key, MASK mask) { if(!mPTTIsMiddleMouse) { - if(!mPTTIsToggle && (mPTTKey != KEY_NONE)) + bool down = (mPTTKey != KEY_NONE) + && gKeyboard->getKeyDown(mPTTKey); + inputUserControlState(down); + } +} +void LLVoiceClient::inputUserControlState(bool down) +{ + if(mPTTIsToggle) + { + if(down) // toggle open-mic state on 'down' { - setUserPTTState(gKeyboard->getKeyDown(mPTTKey)); + toggleUserPTTState(); } } + else // set open-mic state as an absolute + { + setUserPTTState(down); + } } void LLVoiceClient::middleMouseState(bool down) { if(mPTTIsMiddleMouse) { - if(mPTTIsToggle) - { - if(down) - { - toggleUserPTTState(); - } - } - else - { - setUserPTTState(down); - } + inputUserControlState(down); } } diff --git a/indra/newview/llvoiceclient.h b/indra/newview/llvoiceclient.h index 2b61086680..347fae6156 100644 --- a/indra/newview/llvoiceclient.h +++ b/indra/newview/llvoiceclient.h @@ -188,6 +188,7 @@ static void updatePosition(void); void setUserPTTState(bool ptt); bool getUserPTTState(); void toggleUserPTTState(void); + void inputUserControlState(bool down); // interpret any sort of up-down mic-open control input according to ptt-toggle prefs void setVoiceEnabled(bool enabled); static bool voiceEnabled(); void setUsePTT(bool usePTT); |