From 36b31c11bc6dea2e3a6a25b6e74df703afdfca7e Mon Sep 17 00:00:00 2001
From: Armin Weatherwax
Date: Mon, 21 Mar 2011 00:15:28 +0100
Subject: several embedded browser proxy fixes and one small cookie fix

* split xmlrpc and web browser proxy setting into 2 settings
  (because the login service might refuse to let you in using TOR)
* fix web proxy to be used not only for the browser floater but also for login screen and parcel media.
  Backported for that the setProxyConfig method from Viewer-external(last gpl+floss version)
* fix: no clear cookies button
* todo: cookies need work

note to devs of other viewers: if you find this useful feel free to apply my part to "lgpl v2.1 only" code without need to ask (thats all but setProxyConfig, which is anyway also released under lgpl  by LL ).
---
 linden/indra/newview/app_settings/settings.xml     | 35 ++++++++++++++++++++
 linden/indra/newview/llpanelnetwork.cpp            | 24 ++++++++++++++
 linden/indra/newview/llpanelnetwork.h              |  1 +
 linden/indra/newview/llpanelweb.cpp                | 13 ++++++--
 linden/indra/newview/llviewermedia.cpp             | 38 ++++++++++++++++++++++
 linden/indra/newview/llviewermedia.h               |  5 +++
 linden/indra/newview/llxmlrpctransaction.cpp       |  6 ++--
 .../xui/en-us/panel_preferences_network.xml        | 27 +++++++++++++++
 .../default/xui/en-us/panel_preferences_web.xml    |  4 +++
 9 files changed, 147 insertions(+), 6 deletions(-)

(limited to 'linden')

diff --git a/linden/indra/newview/app_settings/settings.xml b/linden/indra/newview/app_settings/settings.xml
index 2a508ee..c381d99 100644
--- a/linden/indra/newview/app_settings/settings.xml
+++ b/linden/indra/newview/app_settings/settings.xml
@@ -2311,6 +2311,41 @@
     <key>Value</key>
     <integer>0</integer>
   </map>
+
+  <key>XMLRPCProxyAddress</key>
+  <map>
+    <key>Comment</key>
+    <string>Address for the XMLRPC Web Proxy</string>
+    <key>Persist</key>
+    <integer>1</integer>
+    <key>Type</key>
+    <string>String</string>
+    <key>Value</key>
+    <string />
+  </map>
+  <key>XMLRPCProxyEnabled</key>
+  <map>
+    <key>Comment</key>
+    <string>Use XMLRPC Proxy</string>
+    <key>Persist</key>
+    <integer>1</integer>
+    <key>Type</key>
+    <string>Boolean</string>
+    <key>Value</key>
+    <integer>0</integer>
+  </map>
+  <key>XMLRPCProxyPort</key>
+  <map>
+    <key>Comment</key>
+    <string>Port of the XMLRPC Proxy</string>
+    <key>Persist</key>
+    <integer>1</integer>
+    <key>Type</key>
+    <string>S32</string>
+    <key>Value</key>
+    <integer>3128</integer>
+  </map>
+
   <key>AllowIdleAFK</key>
   <map>
     <key>Comment</key>
diff --git a/linden/indra/newview/llpanelnetwork.cpp b/linden/indra/newview/llpanelnetwork.cpp
index 2edd1a1..16b9a76 100644
--- a/linden/indra/newview/llpanelnetwork.cpp
+++ b/linden/indra/newview/llpanelnetwork.cpp
@@ -64,6 +64,14 @@ BOOL LLPanelNetwork::postBuild()
 	childSetValue("connection_port_enabled", gSavedSettings.getBOOL("ConnectionPortEnabled"));
 	childSetValue("connection_port", (F32)gSavedSettings.getU32("ConnectionPort"));
 
