Merge branch 'mgorse' of ssh://git.codethink.co.uk/git/atspi-dbus into mgorse
authorMike Gorse <mgorse@boston.site>
Mon, 9 Jun 2008 16:29:23 +0000 (12:29 -0400)
committerMike Gorse <mgorse@boston.site>
Mon, 9 Jun 2008 16:29:23 +0000 (12:29 -0400)
14 files changed:
atk-adaptor/accessible.c
atk-adaptor/text.c
cspi/stateset.c [moved from atk-adaptor/stateset.c with 100% similarity]
cspi/stateset.h [moved from atk-adaptor/stateset.h with 100% similarity]
registryd/registry.c
spi-common/spi-dbus.h
xml/Accessibility.xml
xml/Accessibility_Relation.xml [new file with mode: 0644]
xml/Makefile.am
xml/org.freedesktop.atspi.Accessible.xml
xml/org.freedesktop.atspi.Component.xml
xml/org.freedesktop.atspi.DeviceEventController.xml
xml/org.freedesktop.atspi.Image.xml
xml/org.freedesktop.atspi.Text.xml

index 7a61524..1fa809e 100644 (file)
@@ -155,13 +155,107 @@ impl_getIndexInParent (DBusConnection * bus, DBusMessage * message,
   return reply;
 }
 
-#if 0
+static gboolean
+spi_init_relation_type_table (Accessibility_RelationType *types)
+{
+  gint i;
+
+  for (i = 0; i < ATK_RELATION_LAST_DEFINED; i++)
+    types[i] = Accessibility_RELATION_NULL;
+
+  types[ATK_RELATION_CONTROLLED_BY] = Accessibility_RELATION_CONTROLLED_BY;
+  types[ATK_RELATION_CONTROLLER_FOR] = Accessibility_RELATION_CONTROLLER_FOR;
+  types[ATK_RELATION_LABEL_FOR] = Accessibility_RELATION_LABEL_FOR;
+  types[ATK_RELATION_LABELLED_BY] = Accessibility_RELATION_LABELLED_BY;
+  types[ATK_RELATION_MEMBER_OF] = Accessibility_RELATION_MEMBER_OF;
+  types[ATK_RELATION_NODE_CHILD_OF] = Accessibility_RELATION_NODE_CHILD_OF;
+  types[ATK_RELATION_FLOWS_TO] = Accessibility_RELATION_FLOWS_TO;
+  types[ATK_RELATION_FLOWS_FROM] = Accessibility_RELATION_FLOWS_FROM;
+  types[ATK_RELATION_SUBWINDOW_OF] = Accessibility_RELATION_SUBWINDOW_OF;
+  types[ATK_RELATION_EMBEDS] = Accessibility_RELATION_EMBEDS;
+  types[ATK_RELATION_EMBEDDED_BY] = Accessibility_RELATION_EMBEDDED_BY;
+  types[ATK_RELATION_POPUP_FOR] = Accessibility_RELATION_POPUP_FOR;
+  types[ATK_RELATION_PARENT_WINDOW_OF] = Accessibility_RELATION_PARENT_WINDOW_OF;
+  types[ATK_RELATION_DESCRIPTION_FOR] = Accessibility_RELATION_DESCRIPTION_FOR;
+  types[ATK_RELATION_DESCRIBED_BY] = Accessibility_RELATION_DESCRIBED_BY;
+
+  return TRUE;
+}
+
+static Accessibility_RelationType
+spi_relation_type_from_atk_relation_type (AtkRelationType type)
+{
+  static gboolean is_initialized = FALSE;
+  static Accessibility_RelationType spi_relation_type_table [ATK_RELATION_LAST_DEFINED];
+  Accessibility_RelationType spi_type;
+
+  if (!is_initialized)
+    is_initialized = spi_init_relation_type_table (spi_relation_type_table);      
+
+  if (type > ATK_RELATION_NULL && type < ATK_RELATION_LAST_DEFINED)
+    spi_type = spi_relation_type_table[type];
+  else
+    spi_type = Accessibility_RELATION_EXTENDED;
+  return spi_type;
+}
+
 static DBusMessage *
 impl_getRelationSet (DBusConnection * bus, DBusMessage * message,
                     void *user_data)
 {
+  AtkObject *object = get_object (message);
+  DBusMessage *reply;
+  AtkRelationSet *set;
+  DBusMessageIter iter, iter_array, iter_struct, iter_targets;
+  gint count;
+  gint i, j;
+
+  if (!object)
+    return spi_dbus_general_error (message);
+  reply = dbus_message_new_method_return (message);
+  if (!reply) return NULL;
+  set = atk_object_ref_relation_set (object);
+  dbus_message_iter_init_append (reply, &iter);
+  if (!dbus_message_iter_open_container (&iter, DBUS_TYPE_ARRAY, "(uao)", &iter_array))
+  {
+    goto oom;
+  }
+  count = atk_relation_set_get_n_relations (set);
+  for (i = 0; i < count; i++)
+  {
+    AtkRelation *r = atk_relation_set_get_relation (set, i);
+    AtkRelationType rt;
+    GPtrArray *target;
+    dbus_uint32_t type;
+    if (!r) continue;
+    rt= atk_relation_get_relation_type (r);
+    type = spi_relation_type_from_atk_relation_type (rt);
+    target = atk_relation_get_target (r);
+    if (!dbus_message_iter_open_container (&iter_array, DBUS_TYPE_STRUCT, NULL, &iter_struct))
+    {
+      goto oom;
+    }
+    dbus_message_iter_append_basic (&iter_struct, DBUS_TYPE_UINT32, &type);
+    if (!dbus_message_iter_open_container (&iter_struct, DBUS_TYPE_ARRAY, "o", &iter_targets))
+    {
+      goto oom;
+    }
+    for (j = 0; j < target->len; j++)
+    {
+      AtkObject *obj = target->pdata[j];
+      char *path;
+      if (!obj) continue;
+      path = spi_dbus_get_path (obj);
+      dbus_message_iter_append (&iter_targets, DBUS_TYPE_OBJECT_PATH, &path);
+    }
+    dbus_message_iter_close_container (&iter_struct, &iter_targets);
+    dbus_message_iter_close_container (&iter_array, &iter_struct);
+  }
+  dbus_message_iter_close_container (&iter, &iter_array);
+oom:
+  // TODO: handle out of memory */
+  return reply;
 }
