Skip to content
Snippets Groups Projects
Commit 62e0e51b authored by callum's avatar callum
Browse files

Merge

parents 3008b3fd 376deff7
No related branches found
No related tags found
No related merge requests found
......@@ -112,6 +112,8 @@ void LLPluginClassMedia::reset()
mLowPrioritySizeLimit = LOW_PRIORITY_TEXTURE_SIZE_DEFAULT;
mAllowDownsample = false;
mPadding = 0;
mLastMouseX = 0;
mLastMouseY = 0;
mStatus = LLPluginClassMediaOwner::MEDIA_NONE;
mSleepTime = 1.0f / 100.0f;
mCanCut = false;
......@@ -412,8 +414,20 @@ std::string LLPluginClassMedia::translateModifiers(MASK modifiers)
return result;
}
void LLPluginClassMedia::mouseEvent(EMouseEventType type, int x, int y, MASK modifiers)
void LLPluginClassMedia::mouseEvent(EMouseEventType type, int button, int x, int y, MASK modifiers)
{
if(type == MOUSE_EVENT_MOVE)
{
if((x == mLastMouseX) && (y == mLastMouseY))
{
// Don't spam unnecessary mouse move events.
return;
}
mLastMouseX = x;
mLastMouseY = y;
}
LLPluginMessage message(LLPLUGIN_MESSAGE_CLASS_MEDIA, "mouse_event");
std::string temp;
switch(type)
......@@ -425,6 +439,8 @@ void LLPluginClassMedia::mouseEvent(EMouseEventType type, int x, int y, MASK mod
}
message.setValue("event", temp);
message.setValueS32("button", button);
message.setValueS32("x", x);
// Incoming coordinates are OpenGL-style ((0,0) = lower left), so flip them here if the plugin has requested it.
......@@ -515,11 +531,12 @@ void LLPluginClassMedia::scrollEvent(int x, int y, MASK modifiers)
sendMessage(message);
}
bool LLPluginClassMedia::textInput(const std::string &text)
bool LLPluginClassMedia::textInput(const std::string &text, MASK modifiers)
{
LLPluginMessage message(LLPLUGIN_MESSAGE_CLASS_MEDIA, "text_event");
message.setValue("text", text);
message.setValue("modifiers", translateModifiers(modifiers));
sendMessage(message);
......
......@@ -101,7 +101,7 @@ class LLPluginClassMedia : public LLPluginProcessParentOwner
MOUSE_EVENT_DOUBLE_CLICK
}EMouseEventType;
void mouseEvent(EMouseEventType type, int x, int y, MASK modifiers);
void mouseEvent(EMouseEventType type, int button, int x, int y, MASK modifiers);
typedef enum
{
......@@ -115,7 +115,7 @@ class LLPluginClassMedia : public LLPluginProcessParentOwner
void scrollEvent(int x, int y, MASK modifiers);
// Text may be unicode (utf8 encoded)
bool textInput(const std::string &text);
bool textInput(const std::string &text, MASK modifiers);
void loadURI(const std::string &uri);
......@@ -310,6 +310,8 @@ class LLPluginClassMedia : public LLPluginProcessParentOwner
std::string translateModifiers(MASK modifiers);
std::string mCursorName;
int mLastMouseX;
int mLastMouseY;
LLPluginClassMediaOwner::EMediaStatus mStatus;
......
This diff is collapsed.
......@@ -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 );
......
......@@ -86,6 +86,8 @@ class LLMediaCtrl :
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 );
......
......@@ -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
......
......@@ -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));
}
}
......
......@@ -133,13 +133,13 @@ class LLViewerMediaImpl
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();
......
......@@ -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.
......
......@@ -948,9 +948,9 @@ anguage Infrstructure (CLI) international standard</string>
<key>darwin</key>
<map>
<key>md5sum</key>
<string>1859f5f6335d702cc42aeb602669b55e</string>
<string>b40a13847ee773c9ee06f641fe0dd1c2</string>
<key>url</key>
<uri>http://s3.amazonaws.com/viewer-source-downloads/install_pkgs/llqtwebkit-darwin-20090827.tar.bz2</uri>
<uri>http://s3.amazonaws.com/viewer-source-downloads/install_pkgs/llqtwebkit-darwin-20091023.tar.bz2</uri>
</map>
<key>linux</key>
<map>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment