diff options
author | Armin Weatherwax | 2010-07-01 15:19:49 +0200 |
---|---|---|
committer | Armin Weatherwax | 2010-07-01 15:19:49 +0200 |
commit | 1ac763405f15934beb156a9db67337de84a68755 (patch) | |
tree | 3d9dc875833b1a61d144120eb45c686e2af304ad /linden/indra | |
parent | retry joystick detection when opening prefs-input-joystick (diff) | |
download | meta-impy-1ac763405f15934beb156a9db67337de84a68755.zip meta-impy-1ac763405f15934beb156a9db67337de84a68755.tar.gz meta-impy-1ac763405f15934beb156a9db67337de84a68755.tar.bz2 meta-impy-1ac763405f15934beb156a9db67337de84a68755.tar.xz |
add dbus method to retry joystick detection
Diffstat (limited to 'linden/indra')
-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 | |||