diff options
Diffstat (limited to 'indra/llplugin')
-rw-r--r-- | indra/llplugin/llpluginclassmedia.cpp | 21 | ||||
-rw-r--r-- | indra/llplugin/llpluginclassmedia.h | 6 |
2 files changed, 23 insertions, 4 deletions
diff --git a/indra/llplugin/llpluginclassmedia.cpp b/indra/llplugin/llpluginclassmedia.cpp index fc58b48a7b..6556aa33a4 100644 --- a/indra/llplugin/llpluginclassmedia.cpp +++ b/indra/llplugin/llpluginclassmedia.cpp @@ -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); diff --git a/indra/llplugin/llpluginclassmedia.h b/indra/llplugin/llpluginclassmedia.h index 697deec353..603817b7d0 100644 --- a/indra/llplugin/llpluginclassmedia.h +++ b/indra/llplugin/llpluginclassmedia.h @@ -101,7 +101,7 @@ public: 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 @@ public: 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 @@ protected: std::string translateModifiers(MASK modifiers); std::string mCursorName; + int mLastMouseX; + int mLastMouseY; LLPluginClassMediaOwner::EMediaStatus mStatus; |