From 9c789283111ef0eaf0944b30d3c024926f88de42 Mon Sep 17 00:00:00 2001 From: Callum Prentice Date: Tue, 28 Apr 2020 10:57:17 -0700 Subject: Initial port of the changes from DRTVWR509 (Adult Swim) minus the volume fall-off settings updates --- indra/llplugin/llpluginclassmedia.cpp | 4 ++ indra/media_plugins/cef/media_plugin_cef.cpp | 42 ++++++++--- indra/newview/llappviewer.cpp | 8 ++- indra/newview/lllogininstance.cpp | 2 +- indra/newview/llviewerparcelmedia.cpp | 1 + indra/newview/viewer_manifest.py | 100 +++++++++++++++------------ 6 files changed, 101 insertions(+), 56 deletions(-) (limited to 'indra') diff --git a/indra/llplugin/llpluginclassmedia.cpp b/indra/llplugin/llpluginclassmedia.cpp index 85197d1272..58069afdf9 100644 --- a/indra/llplugin/llpluginclassmedia.cpp +++ b/indra/llplugin/llpluginclassmedia.cpp @@ -1138,6 +1138,10 @@ void LLPluginClassMedia::receivePluginMessage(const LLPluginMessage &message) mDebugMessageLevel = message.getValue("message_level"); mediaEvent(LLPluginClassMediaOwner::MEDIA_EVENT_DEBUG_MESSAGE); } + else if (message_name == "tooltip_text") + { + mHoverText = message.getValue("tooltip"); + } else { LL_WARNS("Plugin") << "Unknown " << message_name << " class message: " << message_name << LL_ENDL; diff --git a/indra/media_plugins/cef/media_plugin_cef.cpp b/indra/media_plugins/cef/media_plugin_cef.cpp index cff21b13c4..bc967c9bca 100644 --- a/indra/media_plugins/cef/media_plugin_cef.cpp +++ b/indra/media_plugins/cef/media_plugin_cef.cpp @@ -62,6 +62,7 @@ private: void onConsoleMessageCallback(std::string message, std::string source, int line); void onStatusMessageCallback(std::string value); void onTitleChangeCallback(std::string title); + void onTooltipCallback(std::string text); void onLoadStartCallback(); void onRequestExitCallback(); void onLoadEndCallback(int httpStatusCode); @@ -71,6 +72,7 @@ private: bool onHTTPAuthCallback(const std::string host, const std::string realm, std::string& username, std::string& password); void onCursorChangedCallback(dullahan::ECursorType type); const std::vector onFileDialog(dullahan::EFileDialogType dialog_type, const std::string dialog_title, const std::string default_file, const std::string dialog_accept_filter, bool& use_default); + bool onJSDialogCallback(const std::string origin_url, const std::string message_text, const std::string default_prompt_text); void postDebugMessage(const std::string& msg); void authResponse(LLPluginMessage &message); @@ -87,6 +89,8 @@ private: bool mPluginsEnabled; bool mJavascriptEnabled; bool mDisableGPU; + bool mDisableNetworkService; + bool mUseMockKeyChain; std::string mUserAgentSubtring; std::string mAuthUsername; std::string mAuthPassword; @@ -95,7 +99,6 @@ private: bool mCanCopy; bool mCanPaste; std::string mCachePath; - std::string mCookiePath; std::string mCefLogFile; bool mCefLogVerbose; std::vector mPickedFiles; @@ -119,6 +122,8 @@ MediaPluginBase(host_send_func, host_user_data) mPluginsEnabled = false; mJavascriptEnabled = true; mDisableGPU = false; + mDisableNetworkService = true; + mUseMockKeyChain = true; mUserAgentSubtring = ""; mAuthUsername = ""; mAuthPassword = ""; @@ -127,7 +132,6 @@ MediaPluginBase(host_send_func, host_user_data) mCanCopy = false; mCanPaste = false; mCachePath = ""; - mCookiePath = ""; mCefLogFile = ""; mCefLogVerbose = false; mPickedFiles.clear(); @@ -208,6 +212,12 @@ void MediaPluginCEF::onTitleChangeCallback(std::string title) sendMessage(message); } +void MediaPluginCEF::onTooltipCallback(std::string text) +{ + LLPluginMessage message(LLPLUGIN_MESSAGE_CLASS_MEDIA, "tooltip_text"); + message.setValue("tooltip", text); + sendMessage(message); +} //////////////////////////////////////////////////////////////////////////////// // void MediaPluginCEF::onLoadStartCallback() @@ -355,6 +365,14 @@ const std::vector MediaPluginCEF::onFileDialog(dullahan::EFileDialo return std::vector(); } +//////////////////////////////////////////////////////////////////////////////// +// +bool MediaPluginCEF::onJSDialogCallback(const std::string origin_url, const std::string message_text, const std::string default_prompt_text) +{ + // return true indicates we suppress the JavaScript alert UI entirely + return true; +} + //////////////////////////////////////////////////////////////////////////////// // void MediaPluginCEF::onCursorChangedCallback(dullahan::ECursorType type) @@ -431,6 +449,8 @@ void MediaPluginCEF::receiveMessage(const char* message_string) { mCEFLib->update(); + mVolumeCatcher.pump(); + // this seems bad but unless the state changes (it won't until we figure out // how to get CEF to tell us if copy/cut/paste is available) then this function // will return immediately @@ -491,6 +511,7 @@ void MediaPluginCEF::receiveMessage(const char* message_string) mCEFLib->setOnConsoleMessageCallback(std::bind(&MediaPluginCEF::onConsoleMessageCallback, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3)); mCEFLib->setOnStatusMessageCallback(std::bind(&MediaPluginCEF::onStatusMessageCallback, this, std::placeholders::_1)); mCEFLib->setOnTitleChangeCallback(std::bind(&MediaPluginCEF::onTitleChangeCallback, this, std::placeholders::_1)); + mCEFLib->setOnTooltipCallback(std::bind(&MediaPluginCEF::onTooltipCallback, this, std::placeholders::_1)); mCEFLib->setOnLoadStartCallback(std::bind(&MediaPluginCEF::onLoadStartCallback, this)); mCEFLib->setOnLoadEndCallback(std::bind(&MediaPluginCEF::onLoadEndCallback, this, std::placeholders::_1)); mCEFLib->setOnLoadErrorCallback(std::bind(&MediaPluginCEF::onLoadError, this, std::placeholders::_1, std::placeholders::_2)); @@ -500,15 +521,19 @@ void MediaPluginCEF::receiveMessage(const char* message_string) mCEFLib->setOnFileDialogCallback(std::bind(&MediaPluginCEF::onFileDialog, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3, std::placeholders::_4, std::placeholders::_5)); mCEFLib->setOnCursorChangedCallback(std::bind(&MediaPluginCEF::onCursorChangedCallback, this, std::placeholders::_1)); mCEFLib->setOnRequestExitCallback(std::bind(&MediaPluginCEF::onRequestExitCallback, this)); - + mCEFLib->setOnJSDialogCallback(std::bind(&MediaPluginCEF::onJSDialogCallback, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3)); + dullahan::dullahan_settings settings; settings.accept_language_list = mHostLanguage; settings.background_color = 0xffffffff; settings.cache_enabled = true; settings.cache_path = mCachePath; - settings.cookie_store_path = mCookiePath; settings.cookies_enabled = mCookiesEnabled; settings.disable_gpu = mDisableGPU; +#if LL_DARWIN + settings.disable_network_service = mDisableNetworkService; + settings.use_mock_keychain = mUseMockKeyChain; +#endif settings.flash_enabled = mPluginsEnabled; settings.flip_mouse_y = false; settings.flip_pixels_y = true; @@ -561,7 +586,6 @@ void MediaPluginCEF::receiveMessage(const char* message_string) std::string user_data_path_cookies = message_in.getValue("cookies_path"); mCachePath = user_data_path_cache + "cef_cache"; - mCookiePath = user_data_path_cookies + "cef_cookies"; mCefLogFile = message_in.getValue("cef_log_file"); mCefLogVerbose = message_in.getValueBoolean("cef_verbose_log"); } @@ -661,8 +685,9 @@ void MediaPluginCEF::receiveMessage(const char* message_string) else if (message_name == "scroll_event") { // Mouse coordinates for cef to be able to scroll 'containers' - //S32 x = message_in.getValueS32("x"); - //S32 y = message_in.getValueS32("y"); + S32 x = message_in.getValueS32("x"); + S32 y = message_in.getValueS32("y"); + // Wheel's clicks S32 delta_x = message_in.getValueS32("clicks_x"); S32 delta_y = message_in.getValueS32("clicks_y"); @@ -670,8 +695,7 @@ void MediaPluginCEF::receiveMessage(const char* message_string) delta_x *= -scaling_factor; delta_y *= -scaling_factor; - // mCEFLib->mouseWheel(x, y, delta_x, delta_y); - mCEFLib->mouseWheel(delta_x, delta_y); + mCEFLib->mouseWheel(x, y, delta_x, delta_y); } else if (message_name == "text_event") { diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index cbb47d71f7..55728bc366 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -3211,12 +3211,16 @@ LLSD LLAppViewer::getViewerInfo() const cef_ver_codec << "."; cef_ver_codec << DULLAHAN_VERSION_MINOR; cef_ver_codec << "."; + cef_ver_codec << DULLAHAN_VERSION_POINT; + cef_ver_codec << "."; cef_ver_codec << DULLAHAN_VERSION_BUILD; - cef_ver_codec << " / CEF: "; + cef_ver_codec << std::endl; + cef_ver_codec << "CEF: "; cef_ver_codec << CEF_VERSION; - cef_ver_codec << " / Chromium: "; + cef_ver_codec << std::endl; + cef_ver_codec << "Chromium: "; cef_ver_codec << CHROME_VERSION_MAJOR; cef_ver_codec << "."; cef_ver_codec << CHROME_VERSION_MINOR; diff --git a/indra/newview/lllogininstance.cpp b/indra/newview/lllogininstance.cpp index 8a69acb8dc..873531ef22 100644 --- a/indra/newview/lllogininstance.cpp +++ b/indra/newview/lllogininstance.cpp @@ -62,7 +62,7 @@ #include #include -const S32 LOGIN_MAX_RETRIES = 3; +const S32 LOGIN_MAX_RETRIES = 0; // Viewer should not autmatically retry login const F32 LOGIN_SRV_TIMEOUT_MIN = 10; const F32 LOGIN_SRV_TIMEOUT_MAX = 120; const F32 LOGIN_DNS_TIMEOUT_FACTOR = 0.9; // make DNS wait shorter then retry time diff --git a/indra/newview/llviewerparcelmedia.cpp b/indra/newview/llviewerparcelmedia.cpp index b1b5275f82..4713ed4167 100644 --- a/indra/newview/llviewerparcelmedia.cpp +++ b/indra/newview/llviewerparcelmedia.cpp @@ -102,6 +102,7 @@ void LLViewerParcelMedia::update(LLParcel* parcel) if(mMediaImpl.isNull()) { + play(parcel); return; } diff --git a/indra/newview/viewer_manifest.py b/indra/newview/viewer_manifest.py index a403760670..60f980fb56 100755 --- a/indra/newview/viewer_manifest.py +++ b/indra/newview/viewer_manifest.py @@ -489,6 +489,10 @@ class WindowsManifest(ViewerManifest): # include the compiled launcher scripts so that it gets included in the file_list self.path('SLVersionChecker.exe') + with self.prefix(src=os.path.join(pkgdir, 'bin', 'release')): + # include the dullahan host process so we can code sign it later + self.path('dullahan_host.exe') + with self.prefix(dst="vmp_icons"): with self.prefix(src=self.icon_path()): self.path("secondlife.ico") @@ -593,13 +597,11 @@ class WindowsManifest(ViewerManifest): config = 'debug' if self.args['configuration'].lower() == 'debug' else 'release' with self.prefix(src=os.path.join(pkgdir, 'bin', config)): self.path("chrome_elf.dll") - self.path("d3dcompiler_43.dll") self.path("d3dcompiler_47.dll") self.path("libcef.dll") self.path("libEGL.dll") self.path("libGLESv2.dll") self.path("dullahan_host.exe") - self.path("natives_blob.bin") self.path("snapshot_blob.bin") self.path("v8_context_snapshot.bin") @@ -794,6 +796,7 @@ class WindowsManifest(ViewerManifest): for exe in ( self.final_exe(), "SLVersionChecker.exe", + "llplugin/dullahan_host.exe", ): self.sign(exe) @@ -827,13 +830,13 @@ class WindowsManifest(ViewerManifest): def sign(self, exe): sign_py = os.environ.get('SIGN', r'C:\buildscripts\code-signing\sign.py') - python = os.environ.get('PYTHON', 'python') + python = os.environ.get('PYTHON', sys.executable) if os.path.exists(sign_py): dst_path = self.dst_path_of(exe) print "about to run signing of: ", dst_path self.run_command([python, sign_py, dst_path]) else: - print "Skipping code signing of %s: %s not found" % (exe, sign_py) + print "Skipping code signing of %s %s: %s not found" % (self.dst_path_of(exe), exe, sign_py) def escape_slashes(self, path): return path.replace('\\', '\\\\\\\\') @@ -1103,46 +1106,55 @@ class DarwinManifest(ViewerManifest): # $viewer_app/Contents/Frameworks/Chromium Embedded Framework.framework SLPlugin_framework = self.relsymlinkf(CEF_framework, catch=False) - # copy DullahanHelper.app - self.path2basename(relpkgdir, 'DullahanHelper.app') - - # and fix that up with a Frameworks/CEF symlink too - with self.prefix(dst=os.path.join( - 'DullahanHelper.app', 'Contents', 'Frameworks')): - # from Dullahan Helper.app/Contents/Frameworks/Chromium Embedded - # Framework.framework back to - # SLPlugin.app/Contents/Frameworks/Chromium Embedded Framework.framework - # Since SLPlugin_framework is itself a - # symlink, don't let relsymlinkf() resolve -- - # explicitly call relpath(symlink=True) and - # create that symlink here. - DullahanHelper_framework = \ - self.symlinkf(self.relpath(SLPlugin_framework, symlink=True), - catch=False) - - # change_command includes install_name_tool, the - # -change subcommand and the old framework rpath - # stamped into the executable. To use it with - # run_command(), we must still append the new - # framework path and the pathname of the - # executable to change. - change_command = [ - 'install_name_tool', '-change', - '@rpath/Frameworks/Chromium Embedded Framework.framework/Chromium Embedded Framework'] - - with self.prefix(dst=os.path.join( - 'DullahanHelper.app', 'Contents', 'MacOS')): - # Now self.get_dst_prefix() is, at runtime, - # @executable_path. Locate the helper app - # framework (which is a symlink) from here. - newpath = os.path.join( - '@executable_path', - self.relpath(DullahanHelper_framework, symlink=True), - frameworkname) - # and restamp the DullahanHelper executable - self.run_command( - change_command + - [newpath, self.dst_path_of('DullahanHelper')]) + # for all the multiple CEF/Dullahan (as of CEF 76) helper app bundles we need: + for helper in ( + "DullahanHelper", + "DullahanHelper (GPU)", + "DullahanHelper (Renderer)", + "DullahanHelper (Plugin)", + ): + # app is the directory name of the app bundle, with app/Contents/MacOS/helper as the executable + app = helper + ".app" + + # copy DullahanHelper.app + self.path2basename(relpkgdir, app) + + # and fix that up with a Frameworks/CEF symlink too + with self.prefix(dst=os.path.join( + app, 'Contents', 'Frameworks')): + # from Dullahan Helper *.app/Contents/Frameworks/Chromium Embedded + # Framework.framework back to + # SLPlugin.app/Contents/Frameworks/Chromium Embedded Framework.framework + # Since SLPlugin_framework is itself a + # symlink, don't let relsymlinkf() resolve -- + # explicitly call relpath(symlink=True) and + # create that symlink here. + helper_framework = \ + self.symlinkf(self.relpath(SLPlugin_framework, symlink=True), catch=False) + + # change_command includes install_name_tool, the + # -change subcommand and the old framework rpath + # stamped into the executable. To use it with + # run_command(), we must still append the new + # framework path and the pathname of the + # executable to change. + change_command = [ + 'install_name_tool', '-change', + '@rpath/Frameworks/Chromium Embedded Framework.framework/Chromium Embedded Framework'] + + with self.prefix(dst=os.path.join( + app, 'Contents', 'MacOS')): + # Now self.get_dst_prefix() is, at runtime, + # @executable_path. Locate the helper app + # framework (which is a symlink) from here. + newpath = os.path.join( + '@executable_path', + self.relpath(helper_framework, symlink=True), + frameworkname) + # and restamp the Dullahan Helper executable itself + self.run_command( + change_command + + [newpath, self.dst_path_of(helper)]) # SLPlugin plugins with self.prefix(dst="llplugin"): -- cgit v1.2.3 From 1305c03a13ada7617531c0c3daf3092b7c7b3b05 Mon Sep 17 00:00:00 2001 From: Callum Prentice Date: Tue, 28 Apr 2020 15:38:45 -0700 Subject: Remove dullahan_host.exe from signing list - doesn't change anything security wise and leads to an extra copy of dullahan_host.exe because of a code signing bug --- indra/newview/viewer_manifest.py | 1 - 1 file changed, 1 deletion(-) (limited to 'indra') diff --git a/indra/newview/viewer_manifest.py b/indra/newview/viewer_manifest.py index 60f980fb56..a4987af548 100755 --- a/indra/newview/viewer_manifest.py +++ b/indra/newview/viewer_manifest.py @@ -796,7 +796,6 @@ class WindowsManifest(ViewerManifest): for exe in ( self.final_exe(), "SLVersionChecker.exe", - "llplugin/dullahan_host.exe", ): self.sign(exe) -- cgit v1.2.3 From 25aa0999c603399cf81680411e3824430a9be789 Mon Sep 17 00:00:00 2001 From: Callum Prentice Date: Tue, 28 Apr 2020 15:52:13 -0700 Subject: Fix for SL-13138 - Remove extraneous additon of dullahan_host.exe that crept in trying to make code signing work --- indra/newview/viewer_manifest.py | 4 ---- 1 file changed, 4 deletions(-) (limited to 'indra') diff --git a/indra/newview/viewer_manifest.py b/indra/newview/viewer_manifest.py index a4987af548..59929c198b 100755 --- a/indra/newview/viewer_manifest.py +++ b/indra/newview/viewer_manifest.py @@ -489,10 +489,6 @@ class WindowsManifest(ViewerManifest): # include the compiled launcher scripts so that it gets included in the file_list self.path('SLVersionChecker.exe') - with self.prefix(src=os.path.join(pkgdir, 'bin', 'release')): - # include the dullahan host process so we can code sign it later - self.path('dullahan_host.exe') - with self.prefix(dst="vmp_icons"): with self.prefix(src=self.icon_path()): self.path("secondlife.ico") -- cgit v1.2.3 From 77d2a05921bdba3ac284350650c5394dcc8e3444 Mon Sep 17 00:00:00 2001 From: Callum Prentice Date: Sun, 3 May 2020 19:03:22 -0700 Subject: Pick up first version of new Dullahan build autobuild scripts that builds CEF wrapper first before building Dullahan. Change to version headers meant a change to appviewer.cpp too. --- indra/newview/llappviewer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra') diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index 55728bc366..8fc9d7ec30 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -127,7 +127,7 @@ #include "llcoros.h" #include "llexception.h" #if !LL_LINUX -#include "cef/dullahan.h" +#include "cef/dullahan_version.h" #include "vlc/libvlc_version.h" #endif // LL_LINUX -- cgit v1.2.3 From 09802fa8ea9c8459e13a32720088f6d6fb1ad42d Mon Sep 17 00:00:00 2001 From: Callum Prentice Date: Fri, 15 May 2020 18:35:28 -0700 Subject: Tiny text change in the about box - indicates CEF and Chromium are sub-components --- indra/newview/llappviewer.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra') diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index 78cf21ddbb..7c0124322c 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -3223,11 +3223,11 @@ LLSD LLAppViewer::getViewerInfo() const cef_ver_codec << DULLAHAN_VERSION_BUILD; cef_ver_codec << std::endl; - cef_ver_codec << "CEF: "; + cef_ver_codec << " CEF: "; cef_ver_codec << CEF_VERSION; cef_ver_codec << std::endl; - cef_ver_codec << "Chromium: "; + cef_ver_codec << " Chromium: "; cef_ver_codec << CHROME_VERSION_MAJOR; cef_ver_codec << "."; cef_ver_codec << CHROME_VERSION_MINOR; -- cgit v1.2.3 From e853238493577e78199b4b9011d9723d4fa555d6 Mon Sep 17 00:00:00 2001 From: Callum Prentice Date: Wed, 20 May 2020 15:31:55 -0700 Subject: Fix for SL-13125 Update MediaRollOff values for greater range and less attenuation --- indra/newview/app_settings/settings.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'indra') diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 86c6b409de..d11269a6e6 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -8434,7 +8434,7 @@ Type F32 Value - 0.125 + 0.02 MediaRollOffMin @@ -8445,7 +8445,7 @@ Type F32 Value - 10.0 + 40.0 MediaRollOffMax @@ -8456,7 +8456,7 @@ Type F32 Value - 30.0 + 80.0 RecentItemsSortOrder -- cgit v1.2.3 From ad7dd768bc27f31cb0b0bc674432d1d38a33e890 Mon Sep 17 00:00:00 2001 From: Callum Prentice Date: Thu, 21 May 2020 12:28:33 -0700 Subject: Investigating a fix/abatement for SL-13095 Windows Defender Firewall for dullahan_host.exe pops up late in the session - not clear this will remove the popup but it might and it will hopefully have our publisher info on it vs 'Unknown' --- indra/newview/viewer_manifest.py | 1 + 1 file changed, 1 insertion(+) (limited to 'indra') diff --git a/indra/newview/viewer_manifest.py b/indra/newview/viewer_manifest.py index ffc071e70b..41eb40c998 100755 --- a/indra/newview/viewer_manifest.py +++ b/indra/newview/viewer_manifest.py @@ -795,6 +795,7 @@ class WindowsManifest(ViewerManifest): for exe in ( self.final_exe(), "SLVersionChecker.exe", + "llplugin/dullahan_host.exe", ): self.sign(exe) -- cgit v1.2.3 From ad1a46affa3c47ba04a53a5ad625cd3e3693118f Mon Sep 17 00:00:00 2001 From: Callum Prentice Date: Fri, 22 May 2020 13:16:38 -0700 Subject: Fix (has a TOOD) for SL-13203: Parcel media auto-play works when turned off --- indra/newview/llviewerparcelmedia.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'indra') diff --git a/indra/newview/llviewerparcelmedia.cpp b/indra/newview/llviewerparcelmedia.cpp index 4713ed4167..0cdd447fcd 100644 --- a/indra/newview/llviewerparcelmedia.cpp +++ b/indra/newview/llviewerparcelmedia.cpp @@ -159,6 +159,12 @@ void LLViewerParcelMedia::play(LLParcel* parcel) if (!gSavedSettings.getBOOL("AudioStreamingMedia")) return; + // This test appears all over the code and really should be facotred out into a single + // call that returns true/false (with option ask dialog) but that is outside of scope + // for this work so we'll just directly. + if (gSavedSettings.getS32("ParcelMediaAutoPlayEnable") == 0 ) + return; + std::string media_url = parcel->getMediaURL(); std::string media_current_url = parcel->getMediaCurrentURL(); std::string mime_type = parcel->getMediaType(); -- cgit v1.2.3 From a01f29761263314c21dd4905f05124f4c15df502 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Wed, 27 May 2020 00:30:52 +0300 Subject: SL-13148 Implemented wheel support for inworld media --- indra/newview/llpanelprimmediacontrols.cpp | 28 ++++++++++++++++++++++++++-- indra/newview/llpanelprimmediacontrols.h | 1 + indra/newview/lltoolpie.cpp | 21 +++++++++++++++++++-- indra/newview/lltoolpie.h | 1 + indra/newview/llviewermedia.cpp | 12 ++++++++++++ indra/newview/llviewermedia.h | 1 + indra/newview/llviewermediafocus.cpp | 17 +++++++++++++++-- indra/newview/llviewermediafocus.h | 6 ++++-- 8 files changed, 79 insertions(+), 8 deletions(-) (limited to 'indra') diff --git a/indra/newview/llpanelprimmediacontrols.cpp b/indra/newview/llpanelprimmediacontrols.cpp index 6e61584d33..55c84815aa 100644 --- a/indra/newview/llpanelprimmediacontrols.cpp +++ b/indra/newview/llpanelprimmediacontrols.cpp @@ -829,8 +829,32 @@ void LLPanelPrimMediaControls::draw() BOOL LLPanelPrimMediaControls::handleScrollWheel(S32 x, S32 y, S32 clicks) { - mInactivityTimer.start(); - return LLViewerMediaFocus::getInstance()->handleScrollWheel(x, y, clicks); + mInactivityTimer.start(); + BOOL res = FALSE; + + // Unlike other mouse events, we need to handle scroll here otherwise + // it will be intercepted by camera and won't reach toolpie + if (LLViewerMediaFocus::getInstance()->isHoveringOverFocused()) + { + // either let toolpie handle this or expose mHoverPick.mUVCoords in some way + res = LLToolPie::getInstance()->handleScrollWheel(x, y, clicks); + } + + return res; +} + +BOOL LLPanelPrimMediaControls::handleScrollHWheel(S32 x, S32 y, S32 clicks) +{ + mInactivityTimer.start(); + BOOL res = FALSE; + + if (LLViewerMediaFocus::getInstance()->isHoveringOverFocused()) + { + // either let toolpie handle this or expose mHoverPick.mUVCoords in some way + res = LLToolPie::getInstance()->handleScrollHWheel(x, y, clicks); + } + + return res; } BOOL LLPanelPrimMediaControls::handleMouseDown(S32 x, S32 y, MASK mask) diff --git a/indra/newview/llpanelprimmediacontrols.h b/indra/newview/llpanelprimmediacontrols.h index 21d5236074..d4301aaf7c 100644 --- a/indra/newview/llpanelprimmediacontrols.h +++ b/indra/newview/llpanelprimmediacontrols.h @@ -48,6 +48,7 @@ public: /*virtual*/ BOOL postBuild(); virtual void draw(); virtual BOOL handleScrollWheel(S32 x, S32 y, S32 clicks); + virtual BOOL handleScrollHWheel(S32 x, S32 y, S32 clicks); virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask); virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask); diff --git a/indra/newview/lltoolpie.cpp b/indra/newview/lltoolpie.cpp index aeb8bdc496..f499c34ca4 100644 --- a/indra/newview/lltoolpie.cpp +++ b/indra/newview/lltoolpie.cpp @@ -203,14 +203,31 @@ BOOL LLToolPie::handleRightMouseUp(S32 x, S32 y, MASK mask) return LLTool::handleRightMouseUp(x, y, mask); } +BOOL LLToolPie::handleScrollWheelAny(S32 x, S32 y, S32 clicks_x, S32 clicks_y) +{ + BOOL res = FALSE; + // mHoverPick should have updated on its own and we should have a face + // in LLViewerMediaFocus in case of media, so just reuse mHoverPick + if (mHoverPick.mUVCoords.mV[VX] >= 0.f && mHoverPick.mUVCoords.mV[VY] >= 0.f) + { + res = LLViewerMediaFocus::getInstance()->handleScrollWheel(mHoverPick.mUVCoords, clicks_x, clicks_y); + } + else + { + // this won't provide correct coordinates in case of object selection + res = LLViewerMediaFocus::getInstance()->handleScrollWheel(x, y, clicks_x, clicks_y); + } + return res; +} + BOOL LLToolPie::handleScrollWheel(S32 x, S32 y, S32 clicks) { - return LLViewerMediaFocus::getInstance()->handleScrollWheel(x, y, clicks); + return handleScrollWheelAny(x, y, 0, clicks); } BOOL LLToolPie::handleScrollHWheel(S32 x, S32 y, S32 clicks) { - return LLViewerMediaFocus::getInstance()->handleScrollWheel(x, y, clicks); + return handleScrollWheelAny(x, y, clicks, 0); } // True if you selected an object. diff --git a/indra/newview/lltoolpie.h b/indra/newview/lltoolpie.h index fe0acfe473..2d6c22f425 100644 --- a/indra/newview/lltoolpie.h +++ b/indra/newview/lltoolpie.h @@ -49,6 +49,7 @@ public: virtual BOOL handleRightMouseUp(S32 x, S32 y, MASK mask); virtual BOOL handleHover(S32 x, S32 y, MASK mask); virtual BOOL handleDoubleClick(S32 x, S32 y, MASK mask); + BOOL handleScrollWheelAny(S32 x, S32 y, S32 clicks_x, S32 clicks_y); virtual BOOL handleScrollWheel(S32 x, S32 y, S32 clicks); virtual BOOL handleScrollHWheel(S32 x, S32 y, S32 clicks); virtual BOOL handleToolTip(S32 x, S32 y, MASK mask); diff --git a/indra/newview/llviewermedia.cpp b/indra/newview/llviewermedia.cpp index 99b54f66d3..ed5dff1600 100644 --- a/indra/newview/llviewermedia.cpp +++ b/indra/newview/llviewermedia.cpp @@ -2293,6 +2293,18 @@ void LLViewerMediaImpl::mouseDoubleClick(S32 x, S32 y, MASK mask, S32 button) } } +////////////////////////////////////////////////////////////////////////////////////////// +void LLViewerMediaImpl::scrollWheel(const LLVector2& texture_coords, S32 scroll_x, S32 scroll_y, MASK mask) +{ + if (mMediaSource) + { + S32 x, y; + scaleTextureCoords(texture_coords, &x, &y); + + scrollWheel(x, y, scroll_x, scroll_y, mask); + } +} + ////////////////////////////////////////////////////////////////////////////////////////// void LLViewerMediaImpl::scrollWheel(S32 x, S32 y, S32 scroll_x, S32 scroll_y, MASK mask) { diff --git a/indra/newview/llviewermedia.h b/indra/newview/llviewermedia.h index 9467a138f0..512c5a8279 100644 --- a/indra/newview/llviewermedia.h +++ b/indra/newview/llviewermedia.h @@ -235,6 +235,7 @@ public: void mouseMove(const LLVector2& texture_coords, MASK mask); void mouseDoubleClick(const LLVector2& texture_coords, MASK mask); void mouseDoubleClick(S32 x, S32 y, MASK mask, S32 button = 0); + void scrollWheel(const LLVector2& texture_coords, S32 scroll_x, S32 scroll_y, MASK mask); void scrollWheel(S32 x, S32 y, S32 scroll_x, S32 scroll_y, MASK mask); void mouseCapture(); diff --git a/indra/newview/llviewermediafocus.cpp b/indra/newview/llviewermediafocus.cpp index 69ab0a71af..71ae7bfbc3 100644 --- a/indra/newview/llviewermediafocus.cpp +++ b/indra/newview/llviewermediafocus.cpp @@ -371,13 +371,26 @@ BOOL LLViewerMediaFocus::handleUnicodeChar(llwchar uni_char, BOOL called_from_pa media_impl->handleUnicodeCharHere(uni_char); return true; } -BOOL LLViewerMediaFocus::handleScrollWheel(S32 x, S32 y, S32 clicks) + +BOOL LLViewerMediaFocus::handleScrollWheel(const LLVector2& texture_coords, S32 clicks_x, S32 clicks_y) +{ + BOOL retval = FALSE; + LLViewerMediaImpl* media_impl = getFocusedMediaImpl(); + if (media_impl && media_impl->hasMedia()) + { + media_impl->scrollWheel(texture_coords, clicks_x, clicks_y, gKeyboard->currentMask(TRUE)); + retval = TRUE; + } + return retval; +} + +BOOL LLViewerMediaFocus::handleScrollWheel(S32 x, S32 y, S32 clicks_x, S32 clicks_y) { BOOL retval = FALSE; LLViewerMediaImpl* media_impl = getFocusedMediaImpl(); if(media_impl && media_impl->hasMedia()) { - media_impl->scrollWheel(x, y, 0, clicks, gKeyboard->currentMask(TRUE)); + media_impl->scrollWheel(x, y, clicks_x, clicks_y, gKeyboard->currentMask(TRUE)); retval = TRUE; } return retval; diff --git a/indra/newview/llviewermediafocus.h b/indra/newview/llviewermediafocus.h index 763a6c1688..fa469c36e3 100644 --- a/indra/newview/llviewermediafocus.h +++ b/indra/newview/llviewermediafocus.h @@ -58,7 +58,8 @@ public: /*virtual*/ BOOL handleKey(KEY key, MASK mask, BOOL called_from_parent); /*virtual*/ BOOL handleKeyUp(KEY key, MASK mask, BOOL called_from_parent); /*virtual*/ BOOL handleUnicodeChar(llwchar uni_char, BOOL called_from_parent); - BOOL handleScrollWheel(S32 x, S32 y, S32 clicks); + BOOL handleScrollWheel(const LLVector2& texture_coords, S32 clicks_x, S32 clicks_y); + BOOL handleScrollWheel(S32 x, S32 y, S32 clicks_x, S32 clicks_y); void update(); @@ -67,7 +68,8 @@ public: bool isFocusedOnFace(LLPointer objectp, S32 face); bool isHoveringOverFace(LLPointer objectp, S32 face); - + bool isHoveringOverFocused() { return mFocusedObjectID == mHoverObjectID && mFocusedObjectFace == mHoverObjectFace; }; + // These look up (by uuid) and return the values that were set with setFocusFace. They will return null if the objects have been destroyed. LLViewerMediaImpl* getFocusedMediaImpl(); LLViewerObject* getFocusedObject(); -- cgit v1.2.3 From c0087286e78098ee246ea821aefb5686ab8bda78 Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Tue, 23 Jun 2020 16:52:36 -0400 Subject: Increment viewer version to 6.4.5 following promotion of DRTVWR-512 --- indra/newview/VIEWER_VERSION.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra') diff --git a/indra/newview/VIEWER_VERSION.txt b/indra/newview/VIEWER_VERSION.txt index 49df80bfeb..7d765dabde 100644 --- a/indra/newview/VIEWER_VERSION.txt +++ b/indra/newview/VIEWER_VERSION.txt @@ -1 +1 @@ -6.4.4 +6.4.5 -- cgit v1.2.3