From: Mike Gorse Date: Fri, 6 Jun 2008 20:38:06 +0000 (-0400) Subject: Add getCharacterAtOffset X-Git-Tag: AT_SPI2_ATK_2_12_0~699 X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fat-spi2-atk.git;a=commitdiff_plain;h=4471f18895646541db4b1dd61254a3a0023b776e;hp=97bc3c78c1aa7779e758d359f06b026322db3528 Add getCharacterAtOffset --- diff --git a/atk-adaptor/text.c b/atk-adaptor/text.c index aa4f7a6..00ad9a9 100644 --- a/atk-adaptor/text.c +++ b/atk-adaptor/text.c @@ -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"}, diff --git a/xml/org.freedesktop.atspi.Text.xml b/xml/org.freedesktop.atspi.Text.xml index c27173f..a6f9b95 100644 --- a/xml/org.freedesktop.atspi.Text.xml +++ b/xml/org.freedesktop.atspi.Text.xml @@ -278,11 +278,18 @@ + + + + + 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 + + + -

long instead of wchar, - to allow unicode chars > 16 bits

-

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.