+	childSetCommitCallback("xmlrpc_proxy_enabled", onCommitXMLRPCProxyEnabled, this);
+	childSetValue("xmlrpc_proxy_enabled", gSavedSettings.getBOOL("XMLRPCProxyEnabled"));
+	childSetValue("xmlrpc_proxy_editor", gSavedSettings.getString("XMLRPCProxyAddress"));
+	childSetValue("xmlrpc_proxy_port", gSavedSettings.getS32("XMLRPCProxyPort"));
+	childSetEnabled("xmlrpc_proxy_text_label", gSavedSettings.getBOOL("XMLRPCProxyEnabled"));
+	childSetEnabled("xmlrpc_proxy_editor", gSavedSettings.getBOOL("XMLRPCProxyEnabled"));
+	childSetEnabled("xmlrpc_proxy_port", gSavedSettings.getBOOL("XMLRPCProxyEnabled"));
+
 	return TRUE;
 }
 
@@ -79,6 +87,10 @@ void LLPanelNetwork::apply()
 	gSavedSettings.setF32("ThrottleBandwidthKBPS", childGetValue("max_bandwidth").asReal());
 	gSavedSettings.setBOOL("ConnectionPortEnabled", childGetValue("connection_port_enabled"));
 	gSavedSettings.setU32("ConnectionPort", childGetValue("connection_port").asInteger());
+
+	gSavedSettings.setBOOL("XMLRPCProxyEnabled", childGetValue("xmlrpc_proxy_enabled"));
+	gSavedSettings.setString("XMLRPCProxyAddress", childGetValue("xmlrpc_proxy_editor"));
+	gSavedSettings.setS32("XMLRPCProxyPort", childGetValue("xmlrpc_proxy_port"));
 }
 
 void LLPanelNetwork::cancel()
@@ -144,3 +156,15 @@ void LLPanelNetwork::onCommitPort(LLUICtrl* ctrl, void* data)
   self->childSetEnabled("connection_port", check->get());
   LLNotifications::instance().add("ChangeConnectionPort");
 }
+
+// static
+void LLPanelNetwork::onCommitXMLRPCProxyEnabled(LLUICtrl* ctrl, void* data)
+{
+	LLPanelNetwork* self = (LLPanelNetwork*)data;
+	LLCheckBoxCtrl* check = (LLCheckBoxCtrl*)ctrl;
+
+	if (!self || !check) return;
+	self->childSetEnabled("xmlrpc_proxy_editor", check->get());
+	self->childSetEnabled("xmlrpc_proxy_port", check->get());
+	self->childSetEnabled("xmlrpc_proxy_text_label", check->get());
+}
\ No newline at end of file
diff --git a/linden/indra/newview/llpanelnetwork.h b/linden/indra/newview/llpanelnetwork.h
index 3a3d857..900158a 100644
--- a/linden/indra/newview/llpanelnetwork.h
+++ b/linden/indra/newview/llpanelnetwork.h
@@ -51,6 +51,7 @@ private:
 	static void onClickSetCache(void*);
 	static void onClickResetCache(void*);
 	static void onCommitPort(LLUICtrl* ctrl, void*);
+	static void onCommitXMLRPCProxyEnabled(LLUICtrl* ctrl, void* data);
 };
 
 #endif
diff --git a/linden/indra/newview/llpanelweb.cpp b/linden/indra/newview/llpanelweb.cpp
index 6f9bd7a..93441dd 100644
--- a/linden/indra/newview/llpanelweb.cpp
+++ b/linden/indra/newview/llpanelweb.cpp
@@ -69,6 +69,7 @@ BOOL LLPanelWeb::postBuild()
 	childSetValue("use_external_browser", value);
 
 	childSetValue("cookies_enabled", gSavedSettings.getBOOL("BrowserCookiesEnabled"));
+	childSetAction("clear_cookies", onClickClearCookies,this);
 
 	childSetValue("web_proxy_enabled", gSavedSettings.getBOOL("BrowserProxyEnabled"));
 	childSetValue("web_proxy_editor", gSavedSettings.getString("BrowserProxyAddress"));
