Merge branch 'master' of ssh://git.codethink.co.uk/git/atspi-dbus
authorMike Gorse <mgorse@boston.site>
Sun, 12 Oct 2008 14:24:26 +0000 (09:24 -0500)
committerMike Gorse <mgorse@boston.site>
Sun, 12 Oct 2008 14:24:26 +0000 (09:24 -0500)
cspi/Makefile.am
cspi/spi-application.c [new file with mode: 0644]
cspi/spi-event.c
cspi/spi-image.c [new file with mode: 0644]
cspi/spi-listener.c
cspi/spi-main.c
cspi/spi-private.h
cspi/spi-registry.c

index 58a184c..1cb9033 100644 (file)
@@ -19,11 +19,13 @@ libcspi_la_SOURCES =                \
        cspi-lowlevel.h         \
        spi-accessible.c \
        spi-action.c \
+       spi-application.c \
        spi-component.c \
        spi-editabletext.c \
        spi-event.c \
        spi-hyperlink.c \
        spi-hypertext.c \
+       spi-image.c \
        spi-listener.c \
        spi-main.c              \
        spi-registry.c \
diff --git a/cspi/spi-application.c b/cspi/spi-application.c
new file mode 100644 (file)
index 0000000..7b219b0
--- /dev/null
@@ -0,0 +1,208 @@
+/*
+ * AT-SPI - Assistive Technology Service Provider Interface
+ * (Gnome Accessibility Project; http://developer.gnome.org/projects/gap)
+ *
+ * Copyright 2001, 2002 Sun Microsystems Inc.,
+ * Copyright 2001, 2002 Ximian, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+/*
+ *
+ * AccessibleApplication function prototypes
+ *
+ */
+
+#include <cspi/spi-private.h>
+#include <locale.h>
+
+/**
+ * AccessibleApplication_ref:
+ * @obj: a pointer to the #AccessibleApplication on which to operate.
+ *
+ * Increment the reference count for an #AccessibleApplication.
+ **/
+void
+AccessibleApplication_ref (AccessibleApplication *obj)
+{
+  cspi_object_ref (obj);
+}
+
+/**
+ * AccessibleApplication_unref:
+ * @obj: a pointer to the #AccessibleApplication object on which to operate.
+ *
+ * Decrement the reference count for an #AccessibleApplication.
+ **/
+void
+AccessibleApplication_unref (AccessibleApplication *obj)
+{
+  cspi_object_unref (obj);
+}
+
+/**
+ * AccessibleApplication_getToolkitName:
+ * @obj: a pointer to the #AccessibleApplication to query.
+ *
+ * Get the name of the UI toolkit used by an #AccessibleApplication.
+ *
+ * Returns: a UTF-8 string indicating which UI toolkit is
+ *          used by an application.
+ **/
+char *
+AccessibleApplication_getToolkitName (AccessibleApplication *obj)
+{
+  char *retval;
+
+  cspi_return_val_if_fail (obj != NULL, NULL);
+
+  cspi_dbus_get_property (obj, spi_interface_application, "tooklitName", NULL, "s", &retval);
+
+  cspi_return_val_if_ev ("toolkitName", NULL);
+
+  return retval;
+}
+
+/**
+ * AccessibleApplication_getVersion:
+ * @obj: a pointer to the #AccessibleApplication being queried.
+ *
+ * Get the version of the at-spi bridge exported by an
+ *      #AccessibleApplication instance.
+ *
+ * Returns: a UTF-8 string indicating the application's
+ *          at-spi version.
+ **/
+char *
+AccessibleApplication_getVersion (AccessibleApplication *obj)
+{
+  char *retval;
+
+  cspi_return_val_if_fail (obj != NULL, NULL);
+
+  cspi_dbus_get_property (obj, spi_interface_application, "version", NULL, "s", &retval);
+
+  cspi_return_val_if_ev ("version", NULL);
+
+  return retval;
+}
+
+/**
+ * AccessibleApplication_getID:
+ * @obj: a pointer to the #AccessibleApplication being queried.
+ *
+ * Get the unique ID assigned by the Registry to an
+ *      #AccessibleApplication instance.
+ * (Not Yet Implemented by the registry).
+ *
+ * Returns: a unique #long integer associated with the application
+ *          by the Registry, or 0 if the application is not registered.
+ **/
+long
+AccessibleApplication_getID (AccessibleApplication *obj)
+{
+  dbus_int32_t retval;
+
+  cspi_return_val_if_fail (obj != NULL, 0);
+
+  cspi_dbus_get_property (obj, spi_interface_application, "id", NULL, "u", &retval);
+
+  cspi_return_val_if_ev ("id", 0);
+
+  return retval;
+}
+
+/**
+ * AccessibleApplication_getLocale:
+ * @obj: a pointer to the #AccessibleApplication being queried.
+ * @lc_category: one of the POSIX LC_TYPE enumeration, for instance
+ * LC_MESSAGES.
+ *
+ * Get a POSIX-compliant string describing the application's current
+ * locale setting for a particular @lctype category.
+ *
+ * @Since: AT-SPI 1.4
+ *
+ * Returns: a POSIX-compliant locale string, e.g. "C", "pt_BR", "sr@latn", etc.
+ **/
+char *
+AccessibleApplication_getLocale (AccessibleApplication *obj, int lc_category)
+{
+  gchar *retval;
+  dbus_uint32_t lctype;
+
+  cspi_return_val_if_fail (obj != NULL, g_strdup (""));
+
+  switch (lc_category) 
+  {
+  case LC_COLLATE:
+    lctype = Accessibility_LOCALE_TYPE_COLLATE;
+    break;
+  case LC_CTYPE:
+    lctype = Accessibility_LOCALE_TYPE_CTYPE;
+    break;
+  case LC_NUMERIC:
+    lctype = Accessibility_LOCALE_TYPE_NUMERIC;
+    break;
+  case LC_MONETARY:
+    lctype = Accessibility_LOCALE_TYPE_MONETARY;
+    break;
+  case LC_MESSAGES:
+  default:
+    lctype = Accessibility_LOCALE_TYPE_MESSAGES;
+    break;
+  }
+
+  cspi_dbus_call (obj, spi_interface_application, "getLocale", NULL, "u=>s", lctype, &retval);
+
+  cspi_return_val_if_ev ("id", g_strdup (""));
+
+  return g_strdup (retval);
+}
+
+/**
+ * AccessibleApplication_pause:
+ * @obj: a pointer to the #Accessible object on which to operate.
+ *
+ * Attempt to pause the application (used when client event queue is
+ *  over-full).
+ * Not Yet Implemented.
+ *
+ * Returns: #TRUE if the application was paused successfully, #FALSE otherwise.
+ *
+ **/
+SPIBoolean
+AccessibleApplication_pause (AccessibleApplication *obj)
+{
+  return FALSE;
+}
+
+/**
+ * AccessibleApplication_resume:
+ * @obj: a pointer to the #Accessible object on which to operate.
+ *
+ * Attempt to resume the application (used after #AccessibleApplication_pause).
+ * Not Yet Implemented.
+ *
+ * Returns: #TRUE if application processing resumed successfully, #FALSE otherwise.
+ *
+ **/
+SPIBoolean
+AccessibleApplication_resume (AccessibleApplication *obj)
+{
+  return FALSE;
+}
index d20161a..f8179d9 100644 (file)
@@ -1063,7 +1063,7 @@ SPI_registerGlobalEventListener (AccessibleEventListener *listener,
   }
   event_listeners = new_list;
   dbus_error_init (&error);
