Remove old dbus code and replace it with a glib/gio implementation.
parent
dcb9bda19c
commit
ba31ac8efe
|
|
@ -843,48 +843,6 @@
|
|||
<key>version</key>
|
||||
<string>5.1.25</string>
|
||||
</map>
|
||||
<key>dbus_glib</key>
|
||||
<map>
|
||||
<key>copyright</key>
|
||||
<string>Copyright (C) Red Hat Inc.</string>
|
||||
<key>description</key>
|
||||
<string>D-Bus bindings for glib</string>
|
||||
<key>license</key>
|
||||
<string>Academic Free License v. 2.1</string>
|
||||
<key>license_file</key>
|
||||
<string>LICENSES/dbus-glib.txt</string>
|
||||
<key>name</key>
|
||||
<string>dbus_glib</string>
|
||||
<key>platforms</key>
|
||||
<map>
|
||||
<key>linux</key>
|
||||
<map>
|
||||
<key>archive</key>
|
||||
<map>
|
||||
<key>hash</key>
|
||||
<string>9591dcb7efce2a770d77e907705e1492</string>
|
||||
<key>url</key>
|
||||
<string>http://3p.firestormviewer.org/dbus_glib-0.76-linux-180871236.tar.bz2</string>
|
||||
</map>
|
||||
<key>name</key>
|
||||
<string>linux</string>
|
||||
</map>
|
||||
<key>linux64</key>
|
||||
<map>
|
||||
<key>archive</key>
|
||||
<map>
|
||||
<key>hash</key>
|
||||
<string>5a685a65a7066937ef580dcd5a90f9dc</string>
|
||||
<key>url</key>
|
||||
<string>http://3p.firestormviewer.org/dbus_glib-0.76-linux64-180841549.tar.bz2</string>
|
||||
</map>
|
||||
<key>name</key>
|
||||
<string>linux64</string>
|
||||
</map>
|
||||
</map>
|
||||
<key>version</key>
|
||||
<string>0.76</string>
|
||||
</map>
|
||||
<key>dictionaries</key>
|
||||
<map>
|
||||
<key>copyright</key>
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ set(cmake_SOURCE_FILES
|
|||
ConfigurePkgConfig.cmake
|
||||
CURL.cmake
|
||||
Copy3rdPartyLibs.cmake
|
||||
DBusGlib.cmake
|
||||
GLIB.cmake
|
||||
DeploySharedLibs.cmake
|
||||
Discord.cmake # <FS:LO> Discord rich presence
|
||||
DragDrop.cmake
|
||||
|
|
|
|||
|
|
@ -1,27 +0,0 @@
|
|||
# -*- cmake -*-
|
||||
include(Prebuilt)
|
||||
include(GLIB)
|
||||
|
||||
if( GLIB_FOUND )
|
||||
if (USESYSTEMLIBS)
|
||||
include(FindPkgConfig)
|
||||
|
||||
pkg_check_modules(DBUSGLIB REQUIRED dbus-glib-1)
|
||||
|
||||
elseif (LINUX)
|
||||
use_prebuilt_binary(dbus_glib)
|
||||
set(DBUSGLIB_FOUND ON FORCE BOOL)
|
||||
set(DBUSGLIB_INCLUDE_DIRS
|
||||
${GLIB_INCLUDE_DIRS}
|
||||
${LIBS_PREBUILT_DIR}/include/dbus
|
||||
)
|
||||
endif (USESYSTEMLIBS)
|
||||
|
||||
if (DBUSGLIB_FOUND)
|
||||
set(DBUSGLIB ON CACHE BOOL "Build with dbus-glib message bus support.")
|
||||
endif (DBUSGLIB_FOUND)
|
||||
|
||||
if (DBUSGLIB)
|
||||
add_definitions(-DLL_DBUS_ENABLED=1)
|
||||
endif (DBUSGLIB)
|
||||
endif()
|
||||
|
|
@ -6,6 +6,6 @@ if( LINUX )
|
|||
set(GLIB_FOUND ON CACHE BOOL "Build against glib 2")
|
||||
set(GLIB_INCLUDE_DIRS ${LIBS_PREBUILT_DIR}/include/glib-2.0 ${LIBS_PREBUILT_DIR}/lib/release/glib-2.0/include )
|
||||
set(GLIB_LIBRARIES libgobject-2.0.a libglib-2.0.a libffi.a libpcre.a)
|
||||
|
||||
set(GIO_LIBRARIES libgio-2.0.a libgmodule-2.0.a -lresolv)
|
||||
add_definitions(-DLL_GLIB=1)
|
||||
endif()
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
# -*- cmake -*-
|
||||
include(Prebuilt)
|
||||
include(FreeType)
|
||||
include(GLIB)
|
||||
|
||||
if (USESYSTEMLIBS)
|
||||
include(FindPkgConfig)
|
||||
|
|
@ -61,6 +62,7 @@ else (USESYSTEMLIBS)
|
|||
endforeach(libname)
|
||||
|
||||
set(UI_LIBRARIES ${UI_LIBRARIES} Xinerama)
|
||||
include_directories ( ${GLIB_INCLUDE_DIRS} )
|
||||
endif (LINUX)
|
||||
|
||||
include_directories (
|
||||
|
|
|
|||
|
|
@ -48,6 +48,10 @@ extern "C" {
|
|||
#include <locale.h>
|
||||
#endif // LL_GTK
|
||||
|
||||
#ifdef LL_GLIB
|
||||
#include <glib.h>
|
||||
#endif
|
||||
|
||||
extern "C" {
|
||||
# include "fontconfig/fontconfig.h"
|
||||
}
|
||||
|
|
@ -1992,7 +1996,18 @@ void LLWindowSDL::processMiscNativeEvents()
|
|||
setlocale(LC_ALL, saved_locale.c_str() );
|
||||
}
|
||||
#endif // LL_GTK
|
||||
|
||||
#if LL_GLIB
|
||||
// Pump until we've nothing left to do or passed 1/15th of a
|
||||
// second pumping for this frame.
|
||||
static LLTimer pump_timer;
|
||||
pump_timer.reset();
|
||||
pump_timer.setTimerExpirySec(1.0f / 15.0f);
|
||||
do
|
||||
{
|
||||
g_main_context_iteration(g_main_context_default(), FALSE);
|
||||
} while( g_main_context_pending(g_main_context_default()) && !pump_timer.hasExpired());
|
||||
#endif
|
||||
|
||||
// hack - doesn't belong here - but this is just for debugging
|
||||
if (getenv("LL_DEBUG_BLOAT"))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ include(BuildPackagesInfo)
|
|||
include(BuildVersion)
|
||||
include(CMakeCopyIfDifferent)
|
||||
include(CubemapToEquirectangularJS)
|
||||
include(DBusGlib)
|
||||
include(GLIB)
|
||||
include(DragDrop)
|
||||
include(EXPAT)
|
||||
include(FMODSTUDIO)
|
||||
|
|
@ -1797,7 +1797,6 @@ if (LINUX)
|
|||
# fsversionstrings.h with the right numbers in it.
|
||||
# COMPILE_DEFINITIONS "${VIEWER_CHANNEL_VERSION_DEFINES}"
|
||||
)
|
||||
LIST(APPEND viewer_SOURCE_FILES llappviewerlinux_api_dbus.cpp)
|
||||
# [FS] Growl support
|
||||
LIST(APPEND viewer_HEADER_FILES desktopnotifierlinux.h growlmanager.h)
|
||||
LIST(APPEND viewer_SOURCE_FILES desktopnotifierlinux.cpp growlmanager.cpp)
|
||||
|
|
@ -2538,6 +2537,7 @@ target_link_libraries(${VIEWER_BINARY_NAME}
|
|||
${LLPHYSICSEXTENSIONS_LIBRARIES}
|
||||
${LLAPPEARANCE_LIBRARIES}
|
||||
${GROWL_LIBRARY}
|
||||
${GIO_LIBRARIES}
|
||||
)
|
||||
|
||||
target_link_libraries(${VIEWER_BINARY_NAME} ${DISCORD_LIBRARY} )
|
||||
|
|
|
|||
|
|
@ -42,16 +42,27 @@
|
|||
|
||||
#include "json/reader.h" // <FS:ND/> To parse manifest.json from pepperflash
|
||||
|
||||
#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
|
||||
#include <gio/gio.h>
|
||||
|
||||
#define VIEWERAPI_SERVICE "com.secondlife.ViewerAppAPIService"
|
||||
#define VIEWERAPI_PATH "/com/secondlife/ViewerAppAPI"
|
||||
#define VIEWERAPI_INTERFACE "com.secondlife.ViewerAppAPI"
|
||||
|
||||
static const char * DBUS_SERVER = "<node name=\"/com/secondlife/ViewerAppAPI\">\n"
|
||||
" <interface name=\"com.secondlife.ViewerAppAPI\">\n"
|
||||
" <annotation name=\"org.freedesktop.DBus.GLib.CSymbol\" value=\"viewer_app_api\"/>\n"
|
||||
" <method name=\"GoSLURL\">\n"
|
||||
" <annotation name=\"org.freedesktop.DBus.GLib.CSymbol\" value=\"dispatchSLURL\"/>\n"
|
||||
" <arg type=\"s\" name=\"slurl\" direction=\"in\" />\n"
|
||||
" </method>\n"
|
||||
" </interface>\n"
|
||||
"</node>";
|
||||
|
||||
typedef struct
|
||||
{
|
||||
GObject parent;
|
||||
} ViewerAppAPI;
|
||||
|
||||
namespace
|
||||
{
|
||||
|
|
@ -127,10 +138,6 @@ bool LLAppViewerLinux::init()
|
|||
// libraries likes to use glib functions; in short, do this here
|
||||
// really early in app startup!
|
||||
|
||||
#if ( !defined(GLIB_MAJOR_VERSION) && !defined(GLIB_MINOR_VERSION) ) || ( GLIB_MAJOR_VERSION < 2 ) || ( GLIB_MAJOR_VERSION == 2 && GLIB_MINOR_VERSION < 32 )
|
||||
if (!g_thread_supported ()) g_thread_init (NULL);
|
||||
#endif
|
||||
|
||||
bool success = LLAppViewer::init();
|
||||
|
||||
#if LL_SEND_CRASH_REPORTS
|
||||
|
|
@ -152,40 +159,17 @@ bool LLAppViewerLinux::restoreErrorTrap()
|
|||
}
|
||||
|
||||
/////////////////////////////////////////
|
||||
#if LL_DBUS_ENABLED
|
||||
#if LL_GLIB
|
||||
|
||||
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)
|
||||
static void viewerappapi_init(ViewerAppAPI *server);
|
||||
static void viewerappapi_class_init(ViewerAppAPIClass *klass);
|
||||
|
||||
G_DEFINE_TYPE(ViewerAppAPI, viewerappapi, G_TYPE_OBJECT);
|
||||
|
||||
|
|
@ -193,79 +177,71 @@ void viewerappapi_class_init(ViewerAppAPIClass *klass)
|
|||
{
|
||||
}
|
||||
|
||||
static bool dbus_server_init = false;
|
||||
|
||||
void viewerappapi_init(ViewerAppAPI *server)
|
||||
static void dispatchSLURL(gchar const *slurl)
|
||||
{
|
||||
// Connect to the default DBUS, register our service/API.
|
||||
LL_INFOS() << "Was asked to go to slurl: " << slurl << LL_ENDL;
|
||||
|
||||
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
|
||||
{
|
||||
LL_WARNS() << "Unable to register service name: " << error->message << LL_ENDL;
|
||||
}
|
||||
|
||||
g_object_unref(serverproxy);
|
||||
}
|
||||
else
|
||||
{
|
||||
g_warning("Unable to connect to dbus: %s", error->message);
|
||||
}
|
||||
|
||||
if (error)
|
||||
g_error_free(error);
|
||||
}
|
||||
std::string url = slurl;
|
||||
LLMediaCtrl* web = NULL;
|
||||
const bool trusted_browser = false;
|
||||
LLURLDispatcher::dispatch(url, "", web, trusted_browser);
|
||||
}
|
||||
|
||||
// <FS:ND> FIRE-5417; The xml manifest for dbus claims success_rtn is a boolean, not a boolean array
|
||||
//gboolean viewer_app_api_GoSLURL(ViewerAppAPI *obj, gchar *slurl, gboolean **success_rtn, GError **error)
|
||||
gboolean viewer_app_api_GoSLURL(ViewerAppAPI *obj, gchar *slurl, gboolean *success_rtn, GError **error)
|
||||
// </FS:ND>
|
||||
static void DoMethodeCall (GDBusConnection *connection,
|
||||
const gchar *sender,
|
||||
const gchar *object_path,
|
||||
const gchar *interface_name,
|
||||
const gchar *method_name,
|
||||
GVariant *parameters,
|
||||
GDBusMethodInvocation *invocation,
|
||||
gpointer user_data)
|
||||
{
|
||||
bool success = false;
|
||||
LL_INFOS() << "DBUS message " << method_name << " from: " << sender << " interface: " << interface_name << LL_ENDL;
|
||||
const gchar *slurl;
|
||||
|
||||
LL_INFOS() << "Was asked to go to slurl: " << slurl << LL_ENDL;
|
||||
g_variant_get (parameters, "(&s)", &slurl);
|
||||
dispatchSLURL(slurl);
|
||||
}
|
||||
|
||||
std::string url = slurl;
|
||||
LLMediaCtrl* web = NULL;
|
||||
const bool trusted_browser = false;
|
||||
if (LLURLDispatcher::dispatch(url, "", web, trusted_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;
|
||||
}
|
||||
GDBusNodeInfo *gBusNodeInfo = nullptr;
|
||||
static const GDBusInterfaceVTable interface_vtable =
|
||||
{
|
||||
DoMethodeCall
|
||||
};
|
||||
static void busAcquired(GDBusConnection *connection, const gchar *name, gpointer user_data)
|
||||
{
|
||||
auto id = g_dbus_connection_register_object(connection,
|
||||
VIEWERAPI_PATH,
|
||||
gBusNodeInfo->interfaces[0],
|
||||
&interface_vtable,
|
||||
NULL, /* user_data */
|
||||
NULL, /* user_data_free_func */
|
||||
NULL); /* GError** */
|
||||
g_assert (id > 0);
|
||||
}
|
||||
|
||||
// <FS:ND> FIRE-5417; The xml manifest for dbus claims success_rtn is a boolean, not a boolean array
|
||||
static void nameAcquired(GDBusConnection *connection, const gchar *name, gpointer user_data)
|
||||
{
|
||||
}
|
||||
|
||||
// *success_rtn = g_new (gboolean, 1);
|
||||
// (*success_rtn)[0] = (gboolean)success;
|
||||
static void nameLost(GDBusConnection *connection, const gchar *name, gpointer user_data)
|
||||
{
|
||||
|
||||
*success_rtn = (gboolean)success;
|
||||
}
|
||||
void viewerappapi_init(ViewerAppAPI *server)
|
||||
{
|
||||
gBusNodeInfo = g_dbus_node_info_new_for_xml (DBUS_SERVER, NULL);
|
||||
g_assert (gBusNodeInfo != NULL);
|
||||
|
||||
// </FS:ND>
|
||||
auto owner_id = g_bus_own_name(G_BUS_TYPE_SESSION,
|
||||
VIEWERAPI_SERVICE,
|
||||
G_BUS_NAME_OWNER_FLAGS_NONE,
|
||||
busAcquired,
|
||||
nameAcquired,
|
||||
nameLost,
|
||||
NULL,
|
||||
NULL);
|
||||
|
||||
return TRUE; // the invokation succeeded, even if the actual dispatch didn't.
|
||||
}
|
||||
|
||||
///
|
||||
|
|
@ -273,15 +249,6 @@ gboolean viewer_app_api_GoSLURL(ViewerAppAPI *obj, gchar *slurl, gboolean *succe
|
|||
//virtual
|
||||
bool LLAppViewerLinux::initSLURLHandler()
|
||||
{
|
||||
if (!grab_dbus_syms(DBUSGLIB_DYLIB_DEFAULT_NAME))
|
||||
{
|
||||
return false; // failed
|
||||
}
|
||||
|
||||
#if ( !defined(GLIB_MAJOR_VERSION) && !defined(GLIB_MINOR_VERSION) ) || ( GLIB_MAJOR_VERSION < 2 ) || ( GLIB_MAJOR_VERSION == 2 && GLIB_MINOR_VERSION < 35 )
|
||||
g_type_init();
|
||||
#endif
|
||||
|
||||
//ViewerAppAPI *api_server = (ViewerAppAPI*)
|
||||
g_object_new(viewerappapi_get_type(), NULL);
|
||||
|
||||
|
|
@ -291,51 +258,51 @@ bool LLAppViewerLinux::initSLURLHandler()
|
|||
//virtual
|
||||
bool LLAppViewerLinux::sendURLToOtherInstance(const std::string& url)
|
||||
{
|
||||
if (!grab_dbus_syms(DBUSGLIB_DYLIB_DEFAULT_NAME))
|
||||
{
|
||||
return false; // failed
|
||||
}
|
||||
bool success = false;
|
||||
|
||||
bool success = false;
|
||||
DBusGConnection *bus;
|
||||
GError *error = NULL;
|
||||
auto *pBus = g_bus_get_sync(G_BUS_TYPE_SESSION, NULL, nullptr);
|
||||
|
||||
#if ( !defined(GLIB_MAJOR_VERSION) && !defined(GLIB_MINOR_VERSION) ) || ( GLIB_MAJOR_VERSION < 2 ) || ( GLIB_MAJOR_VERSION == 2 && GLIB_MINOR_VERSION < 35 )
|
||||
g_type_init();
|
||||
#endif
|
||||
|
||||
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( !pBus )
|
||||
{
|
||||
LL_WARNS() << "Getting dbus failed." << LL_ENDL;
|
||||
return false;
|
||||
}
|
||||
|
||||
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
|
||||
{
|
||||
LL_INFOS() << "Call-out to other instance failed (perhaps not running): " << error->message << LL_ENDL;
|
||||
}
|
||||
auto pProxy = g_dbus_proxy_new_sync(pBus, G_DBUS_PROXY_FLAGS_NONE, nullptr,
|
||||
VIEWERAPI_SERVICE, VIEWERAPI_PATH,
|
||||
VIEWERAPI_INTERFACE, nullptr, nullptr);
|
||||
|
||||
g_object_unref(G_OBJECT(remote_object));
|
||||
}
|
||||
else
|
||||
{
|
||||
LL_WARNS() << "Couldn't connect to session bus: " << error->message << LL_ENDL;
|
||||
}
|
||||
if( !pProxy )
|
||||
{
|
||||
LL_WARNS() << "Cannot create new dbus proxy." << LL_ENDL;
|
||||
g_object_unref( pBus );
|
||||
return false;
|
||||
}
|
||||
|
||||
if (error)
|
||||
g_error_free(error);
|
||||
|
||||
return success;
|
||||
auto *pArgs = g_variant_new( "(s)", url.c_str() );
|
||||
if( !pArgs )
|
||||
{
|
||||
LL_WARNS() << "Cannot create new variant." << LL_ENDL;
|
||||
g_object_unref( pBus );
|
||||
return false;
|
||||
}
|
||||
|
||||
auto pRes = g_dbus_proxy_call_sync(pProxy,
|
||||
"GoSLURL",
|
||||
pArgs,
|
||||
G_DBUS_CALL_FLAGS_NONE,
|
||||
-1, nullptr, nullptr);
|
||||
|
||||
|
||||
|
||||
if( pRes )
|
||||
g_variant_unref( pRes );
|
||||
g_object_unref( pProxy );
|
||||
g_object_unref( pBus );
|
||||
return true;
|
||||
}
|
||||
|
||||
#else // LL_DBUS_ENABLED
|
||||
#else // LL_GLIB
|
||||
bool LLAppViewerLinux::initSLURLHandler()
|
||||
{
|
||||
return false; // not implemented without dbus
|
||||
|
|
@ -344,7 +311,7 @@ bool LLAppViewerLinux::sendURLToOtherInstance(const std::string& url)
|
|||
{
|
||||
return false; // not implemented without dbus
|
||||
}
|
||||
#endif // LL_DBUS_ENABLED
|
||||
#endif // LL_GLIB
|
||||
|
||||
void LLAppViewerLinux::initCrashReporting(bool reportFreeze)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -27,19 +27,6 @@
|
|||
#ifndef LL_LLAPPVIEWERLINUX_H
|
||||
#define LL_LLAPPVIEWERLINUX_H
|
||||
|
||||
#ifdef LL_GLIB
|
||||
extern "C" {
|
||||
# include <glib.h>
|
||||
|
||||
#if LL_DBUS_ENABLED
|
||||
# include <glib-object.h>
|
||||
# include <dbus/dbus-glib.h>
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#ifndef LL_LLAPPVIEWER_H
|
||||
#include "llappviewer.h"
|
||||
#endif
|
||||
|
|
@ -72,26 +59,4 @@ protected:
|
|||
virtual bool sendURLToOtherInstance(const std::string& url);
|
||||
};
|
||||
|
||||
#if LL_DBUS_ENABLED && LL_GLIB
|
||||
typedef struct
|
||||
{
|
||||
GObject parent;
|
||||
DBusGConnection *connection;
|
||||
} ViewerAppAPI;
|
||||
|
||||
extern "C" {
|
||||
// <FS:ND> FIRE-5417; The xml manifest for dbus claims success_rtn is a boolean, not a boolean array
|
||||
|
||||
// gboolean viewer_app_api_GoSLURL(ViewerAppAPI *obj, gchar *slurl, gboolean **success_rtn, GError **error);
|
||||
gboolean viewer_app_api_GoSLURL(ViewerAppAPI *obj, gchar *slurl, gboolean *success_rtn, GError **error);
|
||||
|
||||
// <FS:ND>
|
||||
}
|
||||
|
||||
#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
|
||||
|
|
|
|||
|
|
@ -1,143 +0,0 @@
|
|||
/* Generated by dbus-binding-tool; do not edit! */
|
||||
/**
|
||||
* $LicenseInfo:firstyear=2008&license=viewerlgpl$
|
||||
* Second Life Viewer Source Code
|
||||
* Copyright (C) 2010, Linden Research, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation;
|
||||
* version 2.1 of the License only.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
|
||||
* $/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"
|
||||
};
|
||||
|
||||
|
|
@ -1,14 +0,0 @@
|
|||
<?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>
|
||||
|
|
@ -1,126 +0,0 @@
|
|||
/**
|
||||
* @file llappviewerlinux_api_dbus.cpp
|
||||
* @brief dynamic DBus symbol-grabbing code
|
||||
*
|
||||
* $LicenseInfo:firstyear=2008&license=viewerlgpl$
|
||||
* Second Life Viewer Source Code
|
||||
* Copyright (C) 2010, Linden Research, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation;
|
||||
* version 2.1 of the License only.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
|
||||
* $/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(...) do { LL_DEBUGS() << llformat(__VA_ARGS__) << LL_ENDL; } while(0)
|
||||
#define INFOMSG(...) do { LL_INFOS() << llformat(__VA_ARGS__) << LL_ENDL; } while(0)
|
||||
#define WARNMSG(...) do { LL_WARNS() << llformat(__VA_ARGS__) << LL_ENDL; } while(0)
|
||||
|
||||
#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
|
||||
|
|
@ -1,44 +0,0 @@
|
|||
/**
|
||||
* @file llappviewerlinux_api_dbus.h
|
||||
* @brief DBus-glib symbol handling
|
||||
*
|
||||
* $LicenseInfo:firstyear=2008&license=viewerlgpl$
|
||||
* Second Life Viewer Source Code
|
||||
* Copyright (C) 2010, Linden Research, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation;
|
||||
* version 2.1 of the License only.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
|
||||
* $/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
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
|
||||
// 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
|
||||
Loading…
Reference in New Issue