2008-12-18 Mark Doffman <mark.doffman@codethink.co.uk>
authorMark Doffman <mdoff@silver-wind.(none)>
Thu, 18 Dec 2008 11:53:42 +0000 (11:53 +0000)
committerMark Doffman <mdoff@silver-wind.(none)>
Thu, 18 Dec 2008 12:25:50 +0000 (12:25 +0000)
        * Makefile.am
          Move dbind to before droute folder.
          droute now depends on dbind library.

        * cspi/*
          Change to cspi to fit with interface
          changes to dbind made in previous commit.

        * dbind/*
          Addition of varargs reentrant method call.
          Used in cspi.

Makefile.am
cspi/spi-listener.c
cspi/spi-main.c
cspi/spi-registry.c
dbind/dbind.c
dbind/dbind.h

index f485d5a..e40a69d 100644 (file)
@@ -1,4 +1,4 @@
-SUBDIRS=xml tools droute spi-common atk-adaptor registryd dbind cspi pyatspi login-helper tests
+SUBDIRS=xml tools dbind droute spi-common atk-adaptor registryd cspi pyatspi login-helper tests
 
 pkgconfigdir = $(libdir)/pkgconfig
 pkgconfig_DATA = libspi-1.0.pc cspi-1.0.pc libloginhelper-1.0.pc
index 57f0bfb..e314999 100644 (file)
@@ -388,7 +388,7 @@ cspi_dbus_handle_deviceEvent (DBusConnection *bus, DBusMessage *message, void *d
     goto done;
   }
   dbus_message_iter_init (message, &iter);
-  dbind_any_demarshal (iter, &deviceEvent_type, &p);
+  dbind_any_demarshal (&iter, (char **) &deviceEvent_type, &p);
   klass = CSPI_DEVICE_LISTENER_GET_CLASS (listener);
   if (klass->device_event)
   {
index 3485a5a..e824c6a 100644 (file)
@@ -413,7 +413,7 @@ add_app_to_desktop (Accessible *a, const char *bus_name)
   char *root_path;
 
   dbus_error_init (&error);
-  if (dbind_connection_method_call (bus, bus_name, "/org/freedesktop/atspi/tree", spi_interface_tree, "getRoot", &error, "=>o", &root_path))
+  if (dbind_method_call_reentrant (bus, bus_name, "/org/freedesktop/atspi/tree", spi_interface_tree, "getRoot", &error, "=>o", &root_path))
   {
     Accessible *obj = cspi_ref_accessible (bus_name, root_path);
     if (obj)
@@ -505,7 +505,7 @@ ref_accessible_desktop (CSpiApplication *app)
   desktop->ref_count = 2;      /* one for the caller, one for the hash */
   desktop->name = g_strdup ("");
   dbus_error_init (&error);
-  if (!dbind_connection_method_call (bus, spi_bus_registry, spi_path_registry, spi_interface_registry, "getApplications", &error, "=>as", &apps))
+  if (!dbind_method_call_reentrant (bus, spi_bus_registry, spi_path_registry, spi_interface_registry, "getApplications", &error, "=>as", &apps))
   {
     g_error ("Couldn't get application list: %s", error.message);
   }
@@ -520,7 +520,7 @@ ref_accessible_desktop (CSpiApplication *app)
     CSpiApplication *app = cspi_get_application (app_name);
     additions = NULL;
     dbus_error_init (&error);
