diff options
Diffstat (limited to 'indra/newview/llviewermediafocus.cpp')
-rw-r--r-- | indra/newview/llviewermediafocus.cpp | 37 |
1 files changed, 34 insertions, 3 deletions
diff --git a/indra/newview/llviewermediafocus.cpp b/indra/newview/llviewermediafocus.cpp index 5d0b77d4fb..0ef4679057 100644 --- a/indra/newview/llviewermediafocus.cpp +++ b/indra/newview/llviewermediafocus.cpp @@ -48,6 +48,9 @@ #include "llviewerparcelmgr.h" #include "llweb.h" #include "llmediaentry.h" +#include "llkeyboard.h" +#include "lltoolmgr.h" + // // LLViewerMediaFocus // @@ -114,13 +117,16 @@ void LLViewerMediaFocus::setFocusFace(LLPointer<LLViewerObject> objectp, S32 fac } else { - if(mFocusedImplID != LLUUID::null) + if(mFocusedImplID.notNull()) { if(mMediaControls.get()) { mMediaControls.get()->resetZoomLevel(); } + } + if(hasFocus()) + { gFocusMgr.setKeyboardFocus(NULL); } @@ -298,8 +304,9 @@ BOOL LLViewerMediaFocus::handleScrollWheel(S32 x, S32 y, S32 clicks) // the scrollEvent() API's x and y are not the same as handleScrollWheel's x and y. // The latter is the position of the mouse at the time of the event // The former is the 'scroll amount' in x and y, respectively. - // All we have for 'scroll amount' here is 'clicks', and no mask. - media_impl->getMediaPlugin()->scrollEvent(0, clicks, /*mask*/0); + // All we have for 'scroll amount' here is 'clicks'. + // We're also not passed the keyboard modifier mask, but we can get that from gKeyboard. + media_impl->getMediaPlugin()->scrollEvent(0, clicks, gKeyboard->currentMask(TRUE)); retval = TRUE; } return retval; @@ -307,6 +314,30 @@ BOOL LLViewerMediaFocus::handleScrollWheel(S32 x, S32 y, S32 clicks) void LLViewerMediaFocus::update() { + if(mFocusedImplID.notNull() || mFocusedObjectID.notNull()) + { + // We have a focused impl/face. + if(!getFocus()) + { + // We've lost keyboard focus -- check to see whether the media controls have it + if(mMediaControls.get() && mMediaControls.get()->hasFocus()) + { + // the media controls have focus -- don't clear. + } + else + { + // Someone else has focus -- back off. + clearFocus(); + } + } + else if(LLToolMgr::getInstance()->inBuildMode()) + { + // Build tools are selected -- clear focus. + clearFocus(); + } + } + + LLViewerMediaImpl *media_impl = getFocusedMediaImpl(); LLViewerObject *viewer_object = getFocusedObject(); S32 face = mFocusedObjectFace; |