-  dbus_bus_add_match (cspi_bus(), matchrule, &error);
+  dbus_bus_add_match (SPI_bus(), matchrule, &error);
   if (error.message)
   {
     g_warning ("Adding match: %s", error.message);
@@ -1142,7 +1142,7 @@ SPI_deregisterGlobalEventListener (AccessibleEventListener *listener,
       listener_data_free (e);
       l = g_list_remove (l, e);
       dbus_error_init (&error);
-      dbus_bus_remove_match (cspi_bus(), matchrule, &error);
+      dbus_bus_remove_match (SPI_bus(), matchrule, &error);
     }
     else l = g_list_next (l);
   }
diff --git a/cspi/spi-image.c b/cspi/spi-image.c
new file mode 100644 (file)
index 0000000..17c6d9f
--- /dev/null
@@ -0,0 +1,199 @@
+/*
+ * AT-SPI - Assistive Technology Service Provider Interface
+ * (Gnome Accessibility Project; http://developer.gnome.org/projects/gap)
+ *
+ * Copyright 2001, 2002 Sun Microsystems Inc.,
+ * Copyright 2001, 2002 Ximian, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#include <cspi/spi-private.h>
+
+/**
+ * AccessibleImage_ref:
+ * @obj: a pointer to the #AccessibleImage implementor on which to operate.
+ *
+ * Increment the reference count for an #AccessibleImage object.
+ **/
+void
+AccessibleImage_ref (AccessibleImage *obj)
+{
+  cspi_object_ref (obj);
+}
+
+/**
+ * AccessibleImage_unref:
+ * @obj: a pointer to the #AccessibleImage implementor on which to operate.
+ *
+ * Decrement the reference count for an #AccessibleImage object.
+ **/
+void
+AccessibleImage_unref (AccessibleImage *obj)
+{
+  cspi_object_unref (obj);
+}
+
+/**
+ * AccessibleImage_getImageDescription:
+ * @obj: a pointer to the #AccessibleImage implementor on which to operate.
+ *
+ * Get the description of the image displayed in an #AccessibleImage object.
+ *
+ * Returns: a UTF-8 string describing the image.
+ **/
+char *
+AccessibleImage_getImageDescription (AccessibleImage *obj)
+{
+  char *retval;
+
+  cspi_return_val_if_fail (obj != NULL, NULL);
+
+  cspi_dbus_get_property (obj, spi_interface_image, "description", NULL, "s", &retval);
+
+  cspi_return_val_if_ev ("getImageDescription", NULL);
+
+  return retval;
+}
+
+/**
+ * AccessibleImage_getImageSize:
+ * @obj: a pointer to the #AccessibleImage to query.
+ * @width: a pointer to a #long into which the x extents (width) will be returned.
+ * @height: a pointer to a #long into which the y extents (height) will be returned.
+ *
+ * Get the size of the image displayed in a specified #AccessibleImage object.
+ **/
+void
+AccessibleImage_getImageSize (AccessibleImage *obj,
+                              long int *width,
+                              long int *height)
+{
+  dbus_int32_t w, h;
+
+  cspi_return_if_fail (obj != NULL);
+
+  cspi_dbus_call (obj, spi_interface_image, "getImageSize", NULL, "=>ii", &w, &h);
+
+  if (!cspi_check_ev ("getImageSize"))
+    {
+      *width = 0;
+      *height = 0;
+    }
+  else
+    {
+      *width = w;
+      *height = h;
+    }
+}
+
+/**
+ * AccessibleImage_getImagePosition:
+ * @obj: a pointer to the #AccessibleImage implementor to query.
+ * @x: a pointer to a #long into which the minimum x coordinate will be returned.
+ * @y: a pointer to a #long into which the minimum y coordinate will be returned.
+ * @ctype: the desired coordinate system into which to return the results,
+ *         (e.g. SPI_COORD_TYPE_WINDOW, SPI_COORD_TYPE_SCREEN).
+ *
+ * Get the minimum x and y coordinates of the image displayed in a
+ *         specified #AccessibleImage implementor.
+ **/
+void
+AccessibleImage_getImagePosition (AccessibleImage *obj,
+                                  long *x,
+                                  long *y,
+                                  AccessibleCoordType ctype)
+{
+  dbus_int32_t dx, dy;
+
+  cspi_return_if_fail (obj != NULL);
+
+  cspi_dbus_call (obj, spi_interface_image, "getImagePosition", NULL, "=>ii", &dx, &dy);
+
+  if (!cspi_check_ev ("getImagePosition"))
+    {
+      *x = 0;
+      *y = 0;
+    }
+  else
+    {
+      *x = dx;
+      *y = dy;
+    }
+}
+
+/**
+ * AccessibleImage_getImageExtents:
+ * @obj: a pointer to the #AccessibleImage implementor to query.
+ * @x: a pointer to a #long into which the minimum x coordinate will be returned.
+ * @y: a pointer to a #long into which the minimum y coordinate will be returned.
+ * @width: a pointer to a #long into which the image x extent will be returned.
+ * @height: a pointer to a #long into which the image y extent will be returned.
+ * @ctype: the desired coordinate system into which to return the results,
+ *         (e.g. SPI_COORD_TYPE_WINDOW, SPI_COORD_TYPE_SCREEN).
+ *
+ * Get the bounding box of the image displayed in a
+ *         specified #AccessibleImage implementor.
+ **/
+void
+AccessibleImage_getImageExtents (AccessibleImage *obj,
+                                long *x,
+                                long *y,
+                                long *width,
+                                long *height,
+                                AccessibleCoordType ctype)
+{
+  Accessibility_BoundingBox bbox;
+
+  cspi_return_if_fail (obj != NULL);
+
+  cspi_dbus_call (obj, spi_interface_image, "getImageExtents", NULL, "=>(iiii)", &bbox);
+
+  if (!cspi_check_ev ("getImageExtents"))
+    {
+      *x = *y = *width = *height = 0;
+    }
+  else
+    {
+      *x = bbox.x;
+      *y = bbox.y;
+      *width = bbox.width;
+      *height = bbox.height;
+    }
+}
+
+/**
+ * AccessibleImage_getImageLocale:
+ * @obj: The #AccessibleImage being queried.
+ *
+ * Get the locale associated with an image and its textual representation.
+ *
+ * Returns: A POSIX LC_MESSAGES-style Locale value for image description and text.
+ **/
+char *
+AccessibleImage_getImageLocale  (AccessibleImage *obj)
+{
+    char *retval = "C";
+
+    cspi_return_val_if_fail (obj != NULL, "C");
+
+  cspi_dbus_get_property (obj, spi_interface_image, "imageLocale", NULL, "=>s", &retval);
+
+    cspi_return_val_if_ev ("getImageLocale", NULL);
+
+    return retval;
+}
+
index 3429386..57f0bfb 100644 (file)
@@ -399,7 +399,7 @@ done:
   if (reply)
   {
     dbus_message_append_args (reply, DBUS_TYPE_BOOLEAN, &retval, DBUS_TYPE_INVALID);
-    dbus_connection_send (cspi_bus(), reply, NULL);
+    dbus_connection_send (SPI_bus(), reply, NULL);
     dbus_message_unref (reply);
   }
   return DBUS_HANDLER_RESULT_HANDLED;
index 49d1680..fe8f402 100644 (file)
@@ -147,7 +147,7 @@ cspi_get_live_refs (void)
 }
 
 DBusConnection *
-cspi_bus (void)
+SPI_bus (void)
 {
   return bus;
 }
@@ -1023,7 +1023,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 (cspi_bus(), obj->app->bus_name, path, interface, method, error, type, args);
+  retval = dbind_connection_method_call_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))
@@ -1056,7 +1056,7 @@ cspi_dbus_get_property (Accessible *obj, const char *interface, const char *name
   dbus_message_append_args (message, DBUS_TYPE_STRING, &interface, DBUS_TYPE_STRING, &name, DBUS_TYPE_INVALID);
   if (!error) error = &err;
   dbus_error_init (error);
-  reply = dbus_connection_send_with_reply_and_block (cspi_bus(), message, 1000, error);
+  reply = dbus_connection_send_with_reply_and_block (SPI_bus(), message, 1000, error);
   dbus_message_unref (message);
   if (!reply)
   {
index 43f61d2..57df3fc 100644 (file)
@@ -83,7 +83,7 @@ struct _SPIException {
   char * desc;
 };
 
-DBusConnection *spi_bus (void);
+DBusConnection *SPI_bus (void);
 SPIBoolean             cspi_exception         (void);
 Accessible            *cspi_object_add (Accessible  *accessible);
 void                   cspi_object_ref        (Accessible  *accessible);
@@ -113,10 +113,10 @@ AccessibleAttributeSet
 typedef struct _Accessibility_BoundingBox Accessibility_BoundingBox;
 struct _Accessibility_BoundingBox
 {
-  dbus_uint32_t x;
-  dbus_uint32_t y;
-  dbus_uint32_t width;
-  dbus_uint32_t height;
+  dbus_int32_t x;
+  dbus_int32_t y;
+  dbus_int32_t width;
+  dbus_int32_t height;
 };
 
 #endif /* _SPI_PRIVATE_H_ */
index 48b84d8..ede820d 100644 (file)
@@ -88,7 +88,7 @@ SPI_getDesktopList (Accessible ***desktop_list)
 
   if (!desktops)
   {
-    dbind_connection_method_call (cspi_bus(), spi_bus_registry, spi_path_registry, spi_interface_registry, "getDesktopList", NULL, "=>ao", &desktops);
+    dbind_connection_method_call (SPI_bus(), spi_bus_registry, spi_path_registry, spi_interface_registry, "getDesktopList", NULL, "=>ao", &desktops);
     if (!desktops) return 0;
   }
 
@@ -226,7 +226,7 @@ SPI_registerAccessibleKeystrokeListener (AccessibleKeystrokeListener  *listener,
          (dbus_bool_t) ((sync_type & SPI_KEYLISTENER_ALL_WINDOWS)!=0);
 
     dbus_error_init (&error);
-    dbind_connection_method_call (cspi_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_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);
 
   g_array_free (key_set, TRUE);
   g_free (path);
@@ -265,7 +265,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 (cspi_bus(), spi_bus_registry, spi_path_dec, spi_interface_dec, "deregisterKeystrokeListener", &error, "oa(iisi)uu", path, &key_set, key_events, controller_event_mask);
+    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);
   g_free (path);
   return TRUE;
 }
@@ -310,7 +310,7 @@ SPI_registerDeviceEventListener (AccessibleDeviceListener  *listener,
     }
 
   dbus_error_init (&error);
-    dbind_connection_method_call (cspi_bus(), spi_bus_registry, spi_path_dec, spi_interface_dec, "registerDeviceEventListener", &error, "ou=>b", path, event_types, &retval);
+    dbind_connection_method_call (SPI_bus(), spi_bus_registry, spi_path_dec, spi_interface_dec, "registerDeviceEventListener", &error, "ou=>b", path, event_types, &retval);
   g_free (path);
   return retval;
 }
@@ -343,7 +343,7 @@ SPI_deregisterDeviceEventListener (AccessibleDeviceListener *listener,
   event_types |= (1 << Accessibility_BUTTON_RELEASED_EVENT);
 
   dbus_error_init (&error);
-    dbind_connection_method_call (cspi_bus(), spi_bus_registry, spi_path_dec, spi_interface_dec, "deregisterDeviceEventListener", &error, "ou", path, event_types);
+    dbind_connection_method_call (SPI_bus(), spi_bus_registry, spi_path_dec, spi_interface_dec, "deregisterDeviceEventListener", &error, "ou", path, event_types);
   g_free (path);
   return TRUE;
 }
@@ -399,7 +399,7 @@ SPI_generateKeyboardEvent (long int keyval,
 
   if (!keystring) keystring = "";
   dbus_error_init (&error);
-    dbind_connection_method_call (cspi_bus(), spi_bus_registry, spi_path_dec, spi_interface_dec, "generateKeyboardEvent", &error, "isu", keycode, keystring, keysynth_type);
+    dbind_connection_method_call (SPI_bus(), spi_bus_registry, spi_path_dec, spi_interface_dec, "generateKeyboardEvent", &error, "isu", keycode, keystring, keysynth_type);
 
   return TRUE;
 }
@@ -427,7 +427,7 @@ SPI_generateMouseEvent (long x, long y, char *name)
   DBusError error;
 
   dbus_error_init (&error);
-    dbind_connection_method_call (cspi_bus(), spi_bus_registry, spi_path_dec, spi_interface_dec, "generateMouseEvent", &error, "iis", x, y, name);
+    dbind_connection_method_call (SPI_bus(), spi_bus_registry, spi_path_dec, spi_interface_dec, "generateMouseEvent", &error, "iis", x, y, name);
   return TRUE;
 }