Merge branch 'mdoff' of ssh://git.codethink.co.uk/git/atspi-dbus
[platform/core/uifw/at-spi2-atk.git] / atk-adaptor / text.c
index 00ad9a9..451a92b 100644 (file)
@@ -28,7 +28,7 @@
 static AtkText *
 get_text (DBusMessage * message)
 {
-  AtkObject *obj = spi_dbus_get_object (dbus_message_get_path (message));
+  AtkObject *obj = atk_dbus_get_object (dbus_message_get_path (message));
   if (!obj)
     return NULL;
   return ATK_TEXT (obj);
@@ -37,7 +37,7 @@ get_text (DBusMessage * message)
 static AtkText *
 get_text_from_path (const char *path, void *user_data)
 {
-  AtkObject *obj = spi_dbus_get_object (path);
+  AtkObject *obj = atk_dbus_get_object (path);
   if (!obj || !ATK_IS_TEXT(obj))
     return NULL;
   return ATK_TEXT (obj);
@@ -375,18 +375,19 @@ impl_getAttributes (DBusConnection * bus, DBusMessage * message,
 
   set = atk_text_get_run_attributes (text, offset,
                                     &intstart_offset, &intend_offset);
+
+  rv = _string_from_attribute_set (set);
+
   startOffset = intstart_offset;
   endOffset = intend_offset;
-  rv = _string_from_attribute_set (set);
   reply = dbus_message_new_method_return (message);
   if (reply)
     {
-      dbus_message_append_args (reply, DBUS_TYPE_INT32, &startOffset,
-                               DBUS_TYPE_INT32, &endOffset, DBUS_TYPE_STRING,
-                               &rv, DBUS_TYPE_INVALID);
+      dbus_message_append_args (reply, DBUS_TYPE_STRING, &rv, DBUS_TYPE_INT32, &startOffset,
+                               DBUS_TYPE_INT32, &endOffset, DBUS_TYPE_INVALID);
     }
-  g_free (rv);
   atk_attribute_set_free (set);
+  g_free(rv);
   return reply;
 }
 
@@ -423,7 +424,7 @@ impl_getCharacterExtents (DBusConnection * bus, DBusMessage * message,
 {
   AtkText *text = get_text (message);
   dbus_int32_t offset;
-  dbus_uint32_t coordType;
+  dbus_int16_t coordType;
   dbus_int32_t x, y, width, height;
   gint ix = 0, iy = 0, iw = 0, ih = 0;
   DBusError error;
@@ -433,7 +434,7 @@ impl_getCharacterExtents (DBusConnection * bus, DBusMessage * message,
     return spi_dbus_general_error (message);
   dbus_error_init (&error);
   if (!dbus_message_get_args
-      (message, &error, DBUS_TYPE_INT32, &offset, DBUS_TYPE_INT32, &coordType,
+      (message, &error, DBUS_TYPE_INT32, &offset, DBUS_TYPE_INT16, &coordType,
        DBUS_TYPE_INVALID))
     {
       return SPI_DBUS_RETURN_ERROR (message, &error);
@@ -460,7 +461,7 @@ impl_getOffsetAtPoint (DBusConnection * bus, DBusMessage * message,
 {
   AtkText *text = get_text (message);
   dbus_int32_t x, y;
-  dbus_uint32_t coordType;
+  dbus_int16_t coordType;
   dbus_int32_t rv;
   DBusError error;
   DBusMessage *reply;
@@ -470,7 +471,7 @@ impl_getOffsetAtPoint (DBusConnection * bus, DBusMessage * message,
   dbus_error_init (&error);
   if (!dbus_message_get_args
       (message, &error, DBUS_TYPE_INT32, &x, DBUS_TYPE_INT32, &y,
-       DBUS_TYPE_UINT32, &coordType, DBUS_TYPE_INVALID))
+       DBUS_TYPE_INT16, &coordType, DBUS_TYPE_INVALID))
     {
       return SPI_DBUS_RETURN_ERROR (message, &error);
     }
@@ -630,7 +631,7 @@ impl_getRangeExtents (DBusConnection * bus, DBusMessage * message,
 {
   AtkText *text = get_text (message);
   dbus_int32_t startOffset, endOffset;
-  dbus_uint32_t coordType;
+  dbus_int16_t coordType;
   AtkTextRectangle rect;
   dbus_int32_t x, y, width, height;
   DBusError error;
@@ -641,7 +642,7 @@ impl_getRangeExtents (DBusConnection * bus, DBusMessage * message,
   dbus_error_init (&error);
   if (!dbus_message_get_args
       (message, &error, DBUS_TYPE_INT32, &startOffset, DBUS_TYPE_INT32,
-       &endOffset, DBUS_TYPE_UINT32, &coordType, DBUS_TYPE_INVALID))
+       &endOffset, DBUS_TYPE_INT16, &coordType, DBUS_TYPE_INVALID))
     {
       return SPI_DBUS_RETURN_ERROR (message, &error);
     }
@@ -670,7 +671,7 @@ impl_getBoundedRanges (DBusConnection * bus, DBusMessage * message,
 {
   AtkText *text = get_text (message);
   dbus_int32_t x, y, width, height;
-  dbus_uint32_t coordType, xClipType, yClipType;
+  dbus_int16_t coordType, xClipType, yClipType;
   DBusError error;
   AtkTextRange **range_list = NULL;
   AtkTextRectangle rect;
@@ -889,7 +890,7 @@ static DRouteProperty properties[] = {
 void
 spi_initialize_text (DRouteData * data)
 {
-  droute_add_interface (data, "org.freedesktop.atspi.Text", methods,
+  droute_add_interface (data, SPI_DBUS_INTERFACE_TEXT, methods,
                        properties,
                        (DRouteGetDatumFunction) get_text_from_path, NULL);
 };