@@ -102,9 +103,15 @@ LLPanelWeb::~LLPanelWeb()
 void LLPanelWeb::apply()
 {
 	gSavedSettings.setBOOL("BrowserCookiesEnabled", childGetValue("cookies_enabled"));
-	gSavedSettings.setBOOL("BrowserProxyEnabled", childGetValue("web_proxy_enabled"));
-	gSavedSettings.setString("BrowserProxyAddress", childGetValue("web_proxy_editor"));
-	gSavedSettings.setS32("BrowserProxyPort", childGetValue("web_proxy_port"));
+
+	bool proxy_enable = childGetValue("web_proxy_enabled");
+	std::string proxy_address = childGetValue("web_proxy_editor");
+	int proxy_port = childGetValue("web_proxy_port");
+	gSavedSettings.setBOOL("BrowserProxyEnabled", proxy_enable);
+	gSavedSettings.setString("BrowserProxyAddress", proxy_address);
+	gSavedSettings.setS32("BrowserProxyPort", proxy_port);
+	LLViewerMedia::setProxyConfig(proxy_enable, proxy_address, proxy_port);
+
 	if (gHippoGridManager->getConnectedGrid()->isSecondLife()) 
 	{
 		gSavedSettings.setString("SearchURLQuery", childGetValue("world_search_editor"));
diff --git a/linden/indra/newview/llviewermedia.cpp b/linden/indra/newview/llviewermedia.cpp
index f0faedf..c228468 100644
--- a/linden/indra/newview/llviewermedia.cpp
+++ b/linden/indra/newview/llviewermedia.cpp
@@ -267,6 +267,23 @@ std::string LLViewerMedia::getCurrentUserAgent()
 	
 	return codec.str();
 }
+	
+/////////////////////////////////////////////////////////////////////////////////////////
+// static 
+void LLViewerMedia::setProxyConfig(bool enable, const std::string &host, int port)
+{
+	// Set the proxy config for all loaded plugins
+	impl_list::iterator iter = sViewerMediaImplList.begin();
+	impl_list::iterator end = sViewerMediaImplList.end();
+	for (; iter != end; iter++)
+	{
+		LLViewerMediaImpl* pimpl = *iter;
+		if(pimpl->mMediaSource)
+		{
+			pimpl->mMediaSource->proxy_setup(enable, host, port);
+		}
+	}
+}
 
 //////////////////////////////////////////////////////////////////////////////////////////
 // static
@@ -395,6 +412,19 @@ LLViewerMediaImpl::~LLViewerMediaImpl()
 	LLViewerMedia::removeMedia(this);
 }
 
+//static
+void LLViewerMediaImpl::setProxy(LLPluginClassMedia* media_source)
+{
+			// pass proxy settings to browser
+			bool proxy_enabled = gSavedSettings.getBOOL( "BrowserProxyEnabled" );
+			std::string proxy_address = gSavedSettings.getString("BrowserProxyAddress");
+			S32 proxy_port = gSavedSettings.getS32("BrowserProxyPort");
+			media_source->proxy_setup(proxy_enabled, proxy_address, proxy_port);
+			LL_DEBUGS("Media") << "Proxy: " << (proxy_enabled ? "enabled" : "not enabled")
+					<< " Address: " << proxy_address 
+					<< " Port: " << proxy_port << LL_ENDL;
+}
+
 //////////////////////////////////////////////////////////////////////////////////////////
 bool LLViewerMediaImpl::initializeMedia(const std::string& mime_type)
 {
@@ -411,6 +441,11 @@ bool LLViewerMediaImpl::initializeMedia(const std::string& mime_type)
 		}
 	}
 
+	if(mMediaSource)
+	{
+		setProxy(mMediaSource);
+	}
+
 	// play();
 	return (mMediaSource != NULL);
 }
