diff options
Diffstat (limited to 'indra/newview/llviewermedia.cpp')
-rw-r--r-- | indra/newview/llviewermedia.cpp | 31 |
1 files changed, 30 insertions, 1 deletions
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); } ////////////////////////////////////////////////////////////////////////////////////////// |