-    dbind_connection_method_call (bus, app_name, "/org/freedesktop/atspi/tree", spi_interface_tree, "getTree", &error, "=>a(ooaoassusau)", &additions);
+    dbind_method_call_reentrant (bus, app_name, "/org/freedesktop/atspi/tree", spi_interface_tree, "getTree", &error, "=>a(ooaoassusau)", &additions);
     if (error.message)
     {
       g_warning ("getTree (%s): %s", app_name, error.message);
@@ -1019,7 +1019,7 @@ cspi_dbus_call (Accessible *obj, const char *interface, const char *method, DBus
   if (!error) error = &err;
   dbus_error_init (error);
   va_start (args, type);
-  retval = dbind_connection_method_call_va (SPI_bus(), obj->app->bus_name, path, interface, method, error, type, args);
+  retval = dbind_method_call_reentrant_va (SPI_bus(), obj->app->bus_name, path, interface, method, error, type, args);
   va_end (args);
   g_free (path);
   if (dbus_error_is_set (error))
index 6e432ec..d920cf0 100644 (file)
@@ -210,7 +210,7 @@ SPI_registerAccessibleKeystrokeListener (AccessibleKeystrokeListener  *listener,
          (dbus_bool_t) ((sync_type & SPI_KEYLISTENER_ALL_WINDOWS)!=0);
 
     dbus_error_init (&error);
-    dbind_connection_method_call (SPI_bus(), spi_bus_registry, spi_path_dec, spi_interface_dec, "registerKeystrokeListener", &error, "oa(iisi)uu(bbb)=>b", path, key_set, controller_event_mask, key_set, &listener_mode, &retval);
+    dbind_method_call_reentrant (SPI_bus(), spi_bus_registry, spi_path_dec, spi_interface_dec, "registerKeystrokeListener", &error, "oa(iisi)uu(bbb)=>b", path, key_set, controller_event_mask, key_set, &listener_mode, &retval);
 
   g_array_free (key_set, TRUE);
   g_free (path);
@@ -249,7 +249,7 @@ SPI_deregisterAccessibleKeystrokeListener (AccessibleKeystrokeListener *listener
   controller_event_mask = (dbus_uint32_t) modmask;
 
       key_set = g_array_sized_new (FALSE, TRUE, sizeof (Accessibility_KeyDefinition), 0);
-    dbind_connection_method_call (SPI_bus(), spi_bus_registry, spi_path_dec, spi_interface_dec, "deregisterKeystrokeListener", &error, "oa(iisi)uu", path, &key_set, key_events, controller_event_mask);
+    dbind_method_call_reentrant (SPI_bus(), spi_bus_registry, spi_path_dec, spi_interface_dec, "deregisterKeystrokeListener", &error, "oa(iisi)uu", path, &key_set, key_events, controller_event_mask);
   g_free (path);
   return TRUE;
 }
@@ -294,7 +294,7 @@ SPI_registerDeviceEventListener (AccessibleDeviceListener  *listener,
     }
 
   dbus_error_init (&error);
-    dbind_connection_method_call (SPI_bus(), spi_bus_registry, spi_path_dec, spi_interface_dec, "registerDeviceEventListener", &error, "ou=>b", path, event_types, &retval);
+    dbind_method_call_reentrant (SPI_bus(), spi_bus_registry, spi_path_dec, spi_interface_dec, "registerDeviceEventListener", &error, "ou=>b", path, event_types, &retval);
   g_free (path);
   return retval;
 }
@@ -327,7 +327,7 @@ SPI_deregisterDeviceEventListener (AccessibleDeviceListener *listener,
   event_types |= (1 << Accessibility_BUTTON_RELEASED_EVENT);
 
   dbus_error_init (&error);
-    dbind_connection_method_call (SPI_bus(), spi_bus_registry, spi_path_dec, spi_interface_dec, "deregisterDeviceEventListener", &error, "ou", path, event_types);
+    dbind_method_call_reentrant (SPI_bus(), spi_bus_registry, spi_path_dec, spi_interface_dec, "deregisterDeviceEventListener", &error, "ou", path, event_types);
   g_free (path);
   return TRUE;
 }
@@ -383,7 +383,7 @@ SPI_generateKeyboardEvent (long int keyval,
 
   if (!keystring) keystring = "";
   dbus_error_init (&error);
-    dbind_connection_method_call (SPI_bus(), spi_bus_registry, spi_path_dec, spi_interface_dec, "generateKeyboardEvent", &error, "isu", keycode, keystring, keysynth_type);
+    dbind_method_call_reentrant (SPI_bus(), spi_bus_registry, spi_path_dec, spi_interface_dec, "generateKeyboardEvent", &error, "isu", keycode, keystring, keysynth_type);
 
   return TRUE;
 }
@@ -411,7 +411,7 @@ SPI_generateMouseEvent (long x, long y, char *name)
   DBusError error;
 
   dbus_error_init (&error);
-    dbind_connection_method_call (SPI_bus(), spi_bus_registry, spi_path_dec, spi_interface_dec, "generateMouseEvent", &error, "iis", x, y, name);
+    dbind_method_call_reentrant (SPI_bus(), spi_bus_registry, spi_path_dec, spi_interface_dec, "generateMouseEvent", &error, "iis", x, y, name);
   return TRUE;
 }
 
index 2cdf5f7..0103b4b 100644 (file)
@@ -40,41 +40,21 @@ send_and_allow_reentry (DBusConnection *bus, DBusMessage *message, DBusError *er
     return reply;
 }
 
-/**
- * dbind_method_call_reentrant:
- *
- * @cnx:       A D-Bus Connection used to make the method call.
- * @bus_name:  The D-Bus bus name of the program where the method call should
- *             be made.
- * @path:      The D-Bus object path that should handle the method.
- * @interface: The D-Bus interface used to scope the method name.
- * @method:    Method to be invoked.
- * @opt_error: D-Bus error.
- * @arg_types: Variable length arguments interleaving D-Bus argument types
- *             and pointers to argument data.
- *
- * Makes a D-Bus method call using the supplied location data, method name and
- * argument data.This function is re-entrant. It continuously reads from the D-Bus
- * bus and dispatches messages until a reply has been recieved.
- **/
 dbus_bool_t
-dbind_method_call_reentrant (DBusConnection *cnx,
-                             const char     *bus_name,
-                             const char     *path,
-                             const char     *interface,
-                             const char     *method,
-                             DBusError      *opt_error,
-                             const char     *arg_types,
-                             ...)
+dbind_method_call_reentrant_va (DBusConnection *cnx,
+                                const char     *bus_name,
+                                const char     *path,
+                                const char     *interface,
+                                const char     *method,
+                                DBusError      *opt_error,
+                                const char     *arg_types,
+                                va_list         args)
 {
     dbus_bool_t success = FALSE;
     DBusMessage *msg = NULL, *reply = NULL;
     DBusMessageIter iter;
     DBusError *err, real_err;
     char *p;
-    va_list args;
-
-    va_start (args, arg_types);
 
     if (opt_error)
         err = opt_error;
@@ -112,8 +92,6 @@ dbind_method_call_reentrant (DBusConnection *cnx,
 
     success = TRUE;
 out:
-    va_end (args);
-
     if (msg)
         dbus_message_unref (msg);
 
@@ -126,6 +104,50 @@ out:
     return success;
 }
 
+/**
+ * dbind_method_call_reentrant:
+ *
+ * @cnx:       A D-Bus Connection used to make the method call.
+ * @bus_name:  The D-Bus bus name of the program where the method call should
+ *             be made.
+ * @path:      The D-Bus object path that should handle the method.
+ * @interface: The D-Bus interface used to scope the method name.
+ * @method:    Method to be invoked.
+ * @opt_error: D-Bus error.
+ * @arg_types: Variable length arguments interleaving D-Bus argument types
+ *             and pointers to argument data.
+ *
+ * Makes a D-Bus method call using the supplied location data, method name and
+ * argument data.This function is re-entrant. It continuously reads from the D-Bus
+ * bus and dispatches messages until a reply has been recieved.
+ **/
+dbus_bool_t
+dbind_method_call_reentrant (DBusConnection *cnx,
+                             const char     *bus_name,
+                             const char     *path,
+                             const char     *interface,
+                             const char     *method,
+                             DBusError      *opt_error,
+                             const char     *arg_types,
+                             ...)
+{
+    dbus_bool_t success = FALSE;
+    va_list args;
+
+    va_start (args, arg_types);
+    success = dbind_method_call_reentrant_va (cnx,
+                                              bus_name,
+                                              path,
+                                              interface,
+                                              method,
+                                              opt_error,
+                                              arg_types,
+                                              args);
+    va_end (args);
+
+    return success;
+}
+
 /*---------------------------------------------------------------------------*/
 
 /**
index 0f6cec8..c3e1d56 100644 (file)
@@ -6,6 +6,16 @@
 #include <dbind/dbind-any.h>
 
 dbus_bool_t
+dbind_method_call_reentrant_va (DBusConnection *cnx,
+                                const char     *bus_name,
+                                const char     *path,
+                                const char     *interface,
+                                const char     *method,
+                                DBusError      *opt_error,
+                                const char     *arg_types,
+                                va_list         args);
+
+dbus_bool_t
 dbind_method_call_reentrant (DBusConnection *cnx,
                              const char     *bus_name,
                              const char     *path,