diff options
Diffstat (limited to 'linden')
-rw-r--r-- | linden/indra/newview/llappviewerlinux.cpp | 23 | ||||
-rw-r--r-- | linden/indra/newview/llappviewerlinux.h | 1 | ||||
-rw-r--r-- | linden/indra/newview/llappviewerlinux_api.h | 8 |
3 files changed, 29 insertions, 3 deletions
diff --git a/linden/indra/newview/llappviewerlinux.cpp b/linden/indra/newview/llappviewerlinux.cpp index 4372053..39c2692 100644 --- a/linden/indra/newview/llappviewerlinux.cpp +++ b/linden/indra/newview/llappviewerlinux.cpp | |||
@@ -65,6 +65,7 @@ | |||
65 | 65 | ||
66 | #if LL_DBUS_ENABLED | 66 | #if LL_DBUS_ENABLED |
67 | #include "llappviewerlinux_api.h" | 67 | #include "llappviewerlinux_api.h" |
68 | #include "llviewerjoystick.h" | ||
68 | #endif | 69 | #endif |
69 | 70 | ||
70 | namespace | 71 | namespace |
@@ -452,6 +453,28 @@ gboolean viewer_app_api_GoSLURL(ViewerAppAPI *obj, gchar *slurl, gboolean **succ | |||
452 | return TRUE; // the invokation succeeded, even if the actual dispatch didn't. | 453 | return TRUE; // the invokation succeeded, even if the actual dispatch didn't. |
453 | } | 454 | } |
454 | 455 | ||
456 | gboolean viewer_app_api_HotplugJoystick(ViewerAppAPI *obj, gchar *dummy, gboolean **success_rtn, GError **error) | ||
457 | { | ||
458 | |||
459 | llinfos << "Joystick plugged in: " << dummy << llendl; | ||
460 | bool success = false; | ||
461 | bool joystick_inited = LLViewerJoystick::getInstance()->isJoystickInitialized(); | ||
462 | |||
463 | if (!joystick_inited) | ||
464 | { | ||
465 | success = LLViewerJoystick::getInstance()->init(false); | ||
466 | } | ||
467 | |||
468 | *success_rtn = g_new (gboolean, 1); | ||
469 | (*success_rtn)[0] = (gboolean)success; | ||
470 | |||
471 | return TRUE; // the invokation succeeded, even if the actual dispatch didn't. | ||
472 | |||
473 | // TODO: fire this by the spacenavi udev rule. | ||
474 | // for testing plug in joystick while Imprudence is running and type in a | ||
475 | // console: dbus-send --type=method_call --dest=com.secondlife.ViewerAppAPIService /com/secondlife/ViewerAppAPI com.secondlife.ViewerAppAPI.HotplugJoystick string:'dummy' | ||
476 | } | ||
477 | |||
455 | /// | 478 | /// |
456 | 479 | ||
457 | //virtual | 480 | //virtual |
diff --git a/linden/indra/newview/llappviewerlinux.h b/linden/indra/newview/llappviewerlinux.h index d757639..84074ec 100644 --- a/linden/indra/newview/llappviewerlinux.h +++ b/linden/indra/newview/llappviewerlinux.h | |||
@@ -84,6 +84,7 @@ typedef struct | |||
84 | 84 | ||
85 | extern "C" { | 85 | extern "C" { |
86 | gboolean viewer_app_api_GoSLURL(ViewerAppAPI *obj, gchar *slurl, gboolean **success_rtn, GError **error); | 86 | gboolean viewer_app_api_GoSLURL(ViewerAppAPI *obj, gchar *slurl, gboolean **success_rtn, GError **error); |
87 | gboolean viewer_app_api_HotplugJoystick(ViewerAppAPI *obj, gchar *dummy, gboolean **success_rtn, GError **error); | ||
87 | } | 88 | } |
88 | 89 | ||
89 | #define VIEWERAPI_SERVICE "com.secondlife.ViewerAppAPIService" | 90 | #define VIEWERAPI_SERVICE "com.secondlife.ViewerAppAPIService" |
diff --git a/linden/indra/newview/llappviewerlinux_api.h b/linden/indra/newview/llappviewerlinux_api.h index 56b88fb..812f38c 100644 --- a/linden/indra/newview/llappviewerlinux_api.h +++ b/linden/indra/newview/llappviewerlinux_api.h | |||
@@ -134,16 +134,18 @@ G_END_DECLS | |||
134 | #endif /* __dbus_glib_marshal_viewerapp_MARSHAL_H__ */ | 134 | #endif /* __dbus_glib_marshal_viewerapp_MARSHAL_H__ */ |
135 | 135 | ||
136 | #include <dbus/dbus-glib.h> | 136 | #include <dbus/dbus-glib.h> |
137 | //read http://wiki.maemo.org/Documentation/Maemo_5_Developer_Guide/DBus/Using_GLib_Wrappers_For_D-Bus | ||
137 | static const DBusGMethodInfo dbus_glib_viewerapp_methods[] = { | 138 | static const DBusGMethodInfo dbus_glib_viewerapp_methods[] = { |
138 | { (GCallback) viewer_app_api_GoSLURL, dbus_glib_marshal_viewerapp_BOOLEAN__STRING_POINTER_POINTER, 0 }, | 139 | { (GCallback) viewer_app_api_GoSLURL, dbus_glib_marshal_viewerapp_BOOLEAN__STRING_POINTER_POINTER, 0 }, |
140 | { (GCallback) viewer_app_api_HotplugJoystick, dbus_glib_marshal_viewerapp_BOOLEAN__STRING_POINTER_POINTER, 70 },// at position 70 chars offset, counting from 0 | ||
139 | }; | 141 | }; |
140 | 142 | ||
141 | const DBusGObjectInfo dbus_glib_viewerapp_object_info = { | 143 | const DBusGObjectInfo dbus_glib_viewerapp_object_info = { |
142 | 0, | 144 | 0, |
143 | dbus_glib_viewerapp_methods, | 145 | dbus_glib_viewerapp_methods, |
144 | 1, | 146 | 2, //number of methods (counting from 1) |
145 | "com.secondlife.ViewerAppAPI\0GoSLURL\0S\0slurl\0I\0s\0success_ret\0O\0F\0N\0b\0\0\0", | 147 | "com.secondlife.ViewerAppAPI\0GoSLURL\0S\0slurl\0I\0s\0success_ret\0O\0F\0N\0b\0\0\0" //no comma; this is where the 70 chars are from ... see above ... counting from 0, yeah without quotes and escape |
148 | "com.secondlife.ViewerAppAPI\0HotplugJoystick\0S\0dummy\0I\0s\0success_ret\0O\0F\0N\0b\0\0\0", | ||
146 | "\0", | 149 | "\0", |
147 | "\0" | 150 | "\0" |
148 | }; | 151 | }; |
149 | |||