-#endif
 
 static gboolean
 spi_init_role_lookup_table (Accessibility_Role * role_table)
@@ -588,7 +682,7 @@ static DRouteMethod methods[] = {
   //{impl_isEqual, "isEqual"},
   {impl_getChildren, "getChildren"},
   {impl_getIndexInParent, "getIndexInParent"},
-  //{impl_getRelationSet, "getRelationSet"},,o" },
+  {impl_getRelationSet, "getRelationSet"},
   {impl_getRole, "getRole"},
   {impl_getRoleName, "getRoleName"},
   {impl_getLocalizedRoleName, "getLocalizedRoleName"},
index aa4f7a6..00ad9a9 100644 (file)
@@ -242,6 +242,33 @@ impl_getTextAfterOffset (DBusConnection * bus, DBusMessage * message,
 }
 
 static DBusMessage *
+impl_getCharacterAtOffset (DBusConnection * bus, DBusMessage * message,
+                        void *user_data)
+{
+  AtkText *text = get_text (message);
+  dbus_int32_t offset;
+  dbus_int32_t ch;
+  DBusError error;
+  DBusMessage *reply;
+
+  if (!text)
+    return spi_dbus_general_error (message);
+  dbus_error_init (&error);
+  if (!dbus_message_get_args
+      (message, &error, DBUS_TYPE_INT32, &offset, DBUS_TYPE_INVALID))
+    {
+      return SPI_DBUS_RETURN_ERROR (message, &error);
+    }
+  ch = atk_text_get_character_at_offset (text, offset);
+  reply = dbus_message_new_method_return (message);
+  if (reply)
+    {
+      dbus_message_append_args (reply, DBUS_TYPE_INT32, &ch, DBUS_TYPE_INVALID);
+    }
+  return reply;
+}
+
+static DBusMessage *
 impl_getAttributeValue (DBusConnection * bus, DBusMessage * message,
                        void *user_data)
 {
@@ -808,7 +835,7 @@ impl_getDefaultAttributeSet (DBusConnection * bus, DBusMessage * message,
   if (attributes)
     n_attributes = g_slist_length (attributes);
 
-  retval = (char **) malloc (n_attributes * sizeof (char *));
+  retval = g_new (char *, n_attributes);
 
   for (i = 0; i < n_attributes; ++i)
     {
@@ -835,6 +862,7 @@ static DRouteMethod methods[] = {
   {impl_getTextBeforeOffset, "getTextBeforeOffset"},
   {impl_getTextAtOffset, "getTextAtOffset"},
   {impl_getTextAfterOffset, "getTextAfterOffset"},
+  {impl_getCharacterAtOffset, "getCharacterAtOffset"},
   {impl_getAttributeValue, "getAttributeValue"},
   {impl_getAttributes, "getAttributes"},
   {impl_getDefaultAttributes, "getDefaultAttributes"},
similarity index 100%
rename from atk-adaptor/stateset.c
rename to cspi/stateset.c
similarity index 100%
rename from atk-adaptor/stateset.h
rename to cspi/stateset.h
index 3dc13d6..6068f52 100644 (file)
@@ -298,6 +298,7 @@ spi_registry_init (SpiRegistry *registry)
     g_warning("Couldn't connect to dbus: %s\n", error.message);
     return;
   }
+  registry->droute.user_data = registry;
   spi_registry_initialize_registry_interface (&registry->droute);
   spi_registry_initialize_desktop_interface (&registry->droute);
   spi_registry_initialize_dec_interface (&registry->droute);
index 3215748..6e1d704 100644 (file)
 
 extern int _dbg;
 
-#define SPI_DBUS_NAME_REGISTRY "org.freedesktop.atspi.registry"
-#define SPI_DBUS_PATH_REGISTRY "/org/freedesktop/atspi/registry"
-#define SPI_DBUS_INTERFACE_REGISTRY "org.freedesktop.atspi.registry"
 #define SPI_DBUS_PATH_DEC "/org/freedesktop/atspi/registry/dec"
-#define SPI_DBUS_INTERFACE_DEC "org.freedesktop.atspi.deviceEventController"
+#define SPI_DBUS_INTERFACE_ACCESSIBLE "org.freedesktop.atspi.Accessible"
+#define SPI_DBUS_INTERFACE_ACTION "org.freedesktop.atspi.Action"
+#define SPI_DBUS_INTERFACE_APPLICATION "org.freedesktop.atspi.Application"
+#define SPI_DBUS_INTERFACE_COMPONENT "org.freedesktop.atspi.Component"
+#define SPI_DBUS_INTERFACE_DEC "org.freedesktop.atspi.DeviceEventController"
+#define SPI_DBUS_INTERFACE_DEVICE_EVENT_LISTENER "org.freedesktop.atspi.DeviceEventListener"
+#define SPI_DBUS_INTERFACE_DOCUMENT "org.freedesktop.atspi.Document"
+#define SPI_DBUS_INTERFACE_EDITABLE_TEXT "org.freedesktop.atspi.EditableText"
+#define SPI_DBUS_INTERFACE_HYPERLINK "org.freedesktop.atspi.Hyperlink"
+#define SPI_DBUS_INTERFACE_HYPERTEXT "org.freedesktop.atspi.Hypertext"
+#define SPI_DBUS_INTERFACE_IMAGE "org.freedesktop.atspi.Image"
+#define SPI_DBUS_INTERFACE_REGISTRY "org.freedesktop.atspi.registry"
+#define SPI_DBUS_INTERFACE_SELECTION "org.freedesktop.atspi.Selection"
+#define SPI_DBUS_INTERFACE_TABLE "org.freedesktop.atspi.Table"
+#define SPI_DBUS_INTERFACE_TEXT "org.freedesktop.atspi.Text"
+#define SPI_DBUS_INTERFACE_TREE "org.freedesktop.atspi.Tree"
+#define SPI_DBUS_INTERFACE_VALUE "org.freedesktop.atspi.Value"
+#define SPI_DBUS_NAME_REGISTRY "org.freedesktop.atspi.registry"
 #define SPI_DBUS_PATH_DESKTOP "/org/freedesktop/atspi/registry/desktop"
 #define SPI_DBUS_PATH_NULL "/"
-#define SPI_DBUS_INTERFACE_ACCESSIBLE "org.freedesktop.atspi.Accessible"
+#define SPI_DBUS_PATH_REGISTRY "/org/freedesktop/atspi/registry"
 
 DBusMessage *spi_dbus_general_error(DBusMessage *message);
 DBusMessage *spi_dbus_return_rect(DBusMessage *message, gint ix, gint iy, gint iwidth, gint iheight);
index ab697c6..fdc0153 100644 (file)
@@ -108,6 +108,7 @@ Boston, MA 02111-1307, USA.</p>
 <xi:include href="org.freedesktop.atspi.Registry.xml"/>
 <xi:include href="org.freedesktop.atspi.DeviceEventController.xml"/>
 <xi:include href="org.freedesktop.atspi.DeviceEventListener.xml"/>
+<xi:include href="Accessibility_Relation.xml"/>
 <xi:include href="Accessibility_Role.xml"/>
 <xi:include href="org.freedesktop.atspi.LoginHelper.xml"/>
 <xi:include href="org.freedesktop.atspi.Selector.xml"/>
diff --git a/xml/Accessibility_Relation.xml b/xml/Accessibility_Relation.xml
new file mode 100644 (file)
index 0000000..910bda1
--- /dev/null
@@ -0,0 +1,145 @@
+<node name="/node" xmlns:tp="http://telepathy.freedesktop.org/wiki/DbusSpec#extensions-v0">
+
+<tp:title>AT-SPI - Assistive Technology Service Provider Interface </tp:title>
+<tp:copyright>Copyright 2008 Novell, Inc.</tp:copyright>
+<tp:copyright>Copyright 2001 Sun Microsystems Inc.</tp:copyright>
+<tp:license xmlns="http://www.w3.org/1999/xhtml">
+  <p>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.</p>
+
+  <p>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.</p>
+
+  <p>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.</p>
+</tp:license>
+<tp:enum name="RelationType" type="u">
+  <tp:docstring xmlns="http://www.w3.org/1999/xhtml">
+    <p>RelationType specifies a relationship between objects (possibly one-to-many or many-to-one)
+      outside of the normal parent/child hierarchical relationship.  It allows better semantic
+      identification of how objects are associated with one another.
+      For instance the RELATION_LABELLED_BY relationship may be used to identify labelling information
+      that should accompany the accessibleName property when presenting an object's content or identity
+      to the end user.  Similarly, RELATION_CONTROLLER_FOR can be used to further specify the context
+      in which a valuator is useful, and/or the other UI components which are directly effected by
+      user interactions with the valuator.  Common examples include association of scrollbars with
+      the viewport or panel which they control.</p>
+  </tp:docstring>
+  <tp:enumvalue suffix="RELATION_NULL">
+  <tp:docstring>
+    Not a meaningful relationship; clients should not normally encounter this RelationType value. 
+  </tp:docstring>
+  </tp:enumvalue>
+  <tp:enumvalue suffix="RELATION_LABEL_FOR" value="1">
+  <tp:docstring>
+    Object is a label for one or more other objects. 
+  </tp:docstring>
+  </tp:enumvalue>
+  <tp:enumvalue suffix="RELATION_LABELLED_BY" value="2">
+  <tp:docstring>
+    Object is labelled by one or more other objects. 
+  </tp:docstring>
+  </tp:enumvalue>
+  <tp:enumvalue suffix="RELATION_CONTROLLER_FOR" value="3">
+  <tp:docstring xmlns="http://www.w3.org/1999/xhtml">
+    <p>Object is an interactive object which modifies the state, onscreen location, or other attributes
+      of one or more target objects. </p>
+  </tp:docstring>
+  </tp:enumvalue>
+  <tp:enumvalue suffix="RELATION_CONTROLLED_BY" value="4">
+  <tp:docstring xmlns="http://www.w3.org/1999/xhtml">
+    <p>Object state, position, etc. is modified/controlled by user interaction with one or 
+      more other objects.   For instance a viewport or scroll pane may be CONTROLLED_BY scrollbars. </p>
+  </tp:docstring>
+  </tp:enumvalue>
+  <tp:enumvalue suffix="RELATION_MEMBER_OF" value="5">
+  <tp:docstring>
+    Object has a grouping relationship (e.g. ¨same group as¨) to one or more other objects.  
+  </tp:docstring>
+  </tp:enumvalue>
+  <tp:enumvalue suffix="RELATION_TOOLTIP_FOR" value="6">
+  <tp:docstring>
+    Object is a tooltip associated with another object. 
+  </tp:docstring>
+  </tp:enumvalue>
+  <tp:enumvalue suffix="RELATION_NODE_CHILD_OF" value="7">
+  <tp:docstring>
+    Reserved for future use. 
+  </tp:docstring>
+  </tp:enumvalue>
+  <tp:enumvalue suffix="RELATION_EXTENDED" value="8">
+  <tp:docstring xmlns="http://www.w3.org/1999/xhtml">
+    <p>Used to indicate that a relationship exists, but its type is not specified in the enumeration
+      and must be obtained via a call to getRelationTypeName.  </p>
+  </tp:docstring>
+  </tp:enumvalue>
+  <tp:enumvalue suffix="RELATION_FLOWS_TO" value="9">
+  <tp:docstring xmlns="http://www.w3.org/1999/xhtml">
+    <p>Object renders content which flows logically to another object.  
+      For instance, text in a paragraph may flow to another object which is not the 
+      ¨next sibling¨ in the accessibility hierarchy. </p>
+  </tp:docstring>
+  </tp:enumvalue>
+  <tp:enumvalue suffix="RELATION_FLOWS_FROM" value="10">
+  <tp:docstring>
+    Reciprocal of RELATION_FLOWS_TO. 
+  </tp:docstring>
+  </tp:enumvalue>
+  <tp:enumvalue suffix="RELATION_SUBWINDOW_OF" value="11">
+  <tp:docstring xmlns="http://www.w3.org/1999/xhtml">
+    <p>Object is visually and semantically considered a subwindow of another object, even though
+      it is not the object's child.  Useful when dealing with embedded applications and other cases
+      where the widget hierarchy does not map cleanly to the onscreen presentation.  </p>
+  </tp:docstring>
+  </tp:enumvalue>
+  <tp:enumvalue suffix="RELATION_EMBEDS" value="12">
+  <tp:docstring>
+    Similar to SUBWINDOW_OF, but specifically used for cross-process embedding.  
+  </tp:docstring>
+  </tp:enumvalue>
+  <tp:enumvalue suffix="RELATION_EMBEDDED_BY" value="13">
+  <tp:docstring xmlns="http://www.w3.org/1999/xhtml">
+    <p>Reciprocal of RELATION_EMBEDS; Used to denote content rendered by embedded renderers that
+      live in a separate process space from the embedding context.  </p>
+  </tp:docstring>
+  </tp:enumvalue>
+  <tp:enumvalue suffix="RELATION_POPUP_FOR" value="14">
+  <tp:docstring xmlns="http://www.w3.org/1999/xhtml">
+    <p>Denotes that the object is a transient window or frame associated with another onscreen object.
+      Similar to TOOLTIP_FOR, but more general.  Useful for windows which are technically 
+      toplevels but which, for one or more reasons, do not explicitly cause their associated
+      window to lose ¨window focus¨.   Creation of a ROLE_WINDOW object with the POPUP_FOR relation
+      usually requires some presentation action on the part of assistive technology clients, even though
+      the previous toplevel ROLE_FRAME object may still be the active window.  </p>
+  </tp:docstring>
+  </tp:enumvalue>
+  <tp:enumvalue suffix="RELATION_PARENT_WINDOW_OF" value="15">
+  <tp:docstring>
+    This is the reciprocal relation to RELATION_POPUP_FOR. 
+  </tp:docstring>
+  </tp:enumvalue>
+  <tp:enumvalue suffix="RELATION_DESCRIPTION_FOR" value="16">
+  <tp:docstring xmlns="http://www.w3.org/1999/xhtml">
+    <p>Indicates that an object provides descriptive information 
+      about another object; more verbose than RELATION_LABEL_FOR. </p>
+  </tp:docstring>
+  </tp:enumvalue>
+  <tp:enumvalue suffix="RELATION_DESCRIBED_BY" value="17">
+  <tp:docstring xmlns="http://www.w3.org/1999/xhtml">
+    <p>Indicates that another object provides descriptive information 
+      about this object; more verbose than RELATION_LABELLED_BY. </p>
+  </tp:docstring>
+  </tp:enumvalue>
+  <tp:enumvalue suffix="RELATION_LAST_DEFINED" value="18">
+  <tp:docstring>
+    Do not use as a parameter value, used to determine the size of the enumeration. 
+  </tp:docstring>
+  </tp:enumvalue>
+</tp:enum>
+</node>
index 5654674..b30c0b5 100644 (file)
@@ -14,6 +14,7 @@ XML_SPEC= \
        org.freedesktop.atspi.Registry.xml \
        org.freedesktop.atspi.DeviceEventController.xml \
        org.freedesktop.atspi.DeviceEventListener.xml \
+       Accessibility_Relation.xml \
        Accessibility_Role.xml \
        org.freedesktop.atspi.Selection.xml \
        org.freedesktop.atspi.Selector.xml \
index dd29cd1..9cf95e6 100644 (file)
     <tp:docstring>
       Get a set defining this object's relationship to other accessible objects.
     </tp:docstring>
-    <arg direction="out" type="a{uao}" tp:type="RelationSet">
+    <arg direction="out" type="a(uao)" tp:type="RelationSet">
     <tp:docstring>
       a ::RelationSet defining this object's relationships.
     </tp:docstring>
index be00887..2b42a41 100644 (file)
       Obtain the Component's bounding box, in pixels, relative to the specified coordinate system. 
     </tp:docstring>
     <arg direction="in" name="coord_type" type="n" tp:type="short"/>
-    <arg direction="out" type="(uuuu)" tp:type="BoundingBox">
+    <arg direction="out" type="(iiii)" tp:type="BoundingBox">
     <tp:docstring>
       a BoundingBox which entirely contains the object's onscreen visual representation.
     </tp:docstring>
index b53767e..1906b18 100644 (file)
@@ -44,7 +44,7 @@
       a ControllerEventMask filtering the intercepted key events.
     </tp:docstring>
     </arg>
-    <arg direction="in" name="type" type="au" tp:type="KeyEventTypeSeq">
+    <arg direction="in" name="type" type="u" tp:type="KeyEventTypeSeq">
     <tp:docstring>
       a KeyEventTypeSeq that may created by ORing event types together.
     </tp:docstring>
index fe4552c..2c4da06 100644 (file)
@@ -65,7 +65,7 @@
         relative to the containing window.</p>
     </tp:docstring>
     <arg direction="in" name="coordType" type="n" tp:type="short"/>
-    <arg direction="out" type="(uuuu)" tp:type="BoundingBox">
+    <arg direction="out" type="(iiii)" tp:type="BoundingBox">
     <tp:docstring>
       a BoundingBox enclosing the image's onscreen representation.
     </tp:docstring>
index c27173f..a6f9b95 100644 (file)
     </tp:docstring>
     </arg>
   </method>
+  <method name="getCharacterOffset">
+    <arg name="offset" type="i" direction="in"/>
+    <arg type="i" direction="out">
+      <tp:docstring xmlns="http://www.w3.org/1999/xhtml">
+        an unsigned long integer whose value corresponds to the UCS-4 representation of the
+        character at the specified text offset, or 0 if offset is out of range.
+        long instead of wchar, to allow unicode chars > 16 bits
+      </tp:docstring>
+    </arg>
+  </method>
   <method name="getAttributeValue">
     <tp:docstring xmlns="http://www.w3.org/1999/xhtml">
-      <p>long instead of wchar, 
-        to allow unicode chars &gt; 16 bits     </p>
-
       <p>Get the string value of a named attribute at a given offset, if defined.
         @param offset the offset of the character for which the attribute run is to be obtained.
         @param attributeName the name of the attribute for which the value is to be returned, if defined.