@@ -508,6 +543,8 @@ LLPluginClassMedia* LLViewerMediaImpl::newSourceFromMediaType(std::string media_
 			bool javascript_enabled = gSavedSettings.getBOOL( "BrowserJavascriptEnabled" );
 			media_source->setJavascriptEnabled( javascript_enabled );
 
+			setProxy(media_source);
+
 			if (media_source->init(launcher_name, plugin_name, gSavedSettings.getBOOL("PluginAttachDebuggerToPlugins")))
 			{
 				return media_source;
@@ -741,6 +778,7 @@ void LLViewerMediaImpl::navigateHome()
 //////////////////////////////////////////////////////////////////////////////////////////
 void LLViewerMediaImpl::navigateTo(const std::string& url, const std::string& mime_type,  bool rediscover_type)
 {
+
 	if(rediscover_type)
 	{
 
diff --git a/linden/indra/newview/llviewermedia.h b/linden/indra/newview/llviewermedia.h
index afda426..ee5fef4 100644
--- a/linden/indra/newview/llviewermedia.h
+++ b/linden/indra/newview/llviewermedia.h
@@ -79,6 +79,10 @@ class LLViewerMedia
 		static void removeMedia(LLViewerMediaImpl* media);
 		static LLViewerMediaImpl* getMediaImplFromTextureID(const LLUUID& texture_id);
 		static std::string getCurrentUserAgent();
+	
+		// Set the proxy config for all loaded plugins
+		static void setProxyConfig(bool enable, const std::string &host, int port);
+
 		static void updateBrowserUserAgent();
 		static bool handleSkinCurrentChanged(const LLSD& /*newvalue*/);
 		static bool textureHasMedia(const LLUUID& texture_id);
@@ -109,6 +113,7 @@ public:
 	void createMediaSource();
 	void destroyMediaSource();
 	void setMediaType(const std::string& media_type);
+        static void setProxy(LLPluginClassMedia* media_source);
 	bool initializeMedia(const std::string& mime_type);
 	bool initializePlugin(const std::string& media_type);
 	LLPluginClassMedia* getMediaPlugin() { return mMediaSource; }
diff --git a/linden/indra/newview/llxmlrpctransaction.cpp b/linden/indra/newview/llxmlrpctransaction.cpp
index 058946e..675ba42 100644
--- a/linden/indra/newview/llxmlrpctransaction.cpp
+++ b/linden/indra/newview/llxmlrpctransaction.cpp
@@ -226,10 +226,10 @@ void LLXMLRPCTransaction::Impl::init(XMLRPC_REQUEST request, bool useGzip)
 		mCurlRequest = new LLCurlEasyRequest();
 	}
 	
-	if (gSavedSettings.getBOOL("BrowserProxyEnabled"))
+	if (gSavedSettings.getBOOL("XMLRPCProxyEnabled"))
 	{
-		mProxyAddress = gSavedSettings.getString("BrowserProxyAddress");
-		S32 port = gSavedSettings.getS32 ( "BrowserProxyPort" );
+		mProxyAddress = gSavedSettings.getString("XMLRPCProxyAddress");
+		S32 port = gSavedSettings.getS32 ( "XMLRPCProxyPort" );
 
 		// tell curl about the settings
 		mCurlRequest->setoptString(CURLOPT_PROXY, mProxyAddress);
diff --git a/linden/indra/newview/skins/default/xui/en-us/panel_preferences_network.xml b/linden/indra/newview/skins/default/xui/en-us/panel_preferences_network.xml
index 1e4ded6..86aa353 100644
--- a/linden/indra/newview/skins/default/xui/en-us/panel_preferences_network.xml
+++ b/linden/indra/newview/skins/default/xui/en-us/panel_preferences_network.xml
@@ -64,4 +64,31 @@
 	     increment="1" initial_val="13000" label="Port number:" label_width="75"
 	     left_delta="20" max_val="13050" min_val="13000" mouse_opaque="true"
 	     name="connection_port" width="150" />
+	<text type="string" length="1" bg_visible="false" border_drop_shadow_visible="false" border_visible="false"
+	     bottom_delta="-24" drop_shadow_visible="true" enabled="true"
+	     follows="left|top" font="SansSerifSmall" h_pad="0" halign="left"
+	     height="10" left="15" mouse_opaque="false" name="proxy_label" v_pad="0"
+	     width="250">
+		XMLRPC Proxy (Login, Land- and Money purchase):
+	</text>
+	<check_box bottom_delta="-25" enabled="true"
+	     follows="left|top" font="SansSerifSmall" height="16" initial_value="false"
+	     label="Enable XMLRPC proxy" left_delta="199" mouse_opaque="true"
+	     name="xmlrpc_proxy_enabled" radio_style="false" width="256" />
+	<text type="string" length="1" bg_visible="false" border_drop_shadow_visible="false" border_visible="false"
+	     bottom_delta="-25" drop_shadow_visible="true" enabled="true"
+	     follows="left|top" font="SansSerifSmall" h_pad="0" halign="left"
+	     height="10" left="140" mouse_opaque="false" name="xmlrpc_proxy_text_label"
+	     v_pad="0" width="128">
+		Address:
+	</text>
+	<line_editor bottom_delta="-8" enabled="true" follows="left|top" font="SansSerif"
+	     height="20" left="217" name="xmlrpc_proxy_editor"
+	     tool_tip="The name or IP address of the proxy you would like to use"
+	     width="200" />
+	<spinner bottom_delta="-25" decimal_digits="0"
+	     enabled="true" follows="left|top" height="16" increment="1"
+	     initial_val="80" label="Port number:" label_width="75" left="140"
+	     max_val="12000" min_val="10" mouse_opaque="true" name="xmlrpc_proxy_port"
+	     width="140" />
 </panel>
diff --git a/linden/indra/newview/skins/default/xui/en-us/panel_preferences_web.xml b/linden/indra/newview/skins/default/xui/en-us/panel_preferences_web.xml
index 46283bb..727b142 100644
--- a/linden/indra/newview/skins/default/xui/en-us/panel_preferences_web.xml
+++ b/linden/indra/newview/skins/default/xui/en-us/panel_preferences_web.xml
@@ -34,6 +34,10 @@
 		 font="SansSerifSmall" height="16" initial_value="false"
 	     label="Accept cookies from sites" left="140" mouse_opaque="true"
 	     name="cookies_enabled" radio_style="false" width="256" />
+	<button  bottom_delta="-20" enabled="true" follows="left|top" font="SansSerif"
+	     halign="center" height="18" label="Clear Cookies" left_delta="0" 
+	     tool_tip="Clear Cookies"
+	     mouse_opaque="true" name="clear_ookies" scale_image="true" width="110" />
 	<text type="string" length="1" bg_visible="false" border_drop_shadow_visible="false" border_visible="false"
 	     bottom_delta="-24" drop_shadow_visible="true" enabled="true"
 	     follows="left|top" font="SansSerifSmall" h_pad="0" halign="left"
-- 
cgit v1.1


From 53a45c182e97bb1c2e4a2edd6b020b2857269f62 Mon Sep 17 00:00:00 2001
From: Armin Weatherwax
Date: Mon, 21 Mar 2011 16:30:09 +0100
Subject: allow interaction with parcel web media

* the media face gets focus on click and you can interact with mouse and keyboard with it -
just as you would expect it to work in the first place anyway.
* added a checkbox in prefs audio & video for what I call "media helper widget" which allows zooming on
the face, open the link in a browser window and such - the name of the LL debug setting is a bit misleading
("MediaOnAPrimUI"), since this is not MOAP I avoided that name.
---
 linden/indra/newview/llpanelaudioprefs.cpp             |  3 ++-
 linden/indra/newview/llpanelaudioprefs.h               |  1 +
 linden/indra/newview/lltoolpie.cpp                     | 17 +++++++++++------
 linden/indra/newview/llviewermediafocus.cpp            | 18 ++++++++++++++----
 .../default/xui/en-us/panel_preferences_audio.xml      |  5 +++++
 5 files changed, 33 insertions(+), 11 deletions(-)

(limited to 'linden')

diff --git a/linden/indra/newview/llpanelaudioprefs.cpp b/linden/indra/newview/llpanelaudioprefs.cpp
index 1acfcbb..f1a8af5 100644
--- a/linden/indra/newview/llpanelaudioprefs.cpp
+++ b/linden/indra/newview/llpanelaudioprefs.cpp
@@ -112,6 +112,7 @@ void LLPanelAudioPrefs::refreshValues()
 
 	mPreviousStreamingMusic = gSavedSettings.getBOOL("AudioStreamingMusic");
 	mPreviousStreamingVideo = gSavedSettings.getBOOL("AudioStreamingVideo");
+	mPreviousHelperWidget = gSavedSettings.getBOOL("MediaOnAPrimUI");
 
 	mPreviousMuteAudio = gSavedSettings.getBOOL("MuteAudio");
 	mPreviousMuteWhenMinimized = gSavedSettings.getBOOL("MuteWhenMinimized");
@@ -140,7 +141,7 @@ void LLPanelAudioPrefs::cancel()
 
 	gSavedSettings.setBOOL("AudioStreamingMusic", mPreviousStreamingMusic );
 	gSavedSettings.setBOOL("AudioStreamingVideo", mPreviousStreamingVideo );
-
+	gSavedSettings.setBOOL("MediaOnAPrimUI", mPreviousHelperWidget );
 	
 	gSavedSettings.setBOOL("MuteAudio", mPreviousMuteAudio );
 	gSavedSettings.setBOOL("MuteWhenMinimized", mPreviousMuteWhenMinimized );
diff --git a/linden/indra/newview/llpanelaudioprefs.h b/linden/indra/newview/llpanelaudioprefs.h
index 21d2f59..56982b8 100644
--- a/linden/indra/newview/llpanelaudioprefs.h
+++ b/linden/indra/newview/llpanelaudioprefs.h
@@ -75,6 +75,7 @@ private:
 
 	BOOL			mPreviousStreamingMusic;
 	BOOL			mPreviousStreamingVideo;
+	BOOL			mPreviousHelperWidget;
 	BOOL            mPreviousMuteAudio;
 	BOOL            mPreviousMuteWhenMinimized;
 };
diff --git a/linden/indra/newview/lltoolpie.cpp b/linden/indra/newview/lltoolpie.cpp
index 34735a3..b7d762c 100644
--- a/linden/indra/newview/lltoolpie.cpp
+++ b/linden/indra/newview/lltoolpie.cpp
@@ -800,6 +800,14 @@ BOOL LLToolPie::handleDoubleClick(S32 x, S32 y, MASK mask)
 			LL_DEBUGS("DoubleClicks") << "Double clicked a touch-scripted object" << LL_ENDL;
 			return FALSE;
 		}
+
+		const LLTextureEntry* tep = object->getTE(mPick.mObjectFace);
+		viewer_media_t media_impl = LLViewerMedia::getMediaImplFromTextureID(tep->getID());
+		if (tep && media_impl.notNull() && media_impl->hasMedia())
+		{
+			LL_DEBUGS("DoubleClicks") << "Double clicked running parcel media" << LL_ENDL;
+			return FALSE;
+		}
 	}
 
 	std::string action = gSavedSettings.getString("DoubleClickAction");
@@ -938,19 +946,16 @@ static bool handle_media_click(const LLPickInfo& pick)
 	if (tep
 		&& media_impl.notNull()
 		&& media_impl->hasMedia()
-		&& gSavedSettings.getBOOL("MediaOnAPrimUI"))
+		/*&& gSavedSettings.getBOOL("MediaOnAPrimUI")*/)
 	{
 		LLObjectSelectionHandle selection = LLViewerMediaFocus::getInstance()->getSelection(); 
 		if (! selection->contains(pick.getObject(), pick.mObjectFace))
 		{
 			LLViewerMediaFocus::getInstance()->setFocusFace(TRUE, pick.getObject(), pick.mObjectFace, media_impl);
 		}
-		else
-		{
-			media_impl->mouseDown(pick.mXYCoords.mX, pick.mXYCoords.mY);
-			media_impl->mouseCapture(); // the mouse-up will happen when capture is lost
-		}
 
+		media_impl->mouseDown(pick.mXYCoords.mX, pick.mXYCoords.mY);
+		media_impl->mouseCapture(); // the mouse-up will happen when capture is lost
 		return true;
 	}
 
