diff options
Diffstat (limited to 'indra/newview')
-rw-r--r-- | indra/newview/llmediactrl.cpp | 54 | ||||
-rw-r--r-- | indra/newview/llmediactrl.h | 2 | ||||
-rw-r--r-- | indra/newview/lltoolpie.cpp | 5 | ||||
-rw-r--r-- | indra/newview/llviewermedia.cpp | 37 | ||||
-rw-r--r-- | indra/newview/llviewermedia.h | 14 | ||||
-rw-r--r-- | indra/newview/llviewermediafocus.cpp | 2 |
6 files changed, 83 insertions, 31 deletions
diff --git a/indra/newview/llmediactrl.cpp b/indra/newview/llmediactrl.cpp index 15efd0100a..8f29f908e5 100644 --- a/indra/newview/llmediactrl.cpp +++ b/indra/newview/llmediactrl.cpp @@ -51,6 +51,7 @@ #include "llpluginclassmedia.h" #include "llslurl.h" #include "lluictrlfactory.h" // LLDefaultChildRegistry +#include "llkeyboard.h" // linden library includes #include "llfocusmgr.h" @@ -193,7 +194,7 @@ BOOL LLMediaCtrl::handleHover( S32 x, S32 y, MASK mask ) if (mMediaSource) { - mMediaSource->mouseMove(x, y); + mMediaSource->mouseMove(x, y, mask); gViewerWindow->setCursor(mMediaSource->getLastSetCursor()); } @@ -205,7 +206,7 @@ BOOL LLMediaCtrl::handleHover( S32 x, S32 y, MASK mask ) BOOL LLMediaCtrl::handleScrollWheel( S32 x, S32 y, S32 clicks ) { if (mMediaSource && mMediaSource->hasMedia()) - mMediaSource->getMediaPlugin()->scrollEvent(0, clicks, MASK_NONE); + mMediaSource->getMediaPlugin()->scrollEvent(0, clicks, gKeyboard->currentMask(TRUE)); return TRUE; } @@ -218,7 +219,7 @@ BOOL LLMediaCtrl::handleMouseUp( S32 x, S32 y, MASK mask ) if (mMediaSource) { - mMediaSource->mouseUp(x, y); + mMediaSource->mouseUp(x, y, mask); // *HACK: LLMediaImplLLMozLib automatically takes focus on mouseup, // in addition to the onFocusReceived() call below. Undo this. JC @@ -241,7 +242,50 @@ BOOL LLMediaCtrl::handleMouseDown( S32 x, S32 y, MASK mask ) convertInputCoords(x, y); if (mMediaSource) - mMediaSource->mouseDown(x, y); + mMediaSource->mouseDown(x, y, mask); + + gFocusMgr.setMouseCapture( this ); + + if (mTakeFocusOnClick) + { + setFocus( TRUE ); + } + + return TRUE; +} + +//////////////////////////////////////////////////////////////////////////////// +// +BOOL LLMediaCtrl::handleRightMouseUp( S32 x, S32 y, MASK mask ) +{ + convertInputCoords(x, y); + + if (mMediaSource) + { + mMediaSource->mouseUp(x, y, mask, 1); + + // *HACK: LLMediaImplLLMozLib automatically takes focus on mouseup, + // in addition to the onFocusReceived() call below. Undo this. JC + if (!mTakeFocusOnClick) + { + mMediaSource->focus(false); + gViewerWindow->focusClient(); + } + } + + gFocusMgr.setMouseCapture( NULL ); + + return TRUE; +} + +//////////////////////////////////////////////////////////////////////////////// +// +BOOL LLMediaCtrl::handleRightMouseDown( S32 x, S32 y, MASK mask ) +{ + convertInputCoords(x, y); + + if (mMediaSource) + mMediaSource->mouseDown(x, y, mask, 1); gFocusMgr.setMouseCapture( this ); @@ -260,7 +304,7 @@ BOOL LLMediaCtrl::handleDoubleClick( S32 x, S32 y, MASK mask ) convertInputCoords(x, y); if (mMediaSource) - mMediaSource->mouseLeftDoubleClick( x, y ); + mMediaSource->mouseDoubleClick( x, y, mask); gFocusMgr.setMouseCapture( this ); diff --git a/indra/newview/llmediactrl.h b/indra/newview/llmediactrl.h index 5ea03f1e6c..76ddc61ebf 100644 --- a/indra/newview/llmediactrl.h +++ b/indra/newview/llmediactrl.h @@ -86,6 +86,8 @@ public: virtual BOOL handleHover( S32 x, S32 y, MASK mask ); virtual BOOL handleMouseUp( S32 x, S32 y, MASK mask ); virtual BOOL handleMouseDown( S32 x, S32 y, MASK mask ); + virtual BOOL handleRightMouseDown(S32 x, S32 y, MASK mask); + virtual BOOL handleRightMouseUp(S32 x, S32 y, MASK mask); virtual BOOL handleDoubleClick( S32 x, S32 y, MASK mask ); virtual BOOL handleScrollWheel( S32 x, S32 y, S32 clicks ); diff --git a/indra/newview/lltoolpie.cpp b/indra/newview/lltoolpie.cpp index b035fd53fd..22ed1ec219 100644 --- a/indra/newview/lltoolpie.cpp +++ b/indra/newview/lltoolpie.cpp @@ -48,6 +48,7 @@ #include "lltooltip.h" #include "llhudeffecttrail.h" #include "llhudmanager.h" +#include "llkeyboard.h" #include "llmediaentry.h" #include "llmenugl.h" #include "llmutelist.h" @@ -1048,7 +1049,7 @@ bool LLToolPie::handleMediaClick(const LLPickInfo& pick) } else { - media_impl->mouseDown(pick.mUVCoords); + media_impl->mouseDown(pick.mUVCoords, gKeyboard->currentMask(TRUE)); mMediaMouseCaptureID = mep->getMediaID(); setMouseCapture(TRUE); // This object will send a mouse-up to the media when it loses capture. } @@ -1098,7 +1099,7 @@ bool LLToolPie::handleMediaHover(const LLPickInfo& pick) // If this is the focused media face, send mouse move events. if (LLViewerMediaFocus::getInstance()->isFocusedOnFace(objectp, pick.mObjectFace)) { - media_impl->mouseMove(pick.mUVCoords); + media_impl->mouseMove(pick.mUVCoords, gKeyboard->currentMask(TRUE)); gViewerWindow->setCursor(media_impl->getLastSetCursor()); } else diff --git a/indra/newview/llviewermedia.cpp b/indra/newview/llviewermedia.cpp index 5967b68e51..437a5ec770 100644 --- a/indra/newview/llviewermedia.cpp +++ b/indra/newview/llviewermedia.cpp @@ -48,6 +48,7 @@ #include "llevent.h" // LLSimpleListener #include "llnotifications.h" #include "lluuid.h" +#include "llkeyboard.h" #include <boost/bind.hpp> // for SkinFolder listener #include <boost/signals2.hpp> @@ -792,6 +793,7 @@ bool LLViewerMediaImpl::initializePlugin(const std::string& media_type) media_source->setLoop(mMediaLoop); media_source->setAutoScale(mMediaAutoScale); media_source->setBrowserUserAgent(LLViewerMedia::getCurrentUserAgent()); + media_source->focus(mHasFocus); mMediaSource = media_source; return true; @@ -917,7 +919,7 @@ bool LLViewerMediaImpl::hasFocus() const } ////////////////////////////////////////////////////////////////////////////////////////// -void LLViewerMediaImpl::mouseDown(S32 x, S32 y) +void LLViewerMediaImpl::mouseDown(S32 x, S32 y, MASK mask, S32 button) { scaleMouse(&x, &y); mLastMouseX = x; @@ -925,12 +927,12 @@ void LLViewerMediaImpl::mouseDown(S32 x, S32 y) // llinfos << "mouse down (" << x << ", " << y << ")" << llendl; if (mMediaSource) { - mMediaSource->mouseEvent(LLPluginClassMedia::MOUSE_EVENT_DOWN, x, y, 0); + mMediaSource->mouseEvent(LLPluginClassMedia::MOUSE_EVENT_DOWN, button, x, y, mask); } } ////////////////////////////////////////////////////////////////////////////////////////// -void LLViewerMediaImpl::mouseUp(S32 x, S32 y) +void LLViewerMediaImpl::mouseUp(S32 x, S32 y, MASK mask, S32 button) { scaleMouse(&x, &y); mLastMouseX = x; @@ -938,12 +940,12 @@ void LLViewerMediaImpl::mouseUp(S32 x, S32 y) // llinfos << "mouse up (" << x << ", " << y << ")" << llendl; if (mMediaSource) { - mMediaSource->mouseEvent(LLPluginClassMedia::MOUSE_EVENT_UP, x, y, 0); + mMediaSource->mouseEvent(LLPluginClassMedia::MOUSE_EVENT_UP, button, x, y, mask); } } ////////////////////////////////////////////////////////////////////////////////////////// -void LLViewerMediaImpl::mouseMove(S32 x, S32 y) +void LLViewerMediaImpl::mouseMove(S32 x, S32 y, MASK mask) { scaleMouse(&x, &y); mLastMouseX = x; @@ -951,50 +953,53 @@ void LLViewerMediaImpl::mouseMove(S32 x, S32 y) // llinfos << "mouse move (" << x << ", " << y << ")" << llendl; if (mMediaSource) { - mMediaSource->mouseEvent(LLPluginClassMedia::MOUSE_EVENT_MOVE, x, y, 0); + mMediaSource->mouseEvent(LLPluginClassMedia::MOUSE_EVENT_MOVE, 0, x, y, mask); } } ////////////////////////////////////////////////////////////////////////////////////////// -void LLViewerMediaImpl::mouseDown(const LLVector2& texture_coords) +void LLViewerMediaImpl::mouseDown(const LLVector2& texture_coords, MASK mask, S32 button) { if(mMediaSource) { mouseDown( llround(texture_coords.mV[VX] * mMediaSource->getTextureWidth()), - llround((1.0f - texture_coords.mV[VY]) * mMediaSource->getTextureHeight())); + llround((1.0f - texture_coords.mV[VY]) * mMediaSource->getTextureHeight()), + mask, button); } } -void LLViewerMediaImpl::mouseUp(const LLVector2& texture_coords) +void LLViewerMediaImpl::mouseUp(const LLVector2& texture_coords, MASK mask, S32 button) { if(mMediaSource) { mouseUp( llround(texture_coords.mV[VX] * mMediaSource->getTextureWidth()), - llround((1.0f - texture_coords.mV[VY]) * mMediaSource->getTextureHeight())); + llround((1.0f - texture_coords.mV[VY]) * mMediaSource->getTextureHeight()), + mask, button); } } -void LLViewerMediaImpl::mouseMove(const LLVector2& texture_coords) +void LLViewerMediaImpl::mouseMove(const LLVector2& texture_coords, MASK mask) { if(mMediaSource) { mouseMove( llround(texture_coords.mV[VX] * mMediaSource->getTextureWidth()), - llround((1.0f - texture_coords.mV[VY]) * mMediaSource->getTextureHeight())); + llround((1.0f - texture_coords.mV[VY]) * mMediaSource->getTextureHeight()), + mask); } } ////////////////////////////////////////////////////////////////////////////////////////// -void LLViewerMediaImpl::mouseLeftDoubleClick(S32 x, S32 y) +void LLViewerMediaImpl::mouseDoubleClick(S32 x, S32 y, MASK mask, S32 button) { scaleMouse(&x, &y); mLastMouseX = x; mLastMouseY = y; if (mMediaSource) { - mMediaSource->mouseEvent(LLPluginClassMedia::MOUSE_EVENT_DOUBLE_CLICK, x, y, 0); + mMediaSource->mouseEvent(LLPluginClassMedia::MOUSE_EVENT_DOUBLE_CLICK, button, x, y, mask); } } @@ -1003,7 +1008,7 @@ void LLViewerMediaImpl::onMouseCaptureLost() { if (mMediaSource) { - mMediaSource->mouseEvent(LLPluginClassMedia::MOUSE_EVENT_UP, mLastMouseX, mLastMouseY, 0); + mMediaSource->mouseEvent(LLPluginClassMedia::MOUSE_EVENT_UP, 0, mLastMouseX, mLastMouseY, 0); } } @@ -1240,7 +1245,7 @@ bool LLViewerMediaImpl::handleUnicodeCharHere(llwchar uni_char) if (uni_char >= 32 // discard 'control' characters && uni_char != 127) // SDL thinks this is 'delete' - yuck. { - mMediaSource->textInput(wstring_to_utf8str(LLWString(1, uni_char))); + mMediaSource->textInput(wstring_to_utf8str(LLWString(1, uni_char)), gKeyboard->currentMask(FALSE)); } } diff --git a/indra/newview/llviewermedia.h b/indra/newview/llviewermedia.h index fc2776ee91..01640de33a 100644 --- a/indra/newview/llviewermedia.h +++ b/indra/newview/llviewermedia.h @@ -133,13 +133,13 @@ public: void focus(bool focus); // True if the impl has user focus. bool hasFocus() const; - void mouseDown(S32 x, S32 y); - void mouseUp(S32 x, S32 y); - void mouseMove(S32 x, S32 y); - void mouseDown(const LLVector2& texture_coords); - void mouseUp(const LLVector2& texture_coords); - void mouseMove(const LLVector2& texture_coords); - void mouseLeftDoubleClick(S32 x,S32 y ); + void mouseDown(S32 x, S32 y, MASK mask, S32 button = 0); + void mouseUp(S32 x, S32 y, MASK mask, S32 button = 0); + void mouseMove(S32 x, S32 y, MASK mask); + void mouseDown(const LLVector2& texture_coords, MASK mask, S32 button = 0); + void mouseUp(const LLVector2& texture_coords, MASK mask, S32 button = 0); + void mouseMove(const LLVector2& texture_coords, MASK mask); + void mouseDoubleClick(S32 x,S32 y, MASK mask, S32 button = 0); void mouseCapture(); void navigateBack(); diff --git a/indra/newview/llviewermediafocus.cpp b/indra/newview/llviewermediafocus.cpp index cad8b5f0ce..ad48ec145b 100644 --- a/indra/newview/llviewermediafocus.cpp +++ b/indra/newview/llviewermediafocus.cpp @@ -77,7 +77,6 @@ void LLViewerMediaFocus::setFocusFace(LLPointer<LLViewerObject> objectp, S32 fac if (media_impl.notNull() && objectp.notNull()) { bool face_auto_zoom = false; - media_impl->focus(true); mFocusedImplID = media_impl->getMediaTextureID(); mFocusedObjectID = objectp->getID(); @@ -101,6 +100,7 @@ void LLViewerMediaFocus::setFocusFace(LLPointer<LLViewerObject> objectp, S32 fac llwarns << "Can't find media entry for focused face" << llendl; } + media_impl->focus(true); gFocusMgr.setKeyboardFocus(this); // We must do this before processing the media HUD zoom, or it may zoom to the wrong face. |