summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
authorRick Pasetto <rick@lindenlab.com>2009-12-01 15:38:09 -0800
committerRick Pasetto <rick@lindenlab.com>2009-12-01 15:38:09 -0800
commit659dc5224e2f4b6ce90b4f739cc015befc098c12 (patch)
tree43a7d9b6027a82cf917cda3c7fd59e70f7264269 /indra/newview
parent948af3093c93461d11ab6a76a8aab7ea10e377c6 (diff)
DEV-42989: Adjust media priority based on app minimization and focus
Review #49 This change adjusts each media's priority based on whether the viewer is minimized (media priority becomes HIDDEN) or unfocused (media priority becomes LOW). However, due to the fact that updateMedia() was no longer being called when minimized, I moved its call out of LLViewerTextureList::updateImages() (a seemingly odd place anyway) and into its own idle callback.
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/llappviewer.cpp2
-rw-r--r--indra/newview/llviewermedia.cpp31
-rw-r--r--indra/newview/llviewermedia.h1
-rw-r--r--indra/newview/llviewertexturelist.cpp4
-rw-r--r--indra/newview/llviewerwindow.cpp4
5 files changed, 35 insertions, 7 deletions
diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp
index eb08707b61..84843138bf 100644
--- a/indra/newview/llappviewer.cpp
+++ b/indra/newview/llappviewer.cpp
@@ -899,6 +899,8 @@ bool LLAppViewer::init()
loadEventHostModule(gSavedSettings.getS32("QAModeEventHostPort"));
}
+ LLViewerMedia::initClass();
+
return true;
}
diff --git a/indra/newview/llviewermedia.cpp b/indra/newview/llviewermedia.cpp
index f2ddb0b1f1..3bc3292876 100644
--- a/indra/newview/llviewermedia.cpp
+++ b/indra/newview/llviewermedia.cpp
@@ -45,6 +45,9 @@
#include "llviewertexturelist.h"
#include "llvovolume.h"
#include "llpluginclassmedia.h"
+#include "llviewerwindow.h"
+#include "llfocusmgr.h"
+#include "llcallbacklist.h"
#include "llevent.h" // LLSimpleListener
#include "llnotificationsutil.h"
@@ -738,6 +741,19 @@ void LLViewerMedia::updateMedia()
impl_count_total++;
}
+ // Overrides if the window is minimized or we lost focus (taking care
+ // not to accidentally "raise" the priority either)
+ if (!gViewerWindow->getActive() /* viewer window minimized? */
+ && new_priority > LLPluginClassMedia::PRIORITY_HIDDEN)
+ {
+ new_priority = LLPluginClassMedia::PRIORITY_HIDDEN;
+ }
+ else if (!gFocusMgr.getAppHasFocus() /* viewer window lost focus? */
+ && new_priority > LLPluginClassMedia::PRIORITY_LOW)
+ {
+ new_priority = LLPluginClassMedia::PRIORITY_LOW;
+ }
+
pimpl->setPriority(new_priority);
if(pimpl->getUsedInUI())
@@ -774,11 +790,24 @@ void LLViewerMedia::updateMedia()
}
+// idle callback function...only here to provide a hop to updateMedia()
+static void llviewermedia_updatemedia_thunk(void*)
+{
+ LLViewerMedia::updateMedia();
+}
+
+//////////////////////////////////////////////////////////////////////////////////////////
+// static
+void LLViewerMedia::initClass()
+{
+ gIdleCallbacks.addFunction(llviewermedia_updatemedia_thunk, NULL);
+}
+
//////////////////////////////////////////////////////////////////////////////////////////
// static
void LLViewerMedia::cleanupClass()
{
- // This is no longer necessary, since sViewerMediaImplList is no longer smart pointers.
+ gIdleCallbacks.deleteFunction(llviewermedia_updatemedia_thunk, NULL);
}
//////////////////////////////////////////////////////////////////////////////////////////
diff --git a/indra/newview/llviewermedia.h b/indra/newview/llviewermedia.h
index ac12112ed4..c29bd6dbd6 100644
--- a/indra/newview/llviewermedia.h
+++ b/indra/newview/llviewermedia.h
@@ -99,6 +99,7 @@ class LLViewerMedia
static void updateMedia();
static bool isMusicPlaying();
+ static void initClass();
static void cleanupClass();
static void toggleMusicPlay(void*);
diff --git a/indra/newview/llviewertexturelist.cpp b/indra/newview/llviewertexturelist.cpp
index dbcf563010..5be7f2945f 100644
--- a/indra/newview/llviewertexturelist.cpp
+++ b/indra/newview/llviewertexturelist.cpp
@@ -614,10 +614,6 @@ void LLViewerTextureList::updateImages(F32 max_time)
didone = image->doLoadedCallbacks();
}
}
- if (!gNoRender && !gGLManager.mIsDisabled)
- {
- LLViewerMedia::updateMedia();
- }
updateImagesUpdateStats();
}
diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp
index f12937194d..1059b200ab 100644
--- a/indra/newview/llviewerwindow.cpp
+++ b/indra/newview/llviewerwindow.cpp
@@ -1011,6 +1011,7 @@ BOOL LLViewerWindow::handleActivate(LLWindow *window, BOOL activated)
else
{
mActive = FALSE;
+
if (gSavedSettings.getBOOL("AllowIdleAFK"))
{
gAgent.setAFK();
@@ -3242,8 +3243,7 @@ LLPickInfo LLViewerWindow::pickImmediate(S32 x, S32 y_from_bot, BOOL pick_trans
}
else
{
- llwarns << "List of last picks is empty" << llendl;
- llwarns << "Using stub pick" << llendl;
+ lldebugs << "List of last picks is empty: Using stub pick" << llendl;
mLastPick = LLPickInfo();
}