diff options
author | Steven Bennetts <steve@lindenlab.com> | 2008-09-23 01:53:11 +0000 |
---|---|---|
committer | Steven Bennetts <steve@lindenlab.com> | 2008-09-23 01:53:11 +0000 |
commit | afe61eb994377e25d60d0a0893510a693149c6be (patch) | |
tree | 80c6e33cd664e5c8b1c5f55c3b7b49c081dd590a /indra/newview | |
parent | 2945882258ad1befe8e8094c0a1a655e4ddbcd30 (diff) |
QAR-849 merge maint-viewer-10-merge 96838-97237 -> release
Diffstat (limited to 'indra/newview')
34 files changed, 816 insertions, 193 deletions
diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index 8b97ef7da9..78c4a71d3e 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -5,6 +5,7 @@ project(viewer) include(00-Common) include(Boost) include(BuildVersion) +include(DBusGlib) include(DirectX) include(ELFIO) include(FMOD) @@ -874,6 +875,7 @@ endif (DARWIN) if (LINUX) LIST(APPEND viewer_SOURCE_FILES llappviewerlinux.cpp) + LIST(APPEND viewer_SOURCE_FILES llappviewerlinux_api_dbus.cpp) LIST(APPEND CMAKE_EXE_LINKER_FLAGS -Wl,--as-needed) set(viewer_LIBRARIES @@ -1392,6 +1394,7 @@ target_link_libraries(${VIEWER_BINARY_NAME} ${viewer_LIBRARIES} ${BOOST_PROGRAM_OPTIONS_LIBRARY} ${BOOST_REGEX_LIBRARY} + ${DBUSGLIB_LIBRARIES} ${OPENGL_LIBRARIES} ${FMODWRAPPER_LIBRARY} ${OPENGL_LIBRARIES} diff --git a/indra/newview/app_settings/keywords.ini b/indra/newview/app_settings/keywords.ini index 3679c3882c..0ab977d8e9 100644 --- a/indra/newview/app_settings/keywords.ini +++ b/indra/newview/app_settings/keywords.ini @@ -332,11 +332,11 @@ REMOTE_DATA_REQUEST Value of event_type in remote_event if XML-RPC request is re REMOTE_DATA_REPLY Value of event_type in remote_event if XML-RPC reply is received -PRIM_TYPE Followed by PRIM_TYPE_BOX, PRIM_TYPE_CYLINDER, PRIM_TYPE_PRISM, PRIM_TYPE_SPHERE,:PRIM_TYPE_TORUS, or PRIM_TYPE_TUBE and their arguments -PRIM_MATERIAL Sets material to PRIM_MATERIAL_STONE, PRIM_MATERIAL_METAL, PRIM_MATERIAL_GLASS,:PRIM_MATERIAL_WOOD, PRIM_MATERIAL_FLESH, PRIM_MATERIAL_PLASTIC,:PRIM_MATERIAL_RUBBER, or PRIM_MATERIAL_LIGHT +PRIM_TYPE Followed by PRIM_TYPE_BOX, PRIM_TYPE_CYLINDER, PRIM_TYPE_PRISM, PRIM_TYPE_SPHERE, PRIM_TYPE_TORUS, PRIM_TYPE_TUBE, or PRIM_TYPE_SCULPT and their arguments +PRIM_MATERIAL Followed by PRIM_MATERIAL_STONE, PRIM_MATERIAL_METAL, PRIM_MATERIAL_GLASS, PRIM_MATERIAL_WOOD, PRIM_MATERIAL_FLESH, PRIM_MATERIAL_PLASTIC, or PRIM_MATERIAL_RUBBER PRIM_PHYSICS Sets physics to TRUE or FALSE -PRIM_FLEXIBLE Sets primitive flexibility to TRUE or FALSE -PRIM_POINT_LIGHT Sets light emission to TRUE or FALSE +PRIM_FLEXIBLE Followed by TRUE or FALSE, integer softness, float gravity, float friction, float wind, float tension, and vector force +PRIM_POINT_LIGHT Followed by TRUE or FALSE, vector color, float intensity, float radius, float falloff PRIM_TEMP_ON_REZ Sets temporay on rez to TRUE or FALSE PRIM_PHANTOM Sets phantom to TRUE or FALSE PRIM_CAST_SHADOWS DEPRECATED. Takes 1 parameter, an integer, but has no effect when set and always returns 0 if used in llGetPrimitiveParams. @@ -357,7 +357,7 @@ PRIM_TYPE_SPHERE Followed by integer hole shape, vector cut, float hollow, vecto PRIM_TYPE_TORUS Followed by integer hole shape, vector cut, float hollow, vector twist,:vector hole size, vector top shear, vector advanced cut, vector taper,:float revolutions, float radius offset, and float skew PRIM_TYPE_TUBE Followed by integer hole shape, vector cut, float hollow, vector twist,:vector hole size, vector top shear, vector advanced cut, vector taper,:float revolutions, float radius offset, and float skew PRIM_TYPE_RING Followed by integer hole shape, vector cut, float hollow, vector twist,:vector hole size, vector top shear, vector advanced cut, vector taper,:float revolutions, float radius offset, and float skew -PRIM_TYPE_SCULPT Followed by a key or string texture uuid. +PRIM_TYPE_SCULPT Followed by a key/string texture uuid, and one of PRIM_SCULPT_TYPE_SPHERE, PRIM_SCULPT_TYPE_TORUS, PRIM_SCULPT_TYPE_PLANE, or PRIM_SCULPT_TYPE_CYLINDER PRIM_HOLE_DEFAULT Sets hole type to match the prim type. PRIM_HOLE_SQUARE Sets hole type to square. diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp index 19a0676374..36e4182e37 100644 --- a/indra/newview/llagent.cpp +++ b/indra/newview/llagent.cpp @@ -4103,7 +4103,10 @@ void LLAgent::changeCameraToThirdPerson(BOOL animate) if (mAvatarObject) { - mAvatarObject->mPelvisp->setPosition(LLVector3::zero); + if (!mAvatarObject->mIsSitting) + { + mAvatarObject->mPelvisp->setPosition(LLVector3::zero); + } mAvatarObject->startMotion( ANIM_AGENT_BODY_NOISE ); mAvatarObject->startMotion( ANIM_AGENT_BREATHE_ROT ); } diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index 8ee21b6115..87467e6afa 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -307,9 +307,6 @@ const char *VFS_INDEX_FILE_BASE = "index.db2.x."; static std::string gSecondLife; static std::string gWindowTitle; -#ifdef LL_WINDOWS - static char sWindowClass[] = "Second Life"; -#endif std::string gLoginPage; std::vector<std::string> gLoginURIs; @@ -329,8 +326,7 @@ static void ui_audio_callback(const LLUUID& uuid) { if (gAudiop) { - F32 volume = gSavedSettings.getBOOL("MuteUI") ? 0.f : gSavedSettings.getF32("AudioLevelUI"); - gAudiop->triggerSound(uuid, gAgent.getID(), volume); + gAudiop->triggerSound(uuid, gAgent.getID(), 1.0f, LLAudioEngine::AUDIO_TYPE_UI); } } @@ -496,30 +492,17 @@ void LLAppViewer::initGridChoice() } } -bool send_url_to_other_instance(const std::string& url) +//virtual +bool LLAppViewer::initSLURLHandler() { -#if LL_WINDOWS - wchar_t window_class[256]; /* Flawfinder: ignore */ // Assume max length < 255 chars. - mbstowcs(window_class, sWindowClass, 255); - window_class[255] = 0; - // Use the class instead of the window name. - HWND other_window = FindWindow(window_class, NULL); - - if (other_window != NULL) - { - lldebugs << "Found other window with the name '" << gWindowTitle << "'" << llendl; - COPYDATASTRUCT cds; - const S32 SLURL_MESSAGE_TYPE = 0; - cds.dwData = SLURL_MESSAGE_TYPE; - cds.cbData = url.length() + 1; - cds.lpData = (void*)url.c_str(); - - LRESULT msg_result = SendMessage(other_window, WM_COPYDATA, NULL, (LPARAM)&cds); - lldebugs << "SendMessage(WM_COPYDATA) to other window '" - << gWindowTitle << "' returned " << msg_result << llendl; - return true; - } -#endif + // does nothing unless subclassed + return false; +} + +//virtual +bool LLAppViewer::sendURLToOtherInstance(const std::string& url) +{ + // does nothing unless subclassed return false; } @@ -715,6 +698,9 @@ bool LLAppViewer::init() // Find partition serial number (Windows) or hardware serial (Mac) mSerialNumber = generateSerialNumber(); + // do any necessary set-up for accepting incoming SLURLs from apps + initSLURLHandler(); + if(false == initHardwareTest()) { // Early out from user choice. @@ -888,6 +874,13 @@ bool LLAppViewer::mainLoop() { LLFastTimer t(LLFastTimer::FTM_FRAME); + pingMainloopTimeout("Main:MiscNativeWindowEvents"); + + { + LLFastTimer t2(LLFastTimer::FTM_MESSAGES); + gViewerWindow->mWindow->processMiscNativeEvents(); + } + pingMainloopTimeout("Main:GatherInput"); { @@ -1915,7 +1908,7 @@ bool LLAppViewer::initConfiguration() #endif LLStringUtil::truncate(gWindowTitle, 255); - //RN: if we received a URL, hand it off to the existing instance + //RN: if we received a URL, hand it off to the existing instance. // don't call anotherInstanceRunning() when doing URL handoff, as // it relies on checking a marker file which will not work when running // out of different directories @@ -1930,7 +1923,7 @@ bool LLAppViewer::initConfiguration() } if (!slurl.empty()) { - if (send_url_to_other_instance(slurl)) + if (sendURLToOtherInstance(slurl)) { // successfully handed off URL to existing instance, exit return false; @@ -2419,24 +2412,23 @@ bool LLAppViewer::anotherInstanceRunning() { // Another instance is running. Skip the rest of these operations. LL_INFOS("MarkerFile") << "Marker file is locked." << LL_ENDL; - return TRUE; + return true; } if (apr_file_lock(fMarker, APR_FLOCK_NONBLOCK | APR_FLOCK_EXCLUSIVE) != APR_SUCCESS) //flock(fileno(fMarker), LOCK_EX | LOCK_NB) == -1) { apr_file_close(fMarker); LL_INFOS("MarkerFile") << "Marker file is locked." << LL_ENDL; - return TRUE; + return true; } // No other instances; we'll lock this file now & delete on quit. apr_file_close(fMarker); } LL_DEBUGS("MarkerFile") << "Marker file isn't locked." << LL_ENDL; - return FALSE; + return false; } void LLAppViewer::initMarkerFile() { - //First, check for the existence of other files. //There are marker files for two different types of crashes @@ -2691,7 +2683,7 @@ bool LLAppViewer::initCache() // Init the texture cache // Allocate 80% of the cache size for textures - BOOL read_only = mSecondInstance ? true : false; + BOOL read_only = mSecondInstance ? TRUE : FALSE; const S32 MB = 1024*1024; S64 cache_size = (S64)(gSavedSettings.getU32("CacheSize")) * MB; const S64 MAX_CACHE_SIZE = 1024*MB; diff --git a/indra/newview/llappviewer.h b/indra/newview/llappviewer.h index 2415790973..a43fc56e51 100644 --- a/indra/newview/llappviewer.h +++ b/indra/newview/llappviewer.h @@ -135,15 +135,18 @@ public: void resumeMainloopTimeout(const std::string& state = "", F32 secs = -1.0f); void pingMainloopTimeout(const std::string& state, F32 secs = -1.0f); + protected: virtual bool initWindow(); // Initialize the viewer's window. virtual bool initLogging(); // Initialize log files, logging system, return false on failure. virtual void initConsole() {}; // Initialize OS level debugging console. virtual bool initHardwareTest() { return true; } // A false result indicates the app should quit. + virtual bool initSLURLHandler(); + virtual bool sendURLToOtherInstance(const std::string& url); - virtual bool initParseCommandLine(LLCommandLineParser& clp) + virtual bool initParseCommandLine(LLCommandLineParser& clp) { return true; } // Allow platforms to specify the command line args. - + virtual std::string generateSerialNumber() = 0; // Platforms specific classes generate this. diff --git a/indra/newview/llappviewerlinux.cpp b/indra/newview/llappviewerlinux.cpp index a40ee702c6..3f6a30cf32 100644 --- a/indra/newview/llappviewerlinux.cpp +++ b/indra/newview/llappviewerlinux.cpp @@ -1,6 +1,6 @@ /** * @file llappviewerlinux.cpp - * @brief The LLAppViewerWin32 class definitions + * @brief The LLAppViewerLinux class definitions * * $LicenseInfo:firstyear=2007&license=viewergpl$ * @@ -36,8 +36,10 @@ #include "llcommandlineparser.h" #include "llmemtype.h" +#include "llurldispatcher.h" // SLURL from other app instance #include "llviewernetwork.h" #include "llviewercontrol.h" +#include "llwindowsdl.h" #include "llmd5.h" #include "llfindlocale.h" @@ -60,6 +62,17 @@ # include "ELFIO/ELFIO.h" // for better backtraces #endif +#if LL_DBUS_ENABLED +# include "llappviewerlinux_api_dbus.h" + +// regrettable hacks to give us better runtime compatibility with older systems inside llappviewerlinux_api.h: +#define llg_return_if_fail(COND) do{if (!(COND)) return;}while(0) +#undef g_return_if_fail +#define g_return_if_fail(COND) llg_return_if_fail(COND) +// The generated API +# include "llappviewerlinux_api.h" +#endif + namespace { int gArgC = 0; @@ -321,6 +334,186 @@ bool LLAppViewerLinux::init() return LLAppViewer::init(); } +///////////////////////////////////////// +#if LL_DBUS_ENABLED + +typedef struct +{ + GObjectClass parent_class; +} ViewerAppAPIClass; + +static void viewerappapi_init(ViewerAppAPI *server); +static void viewerappapi_class_init(ViewerAppAPIClass *klass); + +/// + +// regrettable hacks to give us better runtime compatibility with older systems in general +static GType llg_type_register_static_simple_ONCE(GType parent_type, + const gchar *type_name, + guint class_size, + GClassInitFunc class_init, + guint instance_size, + GInstanceInitFunc instance_init, + GTypeFlags flags) +{ + static GTypeInfo type_info; + memset(&type_info, 0, sizeof(type_info)); + + type_info.class_size = class_size; + type_info.class_init = class_init; + type_info.instance_size = instance_size; + type_info.instance_init = instance_init; + + return g_type_register_static(parent_type, type_name, &type_info, flags); +} +#define llg_intern_static_string(S) (S) +#define g_intern_static_string(S) llg_intern_static_string(S) +#define g_type_register_static_simple(parent_type, type_name, class_size, class_init, instance_size, instance_init, flags) llg_type_register_static_simple_ONCE(parent_type, type_name, class_size, class_init, instance_size, instance_init, flags) + +G_DEFINE_TYPE(ViewerAppAPI, viewerappapi, G_TYPE_OBJECT); + +void viewerappapi_class_init(ViewerAppAPIClass *klass) +{ +} + +static bool dbus_server_init = false; + +void viewerappapi_init(ViewerAppAPI *server) +{ + // Connect to the default DBUS, register our service/API. + + if (!dbus_server_init) + { + GError *error = NULL; + + server->connection = lldbus_g_bus_get(DBUS_BUS_SESSION, &error); + if (server->connection) + { + lldbus_g_object_type_install_info(viewerappapi_get_type(), &dbus_glib_viewerapp_object_info); + + lldbus_g_connection_register_g_object(server->connection, VIEWERAPI_PATH, G_OBJECT(server)); + + DBusGProxy *serverproxy = lldbus_g_proxy_new_for_name(server->connection, DBUS_SERVICE_DBUS, DBUS_PATH_DBUS, DBUS_INTERFACE_DBUS); + + guint request_name_ret_unused; + // akin to org_freedesktop_DBus_request_name + if (lldbus_g_proxy_call(serverproxy, "RequestName", &error, G_TYPE_STRING, VIEWERAPI_SERVICE, G_TYPE_UINT, 0, G_TYPE_INVALID, G_TYPE_UINT, &request_name_ret_unused, G_TYPE_INVALID)) + { + // total success. + dbus_server_init = true; + } + else + { + llwarns << "Unable to register service name: " << error->message << llendl; + } + + g_object_unref(serverproxy); + } + else + { + g_warning("Unable to connect to dbus: %s", error->message); + } + + if (error) + g_error_free(error); + } +} + +gboolean viewer_app_api_GoSLURL(ViewerAppAPI *obj, gchar *slurl, gboolean **success_rtn, GError **error) +{ + bool success = false; + + llinfos << "Was asked to go to slurl: " << slurl << llendl; + + const bool from_external_browser = true; + if (LLURLDispatcher::dispatch(slurl, from_external_browser)) + { + // bring window to foreground, as it has just been "launched" from a URL + // todo: hmm, how to get there from here? + //xxx->mWindow->bringToFront(); + success = true; + } + + *success_rtn = g_new (gboolean, 1); + (*success_rtn)[0] = (gboolean)success; + + return TRUE; // the invokation succeeded, even if the actual dispatch didn't. +} + +/// + +//virtual +bool LLAppViewerLinux::initSLURLHandler() +{ + if (!grab_dbus_syms(DBUSGLIB_DYLIB_DEFAULT_NAME)) + { + return false; // failed + } + + g_type_init(); + + //ViewerAppAPI *api_server = (ViewerAppAPI*) + g_object_new(viewerappapi_get_type(), NULL); + + return true; +} + +//virtual +bool LLAppViewerLinux::sendURLToOtherInstance(const std::string& url) +{ + if (!grab_dbus_syms(DBUSGLIB_DYLIB_DEFAULT_NAME)) + { + return false; // failed + } + + bool success = false; + DBusGConnection *bus; + GError *error = NULL; + + g_type_init(); + + bus = lldbus_g_bus_get (DBUS_BUS_SESSION, &error); + if (bus) + { + gboolean rtn = FALSE; + DBusGProxy *remote_object = + lldbus_g_proxy_new_for_name(bus, VIEWERAPI_SERVICE, VIEWERAPI_PATH, VIEWERAPI_INTERFACE); + + if (lldbus_g_proxy_call(remote_object, "GoSLURL", &error, + G_TYPE_STRING, url.c_str(), G_TYPE_INVALID, + G_TYPE_BOOLEAN, &rtn, G_TYPE_INVALID)) + { + success = rtn; + } + else + { + llinfos << "Call-out to other instance failed (perhaps not running): " << error->message << llendl; + } + + g_object_unref(G_OBJECT(remote_object)); + } + else + { + llwarns << "Couldn't connect to session bus: " << error->message << llendl; + } + + if (error) + g_error_free(error); + + return success; +} + +#else // LL_DBUS_ENABLED +bool LLAppViewerLinux::initSLURLHandler() +{ + return false; // not implemented without dbus +} +bool LLAppViewerLinux::sendURLToOtherInstance(const std::string& url) +{ + return false; // not implemented without dbus +} +#endif // LL_DBUS_ENABLED + void LLAppViewerLinux::handleSyncCrashTrace() { // This backtrace writes into stack_trace.log diff --git a/indra/newview/llappviewerlinux.h b/indra/newview/llappviewerlinux.h index 300cb10e2d..a0e48ea388 100644 --- a/indra/newview/llappviewerlinux.h +++ b/indra/newview/llappviewerlinux.h @@ -32,6 +32,14 @@ #ifndef LL_LLAPPVIEWERLINUX_H #define LL_LLAPPVIEWERLINUX_H +#if LL_DBUS_ENABLED +extern "C" { +# include <glib.h> +# include <glib-object.h> +# include <dbus/dbus-glib.h> +} +#endif + #ifndef LL_LLAPPVIEWER_H #include "llappviewer.h" #endif @@ -49,6 +57,7 @@ public: // virtual bool init(); // Override to do application initialization std::string generateSerialNumber(); + bool setupSLURLHandler(); protected: virtual bool beingDebugged(); @@ -58,6 +67,26 @@ protected: virtual bool initLogging(); virtual bool initParseCommandLine(LLCommandLineParser& clp); + + virtual bool initSLURLHandler(); + virtual bool sendURLToOtherInstance(const std::string& url); }; +#if LL_DBUS_ENABLED +typedef struct +{ + GObject parent; + DBusGConnection *connection; +} ViewerAppAPI; + +extern "C" { + gboolean viewer_app_api_GoSLURL(ViewerAppAPI *obj, gchar *slurl, gboolean **success_rtn, GError **error); +} + +#define VIEWERAPI_SERVICE "com.secondlife.ViewerAppAPIService" +#define VIEWERAPI_PATH "/com/secondlife/ViewerAppAPI" +#define VIEWERAPI_INTERFACE "com.secondlife.ViewerAppAPI" + +#endif // LL_DBUS_ENABLED + #endif // LL_LLAPPVIEWERLINUX_H diff --git a/indra/newview/llappviewerlinux_api.h b/indra/newview/llappviewerlinux_api.h new file mode 100644 index 0000000000..f9c7c6df35 --- /dev/null +++ b/indra/newview/llappviewerlinux_api.h @@ -0,0 +1,148 @@ +/* Generated by dbus-binding-tool; do not edit! */ +/** + * $LicenseInfo:firstyear=2008&license=viewergpl$ + * + * Copyright (c) 2008, Linden Research, Inc. + * + * Second Life Viewer Source Code + * The source code in this file ("Source Code") is provided by Linden Lab + * to you under the terms of the GNU General Public License, version 2.0 + * ("GPL"), unless you have obtained a separate licensing agreement + * ("Other License"), formally executed by you and Linden Lab. Terms of + * the GPL can be found in doc/GPL-license.txt in this distribution, or + * online at http://secondlife.com/developers/opensource/gplv2 + * + * There are special exceptions to the terms and conditions of the GPL as + * it is applied to this Source Code. View the full text of the exception + * in the file doc/FLOSS-exception.txt in this software distribution, or + * online at http://secondlife.com/developers/opensource/flossexception + * + * By copying, modifying or distributing this software, you acknowledge + * that you have read and understood your obligations described above, + * and agree to abide by those obligations. + * + * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO + * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, + * COMPLETENESS OR PERFORMANCE. + * $/LicenseInfo$ + */ + +#ifndef __dbus_glib_marshal_viewerapp_MARSHAL_H__ +#define __dbus_glib_marshal_viewerapp_MARSHAL_H__ + +#include <glib-object.h> + +G_BEGIN_DECLS + +#ifdef G_ENABLE_DEBUG +#define g_marshal_value_peek_boolean(v) g_value_get_boolean (v) +#define g_marshal_value_peek_char(v) g_value_get_char (v) +#define g_marshal_value_peek_uchar(v) g_value_get_uchar (v) +#define g_marshal_value_peek_int(v) g_value_get_int (v) +#define g_marshal_value_peek_uint(v) g_value_get_uint (v) +#define g_marshal_value_peek_long(v) g_value_get_long (v) +#define g_marshal_value_peek_ulong(v) g_value_get_ulong (v) +#define g_marshal_value_peek_int64(v) g_value_get_int64 (v) +#define g_marshal_value_peek_uint64(v) g_value_get_uint64 (v) +#define g_marshal_value_peek_enum(v) g_value_get_enum (v) +#define g_marshal_value_peek_flags(v) g_value_get_flags (v) +#define g_marshal_value_peek_float(v) g_value_get_float (v) +#define g_marshal_value_peek_double(v) g_value_get_double (v) +#define g_marshal_value_peek_string(v) (char*) g_value_get_string (v) +#define g_marshal_value_peek_param(v) g_value_get_param (v) +#define g_marshal_value_peek_boxed(v) g_value_get_boxed (v) +#define g_marshal_value_peek_pointer(v) g_value_get_pointer (v) +#define g_marshal_value_peek_object(v) g_value_get_object (v) +#else /* !G_ENABLE_DEBUG */ +/* WARNING: This code accesses GValues directly, which is UNSUPPORTED API. + * Do not access GValues directly in your code. Instead, use the + * g_value_get_*() functions + */ +#define g_marshal_value_peek_boolean(v) (v)->data[0].v_int +#define g_marshal_value_peek_char(v) (v)->data[0].v_int +#define g_marshal_value_peek_uchar(v) (v)->data[0].v_uint +#define g_marshal_value_peek_int(v) (v)->data[0].v_int +#define g_marshal_value_peek_uint(v) (v)->data[0].v_uint +#define g_marshal_value_peek_long(v) (v)->data[0].v_long +#define g_marshal_value_peek_ulong(v) (v)->data[0].v_ulong +#define g_marshal_value_peek_int64(v) (v)->data[0].v_int64 +#define g_marshal_value_peek_uint64(v) (v)->data[0].v_uint64 +#define g_marshal_value_peek_enum(v) (v)->data[0].v_long +#define g_marshal_value_peek_flags(v) (v)->data[0].v_ulong +#define g_marshal_value_peek_float(v) (v)->data[0].v_float +#define g_marshal_value_peek_double(v) (v)->data[0].v_double +#define g_marshal_value_peek_string(v) (v)->data[0].v_pointer +#define g_marshal_value_peek_param(v) (v)->data[0].v_pointer +#define g_marshal_value_peek_boxed(v) (v)->data[0].v_pointer +#define g_marshal_value_peek_pointer(v) (v)->data[0].v_pointer +#define g_marshal_value_peek_object(v) (v)->data[0].v_pointer +#endif /* !G_ENABLE_DEBUG */ + + +/* BOOLEAN:STRING,POINTER,POINTER (/tmp/dbus-binding-tool-c-marshallers.5XXD8T:1) */ +extern void dbus_glib_marshal_viewerapp_BOOLEAN__STRING_POINTER_POINTER (GClosure *closure, + GValue *return_value, + guint n_param_values, + const GValue *param_values, + gpointer invocation_hint, + gpointer marshal_data); +void +dbus_glib_marshal_viewerapp_BOOLEAN__STRING_POINTER_POINTER (GClosure *closure, + GValue *return_value, + guint n_param_values, + const GValue *param_values, + gpointer invocation_hint, + gpointer marshal_data) +{ + typedef gboolean (*GMarshalFunc_BOOLEAN__STRING_POINTER_POINTER) (gpointer data1, + gpointer arg_1, + gpointer arg_2, + gpointer arg_3, + gpointer data2); + register GMarshalFunc_BOOLEAN__STRING_POINTER_POINTER callback; + register GCClosure *cc = (GCClosure*) closure; + register gpointer data1, data2; + gboolean v_return; + + g_return_if_fail (return_value != NULL); + g_return_if_fail (n_param_values == 4); + + if (G_CCLOSURE_SWAP_DATA (closure)) + { + data1 = closure->data; + data2 = g_value_peek_pointer (param_values + 0); + } + else + { + data1 = g_value_peek_pointer (param_values + 0); + data2 = closure->data; + } + callback = (GMarshalFunc_BOOLEAN__STRING_POINTER_POINTER) (marshal_data ? marshal_data : cc->callback); + + v_return = callback (data1, + g_marshal_value_peek_string (param_values + 1), + g_marshal_value_peek_pointer (param_values + 2), + g_marshal_value_peek_pointer (param_values + 3), + data2); + + g_value_set_boolean (return_value, v_return); +} + +G_END_DECLS + +#endif /* __dbus_glib_marshal_viewerapp_MARSHAL_H__ */ + +#include <dbus/dbus-glib.h> +static const DBusGMethodInfo dbus_glib_viewerapp_methods[] = { + { (GCallback) viewer_app_api_GoSLURL, dbus_glib_marshal_viewerapp_BOOLEAN__STRING_POINTER_POINTER, 0 }, +}; + +const DBusGObjectInfo dbus_glib_viewerapp_object_info = { + 0, + dbus_glib_viewerapp_methods, + 1, +"com.secondlife.ViewerAppAPI\0GoSLURL\0S\0slurl\0I\0s\0success_ret\0O\0F\0N\0b\0\0\0", +"\0", +"\0" +}; + diff --git a/indra/newview/llappviewerlinux_api.xml b/indra/newview/llappviewerlinux_api.xml new file mode 100644 index 0000000000..fac35b7adc --- /dev/null +++ b/indra/newview/llappviewerlinux_api.xml @@ -0,0 +1,14 @@ +<?xml version="1.0" encoding="UTF-8" ?> + +<!-- dbus-binding-tool -mode=glib-server llappviewerlinux_api.xml -prefix=viewerapp -output=llappviewerlinux_api.h --> + +<node name="/com/secondlife/ViewerAppAPI"> + <interface name="com.secondlife.ViewerAppAPI"> + <annotation name="org.freedesktop.DBus.GLib.CSymbol" value="viewer_app_api"/> + <method name="GoSLURL"> + <annotation name="org.freedesktop.DBus.GLib.CSymbol" value="viewer_app_api_GoSLURL"/> + <arg type="s" name="slurl" direction="in" /> + <arg type="b" name="success_ret" direction="out" /> + </method> + </interface> +</node> diff --git a/indra/newview/llappviewerlinux_api_dbus.cpp b/indra/newview/llappviewerlinux_api_dbus.cpp new file mode 100644 index 0000000000..24dfea1c6a --- /dev/null +++ b/indra/newview/llappviewerlinux_api_dbus.cpp @@ -0,0 +1,131 @@ +/** + * @file llappviewerlinux_api_dbus.cpp + * @brief dynamic DBus symbol-grabbing code + * + * $LicenseInfo:firstyear=2008&license=viewergpl$ + * + * Copyright (c) 2008, Linden Research, Inc. + * + * Second Life Viewer Source Code + * The source code in this file ("Source Code") is provided by Linden Lab + * to you under the terms of the GNU General Public License, version 2.0 + * ("GPL"), unless you have obtained a separate licensing agreement + * ("Other License"), formally executed by you and Linden Lab. Terms of + * the GPL can be found in doc/GPL-license.txt in this distribution, or + * online at http://secondlife.com/developers/opensource/gplv2 + * + * There are special exceptions to the terms and conditions of the GPL as + * it is applied to this Source Code. View the full text of the exception + * in the file doc/FLOSS-exception.txt in this software distribution, or + * online at http://secondlife.com/developers/opensource/flossexception + * + * By copying, modifying or distributing this software, you acknowledge + * that you have read and understood your obligations described above, + * and agree to abide by those obligations. + * + * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO + * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, + * COMPLETENESS OR PERFORMANCE. + * $/LicenseInfo$ + */ + +#if LL_DBUS_ENABLED + +#include "linden_common.h" + +extern "C" { +#include <dbus/dbus-glib.h> + +#include "apr_pools.h" +#include "apr_dso.h" +} + +#define DEBUGMSG(...) lldebugs << llformat(__VA_ARGS__) << llendl +#define INFOMSG(...) llinfos << llformat(__VA_ARGS__) << llendl +#define WARNMSG(...) llwarns << llformat(__VA_ARGS__) << llendl + +#define LL_DBUS_SYM(REQUIRED, DBUSSYM, RTN, ...) RTN (*ll##DBUSSYM)(__VA_ARGS__) = NULL +#include "llappviewerlinux_api_dbus_syms_raw.inc" +#undef LL_DBUS_SYM + +static bool sSymsGrabbed = false; +static apr_pool_t *sSymDBUSDSOMemoryPool = NULL; +static apr_dso_handle_t *sSymDBUSDSOHandleG = NULL; + +bool grab_dbus_syms(std::string dbus_dso_name) +{ + if (sSymsGrabbed) + { + // already have grabbed good syms + return TRUE; + } + + bool sym_error = false; + bool rtn = false; + apr_status_t rv; + apr_dso_handle_t *sSymDBUSDSOHandle = NULL; + +#define LL_DBUS_SYM(REQUIRED, DBUSSYM, RTN, ...) do{rv = apr_dso_sym((apr_dso_handle_sym_t*)&ll##DBUSSYM, sSymDBUSDSOHandle, #DBUSSYM); if (rv != APR_SUCCESS) {INFOMSG("Failed to grab symbol: %s", #DBUSSYM); if (REQUIRED) sym_error = true;} else DEBUGMSG("grabbed symbol: %s from %p", #DBUSSYM, (void*)ll##DBUSSYM);}while(0) + + //attempt to load the shared library + apr_pool_create(&sSymDBUSDSOMemoryPool, NULL); + + if ( APR_SUCCESS == (rv = apr_dso_load(&sSymDBUSDSOHandle, + dbus_dso_name.c_str(), + sSymDBUSDSOMemoryPool) )) + { + INFOMSG("Found DSO: %s", dbus_dso_name.c_str()); + +#include "llappviewerlinux_api_dbus_syms_raw.inc" + + if ( sSymDBUSDSOHandle ) + { + sSymDBUSDSOHandleG = sSymDBUSDSOHandle; + sSymDBUSDSOHandle = NULL; + } + + rtn = !sym_error; + } + else + { + INFOMSG("Couldn't load DSO: %s", dbus_dso_name.c_str()); + rtn = false; // failure + } + + if (sym_error) + { + WARNMSG("Failed to find necessary symbols in DBUS-GLIB libraries."); + } +#undef LL_DBUS_SYM + + sSymsGrabbed = rtn; + return rtn; +} + + +void ungrab_dbus_syms() +{ + // should be safe to call regardless of whether we've + // actually grabbed syms. + + if ( sSymDBUSDSOHandleG ) + { + apr_dso_unload(sSymDBUSDSOHandleG); + sSymDBUSDSOHandleG = NULL; + } + + if ( sSymDBUSDSOMemoryPool ) + { + apr_pool_destroy(sSymDBUSDSOMemoryPool); + sSymDBUSDSOMemoryPool = NULL; + } + + // NULL-out all of the symbols we'd grabbed +#define LL_DBUS_SYM(REQUIRED, DBUSSYM, RTN, ...) do{ll##DBUSSYM = NULL;}while(0) +#include "llappviewerlinux_api_dbus_syms_raw.inc" +#undef LL_DBUS_SYM + + sSymsGrabbed = false; +} + +#endif // LL_DBUS_ENABLED diff --git a/indra/newview/llappviewerlinux_api_dbus.h b/indra/newview/llappviewerlinux_api_dbus.h new file mode 100644 index 0000000000..7afdb270b8 --- /dev/null +++ b/indra/newview/llappviewerlinux_api_dbus.h @@ -0,0 +1,49 @@ +/** + * @file llappviewerlinux_api_dbus.h + * @brief DBus-glib symbol handling + * + * $LicenseInfo:firstyear=2008&license=viewergpl$ + * + * Copyright (c) 2008, Linden Research, Inc. + * + * Second Life Viewer Source Code + * The source code in this file ("Source Code") is provided by Linden Lab + * to you under the terms of the GNU General Public License, version 2.0 + * ("GPL"), unless you have obtained a separate licensing agreement + * ("Other License"), formally executed by you and Linden Lab. Terms of + * the GPL can be found in doc/GPL-license.txt in this distribution, or + * online at http://secondlife.com/developers/opensource/gplv2 + * + * There are special exceptions to the terms and conditions of the GPL as + * it is applied to this Source Code. View the full text of the exception + * in the file doc/FLOSS-exception.txt in this software distribution, or + * online at http://secondlife.com/developers/opensource/flossexception + * + * By copying, modifying or distributing this software, you acknowledge + * that you have read and understood your obligations described above, + * and agree to abide by those obligations. + * + * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO + * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, + * COMPLETENESS OR PERFORMANCE. + * $/LicenseInfo$ + */ + +#include "linden_common.h" + +#if LL_DBUS_ENABLED + +extern "C" { +#include <dbus/dbus-glib.h> +} + +#define DBUSGLIB_DYLIB_DEFAULT_NAME "libdbus-glib-1.so.2" + +bool grab_dbus_syms(std::string dbus_dso_name); +void ungrab_dbus_syms(); + +#define LL_DBUS_SYM(REQUIRED, DBUSSYM, RTN, ...) extern RTN (*ll##DBUSSYM)(__VA_ARGS__) +#include "llappviewerlinux_api_dbus_syms_raw.inc" +#undef LL_DBUS_SYM + +#endif // LL_DBUS_ENABLED diff --git a/indra/newview/llappviewerlinux_api_dbus_syms_raw.inc b/indra/newview/llappviewerlinux_api_dbus_syms_raw.inc new file mode 100644 index 0000000000..c0548e2fba --- /dev/null +++ b/indra/newview/llappviewerlinux_api_dbus_syms_raw.inc @@ -0,0 +1,9 @@ + +// required symbols to grab +LL_DBUS_SYM(true, dbus_g_bus_get, DBusGConnection*, DBusBusType, GError**); +LL_DBUS_SYM(true, dbus_g_proxy_new_for_name, DBusGProxy*, DBusGConnection*, const char *, const char*, const char*); +LL_DBUS_SYM(true, dbus_g_proxy_call, gboolean, DBusGProxy*, const char*, GError**, GType, ...); +LL_DBUS_SYM(true, dbus_g_object_type_install_info, void, GType, const DBusGObjectInfo*); +LL_DBUS_SYM(true, dbus_g_connection_register_g_object, void, DBusGConnection*, const char*, GObject*); + +// optional symbols to grab diff --git a/indra/newview/llappviewerwin32.cpp b/indra/newview/llappviewerwin32.cpp index bdffaeafb3..06b2a467de 100644 --- a/indra/newview/llappviewerwin32.cpp +++ b/indra/newview/llappviewerwin32.cpp @@ -64,7 +64,7 @@ #include "llcommandlineparser.h" -//*FIX:Mani - This hack is to fix a linker issue with libndofdev.lib +// *FIX:Mani - This hack is to fix a linker issue with libndofdev.lib // The lib was compiled under VS2005 - in VS2003 we need to remap assert #ifdef LL_DEBUG #ifdef LL_MSVC7 @@ -77,6 +77,8 @@ extern "C" { #endif #endif +const std::string LLAppViewerWin32::sWindowClass = "Second Life"; + LONG WINAPI viewer_windows_exception_handler(struct _EXCEPTION_POINTERS *exception_infop) { // *NOTE:Mani - this code is stolen from LLApp, where its never actually used. @@ -478,6 +480,33 @@ void LLAppViewerWin32::handleCrashReporting() } } +//virtual +bool LLAppViewerWin32::sendURLToOtherInstance(const std::string& url) +{ + wchar_t window_class[256]; /* Flawfinder: ignore */ // Assume max length < 255 chars. + mbstowcs(window_class, sWindowClass.c_str(), 255); + window_class[255] = 0; + // Use the class instead of the window name. + HWND other_window = FindWindow(window_class, NULL); + + if (other_window != NULL) + { + lldebugs << "Found other window with the name '" << getWindowTitle() << "'" << llendl; + COPYDATASTRUCT cds; + const S32 SLURL_MESSAGE_TYPE = 0; + cds.dwData = SLURL_MESSAGE_TYPE; + cds.cbData = url.length() + 1; + cds.lpData = (void*)url.c_str(); + + LRESULT msg_result = SendMessage(other_window, WM_COPYDATA, NULL, (LPARAM)&cds); + lldebugs << "SendMessage(WM_COPYDATA) to other window '" + << getWindowTitle() << "' returned " << msg_result << llendl; + return true; + } + return false; +} + + std::string LLAppViewerWin32::generateSerialNumber() { char serial_md5[MD5HEX_STR_SIZE]; // Flawfinder: ignore diff --git a/indra/newview/llappviewerwin32.h b/indra/newview/llappviewerwin32.h index d8a79a8b7a..5f26a18263 100644 --- a/indra/newview/llappviewerwin32.h +++ b/indra/newview/llappviewerwin32.h @@ -56,8 +56,12 @@ protected: virtual void handleCrashReporting(); virtual void handleSyncCrashTrace(); + virtual bool sendURLToOtherInstance(const std::string& url); + std::string generateSerialNumber(); + static const std::string sWindowClass; + private: void disableWinErrorReporting(); diff --git a/indra/newview/llaudiosourcevo.cpp b/indra/newview/llaudiosourcevo.cpp index b7f4820a59..3b340739d7 100644 --- a/indra/newview/llaudiosourcevo.cpp +++ b/indra/newview/llaudiosourcevo.cpp @@ -39,7 +39,7 @@ #include "llviewerparcelmgr.h" LLAudioSourceVO::LLAudioSourceVO(const LLUUID &sound_id, const LLUUID& owner_id, const F32 gain, LLViewerObject *objectp) -: LLAudioSource(sound_id, owner_id, gain), + : LLAudioSource(sound_id, owner_id, gain, LLAudioEngine::AUDIO_TYPE_SFX), mObjectp(objectp), mActualGain(gain) { diff --git a/indra/newview/llcommandlineparser.cpp b/indra/newview/llcommandlineparser.cpp index f9c8100cf5..ac07622e8f 100644 --- a/indra/newview/llcommandlineparser.cpp +++ b/indra/newview/llcommandlineparser.cpp @@ -416,11 +416,6 @@ void setControlValueCB(const LLCommandLineParser::token_vector_t& value, const std::string& opt_name, LLControlGroup* ctrlGroup) { - if(value.size() > 1) - { - llwarns << "Ignoring extra tokens mapped to the setting: " << opt_name << "." << llendl; - } - // *FIX: Do sematic conversion here. // LLSD (ImplString) Is no good for doing string to type conversion for... // booleans @@ -457,7 +452,7 @@ void setControlValueCB(const LLCommandLineParser::token_vector_t& value, default: { // For the default types, let llsd do the conversion. - if(value.size() > 1) + if(value.size() > 1 && ctrl->isType(TYPE_LLSD)) { // Assume its an array... LLSD llsdArray; @@ -472,6 +467,11 @@ void setControlValueCB(const LLCommandLineParser::token_vector_t& value, } else if(value.size() > 0) { + if(value.size() > 1) + { + llwarns << "Ignoring extra tokens mapped to the setting: " << opt_name << "." << llendl; + } + LLSD llsdValue; llsdValue.assign(LLSD::String(value[0])); ctrl->setValue(llsdValue, false); diff --git a/indra/newview/llfilepicker.cpp b/indra/newview/llfilepicker.cpp index 0f180472fd..7ac50d7610 100644 --- a/indra/newview/llfilepicker.cpp +++ b/indra/newview/llfilepicker.cpp @@ -933,7 +933,7 @@ void LLFilePicker::chooser_responder(GtkWidget *widget, gint response, gpointer GtkWindow* LLFilePicker::buildFilePicker(bool is_save, bool is_folder, std::string context) { - if (ll_try_gtk_init() && + if (LLWindowSDL::ll_try_gtk_init() && ! gViewerWindow->getWindow()->getFullscreen()) { GtkWidget *win = NULL; @@ -974,7 +974,7 @@ GtkWindow* LLFilePicker::buildFilePicker(bool is_save, bool is_folder, std::stri // Make GTK tell the window manager to associate this // dialog with our non-GTK raw X11 window, which should try // to keep it on top etc. - Window XWindowID = get_SDL_XWindowID(); + Window XWindowID = LLWindowSDL::get_SDL_XWindowID(); if (None != XWindowID) { gtk_widget_realize(GTK_WIDGET(win)); // so we can get its gdkwin diff --git a/indra/newview/llfloaterimagepreview.cpp b/indra/newview/llfloaterimagepreview.cpp index 3d29bb3286..4b0afd6db3 100644 --- a/indra/newview/llfloaterimagepreview.cpp +++ b/indra/newview/llfloaterimagepreview.cpp @@ -774,7 +774,9 @@ LLImagePreviewSculpted::LLImagePreviewSculpted(S32 width, S32 height) : LLDynami LLVolumeParams volume_params; volume_params.setType(LL_PCODE_PROFILE_CIRCLE, LL_PCODE_PATH_CIRCLE); volume_params.setSculptID(LLUUID::null, LL_SCULPT_TYPE_SPHERE); - mVolume = new LLVolume(volume_params, (F32) MAX_LOD); + + F32 const HIGHEST_LOD = 4.0f; + mVolume = new LLVolume(volume_params, HIGHEST_LOD); /* mDummyAvatar = new LLVOAvatar(LLUUID::null, LL_PCODE_LEGACY_AVATAR, gAgent.getRegion()); @@ -811,7 +813,36 @@ void LLImagePreviewSculpted::setPreviewTarget(LLImageRaw* imagep, F32 distance) { mVolume->sculpt(imagep->getWidth(), imagep->getHeight(), imagep->getComponents(), imagep->getData(), 0); } - + + const LLVolumeFace &vf = mVolume->getVolumeFace(0); + U32 num_indices = vf.mIndices.size(); + U32 num_vertices = vf.mVertices.size(); + + mVertexBuffer = new LLVertexBuffer(LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_NORMAL, 0); + mVertexBuffer->allocateBuffer(num_vertices, num_indices, TRUE); + + LLStrider<LLVector3> vertex_strider; + LLStrider<LLVector3> normal_strider; + LLStrider<U16> index_strider; + + mVertexBuffer->getVertexStrider(vertex_strider); + mVertexBuffer->getNormalStrider(normal_strider); + mVertexBuffer->getIndexStrider(index_strider); + + // build vertices and normals + for (U32 i = 0; (S32)i < num_vertices; i++) + { + *(vertex_strider++) = vf.mVertices[i].mPosition; + LLVector3 normal = vf.mVertices[i].mNormal; + normal.normalize(); + *(normal_strider++) = normal; + } + + // build indices + for (U16 i = 0; i < num_indices; i++) + { + *(index_strider++) = vf.mIndices[i]; + } } @@ -846,7 +877,7 @@ BOOL LLImagePreviewSculpted::render() glMatrixMode(GL_MODELVIEW); gGL.popMatrix(); - glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); + glClear(GL_DEPTH_BUFFER_BIT); LLVector3 target_pos(0, 0, 0); @@ -865,55 +896,21 @@ BOOL LLImagePreviewSculpted::render() LLViewerCamera::getInstance()->setView(LLViewerCamera::getInstance()->getDefaultFOV() / mCameraZoom); LLViewerCamera::getInstance()->setPerspective(FALSE, mOrigin.mX, mOrigin.mY, mWidth, mHeight, FALSE); - gPipeline.enableLightsAvatar(); - - gGL.pushMatrix(); - glScalef(0.5, 0.5, 0.5); - const LLVolumeFace &vf = mVolume->getVolumeFace(0); U32 num_indices = vf.mIndices.size(); - U32 num_vertices = vf.mVertices.size(); - - if (num_vertices > 0 && num_indices > 0) - { - glEnableClientState(GL_NORMAL_ARRAY); - // build vertices and normals - F32* vertices = new F32[num_vertices * 3]; - F32* normals = new F32[num_vertices * 3]; - - for (U32 i = 0; (S32)i < num_vertices; i++) - { - LLVector3 position = vf.mVertices[i].mPosition; - vertices[i*3] = position.mV[VX]; - vertices[i*3+1] = position.mV[VY]; - vertices[i*3+2] = position.mV[VZ]; - - LLVector3 normal = vf.mVertices[i].mNormal; - normals[i*3] = normal.mV[VX]; - normals[i*3+1] = normal.mV[VY]; - normals[i*3+2] = normal.mV[VZ]; - } + + mVertexBuffer->setBuffer(LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_NORMAL); - // build indices - U16* indices = new U16[num_indices]; - for (U16 i = 0; i < num_indices; i++) - { - indices[i] = vf.mIndices[i]; - } + gPipeline.enableLightsAvatar(); + gGL.pushMatrix(); + const F32 SCALE = 1.25f; + gGL.scalef(SCALE, SCALE, SCALE); + const F32 BRIGHTNESS = 0.9f; + gGL.color3f(BRIGHTNESS, BRIGHTNESS, BRIGHTNESS); + mVertexBuffer->draw(LLVertexBuffer::TRIANGLES, num_indices, 0); - gGL.color3f(0.4f, 0.4f, 0.4f); - glVertexPointer(3, GL_FLOAT, 0, (void *)vertices); - glNormalPointer(GL_FLOAT, 0, (void *)normals); - glDrawRangeElements(GL_TRIANGLES, 0, num_vertices-1, num_indices, GL_UNSIGNED_SHORT, (void *)indices); + gGL.popMatrix(); - gGL.popMatrix(); - glDisableClientState(GL_NORMAL_ARRAY); - - delete [] indices; - delete [] vertices; - delete [] normals; - } - return TRUE; } diff --git a/indra/newview/llfloaterimagepreview.h b/indra/newview/llfloaterimagepreview.h index 0376ec2bcb..045c8b9867 100644 --- a/indra/newview/llfloaterimagepreview.h +++ b/indra/newview/llfloaterimagepreview.h @@ -41,6 +41,7 @@ class LLJoint; class LLViewerJointMesh; class LLVOAvatar; class LLTextBox; +class LLVertexBuffer; class LLImagePreviewSculpted : public LLDynamicTexture { @@ -67,6 +68,7 @@ class LLImagePreviewSculpted : public LLDynamicTexture F32 mCameraZoom; LLVector3 mCameraOffset; LLPointer<LLVolume> mVolume; + LLPointer<LLVertexBuffer> mVertexBuffer; }; diff --git a/indra/newview/llgroupmgr.cpp b/indra/newview/llgroupmgr.cpp index 32ccc761f8..631b2caa91 100644 --- a/indra/newview/llgroupmgr.cpp +++ b/indra/newview/llgroupmgr.cpp @@ -52,6 +52,7 @@ #include "llfloaterdirectory.h" #include "llfloatergroupinfo.h" #include "lluictrlfactory.h" +#include <boost/regex.hpp> const U32 MAX_CACHED_GROUPS = 10; @@ -791,6 +792,20 @@ LLGroupMgrGroupData* LLGroupMgr::getGroupData(const LLUUID& id) return NULL; } +// Helper function for LLGroupMgr::processGroupMembersReply +// This reformats date strings from MM/DD/YYYY to YYYY/MM/DD ( e.g. 1/27/2008 -> 2008/1/27 ) +// so that the sorter can sort by year before month before day. +static void formatDateString(std::string &date_string) +{ + using namespace boost; + cmatch result; + const regex expression("([0-9]{1,2})/([0-9]{1,2})/([0-9]{4})"); + if (regex_match(date_string.c_str(), result, expression)) + { + date_string = result[3]+"/"+result[1]+"/"+result[2]; + } +} + // static void LLGroupMgr::processGroupMembersReply(LLMessageSystem* msg, void** data) { @@ -840,6 +855,8 @@ void LLGroupMgr::processGroupMembersReply(LLMessageSystem* msg, void** data) if (member_id.notNull()) { + formatDateString(online_status); // reformat for sorting, e.g. 12/25/2008 -> 2008/12/25 + //llinfos << "Member " << member_id << " has powers " << std::hex << agent_powers << std::dec << llendl; LLGroupMemberData* newdata = new LLGroupMemberData(member_id, contribution, diff --git a/indra/newview/llmutelist.cpp b/indra/newview/llmutelist.cpp index 5311a594fb..ccf63b3285 100644 --- a/indra/newview/llmutelist.cpp +++ b/indra/newview/llmutelist.cpp @@ -97,6 +97,26 @@ const char AGENT_SUFFIX[] = " (resident)"; const char OBJECT_SUFFIX[] = " (object)"; const char GROUP_SUFFIX[] = " (group)"; + +LLMute::LLMute(const LLUUID& id, const std::string& name, EType type, U32 flags) + : mID(id), + mName(name), + mType(type), + mFlags(flags) +{ + // muting is done by root objects only - try to find this objects root + LLViewerObject *objectp = gObjectList.findObject(mID); + if ((objectp) && (!objectp->isAvatar())) + { + LLViewerObject *parentp = (LLViewerObject *)objectp->getParent(); + if (parentp) + { + mID = parentp->getID(); + } + } +} + + std::string LLMute::getDisplayName() const { std::string name_with_suffix = mName; diff --git a/indra/newview/llmutelist.h b/indra/newview/llmutelist.h index c1b887b877..5db5c41c4b 100644 --- a/indra/newview/llmutelist.h +++ b/indra/newview/llmutelist.h @@ -60,8 +60,7 @@ public: flagAll = 0x0000000F // Mask of all currently defined flags }; - LLMute(const LLUUID& id, const std::string& name = std::string(), EType type = BY_NAME, U32 flags = 0) - : mID(id), mName(name), mType(type),mFlags(flags) { } + LLMute(const LLUUID& id, const std::string& name = std::string(), EType type = BY_NAME, U32 flags = 0); // Returns name + suffix based on type // For example: "James Tester (resident)" diff --git a/indra/newview/llnetmap.cpp b/indra/newview/llnetmap.cpp index 47948281ab..4f559105f6 100644 --- a/indra/newview/llnetmap.cpp +++ b/indra/newview/llnetmap.cpp @@ -642,7 +642,11 @@ void LLNetMap::renderScaledPointGlobal( const LLVector3d& pos, const LLColor4U & LLVector3 local_pos; local_pos.setVec( pos - mObjectImageCenterGlobal ); - S32 diameter_pixels = llround(2 * radius_meters * mObjectMapTPM); + // DEV-17370 - megaprims of size > 4096 cause lag. (go figger.) + const F32 MAX_RADIUS = 256.0f; + F32 radius_clamped = llmin(radius_meters, MAX_RADIUS); + + S32 diameter_pixels = llround(2 * radius_clamped * mObjectMapTPM); renderPoint( local_pos, color, diameter_pixels ); } diff --git a/indra/newview/llpreviewsound.cpp b/indra/newview/llpreviewsound.cpp index 3c23bf15ae..a9140e23e0 100644 --- a/indra/newview/llpreviewsound.cpp +++ b/indra/newview/llpreviewsound.cpp @@ -106,7 +106,6 @@ void LLPreviewSound::auditionSound( void *userdata ) if(item && gAudiop) { LLVector3d lpos_global = gAgent.getPositionGlobal(); - F32 volume = gSavedSettings.getBOOL("MuteSounds") ? 0.f : SOUND_GAIN * gSavedSettings.getF32("AudioLevelSFX"); - gAudiop->triggerSound(item->getAssetUUID(), gAgent.getID(), volume, lpos_global); + gAudiop->triggerSound(item->getAssetUUID(), gAgent.getID(), SOUND_GAIN, LLAudioEngine::AUDIO_TYPE_UI, lpos_global); } } diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp index eaf1b90be3..500dcfecbf 100644 --- a/indra/newview/llstartup.cpp +++ b/indra/newview/llstartup.cpp @@ -743,6 +743,12 @@ bool idle_startup() gLoginMenuBarView->setVisible( TRUE ); gLoginMenuBarView->setEnabled( TRUE ); + // DEV-16927. The following code removes errant keystrokes that happen while the window is being + // first made visible. +#ifdef _WIN32 + MSG msg; + while( PeekMessage( &msg, /*All hWnds owned by this thread */ NULL, WM_KEYFIRST, WM_KEYLAST, PM_REMOVE ) ); +#endif timeout.reset(); return FALSE; } diff --git a/indra/newview/lltoolplacer.cpp b/indra/newview/lltoolplacer.cpp index 8806d1465a..fa9c9063ff 100644 --- a/indra/newview/lltoolplacer.cpp +++ b/indra/newview/lltoolplacer.cpp @@ -224,8 +224,8 @@ BOOL LLToolPlacer::addObject( LLPCode pcode, S32 x, S32 y, U8 use_physics ) // Play creation sound if (gAudiop) { - F32 volume = gSavedSettings.getBOOL("MuteUI") ? 0.f : gSavedSettings.getF32("AudioLevelUI"); - gAudiop->triggerSound( LLUUID(gSavedSettings.getString("UISndObjectCreate")), gAgent.getID(), volume); + gAudiop->triggerSound( LLUUID(gSavedSettings.getString("UISndObjectCreate")), + gAgent.getID(), 1.0f, LLAudioEngine::AUDIO_TYPE_UI); } gMessageSystem->newMessageFast(_PREHASH_ObjectAdd); diff --git a/indra/newview/llvieweraudio.cpp b/indra/newview/llvieweraudio.cpp index cefbed1353..0d250d97f6 100644 --- a/indra/newview/llvieweraudio.cpp +++ b/indra/newview/llvieweraudio.cpp @@ -139,6 +139,14 @@ void audio_update_volume(bool force_update) { audio_update_wind(true); } + + // handle secondary gains + gAudiop->setSecondaryGain(LLAudioEngine::AUDIO_TYPE_SFX, + gSavedSettings.getBOOL("MuteSounds") ? 0.f : gSavedSettings.getF32("AudioLevelSFX")); + gAudiop->setSecondaryGain(LLAudioEngine::AUDIO_TYPE_UI, + gSavedSettings.getBOOL("MuteUI") ? 0.f : gSavedSettings.getF32("AudioLevelUI")); + gAudiop->setSecondaryGain(LLAudioEngine::AUDIO_TYPE_AMBIENT, + gSavedSettings.getBOOL("MuteAmbient") ? 0.f : gSavedSettings.getF32("AudioLevelAmbient")); } // Streaming Music diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index 7681e98eae..dfe4bd58bd 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -323,13 +323,6 @@ void handle_talk_to(void *userdata); // Debug menu void show_permissions_control(void*); void toggle_build_options(void* user_data); -#if 0 // Unused -void handle_audio_status_1(void*); -void handle_audio_status_2(void*); -void handle_audio_status_3(void*); -void handle_audio_status_4(void*); -#endif -void manage_landmarks(void*); void reload_ui(void*); void handle_agent_stop_moving(void*); void print_packets_lost(void*); @@ -1757,6 +1750,24 @@ class LLViewCheckJoystickFlycam : public view_listener_t } }; +class LLViewCommunicate : public view_listener_t +{ + bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata) + { + if (LLFloaterChatterBox::getInstance()->getFloaterCount() == 0) + { + LLFloaterMyFriends::toggleInstance(); + } + else + { + LLFloaterChatterBox::toggleInstance(); + } + + return true; + } +}; + + void handle_toggle_flycam() { LLViewerJoystick::getInstance()->toggleFlycam(); @@ -2975,63 +2986,16 @@ void show_permissions_control(void*) floaterp->mPermissions->addPermissionsData("foo3", LLUUID::null, 0); } -#if 0 // Unused (these just modify AudioInfoPage which is not used anywhere in the code -void handle_audio_status_1(void*) -{ - S32 page = gSavedSettings.getS32("AudioInfoPage"); - if (1 == page) - { - page = 0; - } - else - { - page = 1; - } - gSavedSettings.setS32("AudioInfoPage", page); -} -void handle_audio_status_2(void*) +class LLCreateLandmarkCallback : public LLInventoryCallback { - S32 page = gSavedSettings.getS32("AudioInfoPage"); - if (2 == page) - { - page = 0; - } - else - { - page = 2; - } - gSavedSettings.setS32("AudioInfoPage", page); -} - -void handle_audio_status_3(void*) -{ - S32 page = gSavedSettings.getS32("AudioInfoPage"); - if (3 == page) - { - page = 0; - } - else - { - page = 3; - } - gSavedSettings.setS32("AudioInfoPage", page); -} - -void handle_audio_status_4(void*) -{ - S32 page = gSavedSettings.getS32("AudioInfoPage"); - if (4 == page) - { - page = 0; - } - else +public: + /*virtual*/ void fire(const LLUUID& inv_item) { - page = 4; + llinfos << "Created landmark with inventory id " << inv_item + << llendl; } - gSavedSettings.setS32("AudioInfoPage", page); -} -#endif +}; void reload_ui(void *) { @@ -4948,7 +4912,7 @@ class LLWorldCreateLandmark : public view_listener_t LLAssetType::AT_LANDMARK, LLInventoryType::IT_LANDMARK, NOT_WEARABLE, PERM_ALL, - NULL); + new LLCreateLandmarkCallback); return true; } }; @@ -7682,6 +7646,7 @@ void initialize_menus() addMenu(new LLViewMouselook(), "View.Mouselook"); addMenu(new LLViewBuildMode(), "View.BuildMode"); addMenu(new LLViewJoystickFlycam(), "View.JoystickFlycam"); + addMenu(new LLViewCommunicate(), "View.Communicate"); addMenu(new LLViewResetView(), "View.ResetView"); addMenu(new LLViewLookAtLastChatter(), "View.LookAtLastChatter"); addMenu(new LLViewShowHoverTips(), "View.ShowHoverTips"); diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index ce91678a36..e47ffe2d7f 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -861,7 +861,8 @@ void open_offer(const std::vector<LLUUID>& items, const std::string& from_name) } if(gSavedSettings.getBOOL("ShowInInventory") && - asset_type != LLAssetType::AT_CALLINGCARD) + asset_type != LLAssetType::AT_CALLINGCARD && + item->getInventoryType() != LLInventoryType::IT_ATTACHMENT) { LLInventoryView::showAgentInventory(TRUE); } @@ -3306,8 +3307,7 @@ void process_sound_trigger(LLMessageSystem *msg, void **) return; } - F32 volume = gSavedSettings.getBOOL("MuteSounds") ? 0.f : (gain * gSavedSettings.getF32("AudioLevelSFX")); - gAudiop->triggerSound(sound_id, owner_id, volume, pos_global); + gAudiop->triggerSound(sound_id, owner_id, gain, LLAudioEngine::AUDIO_TYPE_SFX, pos_global); } void process_preload_sound(LLMessageSystem *msg, void **user_data) diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp index 461a21d51a..cc031b4368 100644 --- a/indra/newview/llviewerobject.cpp +++ b/indra/newview/llviewerobject.cpp @@ -2763,12 +2763,6 @@ void LLViewerObject::setPixelAreaAndAngle(LLAgent &agent) BOOL LLViewerObject::updateLOD() { - // Update volume of looping sounds - if (mAudioSourcep && mAudioSourcep->isLoop()) - { - F32 volume = gSavedSettings.getBOOL("MuteSounds") ? 0.f : (mAudioGain * gSavedSettings.getF32("AudioLevelSFX")); - mAudioSourcep->setGain(volume); - } return FALSE; } @@ -4331,8 +4325,7 @@ void LLViewerObject::setAttachedSound(const LLUUID &audio_uuid, const LLUUID& ow { BOOL queue = flags & LL_SOUND_FLAG_QUEUE; mAudioGain = gain; - F32 volume = gSavedSettings.getBOOL("MuteSounds") ? 0.f : gain * gSavedSettings.getF32("AudioLevelSFX"); - mAudioSourcep->setGain(volume); + mAudioSourcep->setGain(gain); mAudioSourcep->setLoop(flags & LL_SOUND_FLAG_LOOP); mAudioSourcep->setSyncMaster(flags & LL_SOUND_FLAG_SYNC_MASTER); mAudioSourcep->setSyncSlave(flags & LL_SOUND_FLAG_SYNC_SLAVE); @@ -4370,8 +4363,7 @@ void LLViewerObject::adjustAudioGain(const F32 gain) if (mAudioSourcep) { mAudioGain = gain; - F32 volume = gSavedSettings.getBOOL("MuteSounds") ? 0.f : mAudioGain * gSavedSettings.getF32("AudioLevelSFX"); - mAudioSourcep->setGain(volume); + mAudioSourcep->setGain(mAudioGain); } } diff --git a/indra/newview/llviewertexteditor.cpp b/indra/newview/llviewertexteditor.cpp index 0a11f79fd1..aa5f5e0ae0 100644 --- a/indra/newview/llviewertexteditor.cpp +++ b/indra/newview/llviewertexteditor.cpp @@ -1402,8 +1402,7 @@ void LLViewerTextEditor::openEmbeddedSound( LLInventoryItem* item ) const F32 SOUND_GAIN = 1.0f; if(gAudiop) { - F32 volume = gSavedSettings.getBOOL("MuteSounds") ? 0.f : (SOUND_GAIN * gSavedSettings.getF32("AudioLevelSFX")); - gAudiop->triggerSound(item->getAssetUUID(), gAgentID, volume, lpos_global); + gAudiop->triggerSound(item->getAssetUUID(), gAgentID, SOUND_GAIN, LLAudioEngine::AUDIO_TYPE_UI, lpos_global); } showCopyToInvDialog( item ); } diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index 1363a536cb..8ff257ee77 100644 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -1260,6 +1260,7 @@ BOOL LLViewerWindow::handleActivate(LLWindow *window, BOOL activated) BOOL LLViewerWindow::handleActivateApp(LLWindow *window, BOOL activating) { + if (!activating) gAgent.changeCameraToDefault(); LLViewerJoystick::getInstance()->setNeedsReset(true); return FALSE; } diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 0ccba521fa..e67bdfe01f 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -3775,10 +3775,7 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent) // AUDIO_STEP_LO_SPEED, AUDIO_STEP_HI_SPEED, // AUDIO_STEP_LO_GAIN, AUDIO_STEP_HI_GAIN ); - F32 ambient_volume = gSavedSettings.getF32("AudioLevelAmbient"); - F32 gain = gSavedSettings.getBOOL("MuteAmbient") - ? 0.f - : (.50f * ambient_volume * ambient_volume); + const F32 STEP_VOLUME = 0.5f; LLUUID& step_sound_id = getStepSound(); LLVector3d foot_pos_global = gAgent.getPosGlobalFromAgent(foot_pos_agent); @@ -3786,7 +3783,7 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent) if (LLViewerParcelMgr::getInstance()->canHearSound(foot_pos_global) && !LLMuteList::getInstance()->isMuted(getID(), LLMute::flagObjectSounds)) { - gAudiop->triggerSound(step_sound_id, getID(), gain, foot_pos_global); + gAudiop->triggerSound(step_sound_id, getID(), STEP_VOLUME, LLAudioEngine::AUDIO_TYPE_AMBIENT, foot_pos_global); } } } @@ -4760,14 +4757,12 @@ BOOL LLVOAvatar::processSingleAnimationStateChange( const LLUUID& anim_id, BOOL // to support both spatialized and non-spatialized instances of the same sound //if (mIsSelf) //{ - // F32 volume = gain * gSavedSettings.getF32("AudioLevelUI") - // gAudiop->triggerSound(LLUUID(gSavedSettings.getString("UISndTyping")), volume); + // gAudiop->triggerSound(LLUUID(gSavedSettings.getString("UISndTyping")), 1.0f, LLAudioEngine::AUDIO_TYPE_UI); //} //else { LLUUID sound_id = LLUUID(gSavedSettings.getString("UISndTyping")); - F32 volume = gSavedSettings.getBOOL("MuteSounds") ? 0.f : gSavedSettings.getF32("AudioLevelSFX"); - gAudiop->triggerSound(sound_id, getID(), volume, char_pos_global); + gAudiop->triggerSound(sound_id, getID(), 1.0f, LLAudioEngine::AUDIO_TYPE_SFX, char_pos_global); } } } diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index 7dd9ab5e1e..2bd1831946 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -2665,6 +2665,18 @@ void LLPipeline::renderForSelect(std::set<LLViewerObject*>& objects, BOOL render LLGLState::checkClientArrays(); U32 last_type = 0; + // If we don't do this, we crash something on changing graphics settings + // from Medium -> Low, because we unload all the shaders and the + // draw pools aren't aware. I don't know if this has to be a separate + // loop before actual rendering. JC + for (pool_set_t::iterator iter = mPools.begin(); iter != mPools.end(); ++iter) + { + LLDrawPool *poolp = *iter; + if (poolp->isFacePool() && hasRenderType(poolp->getType())) + { + poolp->prerender(); + } + } for (pool_set_t::iterator iter = mPools.begin(); iter != mPools.end(); ++iter) { LLDrawPool *poolp = *iter; |