From adb0706aa0f3778fda9921172eaabefd3177dbdc Mon Sep 17 00:00:00 2001
From: callum_linden <none@none>
Date: Thu, 2 Jul 2015 23:56:19 +0100
Subject: [PATCH] plugin and llceflib code for improved mouse support

---
 autobuild.xml                                | 10 +++++-----
 indra/media_plugins/cef/media_plugin_cef.cpp | 17 +++++++++++++----
 2 files changed, 18 insertions(+), 9 deletions(-)

diff --git a/autobuild.xml b/autobuild.xml
index c3f0297c00d..92317bcaa60 100755
--- a/autobuild.xml
+++ b/autobuild.xml
@@ -1536,11 +1536,11 @@
             <key>archive</key>
             <map>
               <key>hash</key>
-              <string>706fa86b0fd7621456d4b8a6747a8c3f</string>
+              <string>15f7db04113c492d32918ff518cddca7</string>
               <key>hash_algorithm</key>
               <string>md5</string>
               <key>url</key>
-              <string>http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/llceflib_3p-llceflib/rev/303093/arch/Darwin/installer/llceflib-1.0.0.(CEF-OSX-3.2171.2069-32).303093-darwin-303093.tar.bz2</string>
+              <string>http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/llceflib_3p-llceflib/rev/303194/arch/Darwin/installer/llceflib-1.0.0.CEF-OSX-3.2171.2069-32.303194-darwin-303194.tar.bz2</string>
             </map>
             <key>name</key>
             <string>darwin</string>
@@ -1550,18 +1550,18 @@
             <key>archive</key>
             <map>
               <key>hash</key>
-              <string>0867f50bc1292bc0f1a66f2008feab51</string>
+              <string>c0c6e8d79001145c90a7136a1f5a3c18</string>
               <key>hash_algorithm</key>
               <string>md5</string>
               <key>url</key>
-              <string>http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/llceflib_3p-llceflib/rev/303093/arch/CYGWIN/installer/llceflib-1.0.0.(CEF-WIN-3.2272.gbda8dc7-32).303093-windows-303093.tar.bz2</string>
+              <string>http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/llceflib_3p-llceflib/rev/303194/arch/CYGWIN/installer/llceflib-1.0.0.CEF-WIN-3.2272.gbda8dc7-32.303194-windows-303194.tar.bz2</string>
             </map>
             <key>name</key>
             <string>windows</string>
           </map>
         </map>
         <key>version</key>
-        <string>1.0.0.(CEF-WIN-3.2272.gbda8dc7-32).303093</string>
+        <string>1.0.0.CEF-OSX-3.2171.2069-32.303194</string>
       </map>
       <key>llphysicsextensions_source</key>
       <map>
diff --git a/indra/media_plugins/cef/media_plugin_cef.cpp b/indra/media_plugins/cef/media_plugin_cef.cpp
index 358b35bbe20..ccb8a93f870 100644
--- a/indra/media_plugins/cef/media_plugin_cef.cpp
+++ b/indra/media_plugins/cef/media_plugin_cef.cpp
@@ -339,26 +339,35 @@ void MediaPluginCEF::receiveMessage(const char* message_string)
 			else if (message_name == "mouse_event")
 			{
 				std::string event = message_in.getValue("event");
-				//S32 button = message_in.getValueS32("button");
+				
 				S32 x = message_in.getValueS32("x");
 				S32 y = message_in.getValueS32("y");
 
 				//std::string modifiers = message_in.getValue("modifiers");
 
+				S32 button = message_in.getValueS32("button");
+				EMouseButton btn = MB_MOUSE_BUTTON_LEFT;
+				if (button == 0) btn = MB_MOUSE_BUTTON_LEFT;
+				if (button == 1) btn = MB_MOUSE_BUTTON_RIGHT;
+				if (button == 2) btn = MB_MOUSE_BUTTON_MIDDLE;
+
 				if (event == "down")
 				{
-					mLLCEFLib->mouseButton(0, true, x, y);
-					mLLCEFLib->setFocus(true);
+					mLLCEFLib->mouseButton(btn, ME_MOUSE_DOWN, x, y);
 					std::stringstream str;
 					str << "Mouse down at = " << x << ", " << y;
 					postDebugMessage(str.str());
 				}
 				else if (event == "up")
 				{
-					mLLCEFLib->mouseButton(0, false, x, y);
+					mLLCEFLib->mouseButton(btn, ME_MOUSE_UP, x, y);
+					std::stringstream str;
+					str << "Mouse up at = " << x << ", " << y;
+					postDebugMessage(str.str());
 				}
 				else if (event == "double_click")
 				{
+					// TODO: do we need this ?
 				}
 				else
 				{
-- 
GitLab