diff --git a/linden/indra/newview/llviewermediafocus.cpp b/linden/indra/newview/llviewermediafocus.cpp
index 2e372a1..c81cd76 100644
--- a/linden/indra/newview/llviewermediafocus.cpp
+++ b/linden/indra/newview/llviewermediafocus.cpp
@@ -48,6 +48,7 @@
 #include "llparcel.h"
 #include "llviewerparcelmgr.h"
 #include "llweb.h"
+#include "llviewercontrol.h"//gSavedSettings
 //
 // LLViewerMediaFocus
 //
@@ -99,7 +100,7 @@ void LLViewerMediaFocus::setFocusFace( BOOL b, LLPointer<LLViewerObject> objectp
 		LLSelectMgr::getInstance()->selectObjectOnly(objectp, face);
 
 		mFocus = LLSelectMgr::getInstance()->getSelection();
-		if(mMediaHUD.get() && ! parcel->getMediaPreventCameraZoom())
+		if(gSavedSettings.getBOOL("MediaOnAPrimUI") && mMediaHUD.get() && ! parcel->getMediaPreventCameraZoom())
 		{
 			mMediaHUD.get()->resetZoomLevel();
 			mMediaHUD.get()->nextZoomLevel();
@@ -224,14 +225,20 @@ void LLViewerMediaFocus::setMouseOverFlag(bool b, viewer_media_t media_impl)
 {
 	if (b && media_impl.notNull())
 	{
-		if(! mMediaHUD.get())
+
+		if(! mMediaHUD.get() && gSavedSettings.getBOOL("MediaOnAPrimUI"))
 		{
 			LLPanelMediaHUD* media_hud = new LLPanelMediaHUD(mMediaImpl);
 			mMediaHUD = media_hud->getHandle();
 			gHUDView->addChild(media_hud);	
 		}
-		mMediaHUD.get()->setMediaImpl(media_impl);
+
+		if(mMediaHUD.get())
+		{
+			mMediaHUD.get()->setMediaImpl(media_impl);
+		}
 		mMediaImpl = media_impl;
+		
 	}
 	mMouseOverFlag = b;
 }
@@ -281,7 +288,10 @@ void LLViewerMediaFocus::update()
 {
 	if (mMediaHUD.get())
 	{
-		if(mFocus.notNull() || mMouseOverFlag || mMediaHUD.get()->isMouseOver())
+		if(gSavedSettings.getBOOL("MediaOnAPrimUI") 
+			&&(mFocus.notNull() 
+				|| mMouseOverFlag 
+				|| mMediaHUD.get()->isMouseOver() ) )
 		{
 			// mMediaHUD.get()->setVisible(true);
 			mMediaHUD.get()->updateShape();
diff --git a/linden/indra/newview/skins/default/xui/en-us/panel_preferences_audio.xml b/linden/indra/newview/skins/default/xui/en-us/panel_preferences_audio.xml
index c6bb938..1f208e8 100644
--- a/linden/indra/newview/skins/default/xui/en-us/panel_preferences_audio.xml
+++ b/linden/indra/newview/skins/default/xui/en-us/panel_preferences_audio.xml
@@ -42,6 +42,11 @@
 	     initial_value="true" label="Automatically play media" left="162"
 	     mouse_opaque="true" name="auto_streaming_video" radio_style="false"
 	     width="338" />
+	<check_box bottom_delta="-20" control_name="MediaOnAPrimUI" enabled="true"
+	     follows="left|top" font="SansSerifSmall" height="16"
+	     initial_value="true" label="Media helper widget" left="162"
+	     mouse_opaque="true" name="media_helper_widget" radio_style="false"
+	     width="338" />	
 	<check_box bottom_delta="-27" control_name="MuteWhenMinimized" enabled="true"
 	     follows="left|top" font="SansSerifSmall" height="16" initial_value="true"
 	     label="Mute audio when window minimized" left="142" mouse_opaque="true"
-- 
cgit v1.1


From f10d168e0cb4e8dd666bdcbe7ead850be8235bc9 Mon Sep 17 00:00:00 2001
From: Armin Weatherwax
Date: Tue, 22 Mar 2011 02:32:25 +0100
Subject: Don't report crashes if the grid where the crash happened is
 different from the grid logging in.

Because otherwise crash statistics are wrong. See viewers with higher crash than disconnect rate.
---
 linden/indra/newview/app_settings/settings.xml | 11 +++++++++++
 linden/indra/newview/llstartup.cpp             | 23 +++++++++++++++++++++--
 2 files changed, 32 insertions(+), 2 deletions(-)

(limited to 'linden')

diff --git a/linden/indra/newview/app_settings/settings.xml b/linden/indra/newview/app_settings/settings.xml
index c381d99..315670c 100644
--- a/linden/indra/newview/app_settings/settings.xml
+++ b/linden/indra/newview/app_settings/settings.xml
@@ -677,6 +677,17 @@
     <key>Value</key>
     <string>Random</string>
   </map>
+  <key>LastConnectedGrid</key>
+  <map>
+    <key>Comment</key>
+    <string>Last grid actually connected to</string>
+    <key>Persist</key>
+    <integer>1</integer>
+    <key>Type</key>
+    <string>String</string>
+    <key>Value</key>
+    <string />
+  </map>
   <key>LastSelectedGrid</key>
   <map>
     <key>Comment</key>
diff --git a/linden/indra/newview/llstartup.cpp b/linden/indra/newview/llstartup.cpp
index a74744b..85836fd 100644
--- a/linden/indra/newview/llstartup.cpp
+++ b/linden/indra/newview/llstartup.cpp
@@ -1241,6 +1241,20 @@ bool idle_startup()
 		hashed_mac.finalize();
 		hashed_mac.hex_digest(hashed_mac_string);
 
+		// Don't report crashes if the grid we crashed in
+		// is different from the grid we log in
+		eLastExecEvent last_exec_event = LAST_EXEC_NORMAL;
+		{
+			std::string current_grid = gHippoGridManager->getCurrentGrid()->getGridNick();
+			std::string last_grid = gSavedSettings.getString("LastConnectedGrid");
+			LL_DEBUGS("AppInit")	<< "current grid: " << current_grid 
+						<< " Last Connected Grid: " << last_grid << LL_ENDL;
+			if( last_grid ==  current_grid )
+			{
+				last_exec_event = gLastExecEvent;
+			}
+		}
+
 		// TODO if statement here to use web_login_key
 		if(web_login_key.isNull()){
 		sAuthUriNum = llclamp(sAuthUriNum, 0, (S32)sAuthUris.size()-1);
@@ -1255,7 +1269,7 @@ bool idle_startup()
 			gSkipOptionalUpdate,
 			gAcceptTOS,
 			gAcceptCriticalMessage,
-			gLastExecEvent,
+			last_exec_event,
 			requested_options,
 			hashed_mac_string,
 			LLAppViewer::instance()->getSerialNumber());
@@ -1270,7 +1284,7 @@ bool idle_startup()
 			gSkipOptionalUpdate,
 			gAcceptTOS,
 			gAcceptCriticalMessage,
-			gLastExecEvent,
+			last_exec_event,
 			requested_options,
 			hashed_mac_string,
 			LLAppViewer::instance()->getSerialNumber());
@@ -1508,6 +1522,11 @@ bool idle_startup()
 
 		if(successful_login)
 		{
+			{
+				std::string current_grid = gHippoGridManager->getConnectedGrid()->getGridNick();
+				gSavedSettings.setString("LastConnectedGrid", current_grid);
+			}
+
 			std::string text;
 			text = LLUserAuth::getInstance()->getResponse("udp_blacklist");
 			if(!text.empty())
-- 
cgit v1.1