From e9048b17792b91e6bf8a05692d859ea9c94011d6 Mon Sep 17 00:00:00 2001
From: Tofu Linden <tofu.linden@lindenlab.com>
Date: Mon, 9 Nov 2009 17:13:37 +0000
Subject: [PATCH] Central-source the authoritative state of mic openness.

---
 indra/newview/llbottomtray.cpp  | 1 -
 indra/newview/llspeakbutton.cpp | 9 +++++++++
 indra/newview/llspeakbutton.h   | 1 +
 3 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/indra/newview/llbottomtray.cpp b/indra/newview/llbottomtray.cpp
index a17ba79078b..e5cc2fce881 100644
--- a/indra/newview/llbottomtray.cpp
+++ b/indra/newview/llbottomtray.cpp
@@ -50,7 +50,6 @@ LLBottomTray::LLBottomTray(const LLSD&)
 	mSpeakBtn(NULL),
 	mNearbyChatBar(NULL),
 	mToolbarStack(NULL)
-
 {
 	mFactoryMap["chat_bar"] = LLCallbackMap(LLBottomTray::createNearbyChatBar, NULL);
 
diff --git a/indra/newview/llspeakbutton.cpp b/indra/newview/llspeakbutton.cpp
index cd765b0338f..312d7050b91 100644
--- a/indra/newview/llspeakbutton.cpp
+++ b/indra/newview/llspeakbutton.cpp
@@ -62,6 +62,15 @@ LLSpeakButton::Params::Params()
 	// See widgets/talk_button.xml
 }
 
+void LLSpeakButton::draw()
+{
+	// gVoiceClient is the authoritative global source of info regarding our open-mic state, we merely reflect that state.
+	bool openmic = gVoiceClient->getUserPTTState();
+	mSpeakBtn->setToggleState(openmic);
+	llinfos << "mic state " << int(openmic) << llendl;
+	LLUICtrl::draw();
+}
+
 LLSpeakButton::LLSpeakButton(const Params& p)
 : LLUICtrl(p)
 , mPrivateCallPanel(NULL)
diff --git a/indra/newview/llspeakbutton.h b/indra/newview/llspeakbutton.h
index f59ded21333..48a4d5880b2 100644
--- a/indra/newview/llspeakbutton.h
+++ b/indra/newview/llspeakbutton.h
@@ -61,6 +61,7 @@ class LLSpeakButton : public LLUICtrl
 	};
 
 	/*virtual*/ ~LLSpeakButton();
+	/*virtual*/ void draw();
 
 	void setSpeakBtnToggleState(bool state);
 
-- 
GitLab