From ae7080990bc816a73d86ba9957eee4d876f40a06 Mon Sep 17 00:00:00 2001 From: Mike Gorse Date: Thu, 17 Apr 2008 11:35:31 -0400 Subject: [PATCH] Initial commit. Add first pass at an xml spec Modify some sources to use dbus rather than corba Started a function to send a tree of objects (untested, like everything else) --- Makefile.am | 45 +- configure.in | 34 +- libspi/Makefile.am | 103 +-- libspi/accessible.c | 1124 ++++++++++++++------------- libspi/application.c | 299 ++------ libspi/component.c | 431 ++++++----- libspi/document.c | 198 +++-- libspi/editabletext.c | 384 +++++----- libspi/hyperlink.c | 304 ++++---- libspi/hypertext.c | 163 ++-- libspi/image.c | 242 +++--- libspi/selection.c | 372 +++++---- libspi/table.c | 1054 +++++++++++++++---------- libspi/text.c | 1271 ++++++++++++++++++------------- libspi/value.c | 433 ++++++----- tools/Makefile.am | 3 + tools/c-constants-generator.xsl | 305 ++++++++ tools/identity.xsl | 7 + xml/Accessibility.xml | 114 +++ xml/Accessibility_Accessible.xml | 266 +++++++ xml/Accessibility_Action.xml | 112 +++ xml/Accessibility_Application.xml | 125 +++ xml/Accessibility_Component.xml | 244 ++++++ xml/Accessibility_Document.xml | 84 ++ xml/Accessibility_EditableText.xml | 159 ++++ xml/Accessibility_Event.xml | 152 ++++ xml/Accessibility_Hyperlink.xml | 130 ++++ xml/Accessibility_Hypertext.xml | 86 +++ xml/Accessibility_Image.xml | 121 +++ xml/Accessibility_LoginHelper.xml | 193 +++++ xml/Accessibility_Registry.xml | 692 +++++++++++++++++ xml/Accessibility_Selection.xml | 184 +++++ xml/Accessibility_Selector.xml | 173 +++++ xml/Accessibility_StreamableContent.xml | 226 ++++++ xml/Accessibility_Table.xml | 482 ++++++++++++ xml/Accessibility_Text.xml | 586 ++++++++++++++ xml/Accessibility_Value.xml | 70 ++ xml/Makefile.am | 27 + 38 files changed, 7961 insertions(+), 3037 deletions(-) create mode 100644 tools/Makefile.am create mode 100644 tools/c-constants-generator.xsl create mode 100644 tools/identity.xsl create mode 100644 xml/Accessibility.xml create mode 100644 xml/Accessibility_Accessible.xml create mode 100644 xml/Accessibility_Action.xml create mode 100644 xml/Accessibility_Application.xml create mode 100644 xml/Accessibility_Component.xml create mode 100644 xml/Accessibility_Document.xml create mode 100644 xml/Accessibility_EditableText.xml create mode 100644 xml/Accessibility_Event.xml create mode 100644 xml/Accessibility_Hyperlink.xml create mode 100644 xml/Accessibility_Hypertext.xml create mode 100644 xml/Accessibility_Image.xml create mode 100644 xml/Accessibility_LoginHelper.xml create mode 100644 xml/Accessibility_Registry.xml create mode 100644 xml/Accessibility_Selection.xml create mode 100644 xml/Accessibility_Selector.xml create mode 100644 xml/Accessibility_StreamableContent.xml create mode 100644 xml/Accessibility_Table.xml create mode 100644 xml/Accessibility_Text.xml create mode 100644 xml/Accessibility_Value.xml create mode 100644 xml/Makefile.am diff --git a/Makefile.am b/Makefile.am index 770e46e..7805318 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,21 +1,30 @@ -SUBDIRS = docs idl libspi login-helper registryd atk-bridge cspi pyatspi test po +SUBDIRS=xml tools libspi -pkgconfigdir = $(libdir)/pkgconfig -pkgconfig_DATA = libspi-1.0.pc cspi-1.0.pc libloginhelper-1.0.pc +XMLSUB= \ + Accessibility_Accessible.xml \ + Accessibility_Action.xml \ + Accessibility_Application.xml \ + Accessibility_Collection.xml \ + Accessibility_Component.xml \ + Accessibility_Desktop.xml \ + Accessibility_Document.xml \ + Accessibility_EditableText.xml \ + Accessibility_Event.xml \ + Accessibility_Hyperlink.xml \ + Accessibility_Hypertext.xml \ + Accessibility_Image.xml \ + Accessibility_LoginHelper.xml \ + Accessibility_Registry.xml \ + Accessibility_Relation.xml \ + Accessibility_Role.xml \ + Accessibility_Selection.xml \ + Accessibility_Selector.xml \ + Accessibility_State.xml \ + Accessibility_StreamableContent.xml \ + Accessibility_Table.xml \ + Accessibility_Text.xml \ + Accessibility_Value.xml -DISTCHECK_CONFIGURE_FLAGS = --enable-gtk-doc +$(XMLSUB): %.xml: %.idl doit + perl ./doit $< >$@ -EXTRA_DIST = \ - MAINTAINERS \ - intltool-extract.in \ - intltool-merge.in \ - intltool-update.in \ - cspi-1.0.pc.in \ - cspi-1.0-uninstalled.pc.in \ - libloginhelper-1.0.pc.in \ - libspi-1.0.pc.in \ - libspi-1.0-uninstalled.pc.in - -DISTCLEANFILES = intltool-extract \ - intltool-merge \ - intltool-update diff --git a/configure.in b/configure.in index dd544ae..0a7922d 100644 --- a/configure.in +++ b/configure.in @@ -1,4 +1,4 @@ -AC_INIT(idl/Accessibility.idl) +AC_INIT(xml/Accessibility.xml) AT_SPI_MAJOR_VERSION=1 AT_SPI_MINOR_VERSION=22 @@ -29,7 +29,7 @@ dnl required versions of other tools. m4_define([req_ver_atk], [1.17.0]) m4_define([req_ver_gtk], [2.10.0]) m4_define([req_ver_gail], [1.9.0]) -m4_define([req_ver_libbonobo], [1.107.0]) +m4_define([req_ver_dbus_glib], [0.7.0]) dnl Specify a header configuration file AM_CONFIG_HEADER(config.h) @@ -86,14 +86,14 @@ dnl fi dnl Checks for libraries PKG_CHECK_MODULES(LIBSPI, [ - libbonobo-2.0 >= req_ver_libbonobo + dbus-glib-1 >= req_ver_dbus_glib atk >= req_ver_atk ]) AC_SUBST(LIBSPI_LIBS) AC_SUBST(LIBSPI_CFLAGS) PKG_CHECK_MODULES(REGISTRYD, [ - libbonobo-2.0 >= req_ver_libbonobo + dbus-glib-1 >= req_ver_dbus_glib atk >= req_ver_atk gtk+-2.0 >= req_ver_gtk ]) @@ -101,7 +101,7 @@ AC_SUBST(REGISTRYD_LIBS) AC_SUBST(REGISTRYD_CFLAGS) PKG_CHECK_MODULES(TESTS, [ - libbonobo-2.0 >= req_ver_libbonobo + dbus-glib-1 >= req_ver_dbus_glib atk >= req_ver_atk gtk+-2.0 >= req_ver_gtk gail >= req_ver_gail @@ -110,14 +110,14 @@ AC_SUBST(TESTS_LIBS) AC_SUBST(TESTS_CFLAGS) PKG_CHECK_MODULES(ATK_BRIDGE, [ - libbonobo-2.0 >= req_ver_libbonobo + dbus-glib-1 >= req_ver_dbus_glib atk >= req_ver_atk ]) AC_SUBST(ATK_BRIDGE_LIBS) AC_SUBST(ATK_BRIDGE_CFLAGS) PKG_CHECK_MODULES(LIBCSPI, [ - libbonobo-2.0 >= req_ver_libbonobo + dbus-glib-1 >= req_ver_dbus_glib atk >= req_ver_atk ]) AC_SUBST(LIBCSPI_LIBS) @@ -133,12 +133,6 @@ dnl orbit-idl. ORBIT_IDL="`$PKG_CONFIG --variable=orbit_idl ORBit-2.0`" AC_SUBST(ORBIT_IDL) -dnl Bonobo and Bonobo-Activation idl files -BONOBO_ACTIVATION_IDL_DIR="`$PKG_CONFIG --variable=idldir bonobo-activation-2.0`" -LIBBONOBO_IDL_DIR="`$PKG_CONFIG --variable=idldir libbonobo-2.0`" -AC_SUBST(BONOBO_ACTIVATION_IDL_DIR) -AC_SUBST(LIBBONOBO_IDL_DIR) - LIBS="$LIBS $X_LIBS" dnl path to Xtst AC_CHECK_LIB(Xtst, XTestFakeKeyEvent, XTST_LIBS=-lXtst,[ @@ -228,19 +222,9 @@ libspi-1.0-uninstalled.pc libloginhelper-1.0.pc cspi-1.0.pc cspi-1.0-uninstalled.pc -docs/Makefile -docs/reference/Makefile -docs/reference/cspi/Makefile -docs/reference/idl/Makefile -idl/Makefile libspi/Makefile -registryd/Makefile -atk-bridge/Makefile -login-helper/Makefile -test/Makefile -cspi/Makefile -cspi/bonobo/Makefile -pyatspi/Makefile +tools/Makefile +xml/Makefile ]) echo "AT-SPI setup: diff --git a/libspi/Makefile.am b/libspi/Makefile.am index fda146b..9069ad1 100644 --- a/libspi/Makefile.am +++ b/libspi/Makefile.am @@ -16,113 +16,34 @@ libspiincludedir = $(includedir)/at-spi-1.0/libspi libspiinclude_HEADERS = \ Accessibility.h \ - accessible.h \ - eventlistener.h \ - action.h \ - application.h \ - base.h \ - collection.h \ - component.h \ - document.h \ - editabletext.h \ - hyperlink.h \ - hypertext.h \ - image.h \ - devicelistener.h \ - keystrokelistener.h \ - keymasks.h \ - libspi.h \ - listener.h \ - matchrule.h \ - relation.h \ - remoteobject.h \ - selection.h \ - stateset.h \ - streamablecontent.h \ - table.h \ - text.h \ - value.h + bitarray.h \ + dbus.h \ + droute.h -IDL_OUT = Accessibility.h Accessibility-stubs.c Accessibility-skels.c Accessibility-common.c - -IDL_DEPS = \ - $(top_srcdir)/idl/Accessibility.idl \ - $(top_srcdir)/idl/Accessibility_Accessible.idl \ - $(top_srcdir)/idl/Accessibility_Action.idl \ - $(top_srcdir)/idl/Accessibility_Application.idl \ - $(top_srcdir)/idl/Accessibility_Collection.idl \ - $(top_srcdir)/idl/Accessibility_Component.idl \ - $(top_srcdir)/idl/Accessibility_Desktop.idl \ - $(top_srcdir)/idl/Accessibility_EditableText.idl \ - $(top_srcdir)/idl/Accessibility_Event.idl \ - $(top_srcdir)/idl/Accessibility_Hyperlink.idl \ - $(top_srcdir)/idl/Accessibility_Hypertext.idl \ - $(top_srcdir)/idl/Accessibility_Image.idl \ - $(top_srcdir)/idl/Accessibility_Registry.idl \ - $(top_srcdir)/idl/Accessibility_Relation.idl \ - $(top_srcdir)/idl/Accessibility_Role.idl \ - $(top_srcdir)/idl/Accessibility_Selection.idl \ - $(top_srcdir)/idl/Accessibility_State.idl \ - $(top_srcdir)/idl/Accessibility_StreamableContent.idl \ - $(top_srcdir)/idl/Accessibility_Table.idl \ - $(top_srcdir)/idl/Accessibility_Text.idl \ - $(top_srcdir)/idl/Accessibility_Value.idl - - -BUILT_SOURCES = $(IDL_OUT) Accessibility-imodule.c -CLEANFILES = $(IDL_OUT) Accessibility-imodule.c +BUILT_SOURCES = Accessibility.h +CLEANFILES = Accessibility.h libspi_la_SOURCES = \ - $(IDL_OUT) \ + Accessibility.h \ accessible.c \ - action.c \ application.c \ - base.c \ - collection.c \ component.c \ + dbus.c \ document.c \ + droute.c \ editabletext.c \ hyperlink.c \ hypertext.c \ image.c \ - devicelistener.c \ - matchrule.c \ - relation.c \ - remoteobject.c \ selection.c \ - spi-private.h \ - streamablecontent.c \ - stateset.c \ table.c \ text.c \ - util.c \ - value.c \ - listener.c \ - eventlistener.c - -$(top_srcdir)/libspi/accessible.c $(top_srcdir)/libspi/base.h $(top_srcdir)/libspi/keystrokelistener.h $(top_srcdir)/libspi/libspi.h $(top_srcdir)/libspi/listener.h $(top_srcdir)/libspi/remoteobject.h : Accessibility.h - -IDLFLAGS = -I$(BONOBO_ACTIVATION_IDL_DIR) \ - -I$(LIBBONOBO_IDL_DIR) \ - -I$(top_srcdir)/idl \ - --add-imodule - -$(IDL_OUT) Accessibility-imodule.c : $(IDL_DEPS) $(ORBIT_IDL) - $(ORBIT_IDL) -D__ACCESSIBILITY_COMPILATION__ $(IDLFLAGS) $(top_srcdir)/idl/Accessibility.idl - -orbittypelibdir = $(libdir)/orbit-2.0 -orbittypelib_LTLIBRARIES = Accessibility_module.la - -Accessibility_module_la_LDFLAGS = \ - -export-dynamic -module -avoid-version -no-undefined - -Accessibility_module_la_LIBADD = \ - $(ORBIT_LIBS) + value.c -Accessibility_module_la_SOURCES = \ - Accessibility-imodule.c +Accessibility.h: ../xml/spec.xml ../tools/c-constants-generator.xsl + xsltproc --stringparam mixed-case-prefix Accessibility_ ../tools/c-constants-generator.xsl $< >$@ -DONT_DIST_SOURCE = $(IDL_OUT) Accessibility-imodule.c +DONT_DIST_SOURCE = Accessibility.h dist-hook: for file in $(DONT_DIST_SOURCE) ; do \ diff --git a/libspi/accessible.c b/libspi/accessible.c index ad7084f..df18012 100644 --- a/libspi/accessible.c +++ b/libspi/accessible.c @@ -2,6 +2,7 @@ * AT-SPI - Assistive Technology Service Provider Interface * (Gnome Accessibility Project; http://developer.gnome.org/projects/gap) * + * Copyright 2008 Novell, Inc. * Copyright 2001, 2002 Sun Microsystems Inc., * Copyright 2001, 2002 Ximian, Inc. * @@ -21,677 +22,656 @@ * Boston, MA 02111-1307, USA. */ -/* accessible.c: the core of the accessibility implementation */ +#include "accessible.h" +#include "bitarray.h" -#include -#include -#include -#include -#include -#include "spi-private.h" +#define get_object(message) spi_dbus_get_object(dbus_message_get_path(message)) -/* Our parent Gtk object type */ -#define PARENT_TYPE SPI_TYPE_BASE - -static gboolean spi_init_role_lookup_table (Accessibility_Role *role_table); -Accessibility_Role spi_accessible_role_from_atk_role (AtkRole role); - -static gboolean -spi_init_role_lookup_table (Accessibility_Role *role_table) +static AtkObject * +get_object_from_path (const char *path, void *user_data) { - int i; - /* if it's not in the list below, dunno what it is */ - for (i = 0; i < ATK_ROLE_LAST_DEFINED; ++i) - { - role_table [i] = Accessibility_ROLE_UNKNOWN; - } - - role_table [ATK_ROLE_INVALID] = Accessibility_ROLE_INVALID; - role_table [ATK_ROLE_ACCEL_LABEL] = Accessibility_ROLE_ACCELERATOR_LABEL; - role_table [ATK_ROLE_ALERT] = Accessibility_ROLE_ALERT; - role_table [ATK_ROLE_ANIMATION] = Accessibility_ROLE_ANIMATION; - role_table [ATK_ROLE_ARROW] = Accessibility_ROLE_ARROW; - role_table [ATK_ROLE_CALENDAR] = Accessibility_ROLE_CALENDAR; - role_table [ATK_ROLE_CANVAS] = Accessibility_ROLE_CANVAS; - role_table [ATK_ROLE_CHECK_BOX] = Accessibility_ROLE_CHECK_BOX; - role_table [ATK_ROLE_CHECK_MENU_ITEM] = Accessibility_ROLE_CHECK_MENU_ITEM; - role_table [ATK_ROLE_COLOR_CHOOSER] = Accessibility_ROLE_COLOR_CHOOSER; - role_table [ATK_ROLE_COLUMN_HEADER] = Accessibility_ROLE_COLUMN_HEADER; - role_table [ATK_ROLE_COMBO_BOX] = Accessibility_ROLE_COMBO_BOX; - role_table [ATK_ROLE_DATE_EDITOR] = Accessibility_ROLE_DATE_EDITOR; - role_table [ATK_ROLE_DESKTOP_ICON] = Accessibility_ROLE_DESKTOP_ICON; - role_table [ATK_ROLE_DESKTOP_FRAME] = Accessibility_ROLE_DESKTOP_FRAME; - role_table [ATK_ROLE_DIAL] = Accessibility_ROLE_DIAL; - role_table [ATK_ROLE_DIALOG] = Accessibility_ROLE_DIALOG; - role_table [ATK_ROLE_DIRECTORY_PANE] = Accessibility_ROLE_DIRECTORY_PANE; - role_table [ATK_ROLE_DRAWING_AREA] = Accessibility_ROLE_DRAWING_AREA; - role_table [ATK_ROLE_FILE_CHOOSER] = Accessibility_ROLE_FILE_CHOOSER; - role_table [ATK_ROLE_FILLER] = Accessibility_ROLE_FILLER; - role_table [ATK_ROLE_FONT_CHOOSER] = Accessibility_ROLE_FONT_CHOOSER; - role_table [ATK_ROLE_FRAME] = Accessibility_ROLE_FRAME; - role_table [ATK_ROLE_GLASS_PANE] = Accessibility_ROLE_GLASS_PANE; - role_table [ATK_ROLE_HTML_CONTAINER] = Accessibility_ROLE_HTML_CONTAINER; - role_table [ATK_ROLE_ICON] = Accessibility_ROLE_ICON; - role_table [ATK_ROLE_IMAGE] = Accessibility_ROLE_IMAGE; - role_table [ATK_ROLE_INTERNAL_FRAME] = Accessibility_ROLE_INTERNAL_FRAME; - role_table [ATK_ROLE_LABEL] = Accessibility_ROLE_LABEL; - role_table [ATK_ROLE_LAYERED_PANE] = Accessibility_ROLE_LAYERED_PANE; - role_table [ATK_ROLE_LIST] = Accessibility_ROLE_LIST; - role_table [ATK_ROLE_LIST_ITEM] = Accessibility_ROLE_LIST_ITEM; - role_table [ATK_ROLE_MENU] = Accessibility_ROLE_MENU; - role_table [ATK_ROLE_MENU_BAR] = Accessibility_ROLE_MENU_BAR; - role_table [ATK_ROLE_MENU_ITEM] = Accessibility_ROLE_MENU_ITEM; - role_table [ATK_ROLE_OPTION_PANE] = Accessibility_ROLE_OPTION_PANE; - role_table [ATK_ROLE_PAGE_TAB] = Accessibility_ROLE_PAGE_TAB; - role_table [ATK_ROLE_PAGE_TAB_LIST] = Accessibility_ROLE_PAGE_TAB_LIST; - role_table [ATK_ROLE_PANEL] = Accessibility_ROLE_PANEL; - role_table [ATK_ROLE_PASSWORD_TEXT] = Accessibility_ROLE_PASSWORD_TEXT; - role_table [ATK_ROLE_POPUP_MENU] = Accessibility_ROLE_POPUP_MENU; - role_table [ATK_ROLE_PROGRESS_BAR] = Accessibility_ROLE_PROGRESS_BAR; - role_table [ATK_ROLE_PUSH_BUTTON] = Accessibility_ROLE_PUSH_BUTTON; - role_table [ATK_ROLE_RADIO_BUTTON] = Accessibility_ROLE_RADIO_BUTTON; - role_table [ATK_ROLE_RADIO_MENU_ITEM] = Accessibility_ROLE_RADIO_MENU_ITEM; - role_table [ATK_ROLE_ROOT_PANE] = Accessibility_ROLE_ROOT_PANE; - role_table [ATK_ROLE_ROW_HEADER] = Accessibility_ROLE_ROW_HEADER; - role_table [ATK_ROLE_SCROLL_BAR] = Accessibility_ROLE_SCROLL_BAR; - role_table [ATK_ROLE_SCROLL_PANE] = Accessibility_ROLE_SCROLL_PANE; - role_table [ATK_ROLE_SEPARATOR] = Accessibility_ROLE_SEPARATOR; - role_table [ATK_ROLE_SLIDER] = Accessibility_ROLE_SLIDER; - role_table [ATK_ROLE_SPIN_BUTTON] = Accessibility_ROLE_SPIN_BUTTON; - role_table [ATK_ROLE_SPLIT_PANE] = Accessibility_ROLE_SPLIT_PANE; - role_table [ATK_ROLE_STATUSBAR] = Accessibility_ROLE_STATUS_BAR; - role_table [ATK_ROLE_TABLE] = Accessibility_ROLE_TABLE; - role_table [ATK_ROLE_TABLE_CELL] = Accessibility_ROLE_TABLE_CELL; - role_table [ATK_ROLE_TABLE_COLUMN_HEADER] = Accessibility_ROLE_TABLE_COLUMN_HEADER; - role_table [ATK_ROLE_TABLE_ROW_HEADER] = Accessibility_ROLE_TABLE_ROW_HEADER; - role_table [ATK_ROLE_TEAR_OFF_MENU_ITEM] = Accessibility_ROLE_TEAROFF_MENU_ITEM; - role_table [ATK_ROLE_TERMINAL] = Accessibility_ROLE_TERMINAL; - role_table [ATK_ROLE_TEXT] = Accessibility_ROLE_TEXT; - role_table [ATK_ROLE_TOGGLE_BUTTON] = Accessibility_ROLE_TOGGLE_BUTTON; - role_table [ATK_ROLE_TOOL_BAR] = Accessibility_ROLE_TOOL_BAR; - role_table [ATK_ROLE_TOOL_TIP] = Accessibility_ROLE_TOOL_TIP; - role_table [ATK_ROLE_TREE] = Accessibility_ROLE_TREE; - role_table [ATK_ROLE_TREE_TABLE] = Accessibility_ROLE_TREE_TABLE; - role_table [ATK_ROLE_UNKNOWN] = Accessibility_ROLE_UNKNOWN; - role_table [ATK_ROLE_VIEWPORT] = Accessibility_ROLE_VIEWPORT; - role_table [ATK_ROLE_WINDOW] = Accessibility_ROLE_WINDOW; - role_table [ATK_ROLE_HEADER] = Accessibility_ROLE_HEADER; - role_table [ATK_ROLE_FOOTER] = Accessibility_ROLE_FOOTER; - role_table [ATK_ROLE_PARAGRAPH] = Accessibility_ROLE_PARAGRAPH; - role_table [ATK_ROLE_RULER] = Accessibility_ROLE_RULER; - role_table [ATK_ROLE_APPLICATION] = Accessibility_ROLE_APPLICATION; - role_table [ATK_ROLE_AUTOCOMPLETE] = Accessibility_ROLE_AUTOCOMPLETE; - role_table [ATK_ROLE_EDITBAR] = Accessibility_ROLE_EDITBAR; - role_table [ATK_ROLE_EMBEDDED] = Accessibility_ROLE_EMBEDDED; - role_table [ATK_ROLE_ENTRY] = Accessibility_ROLE_ENTRY; - role_table [ATK_ROLE_CHART] = Accessibility_ROLE_CHART; - role_table [ATK_ROLE_CAPTION] = Accessibility_ROLE_CAPTION; - role_table [ATK_ROLE_DOCUMENT_FRAME] = Accessibility_ROLE_DOCUMENT_FRAME; - role_table [ATK_ROLE_HEADING] = Accessibility_ROLE_HEADING; - role_table [ATK_ROLE_PAGE] = Accessibility_ROLE_PAGE; - role_table [ATK_ROLE_SECTION] = Accessibility_ROLE_SECTION; - role_table [ATK_ROLE_FORM] = Accessibility_ROLE_FORM; - role_table [ATK_ROLE_REDUNDANT_OBJECT] = Accessibility_ROLE_REDUNDANT_OBJECT; - role_table [ATK_ROLE_LINK] = Accessibility_ROLE_LINK; - role_table [ATK_ROLE_INPUT_METHOD_WINDOW] = Accessibility_ROLE_INPUT_METHOD_WINDOW; - return TRUE; + return spi_dbus_get_object (path); } -Accessibility_Role -spi_accessible_role_from_atk_role (AtkRole role) +static dbus_bool_t +impl_get_name (const char *path, DBusMessageIter * iter, void *user_data) { - static gboolean is_initialized = FALSE; - static Accessibility_Role spi_role_table [ATK_ROLE_LAST_DEFINED]; - Accessibility_Role spi_role; - - if (!is_initialized) - { - is_initialized = spi_init_role_lookup_table (spi_role_table); - } - - if (role >= 0 && role < ATK_ROLE_LAST_DEFINED) - { - spi_role = spi_role_table [role]; - } - else - { - spi_role = Accessibility_ROLE_EXTENDED; - } - return spi_role; + AtkObject *object = spi_dbus_get_object (path); + if (!object) + return FALSE; + return droute_return_v_string (iter, atk_object_get_name (object)); } -static AtkObject * -get_atkobject_from_servant (PortableServer_Servant servant) +static char * +impl_get_name_str (void *datum) { - SpiBase *object = SPI_BASE (bonobo_object_from_servant (servant)); - - g_return_val_if_fail (object, NULL); - g_return_val_if_fail (ATK_IS_OBJECT(object->gobj), NULL); - return ATK_OBJECT(object->gobj); + g_assert (ATK_IS_OBJECT (datum)); + return g_strdup (atk_object_get_name ((AtkObject *) datum)); } -/* - * CORBA Accessibility::Accessible::get_name method implementation - */ -static CORBA_char * -impl_accessibility_accessible_get_name (PortableServer_Servant servant, - CORBA_Environment *ev) +static dbus_bool_t +impl_set_name (const char *path, DBusMessageIter * iter, void *user_data) { - const gchar *name; - CORBA_char *retval; - AtkObject *object = get_atkobject_from_servant (servant); - - g_return_val_if_fail (object != NULL, CORBA_string_dup ("")); - - name = atk_object_get_name (object); - - if (name) - { - retval = CORBA_string_dup (name); - } - else - { - retval = CORBA_string_dup (""); - } - - return retval; + AtkObject *object = spi_dbus_get_object (path); + const char *name = droute_get_v_string (iter); + atk_object_set_name (object, name); + return TRUE; } -/* - * CORBA Accessibility::Accessible::set_name method implementation - */ -static void -impl_accessibility_accessible_set_name (PortableServer_Servant servant, - const CORBA_char *name, - CORBA_Environment *ev) +static dbus_bool_t +impl_get_description (const char *path, DBusMessageIter * iter, + void *user_data) { - AtkObject *object = get_atkobject_from_servant (servant); - - g_return_if_fail (object != NULL); - - atk_object_set_name (object, name); + AtkObject *object = spi_dbus_get_object (path); + if (!object) + return FALSE; + return droute_return_v_string (iter, atk_object_get_description (object)); } -/* - * CORBA Accessibility::Accessible::get_description method implementation - */ -static CORBA_char * -impl_accessibility_accessible_get_description (PortableServer_Servant servant, - CORBA_Environment *ev) +static char * +impl_get_description_str (void *datum) { - const gchar *descr; - CORBA_char *retval; - AtkObject *object = get_atkobject_from_servant (servant); - - g_return_val_if_fail (object != NULL, CORBA_string_dup ("")); - - descr = atk_object_get_description (object); - - if (descr) - { - retval = CORBA_string_dup (descr); - } - else - { - retval = CORBA_string_dup (""); - } - - return retval; + g_assert (ATK_IS_OBJECT (datum)); + return g_strdup (atk_object_get_description ((AtkObject *) datum)); } -/* - * CORBA Accessibility::Accessible::set_description method implementation - */ -static void -impl_accessibility_accessible_set_description (PortableServer_Servant servant, - const CORBA_char *descr, - CORBA_Environment *ev) +static dbus_bool_t +impl_set_description (const char *path, DBusMessageIter * iter, + void *user_data) { - AtkObject *object = get_atkobject_from_servant (servant); - - g_return_if_fail (object != NULL); - - atk_object_set_description (object, descr); + AtkObject *object = spi_dbus_get_object (path); + const char *description = droute_get_v_string (iter); + atk_object_set_description (object, description); + return TRUE; } -/* - * CORBA Accessibility::Accessible::get_parent method implementation - */ -static Accessibility_Accessible -impl_accessibility_accessible_get_parent (PortableServer_Servant servant, - CORBA_Environment *ev) +static dbus_bool_t +impl_get_parent (const char *path, DBusMessageIter * iter, void *user_data) { - AtkObject *parent; - AtkObject *object = get_atkobject_from_servant (servant); - - g_return_val_if_fail (object != NULL, CORBA_OBJECT_NIL); - - parent = atk_object_get_parent (object); + AtkObject *object = spi_dbus_get_object (path); - return spi_accessible_new_return (parent, FALSE, ev); + if (!object) + return FALSE; + return spi_dbus_return_v_object (iter, atk_object_get_parent (object), + FALSE); } -/* - * CORBA Accessibility::Accessible::get_IndexInParent method implementation - */ -static CORBA_long -impl_accessibility_accessible_get_index_in_parent (PortableServer_Servant servant, - CORBA_Environment *ev) +static char * +impl_get_parent_str (void *datum) { - AtkObject *object = get_atkobject_from_servant (servant); + g_assert (ATK_IS_OBJECT (datum)); + return spi_dbus_get_path (atk_object_get_parent ((AtkObject *) datum)); +} - g_return_val_if_fail (object != NULL, -1); +static dbus_bool_t +impl_get_childCount (const char *path, DBusMessageIter * iter, + void *user_data) +{ + AtkObject *object = spi_dbus_get_object (path); - return atk_object_get_index_in_parent (object); + if (!object) + return FALSE; + return droute_return_v_int32 (iter, + atk_object_get_n_accessible_children + (object)); } -/* - * CORBA Accessibility::Accessible::get_childCount method implementation - */ -static CORBA_long -impl_accessibility_accessible_get_child_count (PortableServer_Servant servant, - CORBA_Environment *ev) +static char * +impl_get_childCount_str (void *datum) { - AtkObject *object = get_atkobject_from_servant (servant); - - g_return_val_if_fail (object != NULL, 0); + int count; + g_assert (ATK_IS_OBJECT (datum)); + count = atk_object_get_n_accessible_children ((AtkObject *) datum); + return g_strdup_printf ("%d", count); +} - return atk_object_get_n_accessible_children (object); +#if 0 +static DBusMessage * +impl_isEqual (DBusConnection * bus, DBusMessage * message, void *user_data) +{ } +#endif -/* - * CORBA Accessibility::Accessible::getChildAtIndex method implementation - */ -static Accessibility_Accessible -impl_accessibility_accessible_get_child_at_index (PortableServer_Servant servant, - const CORBA_long index, - CORBA_Environment *ev) +#if 0 +static DBusMessage * +impl_getChildAtIndex (DBusConnection * bus, DBusMessage * message, + void *user_data) { + AtkObject *object = get_object (message); + dbus_int32_t index; + DBusError error; AtkObject *child; - AtkObject *object = get_atkobject_from_servant (servant); - g_return_val_if_fail (object != NULL, CORBA_OBJECT_NIL); - - child = atk_object_ref_accessible_child (object, index); - - return spi_accessible_new_return (child, TRUE, ev); + if (!object) + return spi_dbus_general_error (message); + dbus_error_init (&error); + if (!dbus_message_get_args + (message, &error, DBUS_TYPE_INT32, &index, DBUS_TYPE_INVALID)) + { + return SPI_DBUS_RETURN_ERROR (message, &error); + } + child = atk_object_ref_accessible - child (object, index); + return spi_dbus_return_object (message, child, TRUE); } +#endif -/* - * CORBA Accessibility::Accessible::getState method implementation - */ -static Accessibility_StateSet -impl_accessibility_accessible_get_state (PortableServer_Servant servant, - CORBA_Environment *ev) +static DBusMessage * +impl_getChildren (DBusConnection * bus, DBusMessage * message, + void *user_data) { - AtkObject *object = get_atkobject_from_servant (servant); - AtkStateSet *atk_set; - SpiStateSet *set; - Accessibility_StateSet retval; - - bonobo_return_val_if_fail (object != NULL, NULL, ev); - - atk_set = atk_object_ref_state_set (object); - - set = spi_state_set_new (atk_set); - retval = CORBA_Object_duplicate ( - BONOBO_OBJREF(set), - NULL); + AtkObject *object = get_object (message); + gint i; + gint count; + DBusMessage *reply; + DBusMessageIter iter, iter_array; + + if (!object) + return spi_dbus_general_error (message); + count = atk_object_get_n_accessible_children (object); + reply = dbus_message_new_method_return (message); + dbus_message_iter_init_append (reply, &iter); + if (!dbus_message_iter_open_container + (&iter, DBUS_TYPE_ARRAY, "o", &iter_array)) + goto oom; + for (i = 0; i < count; i++) + { + AtkObject *child = atk_object_ref_accessible_child (object, i); + char *path = spi_dbus_get_path (child); + if (path) + { + dbus_message_iter_append_basic (&iter_array, DBUS_TYPE_OBJECT_PATH, + &path); + g_free (path); + } + if (child) + g_object_unref (child); + } + if (!dbus_message_iter_close_container (&iter, &iter_array)) + goto oom; + return reply; +oom: + // TODO: handle out-of-memory + return reply; +} - g_object_unref (atk_set); +static DBusMessage * +impl_getIndexInParent (DBusConnection * bus, DBusMessage * message, + void *user_data) +{ + AtkObject *object = get_object (message); + dbus_uint32_t rv; + DBusMessage *reply; + + if (!object) + return spi_dbus_general_error (message); + rv = atk_object_get_index_in_parent (object); + reply = dbus_message_new_method_return (message); + if (reply) + { + dbus_message_append_args (reply, DBUS_TYPE_UINT32, &rv, + DBUS_TYPE_INVALID); + } + return reply; +} - return retval; +#if 0 +static DBusMessage * +impl_getRelationSet (DBusConnection * bus, DBusMessage * message, + void *user_data) +{ } +#endif -/* - * CORBA Accessibility::Accessible::getRelationSet method implementation - */ -static Accessibility_RelationSet * -impl_accessibility_accessible_get_relation_set (PortableServer_Servant servant, - CORBA_Environment *ev) +static gboolean +spi_init_role_lookup_table (Accessibility_Role * role_table) { - Accessibility_RelationSet *retval; - gint n_relations = 0; - gint i; - AtkRelationSet *relation_set; - AtkObject *object = get_atkobject_from_servant (servant); + int i; + /* if it's not in the list below, dunno what it is */ + for (i = 0; i < ATK_ROLE_LAST_DEFINED; ++i) + { + role_table[i] = Accessibility_ROLE_UNKNOWN; + } - bonobo_return_val_if_fail (object != NULL, NULL, ev); + role_table[ATK_ROLE_INVALID] = Accessibility_ROLE_INVALID; + role_table[ATK_ROLE_ACCEL_LABEL] = Accessibility_ROLE_ACCELERATOR_LABEL; + role_table[ATK_ROLE_ALERT] = Accessibility_ROLE_ALERT; + role_table[ATK_ROLE_ANIMATION] = Accessibility_ROLE_ANIMATION; + role_table[ATK_ROLE_ARROW] = Accessibility_ROLE_ARROW; + role_table[ATK_ROLE_CALENDAR] = Accessibility_ROLE_CALENDAR; + role_table[ATK_ROLE_CANVAS] = Accessibility_ROLE_CANVAS; + role_table[ATK_ROLE_CHECK_BOX] = Accessibility_ROLE_CHECK_BOX; + role_table[ATK_ROLE_CHECK_MENU_ITEM] = Accessibility_ROLE_CHECK_MENU_ITEM; + role_table[ATK_ROLE_COLOR_CHOOSER] = Accessibility_ROLE_COLOR_CHOOSER; + role_table[ATK_ROLE_COLUMN_HEADER] = Accessibility_ROLE_COLUMN_HEADER; + role_table[ATK_ROLE_COMBO_BOX] = Accessibility_ROLE_COMBO_BOX; + role_table[ATK_ROLE_DATE_EDITOR] = Accessibility_ROLE_DATE_EDITOR; + role_table[ATK_ROLE_DESKTOP_ICON] = Accessibility_ROLE_DESKTOP_ICON; + role_table[ATK_ROLE_DESKTOP_FRAME] = Accessibility_ROLE_DESKTOP_FRAME; + role_table[ATK_ROLE_DIAL] = Accessibility_ROLE_DIAL; + role_table[ATK_ROLE_DIALOG] = Accessibility_ROLE_DIALOG; + role_table[ATK_ROLE_DIRECTORY_PANE] = Accessibility_ROLE_DIRECTORY_PANE; + role_table[ATK_ROLE_DRAWING_AREA] = Accessibility_ROLE_DRAWING_AREA; + role_table[ATK_ROLE_FILE_CHOOSER] = Accessibility_ROLE_FILE_CHOOSER; + role_table[ATK_ROLE_FILLER] = Accessibility_ROLE_FILLER; + role_table[ATK_ROLE_FONT_CHOOSER] = Accessibility_ROLE_FONT_CHOOSER; + role_table[ATK_ROLE_FRAME] = Accessibility_ROLE_FRAME; + role_table[ATK_ROLE_GLASS_PANE] = Accessibility_ROLE_GLASS_PANE; + role_table[ATK_ROLE_HTML_CONTAINER] = Accessibility_ROLE_HTML_CONTAINER; + role_table[ATK_ROLE_ICON] = Accessibility_ROLE_ICON; + role_table[ATK_ROLE_IMAGE] = Accessibility_ROLE_IMAGE; + role_table[ATK_ROLE_INTERNAL_FRAME] = Accessibility_ROLE_INTERNAL_FRAME; + role_table[ATK_ROLE_LABEL] = Accessibility_ROLE_LABEL; + role_table[ATK_ROLE_LAYERED_PANE] = Accessibility_ROLE_LAYERED_PANE; + role_table[ATK_ROLE_LIST] = Accessibility_ROLE_LIST; + role_table[ATK_ROLE_LIST_ITEM] = Accessibility_ROLE_LIST_ITEM; + role_table[ATK_ROLE_MENU] = Accessibility_ROLE_MENU; + role_table[ATK_ROLE_MENU_BAR] = Accessibility_ROLE_MENU_BAR; + role_table[ATK_ROLE_MENU_ITEM] = Accessibility_ROLE_MENU_ITEM; + role_table[ATK_ROLE_OPTION_PANE] = Accessibility_ROLE_OPTION_PANE; + role_table[ATK_ROLE_PAGE_TAB] = Accessibility_ROLE_PAGE_TAB; + role_table[ATK_ROLE_PAGE_TAB_LIST] = Accessibility_ROLE_PAGE_TAB_LIST; + role_table[ATK_ROLE_PANEL] = Accessibility_ROLE_PANEL; + role_table[ATK_ROLE_PASSWORD_TEXT] = Accessibility_ROLE_PASSWORD_TEXT; + role_table[ATK_ROLE_POPUP_MENU] = Accessibility_ROLE_POPUP_MENU; + role_table[ATK_ROLE_PROGRESS_BAR] = Accessibility_ROLE_PROGRESS_BAR; + role_table[ATK_ROLE_PUSH_BUTTON] = Accessibility_ROLE_PUSH_BUTTON; + role_table[ATK_ROLE_RADIO_BUTTON] = Accessibility_ROLE_RADIO_BUTTON; + role_table[ATK_ROLE_RADIO_MENU_ITEM] = Accessibility_ROLE_RADIO_MENU_ITEM; + role_table[ATK_ROLE_ROOT_PANE] = Accessibility_ROLE_ROOT_PANE; + role_table[ATK_ROLE_ROW_HEADER] = Accessibility_ROLE_ROW_HEADER; + role_table[ATK_ROLE_SCROLL_BAR] = Accessibility_ROLE_SCROLL_BAR; + role_table[ATK_ROLE_SCROLL_PANE] = Accessibility_ROLE_SCROLL_PANE; + role_table[ATK_ROLE_SEPARATOR] = Accessibility_ROLE_SEPARATOR; + role_table[ATK_ROLE_SLIDER] = Accessibility_ROLE_SLIDER; + role_table[ATK_ROLE_SPIN_BUTTON] = Accessibility_ROLE_SPIN_BUTTON; + role_table[ATK_ROLE_SPLIT_PANE] = Accessibility_ROLE_SPLIT_PANE; + role_table[ATK_ROLE_STATUSBAR] = Accessibility_ROLE_STATUS_BAR; + role_table[ATK_ROLE_TABLE] = Accessibility_ROLE_TABLE; + role_table[ATK_ROLE_TABLE_CELL] = Accessibility_ROLE_TABLE_CELL; + role_table[ATK_ROLE_TABLE_COLUMN_HEADER] = + Accessibility_ROLE_TABLE_COLUMN_HEADER; + role_table[ATK_ROLE_TABLE_ROW_HEADER] = Accessibility_ROLE_TABLE_ROW_HEADER; + role_table[ATK_ROLE_TEAR_OFF_MENU_ITEM] = + Accessibility_ROLE_TEAROFF_MENU_ITEM; + role_table[ATK_ROLE_TERMINAL] = Accessibility_ROLE_TERMINAL; + role_table[ATK_ROLE_TEXT] = Accessibility_ROLE_TEXT; + role_table[ATK_ROLE_TOGGLE_BUTTON] = Accessibility_ROLE_TOGGLE_BUTTON; + role_table[ATK_ROLE_TOOL_BAR] = Accessibility_ROLE_TOOL_BAR; + role_table[ATK_ROLE_TOOL_TIP] = Accessibility_ROLE_TOOL_TIP; + role_table[ATK_ROLE_TREE] = Accessibility_ROLE_TREE; + role_table[ATK_ROLE_TREE_TABLE] = Accessibility_ROLE_TREE_TABLE; + role_table[ATK_ROLE_UNKNOWN] = Accessibility_ROLE_UNKNOWN; + role_table[ATK_ROLE_VIEWPORT] = Accessibility_ROLE_VIEWPORT; + role_table[ATK_ROLE_WINDOW] = Accessibility_ROLE_WINDOW; + role_table[ATK_ROLE_HEADER] = Accessibility_ROLE_HEADER; + role_table[ATK_ROLE_FOOTER] = Accessibility_ROLE_FOOTER; + role_table[ATK_ROLE_PARAGRAPH] = Accessibility_ROLE_PARAGRAPH; + role_table[ATK_ROLE_RULER] = Accessibility_ROLE_RULER; + role_table[ATK_ROLE_APPLICATION] = Accessibility_ROLE_APPLICATION; + role_table[ATK_ROLE_AUTOCOMPLETE] = Accessibility_ROLE_AUTOCOMPLETE; + role_table[ATK_ROLE_EDITBAR] = Accessibility_ROLE_EDITBAR; + role_table[ATK_ROLE_EMBEDDED] = Accessibility_ROLE_EMBEDDED; + role_table[ATK_ROLE_ENTRY] = Accessibility_ROLE_ENTRY; + role_table[ATK_ROLE_CHART] = Accessibility_ROLE_CHART; + role_table[ATK_ROLE_CAPTION] = Accessibility_ROLE_CAPTION; + role_table[ATK_ROLE_DOCUMENT_FRAME] = Accessibility_ROLE_DOCUMENT_FRAME; + role_table[ATK_ROLE_HEADING] = Accessibility_ROLE_HEADING; + role_table[ATK_ROLE_PAGE] = Accessibility_ROLE_PAGE; + role_table[ATK_ROLE_SECTION] = Accessibility_ROLE_SECTION; + role_table[ATK_ROLE_FORM] = Accessibility_ROLE_FORM; + role_table[ATK_ROLE_REDUNDANT_OBJECT] = Accessibility_ROLE_REDUNDANT_OBJECT; + role_table[ATK_ROLE_LINK] = Accessibility_ROLE_LINK; + role_table[ATK_ROLE_INPUT_METHOD_WINDOW] = + Accessibility_ROLE_INPUT_METHOD_WINDOW; + return TRUE; +} - relation_set = atk_object_ref_relation_set (object); +Accessibility_Role +spi_accessible_role_from_atk_role (AtkRole role) +{ + static gboolean is_initialized = FALSE; + static Accessibility_Role spi_role_table[ATK_ROLE_LAST_DEFINED]; + Accessibility_Role spi_role; - if (relation_set) - n_relations = atk_relation_set_get_n_relations (relation_set); + if (!is_initialized) + { + is_initialized = spi_init_role_lookup_table (spi_role_table); + } - retval = CORBA_sequence_Accessibility_Relation__alloc (); - retval->_length = retval->_maximum = n_relations; - retval->_buffer = CORBA_sequence_Accessibility_Relation_allocbuf (n_relations); - CORBA_sequence_set_release (retval, CORBA_TRUE); - - for (i = 0; i < n_relations; ++i) + if (role >= 0 && role < ATK_ROLE_LAST_DEFINED) { - retval->_buffer[i] = - CORBA_Object_duplicate ( - BONOBO_OBJREF ( - spi_relation_new (atk_relation_set_get_relation (relation_set, i))), - NULL); + spi_role = spi_role_table[role]; } - - return retval; + else + { + spi_role = Accessibility_ROLE_EXTENDED; + } + return spi_role; } -/* - * CORBA Accessibility::Accessible::getRole method implementation - */ -static Accessibility_Role -impl_accessibility_accessible_get_role (PortableServer_Servant servant, - CORBA_Environment *ev) +static DBusMessage * +impl_getRole (DBusConnection * bus, DBusMessage * message, void *user_data) { - AtkRole role; - Accessibility_Role retval; - AtkObject *object = get_atkobject_from_servant (servant); - - g_return_val_if_fail (object != NULL, 0); + AtkObject *object = get_object (message); + gint role; + dbus_uint32_t rv; + DBusMessage *reply; + if (!object) + return spi_dbus_general_error (message); role = atk_object_get_role (object); - retval = spi_role_from_atk_role (role); - - return retval; + rv = spi_accessible_role_from_atk_role (role); + reply = dbus_message_new_method_return (message); + if (reply) + { + dbus_message_append_args (reply, DBUS_TYPE_UINT32, &rv, + DBUS_TYPE_INVALID); + } + return reply; } -/* - * CORBA Accessibility::Accessible::getRole method implementation - */ -static CORBA_char * -impl_accessibility_accessible_get_role_name (PortableServer_Servant servant, - CORBA_Environment *ev) +static char * +impl_get_role_str (void *datum) { - const gchar *role_name; - AtkRole role; - AtkObject *object = get_atkobject_from_servant (servant); + g_assert (ATK_IS_OBJECT (datum)); + return g_strdup_printf ("%d", + spi_accessible_role_from_atk_role + (atk_object_get_role ((AtkObject *) datum))); +} - g_return_val_if_fail (object != NULL, NULL); +static DBusMessage * +impl_getRoleName (DBusConnection * bus, DBusMessage * message, + void *user_data) +{ + AtkObject *object = get_object (message); + gint role; + const char *role_name; + DBusMessage *reply; + if (!object) + return spi_dbus_general_error (message); role = atk_object_get_role (object); - role_name = atk_role_get_name (role); - if (role_name) - return CORBA_string_dup (role_name); - else - return CORBA_string_dup (""); + if (!role_name) + role_name = ""; + reply = dbus_message_new_method_return (message); + if (reply) + { + dbus_message_append_args (reply, DBUS_TYPE_STRING, &role_name, + DBUS_TYPE_INVALID); + } + return reply; } -/* - * CORBA Accessibility::Accessible::getLocalizedRole method implementation - */ -static CORBA_char * -impl_accessibility_accessible_get_local_role_name (PortableServer_Servant servant, - CORBA_Environment *ev) +static DBusMessage * +impl_getLocalizedRoleName (DBusConnection * bus, DBusMessage * message, + void *user_data) { - const gchar *role_name; - AtkRole role; - AtkObject *object = get_atkobject_from_servant (servant); - - g_return_val_if_fail (object != NULL, NULL); + AtkObject *object = get_object (message); + gint role; + const char *role_name; + DBusMessage *reply; + if (!object) + return spi_dbus_general_error (message); role = atk_object_get_role (object); - role_name = atk_role_get_localized_name (role); - if (role_name) - return CORBA_string_dup (role_name); - else - return CORBA_string_dup (""); + if (!role_name) + role_name = ""; + reply = dbus_message_new_method_return (message); + if (reply) + { + dbus_message_append_args (reply, DBUS_TYPE_STRING, &role_name, + DBUS_TYPE_INVALID); + } + return reply; } -static Accessibility_Accessible -impl_accessibility_accessible_get_application (PortableServer_Servant servant, - CORBA_Environment *ev) -{ - return spi_accessible_new_return (atk_get_root (), FALSE, ev); -} +static Accessibility_StateType *accessible_state_types = NULL; +static AtkStateType *atk_state_types = NULL; -static Accessibility_AttributeSet* -impl_accessibility_accessible_get_attributes (PortableServer_Servant servant, - CORBA_Environment *ev) +static gboolean +spi_init_state_type_tables (void) { - Accessibility_AttributeSet *retval; - AtkAttributeSet *attributes = NULL; - AtkAttribute *attr = NULL; - gint n_attributes = 0; - gint i; - - AtkObject *object = get_atkobject_from_servant (servant); - - g_return_val_if_fail (object != NULL, NULL); - attributes = atk_object_get_attributes (object); - - if (attributes) - n_attributes = g_slist_length (attributes); - - retval = CORBA_sequence_CORBA_string__alloc (); - retval->_length = retval->_maximum = n_attributes; - retval->_buffer = CORBA_sequence_CORBA_string_allocbuf (n_attributes); - CORBA_sequence_set_release (retval, CORBA_TRUE); - - for (i = 0; i < n_attributes; ++i) + gint i; + + if (accessible_state_types || atk_state_types) + return FALSE; + if (!accessible_state_types) + accessible_state_types = + g_new (Accessibility_StateType, ATK_STATE_LAST_DEFINED); + if (!atk_state_types) + atk_state_types = g_new (AtkStateType, Accessibility_STATE_LAST_DEFINED); + g_return_val_if_fail (accessible_state_types, FALSE); + g_return_val_if_fail (atk_state_types, FALSE); + + for (i = 0; i < Accessibility_STATE_LAST_DEFINED; i++) { - attr = g_slist_nth_data (attributes, i); - retval->_buffer[i] = CORBA_string_dup (g_strconcat (attr->name, ":", attr->value, NULL)); + atk_state_types[i] = ATK_STATE_INVALID; } - atk_attribute_set_free (attributes); - - return retval; -} + for (i = 0; i < ATK_STATE_LAST_DEFINED; i++) + { + accessible_state_types[i] = Accessibility_STATE_INVALID; + } -static void -spi_accessible_class_init (SpiAccessibleClass *klass) -{ - POA_Accessibility_Accessible__epv *epv = &klass->epv; - - epv->_get_name = impl_accessibility_accessible_get_name; - epv->_set_name = impl_accessibility_accessible_set_name; - epv->_get_description = impl_accessibility_accessible_get_description; - epv->_set_description = impl_accessibility_accessible_set_description; - - epv->_get_parent = impl_accessibility_accessible_get_parent; - epv->_get_childCount = impl_accessibility_accessible_get_child_count; - epv->getChildAtIndex = impl_accessibility_accessible_get_child_at_index; - epv->getIndexInParent = impl_accessibility_accessible_get_index_in_parent; - - epv->getRelationSet = impl_accessibility_accessible_get_relation_set; - epv->getState = impl_accessibility_accessible_get_state; - epv->getRole = impl_accessibility_accessible_get_role; - epv->getRoleName = impl_accessibility_accessible_get_role_name; - epv->getLocalizedRoleName = impl_accessibility_accessible_get_local_role_name; - epv->getApplication = impl_accessibility_accessible_get_application; - epv->getAttributes = impl_accessibility_accessible_get_attributes; + accessible_state_types[ATK_STATE_ACTIVE] = Accessibility_STATE_ACTIVE; + atk_state_types[Accessibility_STATE_ACTIVE] = ATK_STATE_ACTIVE; + accessible_state_types[ATK_STATE_ARMED] = Accessibility_STATE_ARMED; + atk_state_types[Accessibility_STATE_ARMED] = ATK_STATE_ARMED; + accessible_state_types[ATK_STATE_BUSY] = Accessibility_STATE_BUSY; + atk_state_types[Accessibility_STATE_BUSY] = ATK_STATE_BUSY; + accessible_state_types[ATK_STATE_CHECKED] = Accessibility_STATE_CHECKED; + atk_state_types[Accessibility_STATE_CHECKED] = ATK_STATE_CHECKED; + accessible_state_types[ATK_STATE_DEFUNCT] = Accessibility_STATE_DEFUNCT; + atk_state_types[Accessibility_STATE_DEFUNCT] = ATK_STATE_DEFUNCT; + accessible_state_types[ATK_STATE_EDITABLE] = Accessibility_STATE_EDITABLE; + atk_state_types[Accessibility_STATE_EDITABLE] = ATK_STATE_EDITABLE; + accessible_state_types[ATK_STATE_ENABLED] = Accessibility_STATE_ENABLED; + atk_state_types[Accessibility_STATE_ENABLED] = ATK_STATE_ENABLED; + accessible_state_types[ATK_STATE_EXPANDABLE] = + Accessibility_STATE_EXPANDABLE; + atk_state_types[Accessibility_STATE_EXPANDABLE] = ATK_STATE_EXPANDABLE; + accessible_state_types[ATK_STATE_EXPANDED] = Accessibility_STATE_EXPANDED; + atk_state_types[Accessibility_STATE_EXPANDED] = ATK_STATE_EXPANDED; + accessible_state_types[ATK_STATE_FOCUSABLE] = Accessibility_STATE_FOCUSABLE; + atk_state_types[Accessibility_STATE_FOCUSABLE] = ATK_STATE_FOCUSABLE; + accessible_state_types[ATK_STATE_FOCUSED] = Accessibility_STATE_FOCUSED; + atk_state_types[Accessibility_STATE_FOCUSED] = ATK_STATE_FOCUSED; + accessible_state_types[ATK_STATE_HORIZONTAL] = + Accessibility_STATE_HORIZONTAL; + atk_state_types[Accessibility_STATE_HORIZONTAL] = ATK_STATE_HORIZONTAL; + accessible_state_types[ATK_STATE_ICONIFIED] = Accessibility_STATE_ICONIFIED; + atk_state_types[Accessibility_STATE_ICONIFIED] = ATK_STATE_ICONIFIED; + accessible_state_types[ATK_STATE_MODAL] = Accessibility_STATE_MODAL; + atk_state_types[Accessibility_STATE_MODAL] = ATK_STATE_MODAL; + accessible_state_types[ATK_STATE_MULTI_LINE] = + Accessibility_STATE_MULTI_LINE; + atk_state_types[Accessibility_STATE_MULTI_LINE] = ATK_STATE_MULTI_LINE; + accessible_state_types[ATK_STATE_MULTISELECTABLE] = + Accessibility_STATE_MULTISELECTABLE; + atk_state_types[Accessibility_STATE_MULTISELECTABLE] = + ATK_STATE_MULTISELECTABLE; + accessible_state_types[ATK_STATE_OPAQUE] = Accessibility_STATE_OPAQUE; + atk_state_types[Accessibility_STATE_OPAQUE] = ATK_STATE_OPAQUE; + accessible_state_types[ATK_STATE_PRESSED] = Accessibility_STATE_PRESSED; + atk_state_types[Accessibility_STATE_PRESSED] = ATK_STATE_PRESSED; + accessible_state_types[ATK_STATE_RESIZABLE] = Accessibility_STATE_RESIZABLE; + atk_state_types[Accessibility_STATE_RESIZABLE] = ATK_STATE_RESIZABLE; + accessible_state_types[ATK_STATE_SELECTABLE] = + Accessibility_STATE_SELECTABLE; + atk_state_types[Accessibility_STATE_SELECTABLE] = ATK_STATE_SELECTABLE; + accessible_state_types[ATK_STATE_SELECTED] = Accessibility_STATE_SELECTED; + atk_state_types[Accessibility_STATE_SELECTED] = ATK_STATE_SELECTED; + accessible_state_types[ATK_STATE_SENSITIVE] = Accessibility_STATE_SENSITIVE; + atk_state_types[Accessibility_STATE_SENSITIVE] = ATK_STATE_SENSITIVE; + accessible_state_types[ATK_STATE_SHOWING] = Accessibility_STATE_SHOWING; + atk_state_types[Accessibility_STATE_SHOWING] = ATK_STATE_SHOWING; + accessible_state_types[ATK_STATE_SINGLE_LINE] = + Accessibility_STATE_SINGLE_LINE; + atk_state_types[Accessibility_STATE_SINGLE_LINE] = ATK_STATE_SINGLE_LINE; + accessible_state_types[ATK_STATE_STALE] = Accessibility_STATE_STALE; + atk_state_types[Accessibility_STATE_STALE] = ATK_STATE_STALE; + accessible_state_types[ATK_STATE_TRANSIENT] = Accessibility_STATE_TRANSIENT; + atk_state_types[Accessibility_STATE_TRANSIENT] = ATK_STATE_TRANSIENT; + accessible_state_types[ATK_STATE_VERTICAL] = Accessibility_STATE_VERTICAL; + atk_state_types[Accessibility_STATE_VERTICAL] = ATK_STATE_VERTICAL; + accessible_state_types[ATK_STATE_VISIBLE] = Accessibility_STATE_VISIBLE; + atk_state_types[Accessibility_STATE_VISIBLE] = ATK_STATE_VISIBLE; + accessible_state_types[ATK_STATE_MANAGES_DESCENDANTS] = + Accessibility_STATE_MANAGES_DESCENDANTS; + atk_state_types[Accessibility_STATE_MANAGES_DESCENDANTS] = + ATK_STATE_MANAGES_DESCENDANTS; + accessible_state_types[ATK_STATE_INDETERMINATE] = + Accessibility_STATE_INDETERMINATE; + atk_state_types[Accessibility_STATE_INDETERMINATE] = + ATK_STATE_INDETERMINATE; + accessible_state_types[ATK_STATE_TRUNCATED] = Accessibility_STATE_TRUNCATED; + atk_state_types[Accessibility_STATE_TRUNCATED] = ATK_STATE_TRUNCATED; + accessible_state_types[ATK_STATE_REQUIRED] = Accessibility_STATE_REQUIRED; + atk_state_types[Accessibility_STATE_REQUIRED] = ATK_STATE_REQUIRED; + accessible_state_types[ATK_STATE_INVALID_ENTRY] = + Accessibility_STATE_INVALID_ENTRY; + atk_state_types[Accessibility_STATE_INVALID_ENTRY] = + ATK_STATE_INVALID_ENTRY; + accessible_state_types[ATK_STATE_SUPPORTS_AUTOCOMPLETION] = + Accessibility_STATE_SUPPORTS_AUTOCOMPLETION; + atk_state_types[Accessibility_STATE_SUPPORTS_AUTOCOMPLETION] = + ATK_STATE_SUPPORTS_AUTOCOMPLETION; + accessible_state_types[ATK_STATE_SELECTABLE_TEXT] = + Accessibility_STATE_SELECTABLE_TEXT; + atk_state_types[Accessibility_STATE_SELECTABLE_TEXT] = + ATK_STATE_SELECTABLE_TEXT; + accessible_state_types[ATK_STATE_DEFAULT] = Accessibility_STATE_IS_DEFAULT; + atk_state_types[Accessibility_STATE_IS_DEFAULT] = ATK_STATE_DEFAULT; + accessible_state_types[ATK_STATE_VISITED] = Accessibility_STATE_VISITED; + atk_state_types[Accessibility_STATE_VISITED] = ATK_STATE_VISITED; + + + return TRUE; } static void -spi_accessible_init (SpiAccessible *accessible) +get_state (AtkObject * object, dbus_uint32_t * array) { -} - -BONOBO_TYPE_FUNC_FULL (SpiAccessible, - Accessibility_Accessible, - PARENT_TYPE, - spi_accessible) + AtkStateSet *set = atk_object_ref_state_set (object); + int i; -static GHashTable *public_corba_refs = NULL; + array[0] = 0; + array[1] = 0; + if (!set) + return; + spi_init_state_type_tables (); -static GHashTable * -get_public_refs (void) -{ - if (!public_corba_refs) + g_assert (ATK_STATE_LAST_DEFINED <= 64); + for (i = 0; i < ATK_STATE_LAST_DEFINED; i++) { - public_corba_refs = g_hash_table_new (NULL, NULL); + if (atk_state_set_contains_state (set, i)) + { + int a = accessible_state_types[i]; + g_assert (a < 64); + BITARRAY_SET (array, a); + } } - return public_corba_refs; + g_object_unref (set); } -static void -de_register_public_ref (SpiBase *object) +static DBusMessage * +impl_getState (DBusConnection * bus, DBusMessage * message, void *user_data) { - g_hash_table_remove (get_public_refs (), object->gobj); + AtkObject *object = get_object (message); + dbus_uint32_t rv[2]; + DBusMessage *reply; + + if (!object) + return spi_dbus_general_error (message); + get_state (object, rv); + reply = dbus_message_new_method_return (message); + if (reply) + { + dbus_message_append_args (reply, DBUS_TYPE_ARRAY, DBUS_TYPE_INT32, &rv, + 2, DBUS_TYPE_INVALID); + } + return reply; } -SpiAccessible * -spi_accessible_new (AtkObject *o) +static DBusMessage * +impl_getAttributes (DBusConnection * bus, DBusMessage * message, + void *user_data) { - return spi_accessible_construct (SPI_ACCESSIBLE_TYPE, o); -} + AtkObject *object = get_object (message); + DBusMessage *reply; + AtkAttributeSet *attributes; + AtkAttribute *attr = NULL; + char **retval; + gint n_attributes = 0; + gint i; -SpiAccessible * -spi_accessible_construct (GType type, AtkObject *o) -{ - SpiAccessible *retval; - CORBA_Environment ev; - - CORBA_exception_init (&ev); - - g_assert (o); - g_assert (g_type_is_a (type, SPI_ACCESSIBLE_TYPE)); - - if ((retval = g_hash_table_lookup (get_public_refs (), o))) - { - bonobo_object_ref (BONOBO_OBJECT (retval)); - return retval; - } - else - { - retval = g_object_new (type, NULL); - spi_base_construct (SPI_BASE (retval), G_OBJECT(o)); - } - - g_hash_table_insert (get_public_refs (), o, retval); - g_signal_connect (G_OBJECT (retval), "destroy", - G_CALLBACK (de_register_public_ref), - NULL); - - /* aggregate appropriate SPI interfaces based on ATK interfaces */ - - if (ATK_IS_ACTION (o)) - { - bonobo_object_add_interface (bonobo_object (retval), - BONOBO_OBJECT (spi_action_interface_new (o))); - } - - if (ATK_IS_COMPONENT (o)) - { - bonobo_object_add_interface (bonobo_object (retval), - BONOBO_OBJECT (spi_component_interface_new (o))); - } - - if (ATK_IS_EDITABLE_TEXT (o)) - { - bonobo_object_add_interface (bonobo_object (retval), - BONOBO_OBJECT(spi_editable_text_interface_new (o))); - } - - else if (ATK_IS_TEXT (o)) - { - bonobo_object_add_interface (bonobo_object (retval), - BONOBO_OBJECT (spi_text_interface_new (o))); - } - - if (ATK_IS_HYPERTEXT (o)) - { - bonobo_object_add_interface (bonobo_object (retval), - BONOBO_OBJECT (spi_hypertext_interface_new (o))); - } - - if (ATK_IS_IMAGE (o)) - { - bonobo_object_add_interface (bonobo_object (retval), - BONOBO_OBJECT (spi_image_interface_new (o))); - } - - if (ATK_IS_SELECTION (o)) - { - bonobo_object_add_interface (bonobo_object (retval), - BONOBO_OBJECT (spi_selection_interface_new (o))); - } - - if (ATK_IS_TABLE (o)) - { - bonobo_object_add_interface (bonobo_object (retval), - BONOBO_OBJECT (spi_table_interface_new (o))); - } - - if (ATK_IS_VALUE (o)) - { - bonobo_object_add_interface (bonobo_object (retval), - BONOBO_OBJECT (spi_value_interface_new (o))); - } - - if (ATK_IS_STREAMABLE_CONTENT (o)) - { - bonobo_object_add_interface (bonobo_object (retval), - BONOBO_OBJECT (spi_streamable_interface_new (o))); - } - if (ATK_IS_DOCUMENT (o)) /* We add collection interface to document */ - { - - - SpiDocument *doc = spi_document_interface_new (o); - bonobo_object_add_interface (BONOBO_OBJECT (doc), - BONOBO_OBJECT (spi_collection_interface_new (o))); - - bonobo_object_add_interface (bonobo_object (retval), - BONOBO_OBJECT (doc)); - } - if (ATK_IS_HYPERLINK_IMPL (o)) - { - /* !!! the cast below is used instead of the ATK_HYPERLINK macro, since - the object 'o' is not really a hyperlink, but is in fact an AtkHyperlinkImpl. - Ouch. This works since it gets cast back to GObject, but it's nasty and needs - to be cleaned up. - */ - bonobo_object_add_interface (bonobo_object (retval), - BONOBO_OBJECT (spi_hyperlink_new ((AtkHyperlink*)o))); - } - - return retval; -} + if (!object) + return spi_dbus_general_error (message); -/** - * spi_accessible_new_return: - * @o: an AtkObject or NULL - * @release_ref: whether to unref this AtkObject before return - * @ev: a CORBA environment - * - * A helper function to instantiate a CORBA accessiblility - * proxy from an AtkObject. - * - * Return value: the proxy or CORBA_OBJECT_NIL - **/ -Accessibility_Accessible -spi_accessible_new_return (AtkObject *o, - gboolean release_ref, - CORBA_Environment *ev) -{ - SpiAccessible *accessible; - Accessibility_Accessible retval; + attributes = atk_object_get_attributes (object); + if (attributes) + n_attributes = g_slist_length (attributes); - if (!o) - { - return CORBA_OBJECT_NIL; - } - else if (SPI_IS_REMOTE_OBJECT (o)) + retval = (char **) g_malloc (n_attributes * sizeof (char *)); + + for (i = 0; i < n_attributes; ++i) { - retval = spi_remote_object_get_accessible (SPI_REMOTE_OBJECT (o)); + attr = g_slist_nth_data (attributes, i); + retval[i] = g_strconcat (attr->name, ":", attr->value, NULL); } - else + if (attributes) + atk_attribute_set_free (attributes); + reply = dbus_message_new_method_return (message); + if (reply) { - accessible = spi_accessible_construct (SPI_ACCESSIBLE_TYPE, o); - retval = CORBA_Object_duplicate (BONOBO_OBJREF (accessible), ev); + dbus_message_append_args (reply, DBUS_TYPE_ARRAY, DBUS_TYPE_STRING, + &retval, n_attributes, DBUS_TYPE_INVALID); } + for (i = 0; i < n_attributes; i++) + g_free (retval[i]); + g_free (retval); + return reply; +} - if (release_ref) - { - g_object_unref (G_OBJECT (o)); - } - - return retval; +static DBusMessage * +impl_getApplication (DBusConnection * bus, DBusMessage * message, + void *user_data) +{ + AtkObject *root = atk_get_root (); + return spi_dbus_return_object (message, root, FALSE); } + +// TODO: sync spec with updates made here +static DRouteMethod methods[] = { + //{ DROUTE_METHOD, impl_isEqual, "isEqual", "o,obj,i:b,,o" }, + {DROUTE_METHOD, impl_getChildren, "getChildren", "ao,,o"}, + {DROUTE_METHOD, impl_getIndexInParent, "getIndexInParent", "i,,o"}, + //{ DROUTE_METHOD, impl_getRelationSet, "getRelationSet", "a{so},,o" }, + {DROUTE_METHOD, impl_getRole, "getRole", "u,,o"}, + {DROUTE_METHOD, impl_getRoleName, "getRoleName", "s,,o"}, + {DROUTE_METHOD, impl_getLocalizedRoleName, "getLocalizedRoleName", "s,,o"}, + {DROUTE_METHOD, impl_getState, "getState", "o,,au"}, + {DROUTE_METHOD, impl_getAttributes, "getAttributes", "as,,o"}, + {DROUTE_METHOD, impl_getApplication, "getApplication", "o,,o"}, + {0, NULL, NULL, NULL} +}; + +static DRouteProperty properties[] = { + {impl_get_name, impl_get_name_str, impl_set_name, NULL, "name", "s"}, + {impl_get_description, impl_get_description_str, impl_set_description, NULL, + "description", "s"}, + {impl_get_parent, impl_get_parent_str, NULL, NULL, "parent", "o"}, + //{ impl_get_childCount, impl_get_childCount_str, NULL, NULL, "childCount", "n" }, + {NULL, impl_get_role_str, NULL, NULL, "role", "u"}, + {NULL, NULL, NULL, NULL, NULL, NULL} +}; + +void +spi_initialize_accessible (DRouteData * data) +{ + droute_add_interface (data, "org.freedesktop.accessibility.Accessible", + methods, properties, + (DRouteGetDatumFunction) get_object_from_path, NULL); +}; diff --git a/libspi/application.c b/libspi/application.c index fba42cf..c99064f 100644 --- a/libspi/application.c +++ b/libspi/application.c @@ -2,6 +2,7 @@ * AT-SPI - Assistive Technology Service Provider Interface * (Gnome Accessibility Project; http://developer.gnome.org/projects/gap) * + * Copyright 2008 Novell, Inc. * Copyright 2001, 2002 Sun Microsystems Inc., * Copyright 2001, 2002 Ximian, Inc. * @@ -20,278 +21,112 @@ * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ +#include "accessible.h" -/* application.c: implements SpiApplication.idl */ -#include -#include -#include -#include -#include -#include -#include "spi-private.h" - -/* Our parent Gtk object type */ -#define PARENT_TYPE SPI_ACCESSIBLE_TYPE - -/* A pointer to our parent object class */ -static SpiAccessibleClass *spi_application_parent_class; - -static SpiApplication *the_app; - -/* static methods */ - -static void notify_listeners (GList *listeners, - SpiAccessible *source, - Accessibility_Event *e); - -/* - * Implemented GObject::finalize - */ -static void -spi_accessible_application_finalize (GObject *object) +static dbus_bool_t +impl_get_toolkitName (const char *path, DBusMessageIter * iter, + void *user_data) { - GList *l; - SpiApplication *application = (SpiApplication *) object; - CORBA_Environment ev; - - CORBA_exception_init (&ev); - - for (l = application->toolkit_listeners; l; l = l->next) - { - CORBA_Object_release ((CORBA_Object) l->data, &ev); - } - - CORBA_exception_free (&ev); - - g_list_free (application->toolkit_listeners); - application->toolkit_listeners = NULL; - - (G_OBJECT_CLASS (spi_application_parent_class))->finalize (object); + return droute_return_v_string (iter, atk_get_toolkit_name ()); } -static CORBA_string -impl_accessibility_application_get_toolkit_name (PortableServer_Servant servant, - CORBA_Environment *ev) +static char * +impl_get_toolkitName_str (void *datum) { - return CORBA_string_dup (atk_get_toolkit_name ()); + return g_strdup (atk_get_toolkit_name ()); } -static CORBA_string -impl_accessibility_application_get_version (PortableServer_Servant servant, - CORBA_Environment *ev) +static dbus_bool_t +impl_get_version (const char *path, DBusMessageIter * iter, void *user_data) { - return CORBA_string_dup (atk_get_toolkit_version ()); + return droute_return_v_string (iter, atk_get_toolkit_version ()); } -static CORBA_long -impl_accessibility_application_get_id (PortableServer_Servant servant, - CORBA_Environment *ev) +static char * +impl_get_version_str (void *datum) { - SpiApplication *application = SPI_APPLICATION ( - bonobo_object_from_servant (servant)); - - return application->id; + return g_strdup (atk_get_toolkit_version ()); } -static void -impl_accessibility_application_set_id (PortableServer_Servant servant, - const CORBA_long id, - CORBA_Environment *ev) -{ - SpiApplication *application = SPI_APPLICATION ( - bonobo_object_from_servant (servant)); +static dbus_int32_t id; - application->id = id; +static dbus_bool_t +impl_get_id (const char *path, DBusMessageIter * iter, void *user_data) +{ + return droute_return_v_int32 (iter, id); } -static AtkObject * -get_atk_object_ref (GObject *gobject) +static char * +impl_get_id_str (void *datum) { - AtkObject *aobject; - - if (ATK_IS_IMPLEMENTOR (gobject)) - { - aobject = atk_implementor_ref_accessible (ATK_IMPLEMENTOR (gobject)); - } - else if (ATK_IS_OBJECT (gobject)) - { - aobject = ATK_OBJECT (gobject); - g_object_ref (G_OBJECT (aobject)); - } - else - { - aobject = NULL; - g_error ("received event from non-AtkImplementor"); - } - - return aobject; + return g_strdup_printf ("%d", id); } -static gboolean -spi_application_toolkit_event_listener (GSignalInvocationHint *signal_hint, - guint n_param_values, - const GValue *param_values, - gpointer data) +static dbus_bool_t +impl_set_id (const char *path, DBusMessageIter * iter, void *user_data) { - Accessibility_Event e; - AtkObject *aobject; - SpiAccessible *source; - GSignalQuery signal_query; - char *event_name; - - g_return_val_if_fail (the_app != NULL, FALSE); - - g_signal_query (signal_hint->signal_id, &signal_query); - - /* TODO: move GTK reference out of app.c into bridge */ - event_name = g_strdup_printf ("Gtk:%s:%s", - g_type_name (signal_query.itype), - signal_query.signal_name); - -#ifdef SPI_DEBUG - fprintf (stderr, "Received signal %s\n", event_name); -#endif - - aobject = get_atk_object_ref (g_value_get_object (param_values + 0)); - - source = spi_accessible_new (aobject); - e.type = CORBA_string_dup (event_name); - e.source = CORBA_OBJECT_NIL; - e.detail1 = 0; - e.detail2 = 0; - spi_init_any_nil (&e.any_data, - spi_accessible_new_return (atk_get_root (), FALSE, NULL), - Accessibility_ROLE_UNKNOWN, - ""); - notify_listeners (the_app->toolkit_listeners, source, &e); - - bonobo_object_unref (BONOBO_OBJECT (source)); - g_object_unref (G_OBJECT (aobject)); - - g_free (event_name); - + id = droute_get_v_int32 (iter); return TRUE; } -static CORBA_string -impl_accessibility_application_get_locale (PortableServer_Servant servant, - Accessibility_LOCALE_TYPE lctype, - CORBA_Environment *ev) +static DBusMessage * +impl_registerToolkitEventListener (DBusConnection * bus, + DBusMessage * message, void *user_data) { - int category; - switch (lctype) - { - case Accessibility_LOCALE_TYPE_COLLATE: - category = LC_COLLATE; - break; - case Accessibility_LOCALE_TYPE_CTYPE: - category = LC_CTYPE; - break; - case Accessibility_LOCALE_TYPE_MONETARY: - category = LC_MONETARY; - break; - case Accessibility_LOCALE_TYPE_NUMERIC: - category = LC_NUMERIC; - break; - case Accessibility_LOCALE_TYPE_MESSAGES: - default: - category = LC_MESSAGES; - break; - } - return CORBA_string_dup (setlocale (category, NULL)); } -static void -impl_accessibility_application_register_toolkit_event_listener (PortableServer_Servant servant, - Accessibility_EventListener listener, - const CORBA_char *event_name, - CORBA_Environment *ev) +static DBusMessage * +impl_registerObjectEventListener (DBusConnection * bus, DBusMessage * message, + void *user_data) { - guint spi_listener_id; - spi_listener_id = - atk_add_global_event_listener (spi_application_toolkit_event_listener, event_name); - the_app->toolkit_listeners = g_list_append (the_app->toolkit_listeners, - CORBA_Object_duplicate (listener, ev)); -#ifdef SPI_DEBUG - fprintf (stderr, "registered %d for toolkit events named: %s\n", - spi_listener_id, - event_name); -#endif } -static void -notify_listeners (GList *listeners, SpiAccessible *source, Accessibility_Event *e) +static DBusMessage * +impl_pause (DBusConnection * bus, DBusMessage * message, void *user_data) { - GList *l; - CORBA_Environment ev; - - CORBA_exception_init (&ev); - - for (l = listeners; l; l = l->next) - { - Accessibility_EventListener listener = l->data; - - e->source = bonobo_object_dup_ref (BONOBO_OBJREF (source), &ev); - - Accessibility_EventListener_notifyEvent (listener, e, &ev); - /* - * when this (oneway) call completes, the CORBA refcount and - * Bonobo_Unknown refcount will be decremented by the recipient - */ - CORBA_exception_free (&ev); - } } -static void -init_toolkit_names (GHashTable **generic_event_names, GHashTable **toolkit_event_names) +static DBusMessage * +impl_resume (DBusConnection * bus, DBusMessage * message, void *user_data) { - *toolkit_event_names = g_hash_table_new (g_str_hash, g_str_equal); - *generic_event_names = g_hash_table_new (g_str_hash, g_str_equal); - g_hash_table_insert (*toolkit_event_names, - "object:property-change", - "Gtk:AtkObject:property-change"); - g_hash_table_insert (*generic_event_names, - "Gtk:AtkObject:property-change", - "object:property-change"); -#ifdef SPI_DEBUG - fprintf (stderr, "inserted spi_selection_changed hash\n"); -#endif } -static void -spi_application_class_init (SpiApplicationClass *klass) +static DBusMessage * +impl_getLocale (DBusConnection * bus, DBusMessage * message, void *user_data) { - GObjectClass * object_class = (GObjectClass *) klass; - POA_Accessibility_Application__epv *epv = &klass->epv; - - spi_application_parent_class = g_type_class_ref (SPI_ACCESSIBLE_TYPE); - - object_class->finalize = spi_accessible_application_finalize; - - epv->_get_toolkitName = impl_accessibility_application_get_toolkit_name; - epv->_get_version = impl_accessibility_application_get_version; - epv->_get_id = impl_accessibility_application_get_id; - epv->_set_id = impl_accessibility_application_set_id; - epv->registerToolkitEventListener = impl_accessibility_application_register_toolkit_event_listener; - epv->getLocale = impl_accessibility_application_get_locale; - init_toolkit_names (&klass->generic_event_names, &klass->toolkit_event_names); } -static void -spi_application_init (SpiApplication *application) +static DRouteMethod methods[] = { + {DROUTE_METHOD, impl_registerToolkitEventListener, + "registerToolkitEventListener", "o,listener,i:s,eventName,i"}, + {DROUTE_METHOD, impl_registerObjectEventListener, + "registerObjectEventListener", "o,listener,i:s,eventName,i"}, + {DROUTE_METHOD, impl_pause, "pause", "b,,o"}, + {DROUTE_METHOD, impl_resume, "resume", "b,,o"}, + {DROUTE_METHOD, impl_getLocale, "getLocale", "u,lctype,i:s,,o"}, + {0, NULL, NULL, NULL} +}; + +static DRouteProperty properties[] = { + {impl_get_toolkitName, impl_get_toolkitName_str, NULL, NULL, "toolkitName", + "s"}, + {impl_get_version, impl_get_version_str, NULL, NULL, "version", "s"}, + {impl_get_id, impl_get_id_str, impl_set_id, NULL, "id", "i"}, + {NULL, NULL, NULL, NULL, NULL, NULL} +}; + +static long +obj_is_root (const char *path, void *user_data) { - application->toolkit_listeners = NULL; - the_app = application; + AtkObject *obj = spi_dbus_get_object (path); + return (obj == atk_get_root ()); } -BONOBO_TYPE_FUNC_FULL (SpiApplication, - Accessibility_Application, - PARENT_TYPE, spi_application) - -SpiApplication * -spi_application_new (AtkObject *app_root) +void +spi_initialize_application (DRouteData * data) { - return SPI_APPLICATION (spi_accessible_construct ( - SPI_APPLICATION_TYPE, app_root)); -} + droute_add_interface (data, "org.freedesktop.accessibility.Application", + methods, properties, + (DRouteGetDatumFunction) obj_is_root, NULL); +}; diff --git a/libspi/component.c b/libspi/component.c index 9b179a3..7526dc4 100644 --- a/libspi/component.c +++ b/libspi/component.c @@ -2,6 +2,7 @@ * AT-SPI - Assistive Technology Service Provider Interface * (Gnome Accessibility Project; http://developer.gnome.org/projects/gap) * + * Copyright 2008 Novell, Inc. * Copyright 2001, 2002 Sun Microsystems Inc., * Copyright 2001, 2002 Ximian, Inc. * @@ -21,230 +22,298 @@ * Boston, MA 02111-1307, USA. */ -/* component.c : implements the Component interface */ - -#include -#include -#include -#include - -/* Our parent Gtk object type */ -#define PARENT_TYPE SPI_TYPE_BASE - -/* A pointer to our parent object class */ -static GObjectClass *spi_component_parent_class; +#include "accessible.h" static AtkComponent * -get_component_from_servant (PortableServer_Servant servant) +get_component (DBusMessage * message) { - SpiBase *object = SPI_BASE (bonobo_object_from_servant (servant)); - g_return_val_if_fail (object != NULL, NULL); - g_return_val_if_fail (ATK_IS_OBJECT(object->gobj), NULL); - return ATK_COMPONENT (object->gobj); + AtkObject *obj = spi_dbus_get_object (dbus_message_get_path (message)); + if (!obj) + return NULL; + return ATK_COMPONENT (obj); } -/* - * CORBA Accessibility::Component::contains method implementation - */ -static CORBA_boolean -impl_accessibility_component_contains (PortableServer_Servant servant, - const CORBA_long x, - const CORBA_long y, - CORBA_short coord_type, - CORBA_Environment *ev) +static AtkComponent * +get_component_from_path (const char *path, void *user_data) { - CORBA_boolean retval; - AtkComponent *component = get_component_from_servant (servant); - - g_return_val_if_fail (component != NULL, FALSE); - - retval = atk_component_contains (component, x, y, - (AtkCoordType) coord_type); - return retval; + AtkObject *obj = spi_dbus_get_object (path); + if (!obj) + return NULL; + return ATK_COMPONENT (obj); } -/* - * CORBA Accessibility::Component::getAccessibleAtPoint method implementation - */ -static Accessibility_Accessible -impl_accessibility_component_get_accessible_at_point (PortableServer_Servant servant, - const CORBA_long x, - const CORBA_long y, - CORBA_short coord_type, - CORBA_Environment *ev) +static DBusMessage * +impl_contains (DBusConnection * bus, DBusMessage * message, void *user_data) { - AtkObject *child; - AtkComponent *component = get_component_from_servant (servant); - - g_return_val_if_fail (component != NULL, NULL); - - child = atk_component_ref_accessible_at_point (component, - x, y, - (AtkCoordType) coord_type); - return spi_accessible_new_return (child, TRUE, ev); + AtkComponent *component = get_component (message); + dbus_int32_t x, y; + dbus_uint32_t coord_type; + DBusError error; + dbus_bool_t retval; + DBusMessage *reply; + + if (!component) + return spi_dbus_general_error (message); + dbus_error_init (&error); + if (!dbus_message_get_args + (message, &error, DBUS_TYPE_INT32, &x, DBUS_TYPE_UINT32, &y, + DBUS_TYPE_INT32, &coord_type, DBUS_TYPE_INVALID)) + { + return SPI_DBUS_RETURN_ERROR (message, &error); + } + retval = + atk_component_contains (component, x, y, (AtkCoordType) coord_type); + reply = dbus_message_new_method_return (message); + if (reply) + { + dbus_message_append_args (reply, DBUS_TYPE_BOOLEAN, &retval, + DBUS_TYPE_INVALID); + } + return reply; } -/* - * CORBA Accessibility::Component::getExtents method implementation - */ -static Accessibility_BoundingBox -impl_accessibility_component_get_extents (PortableServer_Servant servant, - const CORBA_short coord_type, - CORBA_Environment *ev) +static DBusMessage * +impl_getAccessibleAtPoint (DBusConnection * bus, DBusMessage * message, + void *user_data) { - gint ix, iy, iw, ih; - Accessibility_BoundingBox retval; - AtkComponent *component = get_component_from_servant (servant); + AtkComponent *component = get_component (message); + dbus_int32_t x, y; + dbus_uint32_t coord_type; + DBusError error; + AtkObject *child; + + if (!component) + return spi_dbus_general_error (message); + dbus_error_init (&error); + if (!dbus_message_get_args + (message, &error, DBUS_TYPE_INT32, &x, DBUS_TYPE_INT32, &y, + DBUS_TYPE_UINT32, &coord_type, DBUS_TYPE_INVALID)) + { + return SPI_DBUS_RETURN_ERROR (message, &error); + } + child = + atk_component_ref_accessible_at_point (component, x, y, + (AtkCoordType) coord_type); + return spi_dbus_return_object (message, child, TRUE); +} - atk_component_get_extents (component, &ix, &iy, &iw, &ih, +static DBusMessage * +impl_getExtents (DBusConnection * bus, DBusMessage * message, void *user_data) +{ + AtkComponent *component = get_component (message); + DBusError error; + dbus_uint32_t coord_type; + gint ix, iy, iwidth, iheight; + + if (!component) + return spi_dbus_general_error (message); + dbus_error_init (&error); + if (!dbus_message_get_args + (message, &error, DBUS_TYPE_UINT32, &coord_type, DBUS_TYPE_INVALID)) + { + return SPI_DBUS_RETURN_ERROR (message, &error); + } + atk_component_get_extents (component, &ix, &iy, &iwidth, &iheight, (AtkCoordType) coord_type); - - retval.x = ix; - retval.y = iy; - retval.width = iw; - retval.height = ih; - - return retval; + return spi_dbus_return_rect (message, ix, iy, iwidth, iheight); } -/* - * CORBA Accessibility::Component::getPosition method implementation - */ -static void -impl_accessibility_component_get_position (PortableServer_Servant servant, - CORBA_long * x, - CORBA_long * y, - const CORBA_short coord_type, - CORBA_Environment *ev) +static DBusMessage * +impl_getPosition (DBusConnection * bus, DBusMessage * message, + void *user_data) { - gint ix, iy; - AtkComponent *component = get_component_from_servant (servant); - - g_return_if_fail (component != NULL); - - atk_component_get_position (component, &ix, &iy, - (AtkCoordType) coord_type); - *x = ix; - *y = iy; + AtkComponent *component = get_component (message); + DBusError error; + dbus_uint32_t coord_type; + gint ix = 0, iy = 0; + dbus_int32_t x, y; + DBusMessage *reply; + + if (!component) + return spi_dbus_general_error (message); + dbus_error_init (&error); + if (!dbus_message_get_args + (message, &error, DBUS_TYPE_UINT32, &coord_type, DBUS_TYPE_INVALID)) + { + return SPI_DBUS_RETURN_ERROR (message, &error); + } + atk_component_get_position (component, &ix, &iy, (AtkCoordType) coord_type); + x = ix; + y = iy; + reply = dbus_message_new_method_return (message); + if (reply) + { + dbus_message_append_args (reply, DBUS_TYPE_INT32, &x, DBUS_TYPE_INT32, + &y, DBUS_TYPE_INVALID); + } + return reply; } -/* - * CORBA Accessibility::Component::getSize method implementation - */ -static void -impl_accessibility_component_get_size (PortableServer_Servant servant, - CORBA_long * width, - CORBA_long * height, - CORBA_Environment *ev) +static DBusMessage * +impl_getSize (DBusConnection * bus, DBusMessage * message, void *user_data) { - gint iw, ih; - AtkComponent *component = get_component_from_servant (servant); - - g_return_if_fail (component != NULL); - - atk_component_get_size (component, &iw, &ih); - *width = iw; - *height = ih; + AtkComponent *component = get_component (message); + gint iwidth = 0, iheight = 0; + dbus_int32_t width, height; + DBusMessage *reply; + + if (!component) + return spi_dbus_general_error (message); + atk_component_get_size (component, &iwidth, &iheight); + width = iwidth; + height = iheight; + reply = dbus_message_new_method_return (message); + if (reply) + { + dbus_message_append_args (reply, DBUS_TYPE_INT32, &width, + DBUS_TYPE_INT32, &height, DBUS_TYPE_INVALID); + } + return reply; } -static Accessibility_ComponentLayer -impl_accessibility_component_get_layer (PortableServer_Servant servant, - CORBA_Environment *ev) +static DBusMessage * +impl_getLayer (DBusConnection * bus, DBusMessage * message, void *user_data) { - AtkLayer atklayer; - AtkComponent *component = get_component_from_servant (servant); - - g_return_val_if_fail (component != NULL, Accessibility_LAYER_INVALID); + AtkComponent *component = get_component (message); + AtkLayer atklayer; + dbus_uint32_t rv; + DBusMessage *reply; + if (!component) + return spi_dbus_general_error (message); atklayer = atk_component_get_layer (component); + switch (atklayer) { - case ATK_LAYER_BACKGROUND: - return Accessibility_LAYER_BACKGROUND; - case ATK_LAYER_CANVAS: - return Accessibility_LAYER_CANVAS; - case ATK_LAYER_WIDGET: - return Accessibility_LAYER_WIDGET; - case ATK_LAYER_MDI: - return Accessibility_LAYER_MDI; - case ATK_LAYER_POPUP: - return Accessibility_LAYER_POPUP; - case ATK_LAYER_OVERLAY: - return Accessibility_LAYER_OVERLAY; - case ATK_LAYER_WINDOW: - return Accessibility_LAYER_WINDOW; - default: - break; + case ATK_LAYER_BACKGROUND: + rv = Accessibility_LAYER_BACKGROUND; + break; + case ATK_LAYER_CANVAS: + rv = Accessibility_LAYER_CANVAS; + break; + case ATK_LAYER_WIDGET: + rv = Accessibility_LAYER_WIDGET; + break; + case ATK_LAYER_MDI: + rv = Accessibility_LAYER_MDI; + break; + case ATK_LAYER_POPUP: + rv = Accessibility_LAYER_POPUP; + break; + case ATK_LAYER_OVERLAY: + rv = Accessibility_LAYER_OVERLAY; + break; + case ATK_LAYER_WINDOW: + rv = Accessibility_LAYER_WINDOW; + break; + default: + rv = Accessibility_LAYER_INVALID; + break; } - return Accessibility_LAYER_INVALID; + reply = dbus_message_new_method_return (message); + if (reply) + { + dbus_message_append_args (reply, DBUS_TYPE_UINT32, &rv, + DBUS_TYPE_INVALID); + } + return reply; } -static CORBA_short -impl_accessibility_component_get_mdi_z_order (PortableServer_Servant servant, - CORBA_Environment *ev) +static DBusMessage * +impl_getMDIZOrder (DBusConnection * bus, DBusMessage * message, + void *user_data) { - AtkComponent *component = get_component_from_servant (servant); - - g_return_val_if_fail (component != NULL, -1); - - return atk_component_get_mdi_zorder (component); + AtkComponent *component = get_component (message); + dbus_int16_t rv; + DBusMessage *reply; + + if (!component) + return spi_dbus_general_error (message); + rv = atk_component_get_mdi_zorder (component); + reply = dbus_message_new_method_return (message); + if (reply) + { + dbus_message_append_args (reply, DBUS_TYPE_UINT32, &rv, + DBUS_TYPE_INVALID); + } + return reply; } -static CORBA_boolean -impl_accessibility_component_grab_focus (PortableServer_Servant servant, - CORBA_Environment *ev) +static DBusMessage * +impl_grabFocus (DBusConnection * bus, DBusMessage * message, void *user_data) { - AtkComponent *component = get_component_from_servant (servant); - - g_return_val_if_fail (component != NULL, FALSE); - - return atk_component_grab_focus (component); + AtkComponent *component = get_component (message); + dbus_bool_t rv; + DBusMessage *reply; + + if (!component) + return spi_dbus_general_error (message); + rv = atk_component_grab_focus (component); + reply = dbus_message_new_method_return (message); + if (reply) + { + dbus_message_append_args (reply, DBUS_TYPE_UINT32, &rv, + DBUS_TYPE_INVALID); + } + return reply; } -static double -impl_accessibility_component_get_alpha (PortableServer_Servant servant, - CORBA_Environment *ev) +#if 0 +static DBusMessage * +impl_registerFocusHandler (DBusConnection * bus, DBusMessage * message, + void *user_data) { - AtkComponent *component = get_component_from_servant (servant); - - g_return_val_if_fail (component != NULL, FALSE); - - return atk_component_get_alpha (component); } -static void -spi_component_class_init (SpiComponentClass *klass) +static DBusMessage * +impl_deregisterFocusHandler (DBusConnection * bus, DBusMessage * message, + void *user_data) { - POA_Accessibility_Component__epv *epv = &klass->epv; - spi_component_parent_class = g_type_class_peek_parent (klass); - - epv->contains = impl_accessibility_component_contains; - epv->getAccessibleAtPoint = impl_accessibility_component_get_accessible_at_point; - epv->getExtents = impl_accessibility_component_get_extents; - epv->getPosition = impl_accessibility_component_get_position; - epv->getSize = impl_accessibility_component_get_size; - epv->getLayer = impl_accessibility_component_get_layer; - epv->getMDIZOrder = impl_accessibility_component_get_mdi_z_order; - epv->grabFocus = impl_accessibility_component_grab_focus; - epv->getAlpha = impl_accessibility_component_get_alpha; } +#endif -static void -spi_component_init (SpiComponent *component) +static DBusMessage * +impl_getAlpha (DBusConnection * bus, DBusMessage * message, void *user_data) { + AtkComponent *component = get_component (message); + double rv; + DBusMessage *reply; + + if (!component) + return spi_dbus_general_error (message); + rv = atk_component_get_alpha (component); + reply = dbus_message_new_method_return (message); + if (reply) + { + dbus_message_append_args (reply, DBUS_TYPE_DOUBLE, &rv, + DBUS_TYPE_INVALID); + } + return reply; } -BONOBO_TYPE_FUNC_FULL (SpiComponent, - Accessibility_Component, - PARENT_TYPE, - spi_component) - -SpiComponent * -spi_component_interface_new (AtkObject *o) +static DRouteMethod methods[] = { + {DROUTE_METHOD, impl_contains, "contains", + "i,x,i:i,y,i:u,coord_type,i:b,,o"}, + {DROUTE_METHOD, impl_getAccessibleAtPoint, "getAccessibleAtPoint", + "i,x,i:i,y,i:u,coord_type,i:o,,o"}, + {DROUTE_METHOD, impl_getExtents, "getExtents", "u,coord_type,i:(uuuu),,o"}, + {DROUTE_METHOD, impl_getPosition, "getPosition", + "i,x,o:i,y,o:u,coord_type,i"}, + {DROUTE_METHOD, impl_getSize, "getSize", "i,width,o:i,height,o"}, + {DROUTE_METHOD, impl_getLayer, "getLayer", "g,,o"}, + {DROUTE_METHOD, impl_getMDIZOrder, "getMDIZOrder", "n,,o"}, + {DROUTE_METHOD, impl_grabFocus, "grabFocus", "b,,o"}, + //{ DROUTE_METHOD, impl_registerFocusHandler, "registerFocusHandler", "o,handler,i" }, + //{ DROUTE_METHOD, impl_deregisterFocusHandler, "deregisterFocusHandler", "o,handler,i" }, + {DROUTE_METHOD, impl_getAlpha, "getAlpha", "d,,o"}, + {0, NULL, NULL, NULL} +}; + +void +spi_initialize_component (DRouteData * data) { - SpiComponent *retval = g_object_new (SPI_COMPONENT_TYPE, NULL); - - spi_base_construct (SPI_BASE (retval), G_OBJECT(o)); - - return retval; -} + droute_add_interface (data, "org.freedesktop.accessibility.Component", + methods, NULL, + (DRouteGetDatumFunction) get_component_from_path, + NULL); +}; diff --git a/libspi/document.c b/libspi/document.c index 3965e87..a0ba41e 100644 --- a/libspi/document.c +++ b/libspi/document.c @@ -2,6 +2,7 @@ * AT-SPI - Assistive Technology Service Provider Interface * (Gnome Accessibility Project; http://developer.gnome.org/projects/gap) * + * Copyright 2008 Novell, Inc. * Copyright 2001, 2002 Sun Microsystems Inc., * Copyright 2001, 2002 Ximian, Inc. * @@ -21,133 +22,130 @@ * Boston, MA 02111-1307, USA. */ -/* document.c: implements the Document interface */ +#include "accessible.h" - -#include -#include -#include -#include -#include - -SpiDocument * -spi_document_interface_new (AtkObject *obj) +static AtkDocument * +get_document (DBusMessage * message) { - SpiDocument *new_document = g_object_new (SPI_DOCUMENT_TYPE, NULL); - - spi_base_construct (SPI_BASE (new_document), G_OBJECT(obj)); - - return new_document; - + AtkObject *obj = spi_dbus_get_object (dbus_message_get_path (message)); + if (!obj) + return NULL; + return ATK_DOCUMENT (obj); } static AtkDocument * -get_document_from_servant (PortableServer_Servant servant) +get_document_from_path (const char *path, void *user_data) { - - SpiBase *object = SPI_BASE (bonobo_object_from_servant (servant)); - - g_return_val_if_fail (object, NULL); - g_return_val_if_fail (ATK_IS_OBJECT (object->gobj), NULL); - - return ATK_DOCUMENT (object->gobj); - + AtkObject *obj = spi_dbus_get_object (path); + if (!obj) + return NULL; + return ATK_DOCUMENT (obj); } -static CORBA_string -impl_getLocale (PortableServer_Servant servant, - CORBA_Environment *ev) +static DBusMessage * +impl_getLocale (DBusConnection * bus, DBusMessage * message, void *user_data) { + AtkDocument *document = get_document (message); const gchar *lc; - AtkDocument *document = get_document_from_servant (servant); - - g_return_val_if_fail (document != NULL, ""); + DBusMessage *reply; + if (!document) + return spi_dbus_general_error (message); lc = atk_document_get_locale (document); - - if (lc) - return CORBA_string_dup (lc); - else - return CORBA_string_dup (""); /* Should we return 'C' by default? */ + if (!lc) + lc = ""; + reply = dbus_message_new_method_return (message); + if (reply) + { + dbus_message_append_args (reply, DBUS_TYPE_STRING, &lc, + DBUS_TYPE_INVALID); + } + return reply; } -static CORBA_string -impl_getAttributeValue (PortableServer_Servant servant, - const CORBA_char *attributename, - CORBA_Environment *ev){ - +static DBusMessage * +impl_getAttributeValue (DBusConnection * bus, DBusMessage * message, + void *user_data) +{ + AtkDocument *document = get_document (message); + DBusError error; + gchar *attributename; const gchar *atr; - - AtkDocument *document = get_document_from_servant (servant); - - g_return_val_if_fail (document != NULL, ""); - + DBusMessage *reply; + + if (!document) + return spi_dbus_general_error (message); + dbus_error_init (&error); + if (!dbus_message_get_args + (message, &error, DBUS_TYPE_STRING, &attributename, DBUS_TYPE_INVALID)) + { + return SPI_DBUS_RETURN_ERROR (message, &error); + } atr = atk_document_get_attribute_value (document, attributename); - - if (atr) - return CORBA_string_dup (atr); - else - return CORBA_string_dup (""); + if (!atr) + atr = ""; + reply = dbus_message_new_method_return (message); + if (reply) + { + dbus_message_append_args (reply, DBUS_TYPE_STRING, &atr, + DBUS_TYPE_INVALID); + } + return reply; } - -static Accessibility_AttributeSet* -impl_getAttributes (PortableServer_Servant servant, - CORBA_Environment *ev){ - - AtkDocument *document = get_document_from_servant (servant); - AtkAttributeSet *attributes = NULL; +static DBusMessage * +impl_getAttributes (DBusConnection * bus, DBusMessage * message, + void *user_data) +{ + AtkDocument *document = get_document (message); + DBusMessage *reply; + AtkAttributeSet *attributes; AtkAttribute *attr = NULL; - Accessibility_AttributeSet *retval; + char **retval; gint n_attributes = 0; gint i; - - g_return_val_if_fail (document != NULL, NULL); - + + if (!document) + return spi_dbus_general_error (message); + attributes = atk_document_get_attributes (document); + if (attributes) + n_attributes = g_slist_length (attributes); - if (!attributes) - return NULL; + retval = (char **) g_malloc (n_attributes * sizeof (char *)); - /* according to atkobject.h, AtkAttributeSet is a GSList */ - n_attributes = g_slist_length (attributes); - - retval = CORBA_sequence_CORBA_string__alloc (); - retval->_length = retval->_maximum = n_attributes; - retval->_buffer = CORBA_sequence_CORBA_string_allocbuf (n_attributes); - CORBA_sequence_set_release (retval, CORBA_TRUE); - for (i = 0; i < n_attributes; ++i) - { + { attr = g_slist_nth_data (attributes, i); - retval->_buffer [i] = CORBA_string_dup (g_strconcat (attr->name, ":", attr->value, NULL)); - } - - atk_attribute_set_free (attributes); - - return retval; - + retval[i] = g_strconcat (attr->name, ":", attr->value, NULL); + } + if (attributes) + atk_attribute_set_free (attributes); + reply = dbus_message_new_method_return (message); + if (reply) + { + dbus_message_append_args (reply, DBUS_TYPE_ARRAY, DBUS_TYPE_STRING, + &retval, n_attributes, DBUS_TYPE_INVALID); + } + for (i = 0; i < n_attributes; i++) + g_free (retval[i]); + g_free (retval); + return reply; } +static DRouteMethod methods[] = { + {DROUTE_METHOD, impl_getLocale, "getLocale", "s,,o"}, + {DROUTE_METHOD, impl_getAttributeValue, "getAttributeValue", + "s,attributename,i:s,,o"}, + {DROUTE_METHOD, impl_getAttributes, "getAttributes", "as,,o"}, + {0, NULL, NULL, NULL} +}; -static void -spi_document_class_init (SpiDocumentClass *klass) +void +spi_initialize_document (DRouteData * data) { - - - POA_Accessibility_Document__epv *epv = &klass->epv; - - epv->getLocale = impl_getLocale; - epv->getAttributeValue = impl_getAttributeValue; - epv->getAttributes = impl_getAttributes; - -} - -static void -spi_document_init (SpiDocument *document) -{ -} -BONOBO_TYPE_FUNC_FULL (SpiDocument, - Accessibility_Document, - SPI_TYPE_BASE, - spi_document) + droute_add_interface (data, "org.freedesktop.accessibility.Document", + methods, NULL, + (DRouteGetDatumFunction) get_document_from_path, + NULL); +}; diff --git a/libspi/editabletext.c b/libspi/editabletext.c index d63b3c6..2e82cc3 100644 --- a/libspi/editabletext.c +++ b/libspi/editabletext.c @@ -2,6 +2,7 @@ * AT-SPI - Assistive Technology Service Provider Interface * (Gnome Accessibility Project; http://developer.gnome.org/projects/gap) * + * Copyright 2008 Novell, Inc. * Copyright 2001, 2002 Sun Microsystems Inc., * Copyright 2001, 2002 Ximian, Inc. * @@ -21,208 +22,249 @@ * Boston, MA 02111-1307, USA. */ -/* editabletext.c : implements the EditableText interface */ - -#include -#include -#include -#include - -/* Static function declarations */ - -static void -spi_editable_text_class_init (SpiEditableTextClass *klass); -static void -spi_editable_text_init (SpiEditableText *editable); -static CORBA_boolean -impl_setAttributes (PortableServer_Servant servant, - const CORBA_char * attributes, - const CORBA_long startPos, - const CORBA_long endPos, - CORBA_Environment *ev); -static CORBA_boolean -impl_setTextContents (PortableServer_Servant servant, - const CORBA_char * newContents, - CORBA_Environment *ev); -static CORBA_boolean -impl_insertText (PortableServer_Servant servant, - const CORBA_long position, - const CORBA_char * text, - const CORBA_long length, - CORBA_Environment *ev); -static void -impl_copyText (PortableServer_Servant servant, - const CORBA_long startPos, const CORBA_long endPos, - CORBA_Environment *ev); -static CORBA_boolean -impl_cutText (PortableServer_Servant servant, - const CORBA_long startPos, const CORBA_long endPos, - CORBA_Environment *ev); -static CORBA_boolean -impl_deleteText (PortableServer_Servant servant, - const CORBA_long startPos, const CORBA_long endPos, - CORBA_Environment *ev); -static CORBA_boolean -impl_pasteText (PortableServer_Servant servant, - const CORBA_long position, CORBA_Environment *ev); - -BONOBO_TYPE_FUNC_FULL (SpiEditableText, - Accessibility_EditableText, - SPI_TEXT_TYPE, - spi_editable_text) - -static void -spi_editable_text_class_init (SpiEditableTextClass *klass) -{ - POA_Accessibility_EditableText__epv *epv = &klass->epv; - - /* Initialize epv table */ - - epv->setAttributes = impl_setAttributes; - epv->setTextContents = impl_setTextContents; - epv->insertText = impl_insertText; - epv->copyText = impl_copyText; - epv->cutText = impl_cutText; - epv->deleteText = impl_deleteText; - epv->pasteText = impl_pasteText; -} - - -static void -spi_editable_text_init (SpiEditableText *editable) -{ -} - - -SpiEditableText * -spi_editable_text_interface_new (AtkObject *obj) -{ - SpiEditableText *new_editable = g_object_new ( - SPI_EDITABLE_TEXT_TYPE, NULL); - - spi_text_construct (SPI_TEXT (new_editable), obj); - - return new_editable; -} - +#include "accessible.h" static AtkEditableText * -get_editable_text_from_servant (PortableServer_Servant servant) +get_editable (DBusMessage * message) { - SpiBase *object = SPI_BASE (bonobo_object_from_servant (servant)); - - g_return_val_if_fail (object, NULL); - g_return_val_if_fail (ATK_IS_OBJECT(object->gobj), NULL); - return ATK_EDITABLE_TEXT (object->gobj); + AtkObject *obj = spi_dbus_get_object (dbus_message_get_path (message)); + if (!obj) + return NULL; + return ATK_EDITABLE_TEXT (obj); } - -static CORBA_boolean -impl_setAttributes (PortableServer_Servant servant, - const CORBA_char * attributes, - const CORBA_long startPos, - const CORBA_long endPos, - CORBA_Environment *ev) +static AtkEditableText * +get_editable_from_path (const char *path, void *user_data) { - AtkEditableText *editable = get_editable_text_from_servant (servant); - - g_return_val_if_fail (editable != NULL, FALSE); - - g_print ("setRunAttributes not implemented.\n"); - - return FALSE; + AtkObject *obj = spi_dbus_get_object (path); + if (!obj) + return NULL; + return ATK_EDITABLE_TEXT (obj); } - -static CORBA_boolean -impl_setTextContents (PortableServer_Servant servant, - const CORBA_char *newContents, - CORBA_Environment *ev) +static DBusMessage * +impl_setTextContents (DBusConnection * bus, DBusMessage * message, + void *user_data) { - AtkEditableText *editable = get_editable_text_from_servant (servant); - - g_return_val_if_fail (editable != NULL, FALSE); - + AtkEditableText *editable = get_editable (message); + const char *newContents; + dbus_bool_t rv; + DBusError error; + DBusMessage *reply; + + if (!editable) + return spi_dbus_general_error (message); + dbus_error_init (&error); + if (!dbus_message_get_args + (message, &error, DBUS_TYPE_STRING, &newContents, DBUS_TYPE_INVALID)) + { + return SPI_DBUS_RETURN_ERROR (message, &error); + } atk_editable_text_set_text_contents (editable, newContents); - - return TRUE; + rv = TRUE; + // TODO decide if we really need this return value + reply = dbus_message_new_method_return (message); + if (reply) + { + dbus_message_append_args (reply, DBUS_TYPE_BOOLEAN, &rv, + DBUS_TYPE_INVALID); + } + return reply; } - -static CORBA_boolean -impl_insertText (PortableServer_Servant servant, - const CORBA_long position, - const CORBA_char *text, - const CORBA_long length, - CORBA_Environment *ev) +static DBusMessage * +impl_insertText (DBusConnection * bus, DBusMessage * message, void *user_data) { - AtkEditableText *editable = get_editable_text_from_servant (servant); + AtkEditableText *editable = get_editable (message); + dbus_int32_t position, length; + char *text; + dbus_bool_t rv; + DBusError error; + DBusMessage *reply; gint ip; - g_return_val_if_fail (editable != NULL, FALSE); - + if (!editable) + return spi_dbus_general_error (message); + dbus_error_init (&error); + if (!dbus_message_get_args + (message, &error, DBUS_TYPE_INT32, &position, DBUS_TYPE_STRING, &text, + DBUS_TYPE_INT32, &length, DBUS_TYPE_INVALID)) + { + return SPI_DBUS_RETURN_ERROR (message, &error); + } ip = position; - atk_editable_text_insert_text (editable, - text, - length, - &ip); - return TRUE; + atk_editable_text_insert_text (editable, text, length, &ip); + rv = TRUE; + // TODO decide if we really need this return value + reply = dbus_message_new_method_return (message); + if (reply) + { + dbus_message_append_args (reply, DBUS_TYPE_BOOLEAN, &rv, + DBUS_TYPE_INVALID); + } + return reply; } - -static void -impl_copyText (PortableServer_Servant servant, - const CORBA_long startPos, const CORBA_long endPos, - CORBA_Environment *ev) +static DBusMessage * +impl_setAttributes (DBusConnection * bus, DBusMessage * message, + void *user_data) { - AtkEditableText *editable = get_editable_text_from_servant (servant); - - g_return_if_fail (editable != NULL); + AtkEditableText *editable = get_editable (message); + const char *attributes; + dbus_int32_t startPos, endPos; + dbus_bool_t rv; + DBusError error; + DBusMessage *reply; + + if (!editable) + return spi_dbus_general_error (message); + dbus_error_init (&error); + if (!dbus_message_get_args + (message, &error, DBUS_TYPE_STRING, &attributes, DBUS_TYPE_INT32, + &startPos, DBUS_TYPE_INT32, &endPos, DBUS_TYPE_INVALID)) + { + return SPI_DBUS_RETURN_ERROR (message, &error); + } + // TODO implement + rv = FALSE; + reply = dbus_message_new_method_return (message); + if (reply) + { + dbus_message_append_args (reply, DBUS_TYPE_BOOLEAN, &rv, + DBUS_TYPE_INVALID); + } + return reply; +} +static DBusMessage * +impl_copyText (DBusConnection * bus, DBusMessage * message, void *user_data) +{ + AtkEditableText *editable = get_editable (message); + dbus_int32_t startPos, endPos; + DBusError error; + + if (!editable) + return spi_dbus_general_error (message); + dbus_error_init (&error); + if (!dbus_message_get_args + (message, &error, DBUS_TYPE_INT32, &startPos, DBUS_TYPE_INT32, &endPos, + DBUS_TYPE_INVALID)) + { + return SPI_DBUS_RETURN_ERROR (message, &error); + } atk_editable_text_copy_text (editable, startPos, endPos); - + return NULL; } - -static CORBA_boolean -impl_cutText (PortableServer_Servant servant, - const CORBA_long startPos, const CORBA_long endPos, - CORBA_Environment *ev) +static DBusMessage * +impl_cutText (DBusConnection * bus, DBusMessage * message, void *user_data) { - AtkEditableText *editable = get_editable_text_from_servant (servant); - - g_return_val_if_fail (editable != NULL, FALSE); - + AtkEditableText *editable = get_editable (message); + dbus_int32_t startPos, endPos; + DBusError error; + dbus_bool_t rv; + DBusMessage *reply; + + if (!editable) + return spi_dbus_general_error (message); + dbus_error_init (&error); + if (!dbus_message_get_args + (message, &error, DBUS_TYPE_INT32, &startPos, DBUS_TYPE_INT32, &endPos, + DBUS_TYPE_INVALID)) + { + return SPI_DBUS_RETURN_ERROR (message, &error); + } atk_editable_text_cut_text (editable, startPos, endPos); - - return TRUE; + rv = TRUE; + // TODO decide if we really need this return value + reply = dbus_message_new_method_return (message); + if (reply) + { + dbus_message_append_args (reply, DBUS_TYPE_BOOLEAN, &rv, + DBUS_TYPE_INVALID); + } + return reply; } - -static CORBA_boolean -impl_deleteText (PortableServer_Servant servant, - const CORBA_long startPos, const CORBA_long endPos, - CORBA_Environment *ev) +static DBusMessage * +impl_deleteText (DBusConnection * bus, DBusMessage * message, void *user_data) { - AtkEditableText *editable = get_editable_text_from_servant (servant); - - g_return_val_if_fail (editable != NULL, FALSE); - + AtkEditableText *editable = get_editable (message); + dbus_int32_t startPos, endPos; + DBusError error; + dbus_bool_t rv; + DBusMessage *reply; + + if (!editable) + return spi_dbus_general_error (message); + dbus_error_init (&error); + if (!dbus_message_get_args + (message, &error, DBUS_TYPE_INT32, &startPos, DBUS_TYPE_INT32, &endPos, + DBUS_TYPE_INVALID)) + { + return SPI_DBUS_RETURN_ERROR (message, &error); + } atk_editable_text_delete_text (editable, startPos, endPos); - - return TRUE; + rv = TRUE; + // TODO decide if we really need this return value + reply = dbus_message_new_method_return (message); + if (reply) + { + dbus_message_append_args (reply, DBUS_TYPE_BOOLEAN, &rv, + DBUS_TYPE_INVALID); + } + return reply; } - -static CORBA_boolean -impl_pasteText (PortableServer_Servant servant, - const CORBA_long position, CORBA_Environment *ev) +static DBusMessage * +impl_pasteText (DBusConnection * bus, DBusMessage * message, void *user_data) { - AtkEditableText *editable = get_editable_text_from_servant (servant); - - g_return_val_if_fail (editable != NULL, FALSE); - + AtkEditableText *editable = get_editable (message); + dbus_int32_t position; + DBusError error; + dbus_bool_t rv; + DBusMessage *reply; + + if (!editable) + return spi_dbus_general_error (message); + dbus_error_init (&error); + if (!dbus_message_get_args + (message, &error, DBUS_TYPE_INT32, &position, DBUS_TYPE_INVALID)) + { + return SPI_DBUS_RETURN_ERROR (message, &error); + } atk_editable_text_paste_text (editable, position); - - return TRUE; + rv = TRUE; + // TODO decide if we really need this return value + reply = dbus_message_new_method_return (message); + if (reply) + { + dbus_message_append_args (reply, DBUS_TYPE_BOOLEAN, &rv, + DBUS_TYPE_INVALID); + } + return reply; } + +static DRouteMethod methods[] = { + {DROUTE_METHOD, impl_setTextContents, "setTextContents", + "s,newContents,i:b,,o"}, + {DROUTE_METHOD, impl_insertText, "insertText", + "i,position,i:s,text,i:i,length,i:b,,o"}, + {DROUTE_METHOD, impl_setAttributes, "setAttributes", + "s,attributes,i:i,startPos,i:i,endPos,i:b,,o"}, + {DROUTE_METHOD, impl_copyText, "copyText", "i,startPos,i:i,endPos,i"}, + {DROUTE_METHOD, impl_cutText, "cutText", "i,startPos,i:i,endPos,i:b,,o"}, + {DROUTE_METHOD, impl_deleteText, "deleteText", + "i,startPos,i:i,endPos,i:b,,o"}, + {DROUTE_METHOD, impl_pasteText, "pasteText", "i,position,i:b,,o"}, + {0, NULL, NULL, NULL} +}; + +void +spi_initialize_editabletext (DRouteData * data) +{ + droute_add_interface (data, "org.freedesktop.accessibility.EditableText", + methods, NULL, + (DRouteGetDatumFunction) get_editable_from_path, + NULL); +}; diff --git a/libspi/hyperlink.c b/libspi/hyperlink.c index 6d6bf5d..8491163 100644 --- a/libspi/hyperlink.c +++ b/libspi/hyperlink.c @@ -2,6 +2,7 @@ * AT-SPI - Assistive Technology Service Provider Interface * (Gnome Accessibility Project; http://developer.gnome.org/projects/gap) * + * Copyright 2008 Novell, Inc. * Copyright 2001, 2002 Sun Microsystems Inc., * Copyright 2001, 2002 Ximian, Inc. * @@ -21,207 +22,172 @@ * Boston, MA 02111-1307, USA. */ -/* hyperlink.c : implements the Hyperlink interface */ - -#include -#include -#include -#include -#include - -/* Static function declarations */ - -static void -spi_hyperlink_class_init (SpiHyperlinkClass *klass); -static void -spi_hyperlink_init (SpiHyperlink *hyperlink); -static CORBA_string -impl_getURI (PortableServer_Servant _servant, - const CORBA_long i, CORBA_Environment * ev); -static CORBA_short -impl__get_n_anchors (PortableServer_Servant _servant, - CORBA_Environment * ev); -static CORBA_long -impl__get_startIndex (PortableServer_Servant _servant, - CORBA_Environment * ev); -static CORBA_long -impl__get_endIndex (PortableServer_Servant _servant, - CORBA_Environment * ev); -static Accessibility_Accessible -impl_getObject (PortableServer_Servant _servant, - const CORBA_long i, - CORBA_Environment * ev); -static CORBA_boolean -impl_isValid (PortableServer_Servant _servant, - CORBA_Environment * ev); - - -BONOBO_TYPE_FUNC_FULL (SpiHyperlink, - Accessibility_Hyperlink, - SPI_TYPE_BASE, - spi_hyperlink) - - -static void -spi_hyperlink_class_init (SpiHyperlinkClass *klass) -{ - POA_Accessibility_Hyperlink__epv *epv = &klass->epv; - - /* Initialize epv table */ +#include "accessible.h" - epv->_get_nAnchors = impl__get_n_anchors; - epv->getURI = impl_getURI; - epv->_get_startIndex = impl__get_startIndex; - epv->_get_endIndex = impl__get_endIndex; - epv->getObject = impl_getObject; - epv->isValid = impl_isValid; +static AtkHyperlink * +get_hyperlink (DBusMessage * message) +{ + AtkObject *obj = spi_dbus_get_object (dbus_message_get_path (message)); + if (!obj) + return NULL; + return ATK_HYPERLINK (obj); } - -static void -spi_hyperlink_init (SpiHyperlink *hyperlink) +static AtkHyperlink * +get_hyperlink_from_path (const char *path, void *user_data) { + AtkObject *obj = spi_dbus_get_object (path); + if (!obj) + return NULL; + return ATK_HYPERLINK (obj); } - -SpiHyperlink * -spi_hyperlink_new (AtkHyperlink *object) +static dbus_bool_t +impl_get_nAnchors (const char *path, DBusMessageIter * iter, void *user_data) { - SpiHyperlink *new_hyperlink = g_object_new ( - SPI_HYPERLINK_TYPE, NULL); - - spi_base_construct (SPI_BASE (new_hyperlink), G_OBJECT(object)); - - /* - * some hyperlinks are actionable... this is an ATK convention - * that seems convenient though possibly poorly documented or unintended. - */ - if (ATK_IS_ACTION (object)) - { - /* - * NOTE: we don't cast 'object' to ATK_OBJECT in the call to - * spi_action_interface_new(), because of the above convention, - * even though it means we may be violating the func prototype. - * See discussion in bugzilla bug #120659. - * !!! - * IMPORTANT! The 'AtkObject' typecast, instead of the cast macro, - * is used below, because 'object' may NOT really be an AtkObject; - * it will be cast back to a G_OBJECT inside spi_action_interface_new - * before use, so this is OK though very ropey coding style. - */ - - /* Don't aggregate action twice... if this is from AtkHyperlinkImpl */ - if (!bonobo_object_query_interface (bonobo_object (new_hyperlink), "IDL:Accessibility/Action:1.0", - NULL)) - - bonobo_object_add_interface (bonobo_object (new_hyperlink), - BONOBO_OBJECT (spi_action_interface_new ((AtkObject *) object))); - } - return new_hyperlink; + AtkHyperlink *link = get_hyperlink_from_path (path, user_data); + if (!link) + return FALSE; + return droute_return_v_int32 (iter, atk_hyperlink_get_n_anchors (link)); } -static AtkHyperlink * -get_hyperlink_from_servant (PortableServer_Servant servant) +static char * +impl_get_nAnchors_str (void *datum) { - SpiBase *object = SPI_BASE (bonobo_object_from_servant (servant)); - - g_return_val_if_fail (object != NULL, NULL); - if (ATK_IS_HYPERLINK(object->gobj)) - { - return ATK_HYPERLINK (object->gobj); - } - else if (ATK_IS_HYPERLINK_IMPL(object->gobj)) - { - return atk_hyperlink_impl_get_hyperlink (ATK_HYPERLINK_IMPL (object->gobj)); - } - else - return NULL; + g_assert (ATK_IS_HYPERLINK (datum)); + return g_strdup_printf ("%d", + atk_hyperlink_get_n_anchors ((AtkHyperlink *) + datum)); } - -static CORBA_short -impl__get_n_anchors (PortableServer_Servant servant, - CORBA_Environment *ev) +static dbus_bool_t +impl_get_startIndex (const char *path, DBusMessageIter * iter, + void *user_data) { - AtkHyperlink *link = get_hyperlink_from_servant (servant); - - g_return_val_if_fail (link != NULL, 0); - - return atk_hyperlink_get_n_anchors (link); + AtkHyperlink *link = get_hyperlink_from_path (path, user_data); + if (!link) + return FALSE; + return droute_return_v_int32 (iter, atk_hyperlink_get_start_index (link)); } - -static CORBA_long -impl__get_startIndex (PortableServer_Servant servant, - CORBA_Environment *ev) +static char * +impl_get_startIndex_str (void *datum) { - AtkHyperlink *link = get_hyperlink_from_servant (servant); - - g_return_val_if_fail (link != NULL, -1); - - return atk_hyperlink_get_start_index (link); + g_assert (ATK_IS_HYPERLINK (datum)); + return g_strdup_printf ("%d", + atk_hyperlink_get_start_index ((AtkHyperlink *) + datum)); } - -static CORBA_long -impl__get_endIndex (PortableServer_Servant servant, - CORBA_Environment *ev) +static dbus_bool_t +impl_get_endIndex (const char *path, DBusMessageIter * iter, void *user_data) { - AtkHyperlink *link = get_hyperlink_from_servant (servant); - - g_return_val_if_fail (link != NULL, -1); - - return atk_hyperlink_get_end_index (link); + AtkHyperlink *link = get_hyperlink_from_path (path, user_data); + if (!link) + return FALSE; + return droute_return_v_int32 (iter, atk_hyperlink_get_end_index (link)); } - -static CORBA_string -impl_getURI (PortableServer_Servant servant, - const CORBA_long i, CORBA_Environment *ev) +static char * +impl_get_endIndex_str (void *datum) { - gchar *uri; - CORBA_char *rv; - AtkHyperlink *link = get_hyperlink_from_servant (servant); - - g_return_val_if_fail (link != NULL, CORBA_string_dup ("")); + g_assert (ATK_IS_HYPERLINK (datum)); + return g_strdup_printf ("%d", + atk_hyperlink_get_end_index ((AtkHyperlink *) + datum)); +} - uri = atk_hyperlink_get_uri (link, i); - if (uri) +static DBusMessage * +impl_getObject (DBusConnection * bus, DBusMessage * message, void *user_data) +{ + AtkHyperlink *link = get_hyperlink (message); + DBusError error; + dbus_int32_t i; + AtkObject *atk_object; + + if (!link) + return spi_dbus_general_error (message); + dbus_error_init (&error); + if (!dbus_message_get_args + (message, &error, DBUS_TYPE_INT32, &i, DBUS_TYPE_INVALID)) { - rv = CORBA_string_dup (uri); - g_free (uri); + return SPI_DBUS_RETURN_ERROR (message, &error); } - else - rv = CORBA_string_dup (""); - - return rv; -} - + atk_object = atk_hyperlink_get_object (link, i); + return spi_dbus_return_object (message, atk_object, FALSE); +} -static Accessibility_Accessible -impl_getObject (PortableServer_Servant servant, - const CORBA_long i, - CORBA_Environment *ev) +static DBusMessage * +impl_getURI (DBusConnection * bus, DBusMessage * message, void *user_data) { - AtkObject *atk_object; - AtkHyperlink *link = get_hyperlink_from_servant (servant); - - g_return_val_if_fail (link != NULL, CORBA_OBJECT_NIL); - - atk_object = atk_hyperlink_get_object (link, i); + AtkHyperlink *link = get_hyperlink (message); + dbus_int32_t i; + DBusError error; + gchar *rv; + DBusMessage *reply; + + if (!link) + return spi_dbus_general_error (message); + dbus_error_init (&error); + if (!dbus_message_get_args + (message, &error, DBUS_TYPE_INT32, &i, DBUS_TYPE_INT32, &i, + DBUS_TYPE_INVALID)) + { + return SPI_DBUS_RETURN_ERROR (message, &error); + } - return spi_accessible_new_return (atk_object, FALSE, ev); + rv = atk_hyperlink_get_uri (link, i); + if (!rv) + rv = g_strdup (""); + reply = dbus_message_new_method_return (message); + if (reply) + { + dbus_message_append_args (reply, DBUS_TYPE_STRING, &rv, + DBUS_TYPE_INVALID); + } + g_free (rv); + return reply; } - -static CORBA_boolean -impl_isValid (PortableServer_Servant servant, - CORBA_Environment *ev) +static DBusMessage * +impl_isValid (DBusConnection * bus, DBusMessage * message, void *user_data) { - AtkHyperlink *link = get_hyperlink_from_servant (servant); + AtkHyperlink *link = get_hyperlink (message); + dbus_bool_t rv; + DBusMessage *reply; - g_return_val_if_fail (link != NULL, TRUE); + if (!link) + return spi_dbus_general_error (message); - return atk_hyperlink_is_valid (link); + rv = atk_hyperlink_is_valid (link); + reply = dbus_message_new_method_return (message); + if (reply) + { + dbus_message_append_args (reply, DBUS_TYPE_BOOLEAN, &rv, + DBUS_TYPE_INVALID); + } + return reply; } +static DRouteMethod methods[] = { + {DROUTE_METHOD, impl_getObject, "getObject", "i,i,i:o,,o"}, + {DROUTE_METHOD, impl_getURI, "getURI", "i,i,i:s,,o"}, + {DROUTE_METHOD, impl_isValid, "isValid", "b,,o"}, + {0, NULL, NULL, NULL} +}; + +static DRouteProperty properties[] = { + {impl_get_nAnchors, impl_get_nAnchors_str, NULL, NULL, "nAnchors"}, + {impl_get_startIndex, impl_get_startIndex_str, NULL, NULL, "startIndex"}, + {impl_get_endIndex, impl_get_endIndex_str, NULL, NULL, "endIndex"}, + {NULL, NULL, NULL, NULL, NULL} +}; + +void +spi_initialize_hyperlink (DRouteData * data) +{ + droute_add_interface (data, "org.freedesktop.accessibility.Hyperlink", + methods, properties, + (DRouteGetDatumFunction) get_hyperlink_from_path, + NULL); +}; diff --git a/libspi/hypertext.c b/libspi/hypertext.c index 65d96d0..6152235 100644 --- a/libspi/hypertext.c +++ b/libspi/hypertext.c @@ -2,8 +2,9 @@ * AT-SPI - Assistive Technology Service Provider Interface * (Gnome Accessibility Project; http://developer.gnome.org/projects/gap) * + * Copyright 2008 Novell, Inc. * Copyright 2001, 2002 Sun Microsystems Inc., - * Copyright 2001, 2002 Ximian, Inc. Ximian 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 @@ -21,104 +22,106 @@ * Boston, MA 02111-1307, USA. */ -/* hypertext.c : implements the HyperText interface */ +#include "accessible.h" -#include -#include -#include -#include -#include - -#define PARENT_TYPE SPI_TYPE_BASE - -SpiHypertext * -spi_hypertext_interface_new (AtkObject *obj) +static AtkHypertext * +get_hypertext (DBusMessage * message) { - SpiHypertext *new_hypertext = g_object_new (SPI_HYPERTEXT_TYPE, NULL); - - spi_base_construct (SPI_BASE (new_hypertext), G_OBJECT (obj)); - - return new_hypertext; + AtkObject *obj = spi_dbus_get_object (dbus_message_get_path (message)); + if (!obj) + return NULL; + return ATK_HYPERTEXT (obj); } - static AtkHypertext * -get_hypertext_from_servant (PortableServer_Servant servant) +get_hypertext_from_path (const char *path, void *user_data) { - SpiBase *object = SPI_BASE (bonobo_object_from_servant (servant)); - - g_return_val_if_fail (object, NULL); - g_return_val_if_fail (ATK_IS_OBJECT(object->gobj), NULL); - return ATK_HYPERTEXT (object->gobj); + AtkObject *obj = spi_dbus_get_object (path); + if (!obj) + return NULL; + return ATK_HYPERTEXT (obj); } - -static CORBA_long -impl_getNLinks (PortableServer_Servant servant, - CORBA_Environment *ev) +static DBusMessage * +impl_getNLinks (DBusConnection * bus, DBusMessage * message, void *user_data) { - AtkHypertext *hypertext = get_hypertext_from_servant (servant); - - g_return_val_if_fail (hypertext != NULL, 0); - - return atk_hypertext_get_n_links (hypertext); + AtkHypertext *hypertext = get_hypertext (message); + gint rv; + DBusMessage *reply; + + if (!hypertext) + return spi_dbus_general_error (message); + rv = atk_hypertext_get_n_links (hypertext); + reply = dbus_message_new_method_return (message); + if (reply) + { + dbus_message_append_args (reply, DBUS_TYPE_INT32, &rv, + DBUS_TYPE_INVALID); + } + return reply; } - -static Accessibility_Hyperlink -impl_getLink (PortableServer_Servant servant, - const CORBA_long linkIndex, - CORBA_Environment *ev) +static DBusMessage * +impl_getLink (DBusConnection * bus, DBusMessage * message, void *user_data) { + AtkHypertext *hypertext = get_hypertext (message); + DBusError error; + dbus_int32_t linkIndex; AtkHyperlink *link; - Accessibility_Hyperlink rv; - AtkHypertext *hypertext = get_hypertext_from_servant (servant); - g_return_val_if_fail (hypertext != NULL, CORBA_OBJECT_NIL); - + if (!hypertext) + return spi_dbus_general_error (message); + dbus_error_init (&error); + if (!dbus_message_get_args + (message, &error, DBUS_TYPE_INT32, &linkIndex, DBUS_TYPE_INVALID)) + { + return SPI_DBUS_RETURN_ERROR (message, &error); + } link = atk_hypertext_get_link (hypertext, linkIndex); - g_return_val_if_fail (link != NULL, CORBA_OBJECT_NIL); - - rv = BONOBO_OBJREF (spi_hyperlink_new (link)); - - return CORBA_Object_duplicate (rv, ev); + return spi_dbus_return_object (message, ATK_OBJECT (link), FALSE); } - -static CORBA_long -impl_getLinkIndex (PortableServer_Servant servant, - const CORBA_long characterIndex, - CORBA_Environment *ev) -{ - AtkHypertext *hypertext = get_hypertext_from_servant (servant); - - g_return_val_if_fail (hypertext != NULL, 0); - - return atk_hypertext_get_link_index (hypertext, - characterIndex); -} - - -static void -spi_hypertext_class_init (SpiHypertextClass *klass) +static DBusMessage * +impl_getLinkIndex (DBusConnection * bus, DBusMessage * message, + void *user_data) { - POA_Accessibility_Hypertext__epv *epv = &klass->epv; - - /* Initialize epv table */ - - epv->getNLinks = impl_getNLinks; - epv->getLink = impl_getLink; - epv->getLinkIndex = impl_getLinkIndex; + AtkHypertext *hypertext = get_hypertext (message); + DBusError error; + dbus_int32_t characterIndex; + dbus_int32_t rv; + DBusMessage *reply; + + if (!hypertext) + return spi_dbus_general_error (message); + dbus_error_init (&error); + if (!dbus_message_get_args + (message, &error, DBUS_TYPE_INT32, &characterIndex, DBUS_TYPE_INVALID)) + { + return SPI_DBUS_RETURN_ERROR (message, &error); + } + rv = atk_hypertext_get_link_index (hypertext, characterIndex); + reply = dbus_message_new_method_return (message); + if (reply) + { + dbus_message_append_args (reply, DBUS_TYPE_INT32, &rv, + DBUS_TYPE_INVALID); + } + return reply; } +static DRouteMethod methods[] = { + {DROUTE_METHOD, impl_getNLinks, "getNLinks", "i,,o"}, + {DROUTE_METHOD, impl_getLink, "getLink", "i,linkIndex,i:o,,o"}, + {DROUTE_METHOD, impl_getLinkIndex, "getLinkIndex", + "i,characterIndex,i:i,,o"}, + {0, NULL, NULL, NULL} +}; -static void -spi_hypertext_init (SpiHypertext *hypertext) +void +spi_initialize_hypertext (DRouteData * data) { -} - - -BONOBO_TYPE_FUNC_FULL (SpiHypertext, - Accessibility_Hypertext, - PARENT_TYPE, - spi_hypertext) + droute_add_interface (data, "org.freedesktop.accessibility.Hypertext", + methods, NULL, + (DRouteGetDatumFunction) get_hypertext_from_path, + NULL); +}; diff --git a/libspi/image.c b/libspi/image.c index 34340c6..4557ff6 100644 --- a/libspi/image.c +++ b/libspi/image.c @@ -2,6 +2,7 @@ * AT-SPI - Assistive Technology Service Provider Interface * (Gnome Accessibility Project; http://developer.gnome.org/projects/gap) * + * Copyright 2008 Novell, Inc. * Copyright 2001, 2002 Sun Microsystems Inc., * Copyright 2001, 2002 Ximian, Inc. * @@ -21,155 +22,160 @@ * Boston, MA 02111-1307, USA. */ -/* image.c : implements the Image interface */ +#include "accessible.h" -#include -#include -#include - - -SpiImage * -spi_image_interface_new (AtkObject *obj) +static AtkImage * +get_image (DBusMessage * message) { - SpiImage *new_image = g_object_new (SPI_IMAGE_TYPE, NULL); - - spi_base_construct (SPI_BASE (new_image), G_OBJECT(obj)); - - return new_image; + AtkObject *obj = spi_dbus_get_object (dbus_message_get_path (message)); + if (!obj) + return NULL; + return ATK_IMAGE (obj); } static AtkImage * -get_image_from_servant (PortableServer_Servant servant) +get_image_from_path (const char *path, void *user_data) { - SpiBase *object = SPI_BASE (bonobo_object_from_servant (servant)); - - g_return_val_if_fail (object, NULL); - g_return_val_if_fail (ATK_IS_OBJECT(object->gobj), NULL); - return ATK_IMAGE (object->gobj); + AtkObject *obj = spi_dbus_get_object (path); + if (!obj) + return NULL; + return ATK_IMAGE (obj); } -static void -impl_getImagePosition (PortableServer_Servant servant, - CORBA_long * x, CORBA_long * y, - const CORBA_short coordType, - CORBA_Environment *ev) +static dbus_bool_t +impl_get_imageDescription (const char *path, DBusMessageIter * iter, + void *user_data) { - AtkImage *image = get_image_from_servant (servant); - gint ix, iy; - - g_return_if_fail (image != NULL); - - atk_image_get_image_position (image, - &ix, &iy, - (AtkCoordType) coordType); - *x = ix; - *y = iy; + AtkImage *image = get_image_from_path (path, user_data); + if (!image) + return FALSE; + return droute_return_v_string (iter, + atk_image_get_image_description (image)); } -static void -impl_getImageSize (PortableServer_Servant servant, - CORBA_long * width, CORBA_long * height, - CORBA_Environment *ev) +static char * +impl_get_imageDescription_str (void *datum) { - AtkImage *image = get_image_from_servant (servant); - gint iw, ih; - - g_return_if_fail (image != NULL); - - atk_image_get_image_size (image, - &iw, &ih); - *width = iw; - *height = ih; + AtkImage *image = (AtkImage *) datum; + g_assert (ATK_IS_IMAGE (datum)); + return g_strdup (atk_image_get_image_description (image)); } -static Accessibility_BoundingBox -impl_getImageExtents (PortableServer_Servant servant, - const CORBA_short coordType, - CORBA_Environment *ev) +static dbus_bool_t +impl_get_imageLocale (const char *path, DBusMessageIter * iter, + void *user_data) { - AtkImage *image; - gint x, y, width, height; - Accessibility_BoundingBox bbox; - - bbox.x = bbox.y = bbox.width = bbox.height = -1; - - image = get_image_from_servant (servant); - - if (image) - { - atk_image_get_image_size (image, &width, &height); - atk_image_get_image_position (image, &x, &y, coordType); - - bbox.x = x; - bbox.y = y; - bbox.width = width; - bbox.height = height; - } - - return bbox; + AtkImage *image = get_image_from_path (path, user_data); + if (!image) + return FALSE; + return droute_return_v_string (iter, atk_image_get_image_locale (image)); } -static CORBA_string -impl__get_imageDescription (PortableServer_Servant servant, - CORBA_Environment *ev) +static char * +impl_get_imageLocale_str (void *datum) { - const char *rv; - AtkImage *image = get_image_from_servant (servant); - - g_return_val_if_fail (image != NULL, CORBA_string_dup ("")); - - rv = atk_image_get_image_description (image); + AtkImage *image = (AtkImage *) datum; + g_assert (ATK_IS_IMAGE (datum)); + return g_strdup (atk_image_get_image_locale (image)); +} - if (rv) - { - return CORBA_string_dup (rv); - } - else +static DBusMessage * +impl_getImageExtents (DBusConnection * bus, DBusMessage * message, + void *user_data) +{ + AtkImage *image = get_image (message); + DBusError error; + dbus_uint32_t coordType; + gint ix, iy, iwidth, iheight; + + if (!image) + return spi_dbus_general_error (message); + dbus_error_init (&error); + if (!dbus_message_get_args + (message, &error, DBUS_TYPE_UINT32, &coordType, DBUS_TYPE_INVALID)) { - return CORBA_string_dup (""); + return SPI_DBUS_RETURN_ERROR (message, &error); } + atk_image_get_image_size (image, &iwidth, &iheight); + atk_image_get_image_position (image, &ix, &iy, (AtkCoordType) coordType); + return spi_dbus_return_rect (message, ix, iy, iwidth, iheight); } -static CORBA_string -impl__get_imageLocale (PortableServer_Servant servant, - CORBA_Environment *ev) +static DBusMessage * +impl_getImagePosition (DBusConnection * bus, DBusMessage * message, + void *user_data) { - const char *rv; - AtkImage *image = get_image_from_servant (servant); - - g_return_val_if_fail (image != NULL, CORBA_string_dup ("C")); - - rv = atk_image_get_image_locale (image); - - if (rv) + AtkImage *image = get_image (message); + DBusError error; + dbus_uint32_t coord_type; + gint ix = 0, iy = 0; + dbus_int32_t x, y; + DBusMessage *reply; + + if (!image) + return spi_dbus_general_error (message); + dbus_error_init (&error); + if (!dbus_message_get_args + (message, &error, DBUS_TYPE_UINT32, &coord_type, DBUS_TYPE_INVALID)) { - return CORBA_string_dup (rv); + return SPI_DBUS_RETURN_ERROR (message, &error); } - else + atk_image_get_image_position (image, &ix, &iy, (AtkCoordType) coord_type); + x = ix; + y = iy; + reply = dbus_message_new_method_return (message); + if (reply) { - return CORBA_string_dup ("C"); + dbus_message_append_args (reply, DBUS_TYPE_INT32, &x, DBUS_TYPE_INT32, + &y, DBUS_TYPE_INVALID); } + return reply; } -static void -spi_image_class_init (SpiImageClass *klass) +static DBusMessage * +impl_getImageSize (DBusConnection * bus, DBusMessage * message, + void *user_data) { - POA_Accessibility_Image__epv *epv = &klass->epv; - - /* Initialize epv table */ - epv->getImagePosition = impl_getImagePosition; - epv->getImageSize = impl_getImageSize; - epv->getImageExtents = impl_getImageExtents; - epv->_get_imageDescription = impl__get_imageDescription; - epv->_get_imageLocale = impl__get_imageLocale; + AtkImage *image = get_image (message); + gint iwidth = 0, iheight = 0; + dbus_int32_t width, height; + DBusMessage *reply; + + if (!image) + return spi_dbus_general_error (message); + atk_image_get_image_size (image, &iwidth, &iheight); + width = iwidth; + height = iheight; + reply = dbus_message_new_method_return (message); + if (reply) + { + dbus_message_append_args (reply, DBUS_TYPE_INT32, &width, + DBUS_TYPE_INT32, &height, DBUS_TYPE_INVALID); + } + return reply; } -static void -spi_image_init (SpiImage *image) +static DRouteMethod methods[] = { + {DROUTE_METHOD, impl_getImageExtents, "getImageExtents", + "n,coordType,i:(uuuu),,o"}, + {DROUTE_METHOD, impl_getImagePosition, "getImagePosition", + "i,x,o:i,y,o:n,coordType,i"}, + {DROUTE_METHOD, impl_getImageSize, "getImageSize", "i,width,o:i,height,o"}, + {0, NULL, NULL, NULL} +}; + +static DRouteProperty properties[] = { + {impl_get_imageDescription, impl_get_imageDescription_str, NULL, NULL, + "imageDescription", "s"}, + {impl_get_imageLocale, impl_get_imageLocale_str, NULL, NULL, "imageLocale", + "s"}, + {NULL, NULL, NULL, NULL, NULL, NULL} +}; + +void +spi_initialize_image (DRouteData * data) { -} - -BONOBO_TYPE_FUNC_FULL (SpiImage, - Accessibility_Image, - SPI_TYPE_BASE, - spi_image) + droute_add_interface (data, "org.freedesktop.accessibility.Image", methods, + properties, + (DRouteGetDatumFunction) get_image_from_path, NULL); +}; diff --git a/libspi/selection.c b/libspi/selection.c index 42fafe1..87d57fa 100644 --- a/libspi/selection.c +++ b/libspi/selection.c @@ -2,6 +2,7 @@ * AT-SPI - Assistive Technology Service Provider Interface * (Gnome Accessibility Project; http://developer.gnome.org/projects/gap) * + * Copyright 2008 Novell, Inc. * Copyright 2001, 2002 Sun Microsystems Inc., * Copyright 2001, 2002 Ximian, Inc. * @@ -21,190 +22,259 @@ * Boston, MA 02111-1307, USA. */ -/* selection.c : implements the Selection interface */ +#include "accessible.h" -#include -#include -#include -#include - - -SpiSelection * -spi_selection_interface_new (AtkObject *obj) +static AtkSelection * +get_selection (DBusMessage * message) { - SpiSelection *new_selection = g_object_new (SPI_SELECTION_TYPE, NULL); - - spi_base_construct (SPI_BASE (new_selection), G_OBJECT(obj)); - - return new_selection; + AtkObject *obj = spi_dbus_get_object (dbus_message_get_path (message)); + if (!obj) + return NULL; + return ATK_SELECTION (obj); } - static AtkSelection * -get_selection_from_servant (PortableServer_Servant servant) +get_selection_from_path (const char *path, void *user_data) { - SpiBase *object = SPI_BASE (bonobo_object_from_servant (servant)); - - g_return_val_if_fail (object, NULL); - g_return_val_if_fail (ATK_IS_OBJECT(object->gobj), NULL); - return ATK_SELECTION (object->gobj); + AtkObject *obj = spi_dbus_get_object (path); + if (!obj) + return NULL; + return ATK_SELECTION (obj); } - -static CORBA_long -impl__get_nSelectedChildren (PortableServer_Servant servant, - CORBA_Environment *ev) +static dbus_bool_t +impl_get_nSelectedChildren (const char *path, DBusMessageIter * iter, + void *user_data) { - AtkSelection *selection = get_selection_from_servant (servant); - - g_return_val_if_fail (selection != NULL, 0); - - return atk_selection_get_selection_count (selection); + AtkSelection *selection = get_selection_from_path (path, user_data); + if (!selection) + return FALSE; + return droute_return_v_int32 (iter, + atk_selection_get_selection_count + (selection)); } - -static Accessibility_Accessible -impl_getSelectedChild (PortableServer_Servant servant, - const CORBA_long selectedChildIndex, - CORBA_Environment *ev) +static char * +impl_get_nSelectedChildren_str (void *datum) { - AtkObject *atk_object; - AtkSelection *selection = get_selection_from_servant (servant); - - g_return_val_if_fail (selection != NULL, CORBA_OBJECT_NIL); - -#ifdef SPI_DEBUG - fprintf (stderr, "calling impl_getSelectedChild\n"); -#endif - - atk_object = atk_selection_ref_selection (selection, - selectedChildIndex); - - g_return_val_if_fail (ATK_IS_OBJECT (atk_object), CORBA_OBJECT_NIL); - -#ifdef SPI_DEBUG - fprintf (stderr, "child type is %s\n", - g_type_name (G_OBJECT_TYPE (atk_object))); -#endif - - return spi_accessible_new_return (atk_object, TRUE, ev); + g_assert (ATK_IS_HYPERLINK (datum)); + return g_strdup_printf ("%d", + atk_selection_get_selection_count ((AtkSelection *) + datum)); } - -static CORBA_boolean -impl_selectChild (PortableServer_Servant servant, - const CORBA_long childIndex, - CORBA_Environment *ev) +static DBusMessage * +impl_getSelectedChild (DBusConnection * bus, DBusMessage * message, + void *user_data) { - AtkSelection *selection = get_selection_from_servant (servant); - - g_return_val_if_fail (selection != NULL, FALSE); - - return atk_selection_add_selection (selection, childIndex); + AtkSelection *selection = get_selection (message); + DBusError error; + dbus_int32_t selectedChildIndex; + AtkObject *atk_object; + + if (!selection) + return spi_dbus_general_error (message); + dbus_error_init (&error); + if (!dbus_message_get_args + (message, &error, DBUS_TYPE_INT32, &selectedChildIndex, + DBUS_TYPE_INVALID)) + { + return SPI_DBUS_RETURN_ERROR (message, &error); + } + atk_object = atk_selection_ref_selection (selection, selectedChildIndex); + return spi_dbus_return_object (message, atk_object, TRUE); } - -static CORBA_boolean -impl_deselectSelectedChild (PortableServer_Servant servant, - const CORBA_long selectedChildIndex, - CORBA_Environment *ev) +static DBusMessage * +impl_selectChild (DBusConnection * bus, DBusMessage * message, + void *user_data) { - AtkSelection *selection = get_selection_from_servant (servant); - - g_return_val_if_fail (selection != NULL, FALSE); - - return atk_selection_remove_selection (selection, selectedChildIndex); + AtkSelection *selection = get_selection (message); + DBusError error; + dbus_int32_t childIndex; + dbus_bool_t rv; + DBusMessage *reply; + + if (!selection) + return spi_dbus_general_error (message); + dbus_error_init (&error); + if (!dbus_message_get_args + (message, &error, DBUS_TYPE_INT32, &childIndex, DBUS_TYPE_INVALID)) + { + return SPI_DBUS_RETURN_ERROR (message, &error); + } + rv = atk_selection_add_selection (selection, childIndex); + reply = dbus_message_new_method_return (message); + if (reply) + { + dbus_message_append_args (reply, DBUS_TYPE_BOOLEAN, &rv, + DBUS_TYPE_INVALID); + } + return reply; } - - -static CORBA_boolean -impl_deselectChild (PortableServer_Servant servant, - const CORBA_long selectedChildIndex, - CORBA_Environment *ev) +static DBusMessage * +impl_deselectSelectedChild (DBusConnection * bus, DBusMessage * message, + void *user_data) { - AtkSelection *selection = get_selection_from_servant (servant); - gint i, nselected; - - g_return_val_if_fail (selection != NULL, FALSE); - nselected = atk_selection_get_selection_count (selection); - for (i=0; iepv; - - /* Initialize epv table */ - - epv->_get_nSelectedChildren = impl__get_nSelectedChildren; - epv->getSelectedChild = impl_getSelectedChild; - epv->selectChild = impl_selectChild; - epv->deselectSelectedChild = impl_deselectSelectedChild; - epv->deselectChild = impl_deselectChild; - epv->isChildSelected = impl_isChildSelected; - epv->selectAll = impl_selectAll; - epv->clearSelection = impl_clearSelection; + AtkSelection *selection = get_selection (message); + DBusError error; + dbus_int32_t selectedChildIndex; + dbus_bool_t rv = FALSE; + gint i, nselected; + DBusMessage *reply; + + if (!selection) + return spi_dbus_general_error (message); + dbus_error_init (&error); + if (!dbus_message_get_args + (message, &error, DBUS_TYPE_INT32, &selectedChildIndex, + DBUS_TYPE_INVALID)) + { + return SPI_DBUS_RETURN_ERROR (message, &error); + } + nselected = atk_selection_get_selection_count (selection); + for (i = 0; i < nselected; ++i) + { + AtkObject *selected_obj = atk_selection_ref_selection (selection, i); + if (atk_object_get_index_in_parent (selected_obj) == selectedChildIndex) + { + g_object_unref (G_OBJECT (selected_obj)); + rv = atk_selection_remove_selection (selection, i); + break; + } + g_object_unref (G_OBJECT (selected_obj)); + } + reply = dbus_message_new_method_return (message); + if (reply) + { + dbus_message_append_args (reply, DBUS_TYPE_BOOLEAN, &rv, + DBUS_TYPE_INVALID); + } + return reply; } - -static void -spi_selection_init (SpiSelection *selection) +static DRouteMethod methods[] = { + {DROUTE_METHOD, impl_getSelectedChild, "getSelectedChild", + "i,selectedChildIndex,i:o,,o"}, + {DROUTE_METHOD, impl_selectChild, "selectChild", "i,childIndex,i:b,,o"}, + {DROUTE_METHOD, impl_deselectSelectedChild, "deselectSelectedChild", + "i,selectedChildIndex,i:b,,o"}, + {DROUTE_METHOD, impl_isChildSelected, "isChildSelected", + "i,childIndex,i:b,,o"}, + {DROUTE_METHOD, impl_selectAll, "selectAll", "b,,o"}, + {DROUTE_METHOD, impl_clearSelection, "clearSelection", "b,,o"}, + {DROUTE_METHOD, impl_deselectChild, "deselectChild", "i,childIndex,i:b,,o"}, + {0, NULL, NULL, NULL} +}; + +static DRouteProperty properties[] = { + {impl_get_nSelectedChildren, impl_get_nSelectedChildren_str, NULL, NULL, + "nSelectedChildren"}, + {NULL, NULL, NULL, NULL, NULL} +}; + +void +spi_initialize_selection (DRouteData * data) { -} - - -BONOBO_TYPE_FUNC_FULL (SpiSelection, - Accessibility_Selection, - SPI_TYPE_BASE, - spi_selection) + droute_add_interface (data, "org.freedesktop.accessibility.Selection", + methods, properties, + (DRouteGetDatumFunction) get_selection_from_path, + NULL); +}; diff --git a/libspi/table.c b/libspi/table.c index 33290dd..3c7a213 100644 --- a/libspi/table.c +++ b/libspi/table.c @@ -2,6 +2,7 @@ * AT-SPI - Assistive Technology Service Provider Interface * (Gnome Accessibility Project; http://developer.gnome.org/projects/gap) * + * Copyright 2008 Novell, Inc. * Copyright 2001, 2002 Sun Microsystems Inc., * Copyright 2001, 2002 Ximian, Inc. * @@ -21,519 +22,760 @@ * Boston, MA 02111-1307, USA. */ -/* table.c : implements the Table interface */ +#include "accessible.h" -#include -#include -#include -#include -#include -#include - - -SpiTable * -spi_table_interface_new (AtkObject *obj) +static AtkTable * +get_table (DBusMessage * message) { - SpiTable *new_table = g_object_new (SPI_TABLE_TYPE, NULL); - - spi_base_construct (SPI_BASE (new_table), G_OBJECT(obj)); - - return new_table; + AtkObject *obj = spi_dbus_get_object (dbus_message_get_path (message)); + if (!obj) + return NULL; + return ATK_TABLE (obj); } - static AtkTable * -get_table_from_servant (PortableServer_Servant servant) +get_table_from_path (const char *path, void *user_data) { - SpiBase *object = SPI_BASE (bonobo_object_from_servant (servant)); - - g_return_val_if_fail (object, NULL); - g_return_val_if_fail (ATK_IS_OBJECT(object->gobj), NULL); - return ATK_TABLE (object->gobj); + AtkObject *obj = spi_dbus_get_object (path); + if (!obj) + return NULL; + return ATK_TABLE (obj); } - -static Accessibility_Accessible -impl__get_caption (PortableServer_Servant servant, - CORBA_Environment *ev) +static dbus_bool_t +impl_get_nRows (const char *path, DBusMessageIter * iter, void *user_data) { - AtkObject *atk_object; - AtkTable *table = get_table_from_servant (servant); - - g_return_val_if_fail (table != NULL, CORBA_OBJECT_NIL); - - atk_object = atk_table_get_caption (table); - - return spi_accessible_new_return (atk_object, FALSE, ev); + AtkTable *table = get_table_from_path (path, user_data); + if (!table) + return FALSE; + return droute_return_v_int32 (iter, atk_table_get_n_rows (table)); } - -static Accessibility_Accessible -impl__get_summary (PortableServer_Servant servant, - CORBA_Environment *ev) +static char * +impl_get_nRows_str (void *datum) { - AtkObject *atk_object; - AtkTable *table = get_table_from_servant (servant); - - g_return_val_if_fail (table != NULL, CORBA_OBJECT_NIL); - - atk_object = atk_table_get_summary (table); - - return spi_accessible_new_return (atk_object, FALSE, ev); + g_assert (ATK_IS_TABLE (datum)); + return g_strdup_printf ("%d", atk_table_get_n_rows ((AtkTable *) datum)); } - -static CORBA_long -impl__get_nRows (PortableServer_Servant servant, - CORBA_Environment *ev) +static dbus_bool_t +impl_get_nColumns (const char *path, DBusMessageIter * iter, void *user_data) { - AtkTable *table = get_table_from_servant (servant); - - g_return_val_if_fail (table != NULL, 0); - - return atk_table_get_n_rows (table); + AtkTable *table = get_table_from_path (path, user_data); + if (!table) + return FALSE; + return droute_return_v_int32 (iter, atk_table_get_n_columns (table)); } - -static CORBA_long -impl__get_nColumns (PortableServer_Servant servant, - CORBA_Environment *ev) +static char * +impl_get_nColumns_str (void *datum) { - AtkTable *table = get_table_from_servant (servant); - - g_return_val_if_fail (table != NULL, 0); - - return atk_table_get_n_columns (table); + g_assert (ATK_IS_TABLE (datum)); + return g_strdup_printf ("%d", atk_table_get_n_columns ((AtkTable *) datum)); } - -static Accessibility_Accessible -impl_getAccessibleAt (PortableServer_Servant servant, - const CORBA_long row, - const CORBA_long column, - CORBA_Environment *ev) +static dbus_bool_t +impl_get_caption (const char *path, DBusMessageIter * iter, void *user_data) { - AtkObject *atk_object; - AtkTable *table = get_table_from_servant (servant); - - g_return_val_if_fail (table != NULL, CORBA_OBJECT_NIL); - - atk_object = atk_table_ref_at (table, row, column); - - return spi_accessible_new_return (atk_object, TRUE, ev); + AtkTable *table = get_table_from_path (path, user_data); + if (!table) + return FALSE; + return spi_dbus_return_v_object (iter, atk_table_get_caption (table), + FALSE); } - -static CORBA_long -impl_getIndexAt (PortableServer_Servant servant, - const CORBA_long row, - const CORBA_long column, - CORBA_Environment *ev) +static char * +impl_get_caption_str (void *datum) { - AtkTable *table = get_table_from_servant (servant); - - g_return_val_if_fail (table != NULL, 0); - - return atk_table_get_index_at (table, row, column); + AtkTable *table = (AtkTable *) datum; + g_assert (ATK_IS_TABLE (datum)); + return spi_dbus_get_path (atk_table_get_caption (table)); } - -static CORBA_long -impl_getRowAtIndex (PortableServer_Servant servant, - const CORBA_long index, - CORBA_Environment *ev) +static dbus_bool_t +impl_get_summary (const char *path, DBusMessageIter * iter, void *user_data) { - AtkTable *table = get_table_from_servant (servant); - - g_return_val_if_fail (table != NULL, 0); + AtkTable *table = get_table_from_path (path, user_data); + if (!table) + return FALSE; + return spi_dbus_return_v_object (iter, atk_table_get_summary (table), + FALSE); +} - return atk_table_get_row_at_index (table, index); +static char * +impl_get_summary_str (void *datum) +{ + AtkTable *table = (AtkTable *) datum; + g_assert (ATK_IS_TABLE (datum)); + return spi_dbus_get_path (atk_table_get_summary (table)); } +static dbus_bool_t +impl_get_nSelectedRows (const char *path, DBusMessageIter * iter, + void *user_data) +{ + AtkTable *table = get_table_from_path (path, user_data); + gint *selected_rows = NULL; + int count; + if (!table) + return FALSE; + count = atk_table_get_selected_rows (table, &selected_rows); + if (selected_rows) + g_free (selected_rows); + return droute_return_v_int32 (iter, count); +} -static CORBA_long -impl_getColumnAtIndex (PortableServer_Servant servant, - const CORBA_long index, - CORBA_Environment *ev) +static char * +impl_get_nSelectedRows_str (void *datum) { - AtkTable *table = get_table_from_servant (servant); + gint count; + gint *selected_rows = NULL; + g_assert (ATK_IS_TABLE (datum)); + count = atk_table_get_selected_rows ((AtkTable *) datum, &selected_rows); + if (selected_rows) + g_free (selected_rows); + return g_strdup_printf ("%d", count); +} - g_return_val_if_fail (table != NULL, 0); +static dbus_bool_t +impl_get_nSelectedColumns (const char *path, DBusMessageIter * iter, + void *user_data) +{ + AtkTable *table = get_table_from_path (path, user_data); + gint *selected_columns = NULL; + int count; + if (!table) + return FALSE; + count = atk_table_get_selected_columns (table, &selected_columns); + if (selected_columns) + g_free (selected_columns); + return droute_return_v_int32 (iter, count); +} - return atk_table_get_column_at_index (table, index); +static char * +impl_get_nSelectedColumns_str (void *datum) +{ + gint count; + gint *selected_columns = NULL; + g_assert (ATK_IS_TABLE (datum)); + count = + atk_table_get_selected_columns ((AtkTable *) datum, &selected_columns); + if (selected_columns) + g_free (selected_columns); + return g_strdup_printf ("%d", count); } -static CORBA_string -impl_getRowDescription (PortableServer_Servant servant, - const CORBA_long row, - CORBA_Environment *ev) +static DBusMessage * +impl_getAccessibleAt (DBusConnection * bus, DBusMessage * message, + void *user_data) { - const char *rv; - AtkTable *table = get_table_from_servant (servant); - - g_return_val_if_fail (table != NULL, NULL); - - rv = atk_table_get_row_description (table, row); + AtkTable *table = get_table (message); + dbus_int32_t row, column; + DBusError error; + AtkObject *obj; + + if (!table) + return spi_dbus_general_error (message); + dbus_error_init (&error); + if (!dbus_message_get_args + (message, &error, DBUS_TYPE_INT32, &row, DBUS_TYPE_INT32, &column, + DBUS_TYPE_INVALID)) + { + return SPI_DBUS_RETURN_ERROR (message, &error); + } + obj = atk_table_ref_at (table, row, column); + return spi_dbus_return_object (message, obj, TRUE); +} - if (rv) +static DBusMessage * +impl_getIndexAt (DBusConnection * bus, DBusMessage * message, void *user_data) +{ + AtkTable *table = get_table (message); + dbus_int32_t row, column; + dbus_int32_t index; + DBusError error; + DBusMessage *reply; + + if (!table) + return spi_dbus_general_error (message); + dbus_error_init (&error); + if (!dbus_message_get_args + (message, &error, DBUS_TYPE_INT32, &row, DBUS_TYPE_INT32, &column, + DBUS_TYPE_INVALID)) { - return CORBA_string_dup (rv); + return SPI_DBUS_RETURN_ERROR (message, &error); } - else + index = atk_table_get_index_at (table, row, column); + reply = dbus_message_new_method_return (message); + if (reply) { - return CORBA_string_dup (""); + dbus_message_append_args (reply, DBUS_TYPE_INT32, &index, + DBUS_TYPE_INVALID); } + return reply; } - -static CORBA_string -impl_getColumnDescription (PortableServer_Servant servant, - const CORBA_long column, - CORBA_Environment *ev) +static DBusMessage * +impl_getRowAtIndex (DBusConnection * bus, DBusMessage * message, + void *user_data) { - const char *rv; - AtkTable *table = get_table_from_servant (servant); - - g_return_val_if_fail (table != NULL, CORBA_string_dup ("")); - - rv = atk_table_get_column_description (table, column); - - if (rv) + AtkTable *table = get_table (message); + dbus_int32_t index; + dbus_int32_t row; + DBusError error; + DBusMessage *reply; + + if (!table) + return spi_dbus_general_error (message); + dbus_error_init (&error); + if (!dbus_message_get_args + (message, &error, DBUS_TYPE_INT32, &index, DBUS_TYPE_INVALID)) { - return CORBA_string_dup (rv); + return SPI_DBUS_RETURN_ERROR (message, &error); } - else + row = atk_table_get_row_at_index (table, index); + reply = dbus_message_new_method_return (message); + if (reply) { - return CORBA_string_dup (""); + dbus_message_append_args (reply, DBUS_TYPE_INT32, &row, + DBUS_TYPE_INVALID); } + return reply; } - -static CORBA_long -impl_getRowExtentAt (PortableServer_Servant servant, - const CORBA_long row, - const CORBA_long column, - CORBA_Environment *ev) +static DBusMessage * +impl_getColumnAtIndex (DBusConnection * bus, DBusMessage * message, + void *user_data) { - AtkTable *table = get_table_from_servant (servant); - - g_return_val_if_fail (table != NULL, -1); - - return atk_table_get_row_extent_at (table, row, column); + AtkTable *table = get_table (message); + dbus_int32_t index; + dbus_int32_t column; + DBusError error; + DBusMessage *reply; + + if (!table) + return spi_dbus_general_error (message); + dbus_error_init (&error); + if (!dbus_message_get_args + (message, &error, DBUS_TYPE_INT32, &index, DBUS_TYPE_INVALID)) + { + return SPI_DBUS_RETURN_ERROR (message, &error); + } + column = atk_table_get_column_at_index (table, index); + reply = dbus_message_new_method_return (message); + if (reply) + { + dbus_message_append_args (reply, DBUS_TYPE_INT32, &column, + DBUS_TYPE_INVALID); + } + return reply; } - -static CORBA_long -impl_getColumnExtentAt (PortableServer_Servant servant, - const CORBA_long row, - const CORBA_long column, - CORBA_Environment *ev) +static DBusMessage * +impl_getRowDescription (DBusConnection * bus, DBusMessage * message, + void *user_data) { - AtkTable *table = get_table_from_servant (servant); - - g_return_val_if_fail (table != NULL, -1); - - return atk_table_get_column_extent_at (table, row, column); + AtkTable *table = get_table (message); + dbus_int32_t row; + const gchar *description; + DBusError error; + DBusMessage *reply; + + if (!table) + return spi_dbus_general_error (message); + dbus_error_init (&error); + if (!dbus_message_get_args + (message, &error, DBUS_TYPE_INT32, &row, DBUS_TYPE_INVALID)) + { + return SPI_DBUS_RETURN_ERROR (message, &error); + } + description = atk_table_get_row_description (table, row); + if (!description) + description = ""; + reply = dbus_message_new_method_return (message); + if (reply) + { + dbus_message_append_args (reply, DBUS_TYPE_STRING, &description, + DBUS_TYPE_INVALID); + } + return reply; } - -static Accessibility_Table -impl_getRowHeader (PortableServer_Servant servant, - const CORBA_long row, - CORBA_Environment *ev) +static DBusMessage * +impl_getColumnDescription (DBusConnection * bus, DBusMessage * message, + void *user_data) { - AtkObject *header; - AtkTable *table = get_table_from_servant (servant); - - g_return_val_if_fail (table != NULL, CORBA_OBJECT_NIL); - - header = atk_table_get_row_header (table, row); - - return spi_accessible_new_return (header, FALSE, ev); + AtkTable *table = get_table (message); + dbus_int32_t column; + const char *description; + DBusError error; + DBusMessage *reply; + + if (!table) + return spi_dbus_general_error (message); + dbus_error_init (&error); + if (!dbus_message_get_args + (message, &error, DBUS_TYPE_INT32, &column, DBUS_TYPE_INVALID)) + { + return SPI_DBUS_RETURN_ERROR (message, &error); + } + description = atk_table_get_column_description (table, column); + if (!description) + description = ""; + reply = dbus_message_new_method_return (message); + if (reply) + { + dbus_message_append_args (reply, DBUS_TYPE_STRING, &description, + DBUS_TYPE_INVALID); + } + return reply; } - -static Accessibility_Table -impl_getColumnHeader (PortableServer_Servant servant, - const CORBA_long column, - CORBA_Environment *ev) +static DBusMessage * +impl_getRowExtentAt (DBusConnection * bus, DBusMessage * message, + void *user_data) { - AtkObject *header; - AtkTable *table = get_table_from_servant (servant); - - g_return_val_if_fail (table != NULL, CORBA_OBJECT_NIL); - - header = atk_table_get_column_header (table, column); - - return spi_accessible_new_return (header, FALSE, ev); + AtkTable *table = get_table (message); + dbus_int32_t row, column; + dbus_int32_t extent; + DBusError error; + DBusMessage *reply; + + if (!table) + return spi_dbus_general_error (message); + dbus_error_init (&error); + if (!dbus_message_get_args + (message, &error, DBUS_TYPE_INT32, &row, DBUS_TYPE_INT32, &column, + DBUS_TYPE_INVALID)) + { + return SPI_DBUS_RETURN_ERROR (message, &error); + } + extent = atk_table_get_row_extent_at (table, row, column); + reply = dbus_message_new_method_return (message); + if (reply) + { + dbus_message_append_args (reply, DBUS_TYPE_INT32, &extent, + DBUS_TYPE_INVALID); + } + return reply; } -static CORBA_long -impl__get_nSelectedRows (PortableServer_Servant servant, - CORBA_Environment *ev) +static DBusMessage * +impl_getColumnExtentAt (DBusConnection * bus, DBusMessage * message, + void *user_data) { - gint *selectedRows = NULL; - gint retval = 0; - AtkTable *table = get_table_from_servant (servant); - - bonobo_return_val_if_fail (table != NULL, 0, ev); - - retval = atk_table_get_selected_rows (table, &selectedRows); - if (selectedRows) g_free (selectedRows); - return retval; + AtkTable *table = get_table (message); + dbus_int32_t row, column; + dbus_int32_t extent; + DBusError error; + DBusMessage *reply; + + if (!table) + return spi_dbus_general_error (message); + dbus_error_init (&error); + if (!dbus_message_get_args + (message, &error, DBUS_TYPE_INT32, &row, DBUS_TYPE_INT32, &column, + DBUS_TYPE_INVALID)) + { + return SPI_DBUS_RETURN_ERROR (message, &error); + } + extent = atk_table_get_column_extent_at (table, row, column); + reply = dbus_message_new_method_return (message); + if (reply) + { + dbus_message_append_args (reply, DBUS_TYPE_INT32, &extent, + DBUS_TYPE_INVALID); + } + return reply; } - -static CORBA_long -impl__get_nSelectedColumns (PortableServer_Servant servant, - CORBA_Environment *ev) +static DBusMessage * +impl_getRowHeader (DBusConnection * bus, DBusMessage * message, + void *user_data) { - gint *selectedColumns = NULL; - gint retval = 0; - AtkTable *table = get_table_from_servant (servant); - - bonobo_return_val_if_fail (table != NULL, 0, ev); - - retval = atk_table_get_selected_columns (table, &selectedColumns); - if (selectedColumns) g_free (selectedColumns); - return retval; + AtkTable *table = get_table (message); + dbus_int32_t row; + DBusError error; + AtkObject *obj; + + if (!table) + return spi_dbus_general_error (message); + dbus_error_init (&error); + if (!dbus_message_get_args + (message, &error, DBUS_TYPE_INT32, &row, DBUS_TYPE_INVALID)) + { + return SPI_DBUS_RETURN_ERROR (message, &error); + } + obj = atk_table_get_row_header (table, row); + return spi_dbus_return_object (message, obj, FALSE); } -static Accessibility_LongSeq * -impl_getSelectedRows (PortableServer_Servant servant, - CORBA_Environment *ev) +static DBusMessage * +impl_getColumnHeader (DBusConnection * bus, DBusMessage * message, + void *user_data) { - gint *selectedRows = NULL; - gint length; - Accessibility_LongSeq *retval; - AtkTable *table = get_table_from_servant (servant); - - bonobo_return_val_if_fail (table != NULL, NULL, ev); - - length = atk_table_get_selected_rows (table, &selectedRows); - - bonobo_return_val_if_fail (length >= 0, NULL, ev); - - retval = Accessibility_LongSeq__alloc (); - retval->_maximum = retval->_length = length; - retval->_buffer = Accessibility_LongSeq_allocbuf (length); - - while (--length >= 0) + AtkTable *table = get_table (message); + dbus_int32_t column; + DBusError error; + AtkObject *obj; + + if (!table) + return spi_dbus_general_error (message); + dbus_error_init (&error); + if (!dbus_message_get_args + (message, &error, DBUS_TYPE_INT32, &column, DBUS_TYPE_INVALID)) { - retval->_buffer[length] = selectedRows[length]; + return SPI_DBUS_RETURN_ERROR (message, &error); } - - if (selectedRows) g_free (selectedRows); - - return retval; + obj = atk_table_get_column_header (table, column); + return spi_dbus_return_object (message, obj, FALSE); } - -static Accessibility_LongSeq * -impl_getSelectedColumns (PortableServer_Servant servant, - CORBA_Environment *ev) +static DBusMessage * +impl_getSelectedRows (DBusConnection * bus, DBusMessage * message, + void *user_data) { - gint *selectedColumns = NULL; - gint length; - Accessibility_LongSeq *retval; - AtkTable *table = get_table_from_servant (servant); - - bonobo_return_val_if_fail (table != NULL, NULL, ev); - - length = atk_table_get_selected_columns (table, &selectedColumns); - - bonobo_return_val_if_fail (length >= 0, NULL, ev); - - retval = Accessibility_LongSeq__alloc (); - retval->_maximum = retval->_length = length; - retval->_buffer = Accessibility_LongSeq_allocbuf (length); - - while (--length >= 0) + AtkTable *table = get_table (message); + gint *selected_rows = NULL; + gint count; + DBusMessage *reply; + + if (!table) + return spi_dbus_general_error (message); + count = atk_table_get_selected_rows (table, &selected_rows); + if (!selected_rows) + count = 0; + reply = dbus_message_new_method_return (message); + if (reply) { - retval->_buffer[length] = (CORBA_long) selectedColumns[length]; + /* tbd - figure out if this is safe for a 0-length array */ + dbus_message_append_args (reply, DBUS_TYPE_ARRAY, DBUS_TYPE_INT32, + &selected_rows, count, DBUS_TYPE_INVALID); } - - if (selectedColumns) g_free (selectedColumns); - - return retval; + if (selected_rows) + g_free (selected_rows); + return reply; } - -static CORBA_boolean -impl_isRowSelected (PortableServer_Servant servant, - const CORBA_long row, - CORBA_Environment *ev) +static DBusMessage * +impl_getSelectedColumns (DBusConnection * bus, DBusMessage * message, + void *user_data) { - AtkTable *table = get_table_from_servant (servant); - - g_return_val_if_fail (table != NULL, FALSE); - - return atk_table_is_row_selected (table, row); + AtkTable *table = get_table (message); + gint *selected_columns = NULL; + gint count; + DBusMessage *reply; + + if (!table) + return spi_dbus_general_error (message); + count = atk_table_get_selected_columns (table, &selected_columns); + if (!selected_columns) + count = 0; + reply = dbus_message_new_method_return (message); + if (reply) + { + /* tbd - figure out if this is safe for a 0-length array */ + dbus_message_append_args (reply, DBUS_TYPE_ARRAY, DBUS_TYPE_INT32, + &selected_columns, count, DBUS_TYPE_INVALID); + } + if (selected_columns) + g_free (selected_columns); + return reply; } - -static CORBA_boolean -impl_isColumnSelected (PortableServer_Servant servant, - const CORBA_long column, - CORBA_Environment *ev) +static DBusMessage * +impl_isRowSelected (DBusConnection * bus, DBusMessage * message, + void *user_data) { - AtkTable *table = get_table_from_servant (servant); - - g_return_val_if_fail (table != NULL, FALSE); - - return atk_table_is_column_selected (table, column); + AtkTable *table = get_table (message); + dbus_int32_t row; + DBusError error; + DBusMessage *reply; + dbus_bool_t ret; + + if (!table) + return spi_dbus_general_error (message); + dbus_error_init (&error); + if (!dbus_message_get_args + (message, &error, DBUS_TYPE_INT32, &row, DBUS_TYPE_INVALID)) + { + return SPI_DBUS_RETURN_ERROR (message, &error); + } + ret = atk_table_is_row_selected (table, row); + reply = dbus_message_new_method_return (message); + if (reply) + { + dbus_message_append_args (reply, DBUS_TYPE_BOOLEAN, &ret, + DBUS_TYPE_INVALID); + } + return reply; } -static CORBA_boolean -impl_addRowSelection (PortableServer_Servant servant, - const CORBA_long row, - CORBA_Environment *ev) +static DBusMessage * +impl_isColumnSelected (DBusConnection * bus, DBusMessage * message, + void *user_data) { - AtkTable *table = get_table_from_servant (servant); - - g_return_val_if_fail (table != NULL, FALSE); - - return atk_table_add_row_selection (table, row); + AtkTable *table = get_table (message); + dbus_int32_t column; + DBusError error; + DBusMessage *reply; + dbus_bool_t ret; + + if (!table) + return spi_dbus_general_error (message); + dbus_error_init (&error); + if (!dbus_message_get_args + (message, &error, DBUS_TYPE_INT32, &column, DBUS_TYPE_INVALID)) + { + return SPI_DBUS_RETURN_ERROR (message, &error); + } + ret = atk_table_is_column_selected (table, column); + reply = dbus_message_new_method_return (message); + if (reply) + { + dbus_message_append_args (reply, DBUS_TYPE_BOOLEAN, &ret, + DBUS_TYPE_INVALID); + } + return reply; } - -static CORBA_boolean -impl_addColumnSelection (PortableServer_Servant servant, - const CORBA_long column, - CORBA_Environment *ev) +static DBusMessage * +impl_isSelected (DBusConnection * bus, DBusMessage * message, void *user_data) { - AtkTable *table = get_table_from_servant (servant); - - g_return_val_if_fail (table != NULL, FALSE); - - return atk_table_add_column_selection (table, column); + AtkTable *table = get_table (message); + dbus_int32_t row, column; + DBusError error; + DBusMessage *reply; + dbus_bool_t ret; + + if (!table) + return spi_dbus_general_error (message); + dbus_error_init (&error); + if (!dbus_message_get_args + (message, &error, DBUS_TYPE_INT32, &row, DBUS_TYPE_INT32, &column, + DBUS_TYPE_INVALID)) + { + return SPI_DBUS_RETURN_ERROR (message, &error); + } + ret = atk_table_is_selected (table, row, column); + reply = dbus_message_new_method_return (message); + if (reply) + { + dbus_message_append_args (reply, DBUS_TYPE_BOOLEAN, &ret, + DBUS_TYPE_INVALID); + } + return reply; } - -static CORBA_boolean -impl_removeRowSelection (PortableServer_Servant servant, - const CORBA_long row, - CORBA_Environment *ev) +static DBusMessage * +impl_addRowSelection (DBusConnection * bus, DBusMessage * message, + void *user_data) { - AtkTable *table = get_table_from_servant (servant); - - g_return_val_if_fail (table != NULL, FALSE); - - return atk_table_remove_row_selection (table, row); + AtkTable *table = get_table (message); + dbus_int32_t row; + DBusError error; + DBusMessage *reply; + dbus_bool_t ret; + + if (!table) + return spi_dbus_general_error (message); + dbus_error_init (&error); + if (!dbus_message_get_args + (message, &error, DBUS_TYPE_INT32, &row, DBUS_TYPE_INVALID)) + { + return SPI_DBUS_RETURN_ERROR (message, &error); + } + ret = atk_table_add_row_selection (table, row); + reply = dbus_message_new_method_return (message); + if (reply) + { + dbus_message_append_args (reply, DBUS_TYPE_BOOLEAN, &ret, + DBUS_TYPE_INVALID); + } + return reply; } - -static CORBA_boolean -impl_removeColumnSelection (PortableServer_Servant servant, - const CORBA_long column, - CORBA_Environment *ev) +static DBusMessage * +impl_addColumnSelection (DBusConnection * bus, DBusMessage * message, + void *user_data) { - AtkTable *table = get_table_from_servant (servant); - - g_return_val_if_fail (table != NULL, FALSE); - - return atk_table_remove_column_selection (table, column); + AtkTable *table = get_table (message); + dbus_int32_t column; + DBusError error; + DBusMessage *reply; + dbus_bool_t ret; + + if (!table) + return spi_dbus_general_error (message); + dbus_error_init (&error); + if (!dbus_message_get_args + (message, &error, DBUS_TYPE_INT32, &column, DBUS_TYPE_INVALID)) + { + return SPI_DBUS_RETURN_ERROR (message, &error); + } + ret = atk_table_add_column_selection (table, column); + reply = dbus_message_new_method_return (message); + if (reply) + { + dbus_message_append_args (reply, DBUS_TYPE_BOOLEAN, &ret, + DBUS_TYPE_INVALID); + } + return reply; } - -static CORBA_boolean -impl_getRowColumnExtentsAtIndex (PortableServer_Servant servant, - const CORBA_long index, - CORBA_long *row, - CORBA_long *column, - CORBA_long *row_extents, - CORBA_long *col_extents, - CORBA_boolean *is_selected, - CORBA_Environment *ev) +static DBusMessage * +impl_removeRowSelection (DBusConnection * bus, DBusMessage * message, + void *user_data) { - - AtkObject *cell; - AtkRole role; - AtkTable *table = get_table_from_servant (servant); - gint intColumn, intRow, intRow_extents, intCol_extents; - gboolean boolIs_selected; - - g_return_val_if_fail (table != NULL, FALSE); - - intColumn = atk_table_get_column_at_index (table, index); - intRow = atk_table_get_row_at_index (table, index); - intRow_extents = atk_table_get_row_extent_at (table, intRow, intColumn); - intCol_extents = atk_table_get_column_extent_at (table, intRow, intColumn); - boolIs_selected = atk_table_is_selected (table, intRow, intColumn); - - *column = intColumn; - *row = intRow; - *row_extents = intRow_extents; - *col_extents = intCol_extents; - *is_selected = boolIs_selected; - - cell = atk_table_ref_at (table, intRow, intColumn); - role = atk_object_get_role (cell); - - if (role == ATK_ROLE_TABLE_CELL) - return TRUE; - - return FALSE; - + AtkTable *table = get_table (message); + dbus_int32_t row; + DBusError error; + DBusMessage *reply; + dbus_bool_t ret; + + if (!table) + return spi_dbus_general_error (message); + dbus_error_init (&error); + if (!dbus_message_get_args + (message, &error, DBUS_TYPE_INT32, &row, DBUS_TYPE_INVALID)) + { + return SPI_DBUS_RETURN_ERROR (message, &error); + } + ret = atk_table_remove_row_selection (table, row); + reply = dbus_message_new_method_return (message); + if (reply) + { + dbus_message_append_args (reply, DBUS_TYPE_BOOLEAN, &ret, + DBUS_TYPE_INVALID); + } + return reply; } -static CORBA_boolean -impl_isSelected (PortableServer_Servant servant, - const CORBA_long row, - const CORBA_long column, - CORBA_Environment *ev) +static DBusMessage * +impl_removeColumnSelection (DBusConnection * bus, DBusMessage * message, + void *user_data) { - AtkTable *table = get_table_from_servant (servant); - - g_return_val_if_fail (table != NULL, FALSE); - - return atk_table_is_selected (table, - row, column); + AtkTable *table = get_table (message); + dbus_int32_t column; + DBusError error; + DBusMessage *reply; + dbus_bool_t ret; + + if (!table) + return spi_dbus_general_error (message); + dbus_error_init (&error); + if (!dbus_message_get_args + (message, &error, DBUS_TYPE_INT32, &column, DBUS_TYPE_INVALID)) + { + return SPI_DBUS_RETURN_ERROR (message, &error); + } + ret = atk_table_remove_column_selection (table, column); + reply = dbus_message_new_method_return (message); + if (reply) + { + dbus_message_append_args (reply, DBUS_TYPE_BOOLEAN, &ret, + DBUS_TYPE_INVALID); + } + return reply; } - -static void -spi_table_class_init (SpiTableClass *klass) +static DBusMessage * +impl_getRowColumnExtentsAtIndex (DBusConnection * bus, DBusMessage * message, + void *user_data) { - POA_Accessibility_Table__epv *epv = &klass->epv; + AtkTable *table = get_table (message); + dbus_int32_t index; + DBusError error; + dbus_int32_t row, column, row_extents, col_extents; + dbus_bool_t is_selected; + dbus_bool_t ret; + DBusMessage *reply; - /* Initialize epv table */ + AtkObject *cell; + AtkRole role; - epv->_get_caption = impl__get_caption; - epv->_get_summary = impl__get_summary; - epv->_get_nRows = impl__get_nRows; - epv->_get_nColumns = impl__get_nColumns; - epv->_get_nSelectedRows = impl__get_nSelectedRows; - epv->_get_nSelectedColumns = impl__get_nSelectedColumns; - epv->getAccessibleAt = impl_getAccessibleAt; - epv->getIndexAt = impl_getIndexAt; - epv->getRowAtIndex = impl_getRowAtIndex; - epv->getColumnAtIndex = impl_getColumnAtIndex; - epv->getRowDescription = impl_getRowDescription; - epv->getColumnDescription = impl_getColumnDescription; - epv->getRowExtentAt = impl_getRowExtentAt; - epv->getColumnExtentAt = impl_getColumnExtentAt; - epv->getRowHeader = impl_getRowHeader; - epv->getColumnHeader = impl_getColumnHeader; - epv->getSelectedRows = impl_getSelectedRows; - epv->getSelectedColumns = impl_getSelectedColumns; - epv->isRowSelected = impl_isRowSelected; - epv->isColumnSelected = impl_isColumnSelected; - epv->addRowSelection = impl_addRowSelection; - epv->addColumnSelection = impl_addColumnSelection; - epv->removeRowSelection = impl_removeRowSelection; - epv->removeColumnSelection = impl_removeColumnSelection; - epv->isSelected = impl_isSelected; - epv->getRowColumnExtentsAtIndex = impl_getRowColumnExtentsAtIndex; + if (!table) + return spi_dbus_general_error (message); + dbus_error_init (&error); + if (!dbus_message_get_args + (message, &error, DBUS_TYPE_INT32, &index, DBUS_TYPE_INVALID)) + { + return SPI_DBUS_RETURN_ERROR (message, &error); + } + column = atk_table_get_column_at_index (table, index); + row = atk_table_get_row_at_index (table, index); + row_extents = atk_table_get_row_extent_at (table, row, column); + col_extents = atk_table_get_column_extent_at (table, row, column); + is_selected = atk_table_is_selected (table, row, column); + cell = atk_table_ref_at (table, row, column); + role = atk_object_get_role (cell); + g_object_unref (cell); + ret = (role == ATK_ROLE_TABLE_CELL ? TRUE : FALSE); + reply = dbus_message_new_method_return (message); + if (reply) + { + dbus_message_append_args (reply, DBUS_TYPE_INT32, row, DBUS_TYPE_INT32, + column, DBUS_TYPE_INT32, row_extents, + DBUS_TYPE_INT32, col_extents, + DBUS_TYPE_BOOLEAN, is_selected, + DBUS_TYPE_BOOLEAN, &ret, DBUS_TYPE_INVALID); + } + return reply; } -static void -spi_table_init (SpiTable *table) +static DRouteMethod methods[] = { + {DROUTE_METHOD, impl_getAccessibleAt, "getAccessibleAt", + "i,row,i:i,column,i:o,,o"}, + {DROUTE_METHOD, impl_getIndexAt, "getIndexAt", "i,row,i:i,column,i:i,,o"}, + {DROUTE_METHOD, impl_getRowAtIndex, "getRowAtIndex", "i,index,i:i,,o"}, + {DROUTE_METHOD, impl_getColumnAtIndex, "getColumnAtIndex", + "i,index,i:i,,o"}, + {DROUTE_METHOD, impl_getRowDescription, "getRowDescription", + "i,row,i:s,,o"}, + {DROUTE_METHOD, impl_getColumnDescription, "getColumnDescription", + "i,column,i:s,,o"}, + {DROUTE_METHOD, impl_getRowExtentAt, "getRowExtentAt", + "i,row,i:i,column,i:i,,o"}, + {DROUTE_METHOD, impl_getColumnExtentAt, "getColumnExtentAt", + "i,row,i:i,column,i:i,,o"}, + {DROUTE_METHOD, impl_getRowHeader, "getRowHeader", "i,row,i:o,,o"}, + {DROUTE_METHOD, impl_getColumnHeader, "getColumnHeader", "i,column,i:o,,o"}, + {DROUTE_METHOD, impl_getSelectedRows, "getSelectedRows", "ai,,o"}, + {DROUTE_METHOD, impl_getSelectedColumns, "getSelectedColumns", "ai,,o"}, + {DROUTE_METHOD, impl_isRowSelected, "isRowSelected", "i,row,i:b,,o"}, + {DROUTE_METHOD, impl_isColumnSelected, "isColumnSelected", + "i,column,i:b,,o"}, + {DROUTE_METHOD, impl_isSelected, "isSelected", "i,row,i:i,column,i:b,,o"}, + {DROUTE_METHOD, impl_addRowSelection, "addRowSelection", "i,row,i:b,,o"}, + {DROUTE_METHOD, impl_addColumnSelection, "addColumnSelection", + "i,column,i:b,,o"}, + {DROUTE_METHOD, impl_removeRowSelection, "removeRowSelection", + "i,row,i:b,,o"}, + {DROUTE_METHOD, impl_removeColumnSelection, "removeColumnSelection", + "i,column,i:b,,o"}, + {DROUTE_METHOD, impl_getRowColumnExtentsAtIndex, + "getRowColumnExtentsAtIndex", + "i,index,i:i,row,o:i,col,o:i,row_extents,o:i,col_extents,o:b,is_selected,o:b,,o"}, + {0, NULL, NULL, NULL} +}; + +static DRouteProperty properties[] = { + {impl_get_nRows, impl_get_nRows_str, NULL, NULL, "nRows", "i"}, + {impl_get_nColumns, impl_get_nColumns_str, NULL, NULL, "nColumns", "i"}, + {impl_get_caption, impl_get_caption_str, NULL, NULL, "caption", "o"}, + {impl_get_summary, impl_get_summary_str, NULL, NULL, "summary", "o"}, + {impl_get_nSelectedRows, impl_get_nSelectedRows_str, NULL, NULL, + "nSelectedRows", "i"}, + {impl_get_nSelectedColumns, impl_get_nSelectedColumns_str, NULL, NULL, + "nSelectedColumns", "i"}, + {NULL, NULL, NULL, NULL, NULL, NULL} +}; + +void +spi_initialize_table (DRouteData * data) { -} - -BONOBO_TYPE_FUNC_FULL (SpiTable, - Accessibility_Table, - SPI_TYPE_BASE, - spi_table) + droute_add_interface (data, "org.freedesktop.accessibility.Table", methods, + properties, + (DRouteGetDatumFunction) get_table_from_path, NULL); +}; diff --git a/libspi/text.c b/libspi/text.c index 103e719..2bff585 100644 --- a/libspi/text.c +++ b/libspi/text.c @@ -2,6 +2,7 @@ * AT-SPI - Assistive Technology Service Provider Interface * (Gnome Accessibility Project; http://developer.gnome.org/projects/gap) * + * Copyright 2008 Novell, Inc. * Copyright 2001, 2002 Sun Microsystems Inc., * Copyright 2001, 2002 Ximian, Inc. * @@ -21,205 +22,315 @@ * Boston, MA 02111-1307, USA. */ -/* text.c : implements the Text interface */ - -#include -#include -#include +#include "accessible.h" #include -#include -#include -#include - -/* Our parent Gtk object type */ -#define PARENT_TYPE SPI_TYPE_BASE - -typedef struct { - gint x; - gint y; - gint w; - gint h; -} SpiTextRect; static AtkText * -get_text_from_servant (PortableServer_Servant servant) +get_text (DBusMessage * message) { - SpiBase *object = SPI_BASE (bonobo_object_from_servant (servant)); + AtkObject *obj = spi_dbus_get_object (dbus_message_get_path (message)); + if (!obj) + return NULL; + return ATK_TEXT (obj); +} - g_return_val_if_fail (object, NULL); - g_return_val_if_fail (ATK_IS_OBJECT(object->gobj), NULL); - return ATK_TEXT (object->gobj); +static AtkText * +get_text_from_path (const char *path, void *user_data) +{ + AtkObject *obj = spi_dbus_get_object (path); + if (!obj) + return NULL; + return ATK_TEXT (obj); } -static CORBA_string -impl_getText (PortableServer_Servant servant, - const CORBA_long startOffset, - const CORBA_long endOffset, - CORBA_Environment *ev) +static dbus_bool_t +impl_get_characterCount (const char *path, DBusMessageIter * iter, + void *user_data) { - gchar *txt; - CORBA_string rv; - AtkText *text = get_text_from_servant (servant); + AtkText *text = get_text_from_path (path, user_data); + if (!text) + return FALSE; + return droute_return_v_int32 (iter, atk_text_get_character_count (text)); +} - g_return_val_if_fail (text != NULL, CORBA_string_dup ("")); - - txt = atk_text_get_text (text, startOffset, endOffset); - if (txt) - { - rv = CORBA_string_dup (txt); - g_free (txt); - } - else - rv = CORBA_string_dup (""); +static char * +impl_get_characterCount_str (void *datum) +{ + g_assert (ATK_IS_TEXT (datum)); - return rv; + return g_strdup_printf ("%d", + atk_text_get_character_count ((AtkText *) datum)); } - -static CORBA_string -impl_getTextAfterOffset (PortableServer_Servant servant, - const CORBA_long offset, - const - Accessibility_TEXT_BOUNDARY_TYPE - type, CORBA_long * startOffset, - CORBA_long * endOffset, - CORBA_Environment *ev) +static dbus_bool_t +impl_get_caretOffset (const char *path, DBusMessageIter * iter, + void *user_data) { - gchar *txt; - CORBA_char *rv; - gint intStartOffset, intEndOffset; - AtkText *text = get_text_from_servant (servant); + AtkText *text = get_text_from_path (path, user_data); + if (!text) + return FALSE; + return droute_return_v_int32 (iter, atk_text_get_caret_offset (text)); +} - g_return_val_if_fail (text != NULL, CORBA_string_dup ("")); +static char * +impl_get_caretOffset_str (void *datum) +{ + g_assert (ATK_IS_TEXT (datum)); - txt = atk_text_get_text_after_offset (text, - offset, (AtkTextBoundary) type, - &intStartOffset, &intEndOffset); - *startOffset = intStartOffset; - *endOffset = intEndOffset; + return g_strdup_printf ("%d", + atk_text_get_caret_offset ((AtkText *) datum)); +} - if (txt) +static DBusMessage * +impl_getText (DBusConnection * bus, DBusMessage * message, void *user_data) +{ + AtkText *text = get_text (message); + dbus_int32_t startOffset, endOffset; + gchar *txt; + 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, &startOffset, DBUS_TYPE_INT32, + &endOffset, DBUS_TYPE_INVALID)) { - rv = CORBA_string_dup (txt); - g_free (txt); + return SPI_DBUS_RETURN_ERROR (message, &error); } - else - rv = CORBA_string_dup (""); - - return rv; + txt = atk_text_get_text (text, startOffset, endOffset); + if (!txt) + txt = g_strdup (""); + reply = dbus_message_new_method_return (message); + if (reply) + { + dbus_message_append_args (reply, DBUS_TYPE_STRING, &txt, + DBUS_TYPE_INVALID); + } + g_free (txt); + return reply; } +static DBusMessage * +impl_setCaretOffset (DBusConnection * bus, DBusMessage * message, + void *user_data) +{ + AtkText *text = get_text (message); + dbus_int32_t offset; + dbus_bool_t rv; + 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); + } + rv = atk_text_set_caret_offset (text, offset); + reply = dbus_message_new_method_return (message); + if (reply) + { + dbus_message_append_args (reply, DBUS_TYPE_BOOLEAN, &rv, + DBUS_TYPE_INVALID); + } + return reply; +} -static CORBA_string -impl_getTextAtOffset (PortableServer_Servant servant, - const CORBA_long offset, - const Accessibility_TEXT_BOUNDARY_TYPE type, - CORBA_long * startOffset, - CORBA_long * endOffset, - CORBA_Environment *ev) +static DBusMessage * +impl_getTextBeforeOffset (DBusConnection * bus, DBusMessage * message, + void *user_data) { + AtkText *text = get_text (message); + dbus_int32_t offset; + dbus_uint32_t type; gchar *txt; - CORBA_char *rv; - gint intStartOffset, intEndOffset; - AtkText *text = get_text_from_servant (servant); - - g_return_val_if_fail (text != NULL, CORBA_string_dup ("")); - - txt = atk_text_get_text_at_offset ( - text, - offset, (AtkTextBoundary) type, - &intStartOffset, &intEndOffset); - - *startOffset = intStartOffset; - *endOffset = intEndOffset; - - if (txt) + dbus_int32_t startOffset, endOffset; + gint intstart_offset = 0, intend_offset = 0; + 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_UINT32, &type, + DBUS_TYPE_INVALID)) { - rv = CORBA_string_dup (txt); - g_free (txt); + return SPI_DBUS_RETURN_ERROR (message, &error); } - else - rv = CORBA_string_dup (""); - - return rv; + txt = + atk_text_get_text_before_offset (text, offset, (AtkTextBoundary) type, + &intstart_offset, &intend_offset); + startOffset = intstart_offset; + endOffset = intend_offset; + if (!txt) + txt = g_strdup (""); + 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, + &txt, DBUS_TYPE_INVALID); + } + g_free (txt); + return reply; } - -static CORBA_unsigned_long -impl_getCharacterAtOffset (PortableServer_Servant servant, - const CORBA_long offset, - CORBA_Environment *ev) +static DBusMessage * +impl_getTextAtOffset (DBusConnection * bus, DBusMessage * message, + void *user_data) { - AtkText *text = get_text_from_servant (servant); - - g_return_val_if_fail (text != NULL, 0); - - return atk_text_get_character_at_offset (text, offset); + AtkText *text = get_text (message); + dbus_int32_t offset, type; + gchar *txt; + dbus_int32_t startOffset, endOffset; + gint intstart_offset = 0, intend_offset = 0; + 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_UINT32, &type, + DBUS_TYPE_INVALID)) + { + return SPI_DBUS_RETURN_ERROR (message, &error); + } + txt = + atk_text_get_text_at_offset (text, offset, (AtkTextBoundary) type, + &intstart_offset, &intend_offset); + startOffset = intstart_offset; + endOffset = intend_offset; + if (!txt) + txt = g_strdup (""); + 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, + &txt, DBUS_TYPE_INVALID); + } + g_free (txt); + return reply; } - -static CORBA_string -impl_getTextBeforeOffset (PortableServer_Servant servant, - const CORBA_long offset, - const - Accessibility_TEXT_BOUNDARY_TYPE - type, CORBA_long * startOffset, - CORBA_long * endOffset, - CORBA_Environment *ev) +static DBusMessage * +impl_getTextAfterOffset (DBusConnection * bus, DBusMessage * message, + void *user_data) { + AtkText *text = get_text (message); + dbus_int32_t offset; + dbus_uint32_t type; gchar *txt; - CORBA_char *rv; - gint intStartOffset, intEndOffset; - AtkText *text = get_text_from_servant (servant); - - g_return_val_if_fail (text != NULL, CORBA_string_dup ("")); - - txt = atk_text_get_text_before_offset (text, - offset, (AtkTextBoundary) type, - &intStartOffset, &intEndOffset); - - *startOffset = intStartOffset; - *endOffset = intEndOffset; - - if (txt) + dbus_int32_t startOffset, endOffset; + gint intstart_offset = 0, intend_offset = 0; + 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_UINT32, &type, + DBUS_TYPE_INVALID)) { - rv = CORBA_string_dup (txt); - g_free (txt); + return SPI_DBUS_RETURN_ERROR (message, &error); } - else - rv = CORBA_string_dup (""); - - return rv; + txt = + atk_text_get_text_after_offset (text, offset, (AtkTextBoundary) type, + &intstart_offset, &intend_offset); + startOffset = intstart_offset; + endOffset = intend_offset; + if (!txt) + txt = g_strdup (""); + 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, + &txt, DBUS_TYPE_INVALID); + } + g_free (txt); + return reply; } - -static CORBA_long -impl__get_caretOffset (PortableServer_Servant servant, - CORBA_Environment *ev) +static DBusMessage * +impl_getAttributeValue (DBusConnection * bus, DBusMessage * message, + void *user_data) { - AtkText *text = get_text_from_servant (servant); + AtkText *text = get_text (message); + dbus_int32_t offset; + char *attributeName; + dbus_int32_t startOffset, endOffset; + dbus_bool_t defined; + gint intstart_offset = 0, intend_offset = 0; + char *rv; + DBusError error; + DBusMessage *reply; + AtkAttributeSet *set; + GSList *cur_attr; + AtkAttribute *at; - g_return_val_if_fail (text != NULL, -1); + 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_STRING, + &attributeName, DBUS_TYPE_INVALID)) + { + return SPI_DBUS_RETURN_ERROR (message, &error); + } - return atk_text_get_caret_offset (text); + set = atk_text_get_run_attributes (text, offset, + &intstart_offset, &intend_offset); + startOffset = intstart_offset; + endOffset = intend_offset; + defined = FALSE; + cur_attr = (GSList *) set; + while (cur_attr) + { + at = (AtkAttribute *) cur_attr->data; + if (!strcmp (at->name, attributeName)) + { + rv = at->value; + defined = TRUE; + break; + } + cur_attr = cur_attr->next; + } + if (!rv) + rv = ""; + reply = dbus_message_new_method_return (message); + if (reply) + { + dbus_message_append_args (reply, DBUS_TYPE_INT32, &startOffset, + DBUS_TYPE_INT32, &endOffset, + DBUS_TYPE_BOOLEAN, &defined, DBUS_TYPE_STRING, + &rv, DBUS_TYPE_INVALID); + } + atk_attribute_set_free (set); + return reply; } - -static CORBA_char * -_string_from_attribute_set (AtkAttributeSet *set) +static char * +_string_from_attribute_set (AtkAttributeSet * set) { gchar *attributes, *tmp, *tmp2; - CORBA_char *rv; GSList *cur_attr; AtkAttribute *at; - + attributes = g_strdup (""); cur_attr = (GSList *) set; while (cur_attr) { at = (AtkAttribute *) cur_attr->data; tmp = g_strdup_printf ("%s%s:%s%s", - ((GSList *)(set) == cur_attr) ? "" : " ", + ((GSList *) (set) == cur_attr) ? "" : " ", at->name, at->value, (cur_attr->next) ? ";" : ""); tmp2 = g_strconcat (attributes, tmp, NULL); @@ -228,459 +339,565 @@ _string_from_attribute_set (AtkAttributeSet *set) attributes = tmp2; cur_attr = cur_attr->next; } - rv = CORBA_string_dup (attributes); - g_free (attributes); - return rv; + return attributes; } - - -static CORBA_string -impl_getAttributes (PortableServer_Servant servant, - const CORBA_long offset, - CORBA_long * startOffset, - CORBA_long * endOffset, - CORBA_Environment *ev) +static DBusMessage * +impl_getAttributes (DBusConnection * bus, DBusMessage * message, + void *user_data) { - AtkAttributeSet *set; + AtkText *text = get_text (message); + dbus_int32_t offset; + dbus_int32_t startOffset, endOffset; gint intstart_offset, intend_offset; - CORBA_char *rv; - AtkText *text = get_text_from_servant (servant); - - g_return_val_if_fail (text != NULL, CORBA_string_dup ("")); - - set = atk_text_get_run_attributes (text, offset, - &intstart_offset, &intend_offset); - *startOffset = intstart_offset; - *endOffset = intend_offset; - rv = _string_from_attribute_set (set); - atk_attribute_set_free (set); - return rv; -} - -static CORBA_string -impl_getAttributeValue (PortableServer_Servant servant, - const CORBA_long offset, - const CORBA_char *attributename, - CORBA_long * startOffset, - CORBA_long * endOffset, - CORBA_boolean * defined, - CORBA_Environment *ev) -{ + char *rv; + DBusError error; + DBusMessage *reply; AtkAttributeSet *set; - gint intstart_offset, intend_offset; - GSList *cur_attr; - CORBA_string rv = NULL; - AtkText *text = get_text_from_servant (servant); - AtkAttribute *at; - g_return_val_if_fail (text != NULL, CORBA_string_dup ("")); + 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); + } set = atk_text_get_run_attributes (text, offset, &intstart_offset, &intend_offset); - *startOffset = intstart_offset; - *endOffset = intend_offset; - *defined = FALSE; - cur_attr = (GSList *) set; - while (cur_attr) + startOffset = intstart_offset; + endOffset = intend_offset; + rv = _string_from_attribute_set (set); + reply = dbus_message_new_method_return (message); + if (reply) { - at = (AtkAttribute *) cur_attr->data; - if (!strcmp (at->name, attributename)) - { - rv = CORBA_string_dup (at->value); - *defined = TRUE; - break; - } - cur_attr = cur_attr->next; + dbus_message_append_args (reply, DBUS_TYPE_INT32, &startOffset, + DBUS_TYPE_INT32, &endOffset, DBUS_TYPE_STRING, + &rv, DBUS_TYPE_INVALID); } + g_free (rv); atk_attribute_set_free (set); - return (rv ? rv : CORBA_string_dup ("")); + return reply; } -static CORBA_string -impl_getDefaultAttributes (PortableServer_Servant servant, - CORBA_Environment *ev) +static DBusMessage * +impl_getDefaultAttributes (DBusConnection * bus, DBusMessage * message, + void *user_data) { + AtkText *text = get_text (message); + char *rv; + DBusError error; + DBusMessage *reply; AtkAttributeSet *set; - CORBA_char *rv; - AtkText *text = get_text_from_servant (servant); - g_return_val_if_fail (text != NULL, CORBA_string_dup ("")); + if (!text) + return spi_dbus_general_error (message); + dbus_error_init (&error); set = atk_text_get_default_attributes (text); - rv = _string_from_attribute_set (set); + reply = dbus_message_new_method_return (message); + if (reply) + { + dbus_message_append_args (reply, DBUS_TYPE_STRING, &rv, + DBUS_TYPE_INVALID); + } + g_free (rv); atk_attribute_set_free (set); - return rv; + return reply; } -static void -impl_getCharacterExtents (PortableServer_Servant servant, - const CORBA_long offset, CORBA_long * x, - CORBA_long * y, CORBA_long * width, - CORBA_long * height, - const CORBA_short coordType, - CORBA_Environment *ev) +static DBusMessage * +impl_getCharacterExtents (DBusConnection * bus, DBusMessage * message, + void *user_data) { - AtkText *text = get_text_from_servant (servant); - gint ix, iy, iw, ih; - - g_return_if_fail (text != NULL); - - atk_text_get_character_extents ( - text, offset, - &ix, &iy, &iw, &ih, - (AtkCoordType) coordType); - *x = ix; - *y = iy; - *width = iw; - *height = ih; -} - - -static CORBA_long -impl__get_characterCount (PortableServer_Servant servant, - CORBA_Environment *ev) -{ - AtkText *text = get_text_from_servant (servant); - - g_return_val_if_fail (text != NULL, 0); - - return atk_text_get_character_count (text); -} - - -static CORBA_long -impl_getOffsetAtPoint (PortableServer_Servant servant, - const CORBA_long x, const CORBA_long y, - const CORBA_short coordType, - CORBA_Environment *ev) -{ - AtkText *text = get_text_from_servant (servant); - - g_return_val_if_fail (text != NULL, -1); - - return atk_text_get_offset_at_point (text, - x, y, + AtkText *text = get_text (message); + dbus_int32_t offset; + dbus_uint32_t coordType; + dbus_int32_t x, y, width, height; + gint ix = 0, iy = 0, iw = 0, ih = 0; + 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_INT32, &coordType, + DBUS_TYPE_INVALID)) + { + return SPI_DBUS_RETURN_ERROR (message, &error); + } + atk_text_get_character_extents (text, offset, &ix, &iy, &iw, &ih, (AtkCoordType) coordType); + x = ix; + y = iy; + width = iw; + height = ih; + reply = dbus_message_new_method_return (message); + if (reply) + { + dbus_message_append_args (reply, DBUS_TYPE_INT32, &x, DBUS_TYPE_INT32, + &y, DBUS_TYPE_INT32, &width, DBUS_TYPE_INT32, + &height, DBUS_TYPE_INVALID); + } + return reply; } - -static CORBA_long -impl_getNSelections (PortableServer_Servant servant, - CORBA_Environment *ev) +static DBusMessage * +impl_getOffsetAtPoint (DBusConnection * bus, DBusMessage * message, + void *user_data) { - AtkText *text = get_text_from_servant (servant); - - g_return_val_if_fail (text != NULL, 0); - - return atk_text_get_n_selections (text); + AtkText *text = get_text (message); + dbus_int32_t x, y; + dbus_uint32_t coordType; + dbus_int32_t rv; + 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, &x, DBUS_TYPE_INT32, &y, + DBUS_TYPE_UINT32, &coordType, DBUS_TYPE_INVALID)) + { + return SPI_DBUS_RETURN_ERROR (message, &error); + } + rv = atk_text_get_offset_at_point (text, x, y, coordType); + reply = dbus_message_new_method_return (message); + if (reply) + { + dbus_message_append_args (reply, DBUS_TYPE_INT32, &rv, + DBUS_TYPE_INVALID); + } + return reply; } - -static void -impl_getSelection (PortableServer_Servant servant, - const CORBA_long selectionNum, - CORBA_long * startOffset, CORBA_long * endOffset, - CORBA_Environment *ev) +static DBusMessage * +impl_getNSelections (DBusConnection * bus, DBusMessage * message, + void *user_data) { - AtkText *text = get_text_from_servant (servant); - gint intStartOffset, intEndOffset; - - g_return_if_fail (text != NULL); - - /* atk_text_get_selection returns gchar* which we discard */ - g_free (atk_text_get_selection (text, selectionNum, - &intStartOffset, &intEndOffset)); - - *startOffset = intStartOffset; - *endOffset = intEndOffset; + AtkText *text = get_text (message); + dbus_int32_t rv; + DBusMessage *reply; + + if (!text) + return spi_dbus_general_error (message); + rv = atk_text_get_n_selections (text); + reply = dbus_message_new_method_return (message); + if (reply) + { + dbus_message_append_args (reply, DBUS_TYPE_INT32, &rv, + DBUS_TYPE_INVALID); + } + return reply; } - -static CORBA_boolean -impl_addSelection (PortableServer_Servant servant, - const CORBA_long startOffset, - const CORBA_long endOffset, - CORBA_Environment *ev) +static DBusMessage * +impl_getSelection (DBusConnection * bus, DBusMessage * message, + void *user_data) { - AtkText *text = get_text_from_servant (servant); - - g_return_val_if_fail (text != NULL, FALSE); - - return atk_text_add_selection (text, - startOffset, endOffset); + AtkText *text = get_text (message); + dbus_int32_t selectionNum; + dbus_int32_t startOffset, endOffset; + gint intstart_offset = 0, intend_offset = 0; + 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, &selectionNum, DBUS_TYPE_INVALID)) + { + return SPI_DBUS_RETURN_ERROR (message, &error); + } + /* atk_text_get_selection returns gchar * which we discard */ + g_free (atk_text_get_selection + (text, selectionNum, &intstart_offset, &intend_offset)); + startOffset = intstart_offset; + endOffset = intend_offset; + reply = dbus_message_new_method_return (message); + if (reply) + { + dbus_message_append_args (reply, DBUS_TYPE_INT32, &startOffset, + DBUS_TYPE_INT32, &endOffset, + DBUS_TYPE_INVALID); + } + return reply; } - -static CORBA_boolean -impl_removeSelection (PortableServer_Servant servant, - const CORBA_long selectionNum, - CORBA_Environment *ev) +static DBusMessage * +impl_addSelection (DBusConnection * bus, DBusMessage * message, + void *user_data) { - AtkText *text = get_text_from_servant (servant); - - g_return_val_if_fail (text != NULL, FALSE); - - return atk_text_remove_selection (text, selectionNum); + AtkText *text = get_text (message); + dbus_int32_t startOffset, endOffset; + dbus_bool_t rv; + 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, &startOffset, DBUS_TYPE_INT32, + &endOffset, DBUS_TYPE_INVALID)) + { + return SPI_DBUS_RETURN_ERROR (message, &error); + } + rv = atk_text_add_selection (text, startOffset, endOffset); + reply = dbus_message_new_method_return (message); + if (reply) + { + dbus_message_append_args (reply, DBUS_TYPE_BOOLEAN, &rv, + DBUS_TYPE_INVALID); + } + return reply; } - -static CORBA_boolean -impl_setSelection (PortableServer_Servant servant, - const CORBA_long selectionNum, - const CORBA_long startOffset, - const CORBA_long endOffset, - CORBA_Environment *ev) +static DBusMessage * +impl_removeSelection (DBusConnection * bus, DBusMessage * message, + void *user_data) { - AtkText *text = get_text_from_servant (servant); - - g_return_val_if_fail (text != NULL, FALSE); - - return atk_text_set_selection (text, - selectionNum, startOffset, endOffset); + AtkText *text = get_text (message); + dbus_int32_t selectionNum; + dbus_bool_t rv; + 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, &selectionNum, DBUS_TYPE_INVALID)) + { + return SPI_DBUS_RETURN_ERROR (message, &error); + } + rv = atk_text_remove_selection (text, selectionNum); + reply = dbus_message_new_method_return (message); + if (reply) + { + dbus_message_append_args (reply, DBUS_TYPE_BOOLEAN, &rv, + DBUS_TYPE_INVALID); + } + return reply; } - -static CORBA_boolean -impl_setCaretOffset (PortableServer_Servant servant, - const CORBA_long value, - CORBA_Environment *ev) +static DBusMessage * +impl_setSelection (DBusConnection * bus, DBusMessage * message, + void *user_data) { - AtkText *text = get_text_from_servant (servant); - - g_return_val_if_fail (text != NULL, FALSE); - - return atk_text_set_caret_offset (text, value); + AtkText *text = get_text (message); + dbus_int32_t selectionNum, startOffset, endOffset; + dbus_bool_t rv; + 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, &selectionNum, DBUS_TYPE_INT32, + &startOffset, DBUS_TYPE_INT32, &endOffset, DBUS_TYPE_INVALID)) + { + return SPI_DBUS_RETURN_ERROR (message, &error); + } + rv = atk_text_set_selection (text, selectionNum, startOffset, endOffset); + reply = dbus_message_new_method_return (message); + if (reply) + { + dbus_message_append_args (reply, DBUS_TYPE_BOOLEAN, &rv, + DBUS_TYPE_INVALID); + } + return reply; } -static void -impl_getRangeExtents(PortableServer_Servant servant, - const CORBA_long startOffset, - const CORBA_long endOffset, - CORBA_long * x, CORBA_long * y, - CORBA_long * width, - CORBA_long * height, - const CORBA_short coordType, - CORBA_Environment * ev) +static DBusMessage * +impl_getRangeExtents (DBusConnection * bus, DBusMessage * message, + void *user_data) { - AtkText *text = get_text_from_servant (servant); + AtkText *text = get_text (message); + dbus_int32_t startOffset, endOffset; + dbus_uint32_t coordType; AtkTextRectangle rect; - - g_return_if_fail (text != NULL); - - atk_text_get_range_extents (text, (gint) startOffset, (gint) endOffset, + dbus_int32_t x, y, width, height; + 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, &startOffset, DBUS_TYPE_INT32, + &endOffset, DBUS_TYPE_UINT32, &coordType, DBUS_TYPE_INVALID)) + { + return SPI_DBUS_RETURN_ERROR (message, &error); + } + memset (&rect, 0, sizeof (rect)); + atk_text_get_range_extents (text, startOffset, endOffset, (AtkCoordType) coordType, &rect); - *x = rect.x; - *y = rect.y; - *width = rect.width; - *height = rect.height; -} - -#define MAXRANGELEN 512 - -static Accessibility_Text_RangeList * -_spi_text_range_seq_from_atkrangelist (AtkTextRange **range_list) -{ - Accessibility_Text_RangeList *rangeList = - Accessibility_Text_RangeList__alloc (); - int i, len; - - for (len = 0; len < MAXRANGELEN && range_list[len]; ++len); - - rangeList->_length = len; - rangeList->_buffer = Accessibility_Text_RangeList_allocbuf (len); - for (i = 0; i < len; ++i) + x = rect.x; + y = rect.y; + width = rect.width; + height = rect.height; + reply = dbus_message_new_method_return (message); + if (reply) { - rangeList->_buffer[i].startOffset = range_list[i]->start_offset; - rangeList->_buffer[i].endOffset = range_list[i]->end_offset; - rangeList->_buffer[i].content = CORBA_string_dup (range_list[i]->content); + dbus_message_append_args (reply, DBUS_TYPE_INT32, &x, DBUS_TYPE_INT32, + &y, DBUS_TYPE_INT32, &width, DBUS_TYPE_INT32, + &height, DBUS_TYPE_INVALID); } - - return rangeList; + return reply; } -static Accessibility_Text_RangeList * -impl_getBoundedRanges(PortableServer_Servant servant, - const CORBA_long x, - const CORBA_long y, - const CORBA_long width, - const CORBA_long height, - const CORBA_short coordType, - const Accessibility_TEXT_CLIP_TYPE xClipType, - const Accessibility_TEXT_CLIP_TYPE yClipType, - CORBA_Environment * ev) +#define MAXRANGELEN 512 + +static DBusMessage * +impl_getBoundedRanges (DBusConnection * bus, DBusMessage * message, + void *user_data) { - AtkText *text = get_text_from_servant (servant); + AtkText *text = get_text (message); + dbus_int32_t x, y, width, height; + dbus_uint32_t coordType, xClipType, yClipType; + DBusError error; AtkTextRange **range_list = NULL; AtkTextRectangle rect; - + DBusMessage *reply; + DBusMessageIter iter, array, struc, variant; + + if (!text) + return spi_dbus_general_error (message); + dbus_error_init (&error); + if (!dbus_message_get_args + (message, &error, DBUS_TYPE_INT32, &x, DBUS_TYPE_INT32, &y, + DBUS_TYPE_INT32, &height, DBUS_TYPE_INT32, &width, DBUS_TYPE_INT32, + &coordType, DBUS_TYPE_INT32, &xClipType, DBUS_TYPE_INT32, &yClipType, + DBUS_TYPE_INVALID)) + { + return SPI_DBUS_RETURN_ERROR (message, &error); + } rect.x = x; rect.y = y; rect.width = width; rect.height = height; - range_list = atk_text_get_bounded_ranges (text, &rect, - (AtkCoordType) coordType, - (AtkTextClipType) xClipType, - (AtkTextClipType) yClipType); - - return _spi_text_range_seq_from_atkrangelist (range_list); + range_list = + atk_text_get_bounded_ranges (text, &rect, (AtkCoordType) coordType, + (AtkTextClipType) xClipType, + (AtkTextClipType) yClipType); + reply = dbus_message_new_method_return (message); + if (!reply) + return NULL; + /* This isn't pleasant. */ + dbus_message_iter_init_append (reply, &iter); + if (dbus_message_iter_open_container + (&iter, DBUS_TYPE_ARRAY, "(iisv)", &array)) + { + int len; + for (len = 0; len < MAXRANGELEN && range_list[len]; ++len) + { + if (dbus_message_iter_open_container + (&array, DBUS_TYPE_STRUCT, NULL, &struc)) + { + dbus_int32_t val; + val = range_list[len]->start_offset; + dbus_message_iter_append_basic (&struc, DBUS_TYPE_INT32, &val); + val = range_list[len]->end_offset; + dbus_message_iter_append_basic (&struc, DBUS_TYPE_INT32, &val); + dbus_message_iter_append_basic (&struc, DBUS_TYPE_STRING, + &range_list[len]->content); + /* The variant is unimplemented in atk, but I don't want to + * unilaterally muck with the spec and remove it, so I'll just + * throw in a dummy value */ + if (dbus_message_iter_open_container + (&array, DBUS_TYPE_VARIANT, "i", &variant)) + { + dbus_uint32_t dummy = 0; + dbus_message_iter_append_basic (&variant, DBUS_TYPE_INT32, + &dummy); + dbus_message_iter_close_container (&struc, &variant); + } + dbus_message_iter_close_container (&array, &struc); + } + } + dbus_message_iter_close_container (&iter, &array); + } + return reply; } +static DBusMessage * +impl_getAttributeRun (DBusConnection * bus, DBusMessage * message, + void *user_data) +{ + DBusError error; + AtkText *text = get_text (message); + dbus_int32_t offset; + dbus_bool_t includeDefaults; + dbus_int32_t startOffset, endOffset; + gint intstart_offset = 0, intend_offset = 0; + DBusMessage *reply; + AtkAttributeSet *attributes, *default_attributes = NULL; + AtkAttribute *attr = NULL; + char **retval; + gint n_attributes = 0, total_attributes = 0, n_default_attributes = 0; + gint i, j; + + 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_BOOLEAN, + &includeDefaults, DBUS_TYPE_INVALID)) + { + return SPI_DBUS_RETURN_ERROR (message, &error); + } + attributes = + atk_text_get_run_attributes (text, offset, &intstart_offset, + &intend_offset); -static Accessibility_AttributeSet * -impl_getAttributeRun (PortableServer_Servant servant, - const CORBA_long offset, - CORBA_long *startOffset, CORBA_long *endOffset, - const CORBA_boolean includeDefaults, - CORBA_Environment *ev){ - - AtkAttributeSet *attributes, *default_attributes = NULL; - AtkAttribute *attr = NULL; - gint intstart_offset, intend_offset; - Accessibility_AttributeSet *retval = NULL; - AtkText *text = get_text_from_servant (servant); - gint n_attributes = 0, total_attributes = 0, n_default_attributes = 0; - gint i, j; - - g_return_val_if_fail (text != NULL, NULL); - - attributes = atk_text_get_run_attributes (text, offset, - &intstart_offset, &intend_offset); - - if (attributes) total_attributes = n_attributes = g_slist_length (attributes); - - if (includeDefaults) - { - default_attributes = atk_text_get_default_attributes (text); - if (default_attributes) - n_default_attributes = g_slist_length (default_attributes); - total_attributes += n_default_attributes; - } - - *startOffset = intstart_offset; - *endOffset = intend_offset; - - retval = CORBA_sequence_CORBA_string__alloc (); - retval->_length = retval->_maximum = total_attributes; - retval->_buffer = CORBA_sequence_CORBA_string_allocbuf (total_attributes); - CORBA_sequence_set_release (retval, CORBA_TRUE); - - if (total_attributes) - { - for (i = 0; i < n_attributes; ++i) - { - attr = g_slist_nth_data (attributes, i); - retval->_buffer[i] = CORBA_string_dup (g_strconcat (attr->name, ":", attr->value, NULL)); - } - - for (j = 0; j < n_default_attributes; ++i, ++j) - { - attr = g_slist_nth_data (default_attributes, j); - retval->_buffer[i] = CORBA_string_dup (g_strconcat (attr->name, ":", attr->value, NULL)); - } - - atk_attribute_set_free (attributes); - if (default_attributes) - atk_attribute_set_free (default_attributes); - } - return retval; -} + if (attributes) + total_attributes = n_attributes = g_slist_length (attributes); -static Accessibility_AttributeSet * -impl_getDefaultAttributeSet (PortableServer_Servant servant, - CORBA_Environment *ev){ - AtkAttributeSet *attributes; - AtkAttribute *attr = NULL; - Accessibility_AttributeSet *retval = NULL; - AtkText *text = get_text_from_servant (servant); - gint n_attributes = 0; - gint i; - - g_return_val_if_fail (text != NULL, NULL); - - attributes = atk_text_get_default_attributes (text); - - if (attributes) - { - n_attributes = g_slist_length (attributes); - - retval = CORBA_sequence_CORBA_string__alloc (); - retval->_length = retval->_maximum = n_attributes; - retval->_buffer = CORBA_sequence_CORBA_string_allocbuf (n_attributes); - CORBA_sequence_set_release (retval, CORBA_TRUE); - - for (i = 0; i < n_attributes; ++i) - { - attr = g_slist_nth_data (attributes, i); - retval->_buffer [i] = CORBA_string_dup (g_strconcat (attr->name, ":", attr->value, NULL)); - } - atk_attribute_set_free (attributes); - } - return retval; -} + if (includeDefaults) + { + default_attributes = atk_text_get_default_attributes (text); + if (default_attributes) + n_default_attributes = g_slist_length (default_attributes); + total_attributes += n_default_attributes; + } + startOffset = intstart_offset; + endOffset = intend_offset; -static void -spi_text_class_init (SpiTextClass *klass) -{ - POA_Accessibility_Text__epv *epv = &klass->epv; - - /* Initialize epv table */ - - epv->getText = impl_getText; - epv->getTextAfterOffset = impl_getTextAfterOffset; - epv->getCharacterAtOffset = impl_getCharacterAtOffset; - epv->getTextAtOffset = impl_getTextAtOffset; - epv->getTextBeforeOffset = impl_getTextBeforeOffset; - epv->_get_caretOffset = impl__get_caretOffset; - epv->getAttributes = impl_getAttributes; - epv->getDefaultAttributes = impl_getDefaultAttributes; - epv->getCharacterExtents = impl_getCharacterExtents; - epv->_get_characterCount = impl__get_characterCount; - epv->getOffsetAtPoint = impl_getOffsetAtPoint; - epv->getNSelections = impl_getNSelections; - epv->getSelection = impl_getSelection; - epv->addSelection = impl_addSelection; - epv->removeSelection = impl_removeSelection; - epv->setSelection = impl_setSelection; - epv->setCaretOffset = impl_setCaretOffset; - epv->getRangeExtents = impl_getRangeExtents; - epv->getBoundedRanges = impl_getBoundedRanges; - epv->getAttributeValue = impl_getAttributeValue; - epv->getAttributeRun = impl_getAttributeRun; - epv->getDefaultAttributeSet = impl_getDefaultAttributeSet; -} + retval = (char **) g_malloc (total_attributes * sizeof (char *)); -static void -spi_text_init (SpiText *text) -{ + if (total_attributes) + { + for (i = 0; i < n_attributes; ++i) + { + attr = g_slist_nth_data (attributes, i); + retval[i] = g_strconcat (attr->name, ":", attr->value, NULL); + } + + for (j = 0; j < n_default_attributes; ++i, ++j) + { + attr = g_slist_nth_data (default_attributes, j); + retval[i] = g_strconcat (attr->name, ":", attr->value, NULL); + } + + atk_attribute_set_free (attributes); + if (default_attributes) + atk_attribute_set_free (default_attributes); + } + reply = dbus_message_new_method_return (message); + if (reply) + { + dbus_message_append_args (reply, DBUS_TYPE_INT32, &startOffset, + DBUS_TYPE_INT32, &endOffset, DBUS_TYPE_ARRAY, + DBUS_TYPE_STRING, &retval, total_attributes, + DBUS_TYPE_INVALID); + } + for (i = 0; i < total_attributes; i++) + g_free (retval[i]); + g_free (retval); + return reply; } -BONOBO_TYPE_FUNC_FULL (SpiText, - Accessibility_Text, - PARENT_TYPE, - spi_text) - -void -spi_text_construct (SpiText *text, AtkObject *obj) +static DBusMessage * +impl_getDefaultAttributeSet (DBusConnection * bus, DBusMessage * message, + void *user_data) { - spi_base_construct (SPI_BASE (text), G_OBJECT(obj)); -} + AtkText *text = get_text (message); + DBusMessage *reply; + AtkAttributeSet *attributes; + AtkAttribute *attr = NULL; + char **retval; + gint n_attributes = 0; + gint i; + if (!text) + return spi_dbus_general_error (message); -SpiText * -spi_text_interface_new (AtkObject *obj) -{ - SpiText *retval; + attributes = atk_text_get_default_attributes (text); + if (attributes) + n_attributes = g_slist_length (attributes); - g_return_val_if_fail (ATK_IS_TEXT (obj), NULL); + retval = (char **) malloc (n_attributes * sizeof (char *)); - retval = g_object_new (SPI_TEXT_TYPE, NULL); + for (i = 0; i < n_attributes; ++i) + { + attr = g_slist_nth_data (attributes, i); + retval[i] = g_strconcat (attr->name, ":", attr->value, NULL); + } + if (attributes) + atk_attribute_set_free (attributes); + reply = dbus_message_new_method_return (message); + if (reply) + { + dbus_message_append_args (reply, DBUS_TYPE_ARRAY, DBUS_TYPE_STRING, + &retval, n_attributes, DBUS_TYPE_INVALID); + } + for (i = 0; i < n_attributes; i++) + g_free (retval[i]); + g_free (retval); + return reply; +} - spi_text_construct (retval, obj); +static DRouteMethod methods[] = { + {DROUTE_METHOD, impl_getText, "getText", + "i,startOffset,i:i,endOffset,i:s,,o"}, + {DROUTE_METHOD, impl_setCaretOffset, "setCaretOffset", "i,offset,i:b,,o"}, + {DROUTE_METHOD, impl_getTextBeforeOffset, "getTextBeforeOffset", + "i,offset,i:u,type,i:i,startOffset,o:i,endOffset,o:s,,o"}, + {DROUTE_METHOD, impl_getTextAtOffset, "getTextAtOffset", + "i,offset,i:u,type,i:i,startOffset,o:i,endOffset,o:s,,o"}, + {DROUTE_METHOD, impl_getTextAfterOffset, "getTextAfterOffset", + "i,offset,i:u,type,i:i,startOffset,o:i,endOffset,o:s,,o"}, + {DROUTE_METHOD, impl_getAttributeValue, "getAttributeValue", + "i,offset,i:s,attributeName,i:i,startOffset,o:i,endOffset,o:b,defined,o:s,,o"}, + {DROUTE_METHOD, impl_getAttributes, "getAttributes", + "i,offset,i:i,startOffset,o:i,endOffset,o:s,,o"}, + {DROUTE_METHOD, impl_getDefaultAttributes, "getDefaultAttributes", "s,,o"}, + {DROUTE_METHOD, impl_getCharacterExtents, "getCharacterExtents", + "i,offset,i:i,x,o:i,y,o:i,width,o:i,height,o:u,coordType,i"}, + {DROUTE_METHOD, impl_getOffsetAtPoint, "getOffsetAtPoint", + "i,x,i:i,y,i:u,coordType,i:i,,o"}, + {DROUTE_METHOD, impl_getNSelections, "getNSelections", "i,,o"}, + {DROUTE_METHOD, impl_getSelection, "getSelection", + "i,selectionNum,i:i,startOffset,o:i,endOffset,o"}, + {DROUTE_METHOD, impl_addSelection, "addSelection", + "i,startOffset,i:i,endOffset,i:b,,o"}, + {DROUTE_METHOD, impl_removeSelection, "removeSelection", + "i,selectionNum,i:b,,o"}, + {DROUTE_METHOD, impl_setSelection, "setSelection", + "i,selectionNum,i:i,startOffset,i:i,endOffset,i:b,,o"}, + {DROUTE_METHOD, impl_getRangeExtents, "getRangeExtents", + "i,startOffset,i:i,endOffset,i:i,x,o:i,y,o:i,width,o:i,height,o:u,coordType,i"}, + {DROUTE_METHOD, impl_getBoundedRanges, "getBoundedRanges", + "i,x,i:i,y,i:i,width,i:i,height,i:u,coordType,i:u,xClipType,i:u,yClipType,i:a(iisv),,o"}, + {DROUTE_METHOD, impl_getAttributeRun, "getAttributeRun", + "i,offset,i:i,startOffset,o:i,endOffset,o:b,includeDefaults,i:as,,o"}, + {DROUTE_METHOD, impl_getDefaultAttributeSet, "getDefaultAttributeSet", + "as,,o"}, + {0, NULL, NULL, NULL} +}; + +static DRouteProperty properties[] = { + {impl_get_characterCount, impl_get_characterCount_str, NULL, NULL, + "characterCount", "i"}, + {impl_get_caretOffset, impl_get_caretOffset_str, NULL, NULL, "caretOffset", + "i"}, + {NULL, NULL, NULL, NULL, NULL, NULL} +}; - return retval; -} +void +spi_initialize_text (DRouteData * data) +{ + droute_add_interface (data, "org.freedesktop.accessibility.Text", methods, + properties, + (DRouteGetDatumFunction) get_text_from_path, NULL); +}; diff --git a/libspi/value.c b/libspi/value.c index 0434411..b9ff9e5 100644 --- a/libspi/value.c +++ b/libspi/value.c @@ -2,6 +2,7 @@ * AT-SPI - Assistive Technology Service Provider Interface * (Gnome Accessibility Project; http://developer.gnome.org/projects/gap) * + * Copyright 2008 Novell, Inc. * Copyright 2001, 2002 Sun Microsystems Inc., * Copyright 2001, 2002 Ximian, Inc. * @@ -21,249 +22,289 @@ * Boston, MA 02111-1307, USA. */ -/* value.c : implements the Value interface */ -#include +#include "accessible.h" #include -#include -#include - -#define PARENT_TYPE SPI_TYPE_BASE - -/* Static function declarations */ - -static double -get_double_from_gvalue (GValue *gvalue); -static void -gvalue_set_from_double (GValue *gvalue, double value); -static void -spi_value_class_init (SpiValueClass *klass); -static void -spi_value_init (SpiValue *value); -static double -impl__get_minimumValue (PortableServer_Servant _servant, - CORBA_Environment * ev); -static double -impl__get_maximumValue (PortableServer_Servant _servant, - CORBA_Environment * ev); -static double -impl__get_currentValue (PortableServer_Servant _servant, - CORBA_Environment * ev); -static void -impl__set_currentValue (PortableServer_Servant _servant, - const CORBA_double value, - CORBA_Environment * ev); -static double -impl__get_minimumIncrement (PortableServer_Servant _servant, - CORBA_Environment * ev); - - -BONOBO_TYPE_FUNC_FULL (SpiValue, - Accessibility_Value, - PARENT_TYPE, - spi_value) - - -static void -spi_value_class_init (SpiValueClass *klass) -{ - POA_Accessibility_Value__epv *epv = &klass->epv; - - /* Initialize epv table */ - - epv->_get_minimumValue = impl__get_minimumValue; - epv->_get_maximumValue = impl__get_maximumValue; - epv->_get_currentValue = impl__get_currentValue; - epv->_set_currentValue = impl__set_currentValue; - epv->_get_minimumIncrement = impl__get_minimumIncrement; -} - - -static void -spi_value_init (SpiValue *value) -{ -} - - -SpiValue * -spi_value_interface_new (AtkObject *obj) -{ - SpiValue *new_value = g_object_new (SPI_VALUE_TYPE, NULL); - - spi_base_construct (SPI_BASE (new_value), G_OBJECT(obj)); - - return new_value; -} - static AtkValue * -get_value_from_servant (PortableServer_Servant servant) +get_value_from_path (const char *path, void *user_data) { - SpiBase *object = SPI_BASE (bonobo_object_from_servant (servant)); - - g_return_val_if_fail (object, NULL); - g_return_val_if_fail (ATK_IS_OBJECT(object->gobj), NULL); - return ATK_VALUE (object->gobj); + AtkObject *obj = spi_dbus_get_object (path); + if (!obj) + return NULL; + return ATK_VALUE (obj); } static double -get_double_from_gvalue (GValue *gvalue) +get_double_from_gvalue (GValue * gvalue) { - double retval = 0; + double retval = 0; if (G_TYPE_IS_FUNDAMENTAL (G_VALUE_TYPE (gvalue))) { switch (gvalue->g_type) - { - case G_TYPE_DOUBLE: - retval = g_value_get_double (gvalue); - break; - case G_TYPE_FLOAT: - retval = g_value_get_float (gvalue); - break; - case G_TYPE_ULONG: - retval = g_value_get_ulong (gvalue); - break; - case G_TYPE_LONG: - retval = g_value_get_long (gvalue); - break; - case G_TYPE_UINT: - retval = g_value_get_uint (gvalue); - break; - case G_TYPE_INT: - retval = g_value_get_int (gvalue); - break; - case G_TYPE_UCHAR: - retval = g_value_get_uchar (gvalue); - break; - case G_TYPE_CHAR: - retval = g_value_get_char (gvalue); - break; - case G_TYPE_BOOLEAN: - retval = g_value_get_boolean (gvalue); - break; - } + { + case G_TYPE_DOUBLE: + retval = g_value_get_double (gvalue); + break; + case G_TYPE_FLOAT: + retval = g_value_get_float (gvalue); + break; + case G_TYPE_ULONG: + retval = g_value_get_ulong (gvalue); + break; + case G_TYPE_LONG: + retval = g_value_get_long (gvalue); + break; + case G_TYPE_UINT: + retval = g_value_get_uint (gvalue); + break; + case G_TYPE_INT: + retval = g_value_get_int (gvalue); + break; + case G_TYPE_UCHAR: + retval = g_value_get_uchar (gvalue); + break; + case G_TYPE_CHAR: + retval = g_value_get_char (gvalue); + break; + case G_TYPE_BOOLEAN: + retval = g_value_get_boolean (gvalue); + break; + } } else { - g_warning ("SpiValue requested from a non-fundamental type\n"); + g_warning ("SpiValue requested from a non-fundamental type\n"); } return retval; -} +} + +static gboolean +get_double_from_variant (DBusMessageIter * iter, double *out) +{ + DBusMessageIter sub; + + dbus_message_iter_recurse (iter, &sub); + switch (dbus_message_iter_get_arg_type (&sub)) + { + case DBUS_TYPE_DOUBLE: + { + dbus_message_iter_get_basic (&sub, out); + return TRUE; + } + case DBUS_TYPE_UINT32: + { + dbus_uint32_t v; + dbus_message_iter_get_basic (&sub, &v); + *out = (double) v; + return TRUE; + } + case DBUS_TYPE_INT32: + { + dbus_int32_t v; + dbus_message_iter_get_basic (&sub, &v); + *out = (double) v; + return TRUE; + } + case DBUS_TYPE_UINT16: + { + dbus_uint16_t v; + dbus_message_iter_get_basic (&sub, &v); + *out = (double) v; + return TRUE; + } + case DBUS_TYPE_INT16: + { + dbus_int16_t v; + dbus_message_iter_get_basic (&sub, &v); + *out = (double) v; + return TRUE; + } + case DBUS_TYPE_BYTE: + { + char v; + dbus_message_iter_get_basic (&sub, &v); + *out = (double) v; + return TRUE; + } + case DBUS_TYPE_BOOLEAN: + { + dbus_bool_t v; + dbus_message_iter_get_basic (&sub, &v); + *out = (double) v; + return TRUE; + } + default: + return FALSE; + } +} static void -gvalue_set_from_double (GValue *gvalue, double value) +gvalue_set_from_double (GValue * gvalue, double value) { if (G_TYPE_IS_FUNDAMENTAL (G_VALUE_TYPE (gvalue))) { switch (gvalue->g_type) - { - case G_TYPE_DOUBLE: - g_value_set_double (gvalue, value); - break; - case G_TYPE_FLOAT: - g_value_set_float (gvalue, value); - break; - case G_TYPE_ULONG: - g_value_set_ulong (gvalue, value); - break; - case G_TYPE_LONG: - g_value_set_long (gvalue, value); - break; - case G_TYPE_UINT: - g_value_set_uint (gvalue, value); - break; - case G_TYPE_INT: - g_value_set_int (gvalue, value); - break; - case G_TYPE_UCHAR: - g_value_set_uchar (gvalue, value); - break; - case G_TYPE_CHAR: - g_value_set_char (gvalue, value); - break; - case G_TYPE_BOOLEAN: - g_value_set_boolean (gvalue, ((fabs (value) > 0.5) ? 1 : 0)); - break; - } + { + case G_TYPE_DOUBLE: + g_value_set_double (gvalue, value); + break; + case G_TYPE_FLOAT: + g_value_set_float (gvalue, value); + break; + case G_TYPE_ULONG: + g_value_set_ulong (gvalue, value); + break; + case G_TYPE_LONG: + g_value_set_long (gvalue, value); + break; + case G_TYPE_UINT: + g_value_set_uint (gvalue, value); + break; + case G_TYPE_INT: + g_value_set_int (gvalue, value); + break; + case G_TYPE_UCHAR: + g_value_set_uchar (gvalue, value); + break; + case G_TYPE_CHAR: + g_value_set_char (gvalue, value); + break; + case G_TYPE_BOOLEAN: + g_value_set_boolean (gvalue, ((fabs (value) > 0.5) ? 1 : 0)); + break; + } } else { - g_warning ("SpiValue change requested for a non-fundamental type\n"); + g_warning ("SpiValue change requested for a non-fundamental type\n"); } } -static double -impl__get_minimumValue (PortableServer_Servant servant, - CORBA_Environment *ev) +static dbus_bool_t +impl_get_minimumValue (const char *path, DBusMessageIter * iter, + void *user_data) { - GValue gvalue = {0, }; - AtkValue *value = get_value_from_servant (servant); - - g_return_val_if_fail (value != NULL, 0.0); - + AtkValue *value = get_value_from_path (path, user_data); + GValue gvalue = { 0, }; + if (!value) + return FALSE; atk_value_get_minimum_value (value, &gvalue); - - return get_double_from_gvalue (&gvalue); + return droute_return_v_double (iter, get_double_from_gvalue (&gvalue)); } - -static double -impl__get_maximumValue (PortableServer_Servant servant, - CORBA_Environment *ev) +static char * +impl_get_minimumValue_str (void *datum) { - GValue gvalue = {0, }; - AtkValue *value = get_value_from_servant (servant); - - g_return_val_if_fail (value != NULL, 0.0); + AtkValue *value = (AtkValue *) datum; + GValue gvalue = { 0, }; + if (!value) + return FALSE; + atk_value_get_minimum_value (value, &gvalue); + return g_strdup_printf ("%lf", get_double_from_gvalue (&gvalue)); +} +static dbus_bool_t +impl_get_maximumValue (const char *path, DBusMessageIter * iter, + void *user_data) +{ + AtkValue *value = get_value_from_path (path, user_data); + GValue gvalue = { 0, }; + if (!value) + return FALSE; atk_value_get_maximum_value (value, &gvalue); - - return get_double_from_gvalue (&gvalue); + return droute_return_v_double (iter, get_double_from_gvalue (&gvalue)); } +static char * +impl_get_maximumValue_str (void *datum) +{ + AtkValue *value = (AtkValue *) datum; + GValue gvalue = { 0, }; + if (!value) + return FALSE; + atk_value_get_maximum_value (value, &gvalue); + return g_strdup_printf ("%lf", get_double_from_gvalue (&gvalue)); +} -static double -impl__get_currentValue (PortableServer_Servant servant, - CORBA_Environment *ev) +static dbus_bool_t +impl_get_minimumIncrement (const char *path, DBusMessageIter * iter, + void *user_data) { - GValue gvalue = {0, }; - AtkValue *value = get_value_from_servant (servant); + AtkValue *value = get_value_from_path (path, user_data); + GValue gvalue = { 0, }; + if (!value) + return FALSE; + atk_value_get_minimum_value (value, &gvalue); + return droute_return_v_double (iter, get_double_from_gvalue (&gvalue)); +} - g_return_val_if_fail (value != NULL, 0.0); +static char * +impl_get_minimumIncrement_str (void *datum) +{ + AtkValue *value = (AtkValue *) datum; + GValue gvalue = { 0, }; + if (!value) + return FALSE; + atk_value_get_minimum_value (value, &gvalue); + return g_strdup_printf ("%lf", get_double_from_gvalue (&gvalue)); +} +static dbus_bool_t +impl_get_currentValue (const char *path, DBusMessageIter * iter, + void *user_data) +{ + AtkValue *value = get_value_from_path (path, user_data); + GValue gvalue = { 0, }; + if (!value) + return FALSE; atk_value_get_current_value (value, &gvalue); - - return get_double_from_gvalue (&gvalue); + return droute_return_v_double (iter, get_double_from_gvalue (&gvalue)); } - -static void -impl__set_currentValue (PortableServer_Servant servant, - const CORBA_double value, - CORBA_Environment *ev) +static char * +impl_get_currentValue_str (void *datum) { - GValue gvalue = { 0, }; - AtkValue *avalue = get_value_from_servant (servant); - - g_return_if_fail (avalue != NULL); - - atk_value_get_current_value (avalue, &gvalue); - gvalue_set_from_double (&gvalue, value); - - atk_value_set_current_value (avalue, &gvalue); + AtkValue *value = (AtkValue *) datum; + GValue gvalue = { 0, }; + if (!value) + return FALSE; + atk_value_get_current_value (value, &gvalue); + return g_strdup_printf ("%lf", get_double_from_gvalue (&gvalue)); } -static double -impl__get_minimumIncrement (PortableServer_Servant servant, - CORBA_Environment *ev) +static dbus_bool_t +impl_set_currentValue (const char *path, DBusMessageIter * iter, + void *user_data) { - GValue gvalue = {0, }; - AtkValue *value = get_value_from_servant (servant); - - g_return_val_if_fail (value != NULL, 0.0); - - atk_value_get_minimum_increment (value, &gvalue); - - return get_double_from_gvalue (&gvalue); + AtkValue *value = get_value_from_path (path, user_data); + GValue gvalue = { 0, }; + double dbl; + + if (!value) + return FALSE; + if (!get_double_from_variant (iter, &dbl)) + return FALSE; + atk_value_get_current_value (value, &gvalue); + gvalue_set_from_double (&gvalue, dbl); + return TRUE; } - +static DRouteProperty properties[] = { + {impl_get_minimumValue, impl_get_minimumValue_str, NULL, NULL, + "minimumValue", "d"}, + {impl_get_maximumValue, impl_get_maximumValue_str, NULL, NULL, + "maximumValue", "d"}, + {impl_get_minimumIncrement, impl_get_minimumIncrement_str, NULL, NULL, + "minimumIncrement", "d"}, + {impl_get_currentValue, impl_get_currentValue_str, impl_set_currentValue, + NULL, "currentValue", "d"}, + {NULL, NULL, NULL, NULL, NULL, NULL} +}; + +void +spi_initialize_value (DRouteData * data) +{ + droute_add_interface (data, "org.freedesktop.accessibility.Value", NULL, + properties, + (DRouteGetDatumFunction) get_value_from_path, NULL); +}; diff --git a/tools/Makefile.am b/tools/Makefile.am new file mode 100644 index 0000000..ee44e58 --- /dev/null +++ b/tools/Makefile.am @@ -0,0 +1,3 @@ +EXTRA_DIST = \ + c-constants-generator.xsl \ + identity.xsl diff --git a/tools/c-constants-generator.xsl b/tools/c-constants-generator.xsl new file mode 100644 index 0000000..992de8f --- /dev/null +++ b/tools/c-constants-generator.xsl @@ -0,0 +1,305 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + /** + * + + : + + + + * + + * <![CDATA[ + + ]]> + * + + * Bitfield/set of flags generated from the AT-SPI specification. + */ + typedef enum { + + + + } + + ; + + + + + + + + + + + + + + + + + + * @ + + : <![CDATA[ + + ]]> + + + + + * @ + + : <![CDATA[ + + ]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + s + + + + /** + * + + : + + + + * + + * <![CDATA[ + + ]]> + * + + * Bitfield/set of flags generated from the AT-SPI specification. + */ + typedef enum { + + + + } + + ; + + /** + * NUM_ + + : + * + * 1 higher than the highest valid value of # + + . + */ + #define NUM_ + + ( + + +1) + + + + + + + + + + + + + + + + + + + + Flag name + + != suffix + + + + + + + = + + , + + + + + + + + + + + + + + + + + + + Enumvalue name + + != suffix + + + + + + + + Enum values must be in ascending numeric order, but + + is less than the previous value + + + + + + , + + + + tp:flag found outside tp:flags + + + + tp:enumvalue found outside tp:enum + + + + + + + + mixed-case-prefix param must be set + + + + /* Generated from + + + , version + + + + + + + + + + + + + */ + + #ifdef __cplusplus + extern "C" { + #endif + + + + #ifdef __cplusplus + } + #endif + + + + + diff --git a/tools/identity.xsl b/tools/identity.xsl new file mode 100644 index 0000000..6630f84 --- /dev/null +++ b/tools/identity.xsl @@ -0,0 +1,7 @@ + + + + + + + diff --git a/xml/Accessibility.xml b/xml/Accessibility.xml new file mode 100644 index 0000000..9342ba3 --- /dev/null +++ b/xml/Accessibility.xml @@ -0,0 +1,114 @@ + + +AT-SPI D-Bus Interface Specification +1.24.0 + +Copyright 2008 Novell, Inc. +Copyright 2001-2005 Ximian, Inc. and Sun Microsystems, 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.

+
+ + + !\mainpage AT-SPI Interfaces and Subinterfaces + + This is the main documentation page for the + Assistive Technology Service Provider Interface (AT-SPI). + + \section apps Applications and Interface Components + Namespace Accessibility includes service APIs implemented by + participating applications and their user interface components:\n\n + Accessibility::Accessible\n + Accessibility::Application\n + Accessibility::Desktop\n + Accessibility::Component\n + Accessibility::Hypertext\n + Accessibility::Image\n + Accessibility::Selection\n + Accessibility::StreamableContent\n + Accessibility::Table\n + Accessibility::Text\n + Accessibility::EditableText\n + Accessibility::Value + + \section types Enumerated Types + Accessibility defines a number of key enumerated types, including:\n\n + Accessibility::RelationType\n + Accessibility::Role\n + Accessibility::StateType\n + Accessibility::Event\n + Accessibility::EventDetails \n + + \section Registry + Accessibility also includes Accessibility::Registry, + which is the service used by assistive technologies and related + AT-SPI clients to register interest in certain classes of events, + enumerate the currently available desktop and application list, + and to synthesize certain kinds of device events. + + \section listeners Event Listener Interfaces + Accessibility::EventListener\n + Accessibility::DeviceEventListener + + \section helpers Helper Interfaces + + The following interfaces may be implemented by assistive technologies + themselves, in order to export their services in a consistent manner or + in order to interoperate with other applications or desktop services.\n + + Accessibility::LoginHelper : Implemented by adaptive technologies which + need to participate in user-authentication or login activities, and which + therefore may need negotiation with authentication agents or processes.\n + + Accessibility::Selector [NEW]: Implemented by user agents or assistive + technologies which export lists of choices from which the end-user is + expected to make selections. Useful for various types of remote + activation or intercommunication between multiple ATs. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/xml/Accessibility_Accessible.xml b/xml/Accessibility_Accessible.xml new file mode 100644 index 0000000..8c2894c --- /dev/null +++ b/xml/Accessibility_Accessible.xml @@ -0,0 +1,266 @@ + + +AT-SPI - Assistive Technology Service Provider Interface +Copyright 2008 Novell, Inc. +Copyright 2001 Sun Microsystems 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.

+
+ + + used by Text and Document: these correspond to the POSIX setlocale() enum values. + + + + + + + + + + +

Used by Component and Text, a struct defining a bounding rectangle. + The relevant coordinate system is determined by the context of the + API call which returned or receives the value.

+
+ + + < the value corresponding to the minimum or leftmost x position. + + + + + < the value corresponding to the minimum y value. + + + + +

< the horizontal extent of the bounding box, + that is, the difference between the maximum and minimum + x coordinate bounds.

+
+
+ + +

< the vertical extent of the bounding box, + that is, the difference between the maximum and minimum + y coordinate bounds.

+
+
+
+ + +

The base interface which is implemented by all accessible objects. + All objects support interfaces for querying their contained 'children' + and position in the accessible-object hierarchy, whether or not they + actually have children.

+ +

@note Events that may be emitted by instances of Accessible include: + \li \c "object:property-change" A base (strongly-typed) object attribute has changed, + for instance "object:property-change:accessible-name". + Notifed property subtypes include accessible-name, accessible-description, + accessible-parent and accessible-role.

+ +

\li \c "object:children-changed" The number or identity of an object's children + has changed. + \li \c "object:state-changed" The object's StateSet has had a state added + or removed. + \li \c "object:active-descendant-changed" If the object includes + STATE_MANAGES_DESCENDANTS, this event is fired to indicate that the + descendant having STATE_ACTIVE has changed; this corresponds to + "micro" keyboard focus when the containing/emitting object has + "macro" or technical keyboard focus. For instance, this event is + usually emitted while traversing tables and/or spreadsheet cells. + \li \c "object:attribute-change" A weakly-typed property, as contained in the + AttributeSet returned by Accessible::getAttributes, has changed in value, + been added, or been removed from the object. + ("object:attribute-change" notifications were added in AT-SPI 1.7.0)

+
+ + + a (short) \c string representing the object's name. + + + + + a \c string describing the object in more detail than \a name. + + + + + an ::Accessible object which is this object's containing object. + + + + + childCount: the number of children contained by this object. + + + + +

Determine whether an ::Accessible refers to the same object as another. + This method should be used rather than brute-force comparison of + object references (i.e. "by-value" comparison), as two object references + may have different apparent values yet refer to the same object.

+
+ + + an ::Accessible object reference to compare to + + + + + a \c boolean indicating whether the two object referencespoint to the same object. + + +
+ + + Get the accessible child of this object at \c index. + + + + an in parameter indicating which child is requested (zero-indexed). + + + + + the 'nth' ::Accessible child of this object. + + + + + + Get the index of this object in its parent's child list. + + + + a long integer indicating this object's index in the parent's list. + + + + + + Get a set defining this object's relationship to other accessible objects. + + + + a ::RelationSet defining this object's relationships. + + + + + +

Get the ::Role indicating the type of UI role played by this object.

+
+ + + a ::Role indicating the type of UI role played by this object. + + +
+ + +

Get a string indicating the type of UI role played by this object.

+
+ + + a UTF-8 string indicating the type of UI role played by this object. + + +
+ + +

Get a string indicating the type of UI role played by this object, + translated to the current locale.

+
+ + + a UTF-8 string indicating the type of UI role played by this object. + + +
+ + + Get the current state of the object as a ::StateSet. + + + + a ::StateSet encapsulating the currently true states of the object. + + + + + +

Get a list of properties applied to this object as a whole, as an + ::AttributeSet consisting of name-value pairs. As such these attributes + may be considered weakly-typed properties or annotations, as distinct + from the strongly-typed interface instance data declared using the IDL + "attribute" keyword.

+ +

Not all objects have explicit "name-value pair" AttributeSet properties.

+ +

Attribute names and values may have any UTF-8 string value, however where possible, + in order to facilitate consistent use and exposure of "attribute" properties by + applications and AT clients, attribute names and values should chosen from + a publicly-specified namespace where appropriate.

+ +

Where possible, the names and values in the name-value pairs + should be chosen from well-established attribute namespaces + using standard semantics. + For example, attributes of ::Accessible objects corresponding to XHTML content + elements should correspond to attribute names and values specified in the w3c + XHTML specification, at http://www.w3.org/TR/xhtml2, where such values are not + already exposed via a more strongly-typed aspect of the AT-SPI API. + Metadata names and + values should be chosen from the 'Dublin Core' Metadata + namespace using Dublin Core semantics: + http://dublincore.org/dcregistry/ + Similarly, relevant structural metadata should be exposed + using attribute names and values chosen from the CSS2 and WICD specification: + http://www.w3.org/TR/1998/REC-CSS2-19980512 + WICD (http://www.w3.org/TR/2005/WD-WICD-20051121/).

+ +

@note Clients seeking semantic or typographical attributes associated with + specific character spans of text content should use ::Text::getAttributeRun instead. + The attributes returned by Accessible::getAttributes do not include + "text attributes".

+ +

@see ::Accessibility::Text::getAttributeRun

+
+ + + an ::AttributeSet encapsulating any "attribute values" currently defined for the object.@since AT-SPI 1.7.0 + + +
+ + +

Get the containing Application for this object.

+
+ + + the Application instance to which this object belongs.@since AT-SPI 1.7.0 + + +
+ + + /cond future expansion + + +
+
diff --git a/xml/Accessibility_Action.xml b/xml/Accessibility_Action.xml new file mode 100644 index 0000000..bdb4fae --- /dev/null +++ b/xml/Accessibility_Action.xml @@ -0,0 +1,112 @@ + + +AT-SPI - Assistive Technology Service Provider Interface +Copyright 2008 Novell, Inc. +Copyright 2001 Sun Microsystems, 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.

+
+ + +

An interface through which a user-actionable user interface + component can be manipulated. Components which react to mouse or + keyboard input from the user, (with the exception of pure text entry + fields with no other function), should implement this interface. + Typical actions include "click", "press", "release" (for instance for + buttons), "menu" (for objects which have context menus invokable from + mouse or keyboard), "open" for icons representing files folders, and others.

+
+ + +

nActions: a \c long containing the number of actions this object supports.

+
+
+ + + getDescription: + + + + the index of the action for which a description is desired.Get the description of the specified action. The description of an actionmay provide information about the result of action invocation, unlike theaction name.@see getName. + + + + + a \c string containing the description of the specified action. + + + + + + getName: + + + + the index of the action whose name is requested.Get the name of the specified action. Action names generally describethe user action, i.e. "click" or "press", rather then the result of invoking the action. + + + + + a \c string containing the name of the specified action. + + + + + + doAction: + + + + the 0-based index of the action to perform.Causes the object to perform the specified action. + + + + + a \c boolean indicating success or failure. + + + + + + getKeyBinding: + + + + the 0-based index of the action for which a key binding is requested.Get the key binding associated with a specific action. + + + + + a \c string containing the key binding for the specified action,or an empty string ("") if none exists. + + + + + +

\cond + unImplemented:

+ +

placeholders for future expansion.

+
+
+ + + + + + +
+
diff --git a/xml/Accessibility_Application.xml b/xml/Accessibility_Application.xml new file mode 100644 index 0000000..a946212 --- /dev/null +++ b/xml/Accessibility_Application.xml @@ -0,0 +1,125 @@ + + +AT-SPI - Assistive Technology Service Provider Interface +Copyright 2008 Novell, Inc. +Copyright 2001-2004 Sun Microsystems 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.

+
+ + +

An interface identifying an object which is the root of the + user interface Accessible hierarchy associated with a running application. + Children of Application are typically, but not exclusively, + top-level windows. + @note It is possible for an element deeper in an Accessibility stack to + implement Application, for instance in the case of "embedded applications" + which draw into toplevel windows associated with other applications + from the user's point of view.

+
+ + +

A string indicating the type of user interface toolkit + which is used by the application. + @note Ordinarily clients of ::Application should be + toolkit-agnostic, dependencies on this property should + be avoided where possible.

+
+
+ + +

A string indicating the version number of the application's + accessibility bridge implementation.

+
+
+ + + The application instance's unique ID as assigned by the registry. + + + + + + an ::EventListener object which will receive the requestedevents from the application's toolkits via toolit 'bridges' + + + + + a UTF-8 string indicating the type of (toolkit-specific) eventbeing requested. Not all applications can generate toolkit events ofa given type.Register with this application's toolkit for "toolkit-specific" event notifications.@noteFor most event support, clients should use non-toolkit-specific eventswhenever possible, via ::Registry::registerGlobalEventListener - this method is provided as a 'back door' when generic names do not exist for the events in question. + + + + + + registerObjectEventListener: + + + + an ::EventListener object which will receive the requestedevents + + + + + a UTF-8 string indicating the type of (toolkit-specific) eventbeing requested. Register with this application toolkit for "Accessibility::Accessible" event notifications. @note: SUBJECT TO DEPRECATION. + + + + + +

Request that the application temporarily stop sending events. + In most cases this should pause the application's main event loop.

+
+ + + \c true if the request succeeded, \c false otherwise.@note: This method is not implemented in most toolkits, and therefore should be treated with caution. + + +
+ + +

Request that the application resume sending events.

+
+ + + \c True if the request succeeded, \c False otherwise. + + +
+ + +

Gets the locale in which the application is currently operating. + For the current message locale, use \a lctype LOCALE_TYPE_MESSAGES.

+ +

@param lctype The LocaleType for which the locale is queried.

+
+ + + + a string compliant with the POSIX standard for locale description. + + +
+ + + \cond (This comment tells doxygen not to document these) + + + + + + +
+
diff --git a/xml/Accessibility_Component.xml b/xml/Accessibility_Component.xml new file mode 100644 index 0000000..0f6f39c --- /dev/null +++ b/xml/Accessibility_Component.xml @@ -0,0 +1,244 @@ + + +AT-SPI - Assistive Technology Service Provider Interface +Copyright 2008 Novell, Inc. +Copyright 2001 Sun Microsystems, 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.

+
+ + +

The ComponentLayer of a Component instance indicates its relative stacking order + with respect to the onscreen visual representation of the UI. + ComponentLayer, in combination with Component bounds information, can be used + to compute the visibility of all or part of a component. This is important in + programmatic determination of region-of-interest for magnification, and in + ¨flat screen review¨ models of the screen, as well as for other uses. + Objects residing in two of the ComponentLayer categories support + further z-ordering information, with respect to their peers in the same layer: + namely, LAYER_WINDOW and LAYER_MDI. Relative stacking order for other objects within + the same layer is not available; the recommended heuristic is ¨first child paints first¨, + in other words, assume that the first siblings in the child list are subject to being + overpainted by later siblings if their bounds intersect.

+ +

The order of layers, from bottom to top, is: + \li LAYER_BACKGROUND + \li LAYER_WINDOW + \li LAYER_MDI + \li LAYER_CANVAS + \li LAYER_WIDGET + \li LAYER_POPUP + \li LAYER_OVERLAY

+
+ + + < Indicates an error condition or uninitialized value. + + + + +

< The bottom-most layer, over which everything else is painted. + The 'desktop background' is generally in this layer.

+
+
+ + +

< The 'background' layer for most content renderers and UI Component + containers.

+
+
+ + + < The layer in which the majority of ordinary 'foreground' widgets reside. + + + + +

< A special layer between LAYER_CANVAS and LAYER_WIDGET, in which the + 'pseudo windows' (e.g. the MDI frames) reside. + @see Component::getMDIZOrder

+
+
+ + + < A layer for popup window content, above LAYER_WIDGET. + + + + + < The topmost layer. + + + + + < The layer in which a toplevel window background usually resides. + + + + + < Used only to determine the end of the enumeration. + + +
+ + +

The Component interface is implemented by objects which occupy on-screen space, e.g. objects + which have onscreen visual representations. The methods in Component allow clients to identify + where the objects lie in the onscreen coordinate system, their relative size, stacking order, and + position. It also provides a mechanism whereby keyboard focus may be transferred to specific + user interface elements programmatically. This is a 2D API, coordinates of 3D objects are projected into the + 2-dimensional screen view for purposes of this interface.

+ +

@note the meaning and defined values of the \c short \c coord_type parameter used by some + Component methods is as follows: + \li 0 indicates coord_type_xy_screen, coordinates are relative to the display screen, in pixels. + \li 1 indicates coord_type_xy_window, coordinates are relative to the current toplevel window, in pixels.

+ +

@note Events emitted by Component instances include: + \li \c "object:bounds-changed" + \li \c "object:visible-data-changed"

+
+ + + + + + + \c True if the specified point lies within the Component's bounding box, \c False otherwise. + + + + + + + + + + the Accessible child whose bounding box contains the specified point. + + + + + + Obtain the Component's bounding box, in pixels, relative to the specified coordinate system. + + + + + a BoundingBox which entirely contains the object's onscreen visual representation. + + + + + +

Obtain the position of the current component in the coordinate system specified + by \c coord_type. + @param coord_type + @param x an out parameter which will be back-filled with the returned x coordinate. + @param y an out parameter which will be back-filled with the returned y coordinate.

+
+ + + +
+ + +

Obtain the size, in the coordinate system specified by \c coord_type, + of the rectangular area which fully contains the object's + visual representation, without accounting for viewport clipping. + @param width the object's horizontal extents in the specified coordinate system. + @param height the object's vertical extents in the specified coordinate system.

+
+ + +
+ + + + the ComponentLayer in which this object resides. + + + + + +

Obtain the relative stacking order (i.e. 'Z' order) of an object. + Larger values indicate that an object is on "top" of the stack, therefore + objects with smaller MDIZOrder may be obscured by objects with a larger MDIZOrder, + but not vice-versa. + @note only relevant for objects in LAYER_MDI or LAYER_WINDOW

+
+ + + an integer indicating the object's place in the stacking order. + + +
+ + +

Request that the object obtain keyboard focus.

+
+ + + \c True if keyboard focus was successfully transferred to the Component. + + +
+ + +

Register an EventListener for notification when this object receives keyboard focus. + @note you probably want to register for ¨focus:¨ events via + Registry::registerGlobalEventListener instead.

+
+ +
+ + +

Request that an EventListener registered via registerFocusHandler no longer be notified + when this object receives keyboard focus.

+
+ +
+ + +

Obtain the alpha value of the component. An alpha value of 1.0 or greater + indicates that the object is fully opaque, and an alpha value of 0.0 indicates + that the object is fully transparent. Negative alpha values have no defined + meaning at this time.

+ +

@note alpha values are used in conjunction with Z-order calculations to + determine whether an object wholly or partially obscures another object's + visual intersection, in the event that their bounds intersect.

+ +

@see STATE_OPAQUE

+ +

@since AT-SPI 1.7.0

+
+ +
+ + +

\cond + unImplemented:

+ +

placeholders for future expansion.

+
+
+ + + + +
+
diff --git a/xml/Accessibility_Document.xml b/xml/Accessibility_Document.xml new file mode 100644 index 0000000..a7b534c --- /dev/null +++ b/xml/Accessibility_Document.xml @@ -0,0 +1,84 @@ + + +AT-SPI - Assistive Technology Service Provider Interface +Copyright 2008 Novell, Inc. +Copyright 2005 Sun Microsystems 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.

+
+ + +

Primarily a 'tagging' interface which indicates the start of + document content in the Accessibility hierarchy. + Accessible objects below the node implementing + Document are normally assumed to be part of the document content. + Attributes of Document are those attributes associated with the document + as a whole. Objects that implement Document are normally expected to + implement Collection as well.

+ +

\see Accessibility::Collection

+
+ + +

Gets the locale associated with the document's content. + e.g. the locale for LOCALE_TYPE_MESSAGES.

+
+ + + a string compliant with the POSIX standard for locale description. + + +
+ + +

Gets the value of a single attribute, if specified for the document as a whole.

+
+ + + a string indicating the name of a specific attribute (name-value pair) being queried. + + + + + a string corresponding to the value of the specified attribute, oran empty string if the attribute is unspecified for the object. + + +
+ + +

Gets all attributes specified for a document as a whole. + For attributes which change within + the document content, see Accessibility::Text::getAttributes instead.

+
+ + + an ::AttributeSet containing the attributes of the document, as name-value pairs.@since AT-SPI 1.8.0 + + +
+ + + \cond + + + + + + + + +
+
diff --git a/xml/Accessibility_EditableText.xml b/xml/Accessibility_EditableText.xml new file mode 100644 index 0000000..5994924 --- /dev/null +++ b/xml/Accessibility_EditableText.xml @@ -0,0 +1,159 @@ + + +AT-SPI - Assistive Technology Service Provider Interface +Copyright 2008 Novell, Inc. +Copyright 2001 Sun Microsystems, 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.

+
+ + +

Derived from interface Text, EditableText provides methods for + modifying textual content of components which support editing. + EditableText also interacts with the system clipboard via copyText, + cutText, and pasteText.

+ +

@note read-only instances of EditableText are possible; + These may be instances of a general-purpose component type which are + sometimes, but not always, user-editable, or may be + components which are temporarily or circumstantially + in a non-editable state.

+
+ + +

Replace the text contents with a new string, discarding the old contents.

+ +

@param newContents a UTF-8 string with which the text object's contents will be replaced.

+
+ + + + \c True if the text content was successfully changed, \c False otherwise. + + +
+ + +

Insert new text contents into an existing text object at a given location, while retaining + the old contents. + @param position the character offset into the Text implementor's content at which the + new content will be inserted. + @param text a UTF-8 string of which \c length characters will be inserted into the text + object's text buffer. + @param length the number of characters of \c text to insert. If the character count + of \c text is less than or equal to \c length, the entire contents of \c text + will be inserted.

+
+ + + + + + \c True if the text content was successfully inserted, \c False otherwise. + + +
+ + +

Apply a particular set of attributes to a range of text.

+
+ + + + + + \c True if the text attributes were successfully modified, \c False otherwise. + + +
+ + +

Copy a range of text into the system clipboard. + @param startPos the character offset of the first character in the range of text being + copied. + @param endPos the offset of the first character past the end of the range of text + being copied.

+
+ + +
+ + +

Excise a range of text from a Text object, copying it into the system clipboard. + @param startPos the character offset of the first character in the range of text being + cut. + @param endPos the offset of the first character past the end of the range of text + being cut.

+
+ + + + + \c True if the text was successfully cut, \c False otherwise. + + +
+ + +

Excise a range of text from a Text object without copying it into the system clipboard. + @param startPos the character offset of the first character in the range of text being + deleted. + @param endPos the offset of the first character past the end of the range of text + being deleted.

+
+ + + + + \c True if the text was successfully deleted, \c False otherwise. + + +
+ + +

Copy the text contents of the system clipboard, if any, into a Text object, + inserting it at a particular character offset.

+ +

@param position the character offset before which the text will be inserted.

+
+ + + + \c True if the text was successfully pasted into the Text object, \c False otherwise. + + +
+ + +

unImplemented:

+ +

placeholders for future expansion. Note that these are named + 'unimplemented5 and unimplemented6' to avoid conflict with + placeholders from Accessibility::Text.

+
+
+ + + + + + + + + + +
+
diff --git a/xml/Accessibility_Event.xml b/xml/Accessibility_Event.xml new file mode 100644 index 0000000..31ddff8 --- /dev/null +++ b/xml/Accessibility_Event.xml @@ -0,0 +1,152 @@ + + +AT-SPI - Assistive Technology Service Provider Interface +Copyright 2008 Novell, Inc. +Copyright 2001, 2002 Sun Microsystems 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.

+
+ + +

A struct encapsulating detailed information about an Event. + This struct supercedes the previous use of the 'any' field + in EventDetails; the content previously stored in Event::any_data + is now stored in EventDetails::any_data, and Event::any_data + points to an instance of the EventDetails structure, if + the object's implementation supports event detail reporting, + otherwise Event::any_data contains CORBA_OBJECT_NIL.

+ +

@since AT-SPI 1.7.0

+
+ + + + +
+ + +

A structure encapsulating information about an event + for which notification was requested. Usually such notification + is requested via a call to Registry::registerGlobalEventListener. + The structure contains a colon-delimited string indicating the event + type, a reference to the generating Accessible, two detail fields whose + interpretation is event-type-specific, and a final field containing + event-type-specific data.

+ +

@note Since AT-SPI 1.7.0 the 'any' field contains an EventDetails + struct, which encapsulates additional information about the event + and its generating object.

+
+ + +

A colon-delimited string indicating the type of the event. + The string can be interpreted as + \c class:type:subtype + For instance ¨object:text-changed:insert¨ is an event + from the 'Object' class, which corresponds to Accessible objects + general, the type of the event is a ¨text-changed¨ event (i.e. a change in the + content of an implementor of the Text interface), and the + specific subtype of the change is an insertion event.

+ +

Event classes include the following: + \li focus: an object has received keyboard focus. This event has no type or subtype. + \li window: a toplevel window has changed state. + \li object: an object (i.e. Accessible) has undergone some change in state, content, + or hierarchy + \li document:a change to a document's content has occurred, or its + content loading status has changed. + \li mouse: an event originating from the pointing device. Rarely used; + in most cases clients will wish to register for pointer events via + the DeviceEventController::registerDeviceEvent method instead. + \li keyboard: an event indicating that the keyboard state (for example, the + modifier state) has changed significantly. + "keyboard:" events are not sent for individual keystrokes except as + a side-effect of certain keys, for instance modifier keys. + Clients interested in key events should listen for DeviceEvents + via DeviceEventController::registerKeystrokeListener instead.

+ +

@note For more information on specific event types, see the documentation for + each of the individual interfaces supported by some Accessible objects.

+ +

@see Accessible, Component, Image, Selection, Table, Text, Value.

+
+
+ + +

The Accessible object which is the source of the event. The source object is the object + to which the change inferred by the event emission occurs; for instance, + the object emitting a ¨object:parent-changed¨ event is the child, not the parent. + Likewise, the event source of an ¨object:children-changed:insert¨ event is the parent, + not the inserted child.

+
+
+ + +

An integer whose meaning is event type dependent. It may indicate the offset of + text being inserted, in the case of ¨object:text-changed:insert¨, or the index of a + newly added child in the case of ¨object:children-changed:add¨. + @note since most AT-SPI clients react to events via an asynchronous queue, for + performance reasons, this field may be of limited utility unless the client maintains + a large client-side cache of the hierarchy and contained data. This is because by the time + such an event is asynchronously processed, the state of the originating object may have + changed. In other words, the data in the detail1 member is not state-coherent outside + of the event handler. More useful results are gotten by examination of the 'any_data' field.

+
+
+ + + see description of detail2 + + + + +

A generic storage location for event-type-specific data which provides more specific + information about the event; for instance, in AT-SPI versions prior to 1.7.0, + in the case of ¨object:text-changed:insert¨ events, this field contains a string + indicating the inserted text.

+ +

@note Since AT-SPI 1.7.0, the data contained in this field is an EventDetails struct.

+
+
+
+ + +

A generic interface implemented by objects for the + receipt of event notifications. EventListener is the interface from which + Accessibility::Registry is derived, and via which clients of the Registry + receive notification of changes to an application's user interface and content.

+
+ + +

Synchronously notify an EventListener that an event has occurred, by passing it an + Event struct. + @param e The Event about which the listener is being notified.

+
+ +
+ + + \cond + + + + + + + + +
+
diff --git a/xml/Accessibility_Hyperlink.xml b/xml/Accessibility_Hyperlink.xml new file mode 100644 index 0000000..788a48a --- /dev/null +++ b/xml/Accessibility_Hyperlink.xml @@ -0,0 +1,130 @@ + + +AT-SPI - Assistive Technology Service Provider Interface +Copyright 2008 Novell, Inc. +Copyright 2001 Sun Microsystems, 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.

+
+ + +

Instances of Hyperlink are returned by Hypertext objects, and are + the means by which end users and clients interact with linked, and in + some cases embedded, content. Hyperlinks may have multiple "anchors", + where an anchor corresponds to a reference to a particular resource with + a corresponding resource identified (URI). Hyperlinks may be + queried for their URIs, or queried for the objects corresponding to their + anchors. The objects thus obtained are instances of Accessible, + and may be queried, and manipulated via the Action interface.

+ +

@note A Hyperlink implementor is normally NOT an Accessible; + the preferred usage is for a Hyperlink's associated "objects" + (accessed via the ::getObject method) are Accessibles. This means + that Actions such as "open link" are normally invoked on + the result of Hyperlink::getObject rather than directly on the + Hyperlink instance. For historical reasons some implementors of Hyperlink + implement Action as well. This usage on the part of implementing + applications and toolkits is discouraged, but clients of Hyperlink + should be aware of it and prepared to handle such usage.

+
+ + + the number of separate anchors associated with this Hyperlink + + + + +

the starting offset within the containing Hypertext content + with which this Hyperlink is associated

+
+
+ + +

the ending offset within the containing Hypertext content + with which this Hyperlink is associated; that is, the offset of the + first element past the range within the Hypertext associated with + this Hyperlink.

+
+
+ + +

Gets the i'th object, (where i is an integer between 0 and + Hyperlink::numAnchors - 1, inclusive) associated with a Hyperlink. + The objects returned are usually actionable (i.e. they should implement + Accessibility::Action), and the available actions often include + "open", "bookmark", "save link as", etc. They may also implement + Accessibility::StreamableContent, although clients can normally use + ::getURI to obtain a resource locator via which the object's + data may be accessed.

+ +

@note the most common application for 'multi anchor' + hyperlinks in HTML is probably "client side imagemaps". + A clickable image which uses the HTML 'usemap' attribute + should have one anchor for every <area> element that + includes an HREF. The objects corresponding to these map + areas may implement Accessibility::Component, to represent + their onscreen bounding box, and may expose their 'shape' as + as name-value pair via Accessibility::Accessible::getAttributeSet.

+
+ + + + an Accessible object instance representing theHyperlink's ith anchor, or through which the content associated withthe \c ith anchor can beaccessed. + + +
+ + +

Obtain a resource locator ('URI') which can be used to + access the content to which this link "points" or is connected.

+
+ + + + a string corresponding to the URI of the Hyperlink's'ith' anchor, if one exists, or a NIL string otherwise. + + +
+ + +

Check the hyperlink to see if a connection to its backing + content can be established, or if its URI is valid. + @note instances of invalid hyperlinks include links with malformed + URIs, or for which a contact to the service provider + specified in the URI cannot be established.

+
+ + + \c True if the object's content is available, or\c False if the hyperlink's URI is invalid, or a connection to the resource can not be established. + + +
+ + +

\cond + unImplemented:

+ +

placeholders for future expansion.

+
+
+ + + + + + +
+
diff --git a/xml/Accessibility_Hypertext.xml b/xml/Accessibility_Hypertext.xml new file mode 100644 index 0000000..12d35c6 --- /dev/null +++ b/xml/Accessibility_Hypertext.xml @@ -0,0 +1,86 @@ + + +AT-SPI - Assistive Technology Service Provider Interface +Copyright 2008 Novell, Inc. +Copyright 2001 Sun Microsystems, 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.

+
+ + +

An interface used for objects which implement linking between + multiple resource or content locations, or multiple 'markers' + within a single document. A Hypertext instance is associated with + one or more Hyperlinks, which are associated with particular + offsets within the Hypertext's included content.

+ +

@note While this interface is derived from ::Text, + there is no requirement that Hypertext instances have + textual content; they may implement ::Image as well, + and Hyperlinks need not have non-zero text offsets.

+
+ + +

Query the hypertext object for the number of Hyperlinks it + contains.

+
+ + + the number of Hyperlinks associated with this Hypertextobject, as a long integer. + + +
+ + +

Get one of the Hyperlinks associated with this Hypertext object, + by index.

+ +

@param linkIndex an integer from 0 to getNLinks() - 1.

+
+ + + + the Hyperlink in this Hypertext object. + + +
+ + +

Get the hyperlink index, if any, associated with a + particular character offset in the Hypertext object. + For Hypertext implementors without textual content, all + hyperlinks are associated with character offset '0'.

+ +

@return the index of the Hyperlink associated with character + offset \c characterIndex, or -1 if no Hyperlink is associated + with that character offset.

+
+ + +
+ + + \cond + + + + + + + + +
+
diff --git a/xml/Accessibility_Image.xml b/xml/Accessibility_Image.xml new file mode 100644 index 0000000..2e73a68 --- /dev/null +++ b/xml/Accessibility_Image.xml @@ -0,0 +1,121 @@ + + +AT-SPI - Assistive Technology Service Provider Interface +Copyright 2008 Novell, Inc. +Copyright 2001 - 2005 Sun Microsystems, 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.

+
+ + +

An interface implemented by objects which render image data or + pictorial information to the screen. When onscreen components include + graphical information that is not purely intended to enhance "3d effect" + or visual layout, but which conveys some semantic or informational + content to the sighted user, they should implement Image, and that + semantic content should be conveyed textually to the extent possible + via the image description, as well as the Accessible::name and + Accessible::description properties.

+
+ + +

A UTF-8 string providing a textual description + of what is visually depicted in the image.

+ +

@note It is recommended that imageDescription be the shorter + of the available image descriptions, for instance "alt text" + in HTML images, and a longer description be provided in + Accessible::accessible-description, if available. + A short, one or two word label for the image should be provided in + Accessible::accessible-name.

+
+
+ + +

A string corresponding to the POSIX LC_MESSAGES locale used + by the imageDescription. + @since AT-SPI 1.7.0

+
+
+ + +

Obtain a bounding box which entirely contains the image contents, + as displayed on screen. The bounds returned do not account for + any viewport clipping or the fact that the image may be + partially or wholly obscured by other onscreen content. + @note This method returns the bounds of the current onscreen + view, and not the nominal size of the source data in the + event that the original image has been rescaled.

+ +

@param coordType If 0, the returned bounding box position is returned + relative to the screen; if 1, the bounding box position is returned + relative to the containing window.

+
+ + + + a BoundingBox enclosing the image's onscreen representation. + + +
+ + +

Get the coordinates of the current image position on screen.

+ +

@param x Back-filled with the x coordinate of the + onscreen image (i.e. the minimum x coordinate) + @param y Back-filled with the y coordinate of the + onscreen image (i.e. the minimum y coordinate) + @param coordType If 0, the returned x and y coordinates are + returned relative to the screen; + if 1, they are returned relative to the containing window.

+
+ + + +
+ + +

Obtain the width and height of the current onscreen view of the + image. The extents returned do not account for + any viewport clipping or the fact that the image may be + partially or wholly obscured by other onscreen content. + @note This method returns the size of the current onscreen + view, and not the nominal or "original" size of the source + image, in the event that the original image has been rescaled.

+ +

@param width Back-filled with the x extents of the + onscreen image (i.e. the image width in pixels) + @param height Back-filled with the y extents of the + onscreen image (i.e. the image height in pixels)

+
+ + +
+ + +

\cond + unImplemented:

+ +

placeholders for future expansion.

+
+
+ + + + +
+
diff --git a/xml/Accessibility_LoginHelper.xml b/xml/Accessibility_LoginHelper.xml new file mode 100644 index 0000000..752ea67 --- /dev/null +++ b/xml/Accessibility_LoginHelper.xml @@ -0,0 +1,193 @@ + + +AT-SPI - Assistive Technology Service Provider Interface +Copyright 2008 Novell, Inc. +Copyright 2001 Sun Microsystems 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.

+
+ + +

@brief An interface for use by assistive technologies by which + they can access system information and services on a 'need to know' + basis while the screen is locked, during user authentication, or + during other sensitive operations.

+ +

This interface is intended for use by assistive technologies + and related user-enabling services, and by applications and + utilities which may wish to restrict access to certain system + devices and services during security-sensitive states, e.g. when + the screen is locked or during authentication into some secure + service.

+ +

Such 'applications' (for instance, screen lock dialogs and + security-enabled web browsers) use the ::LoginHelper client + interfaces, and the bonobo-activation query service, to + query for assistive technologies which advertise the ::LoginHelper + service. The client then queries these assistive technologies + for their device I/O requirements, via the ::getDeviceReqs call. + The client may then issue the advisory request ::setSafe (TRUE), + which requests that the ::LoginHelper -implementing service make a + best-effort attempt to make itself more secure (for instance, + an onscreen keyboard might turn off word prediction, and a + screenreader may turn off keyboard echo via speech). The return + value of ::setSafe is an advisory indication of whether this attempt + was successful (no specific guarantees are implied). + Once the 'security sensitive' state is exited, the client should + call ::setSafe (FALSE).

+ +

The return values from ::getDeviceReqs inform the client of which + services the ::LoginHelper service (e. g. assistive technology) needs + in order to do its job. The client may use this information to + loosen any restrictions on access which it may currently have in + place (for instance, keyboard grabs, etc.). If it does not do so, + the likely outcome is that the end-user will experience loss + of access to the system.

+
+ + +

A structure containing info about toplevel X windows that + the ::LoginHelper instance wishes to have raised.

+
+ + +

string display; + short screen;

+
+
+
+ + +

DeviceReq:

+ +

The system and device access and services which the LoginHelper-implementing + assistive technology requires in order to enable the user to use the system.

+
+ + + !<: Needs access to the GUI event subsystem (e.g. Xserver) + + + + + !<: Needs access to the system keyboard events (read and write) + + + + + !<: Needs access to the onscreen pointer (e.g. mouse pointer) + + + + + !<: Reads XInput extended input devices + + + + + !<: Posts Windows, and needs for toplevel windows to be visible + + + + + !<: Writes to audio device + + + + + !<: Reads from audio device + + + + + !<: Requires access to general network services, including remote access + + + + + !<: Requires network services hosted on LOCALHOST only + + + + + !<: Writes to a serial port + + + + + !<: Reads from a serial port + + +
+ + + setSafe: + + + + \c TRUE if the client is requesting that 'safe mode' be initiated, \c FALSE if the client is advising that 'safe mode' may beexited, i.e. normal operation may be resumed.Request a LoginHelper to enter "safe" mode, orinform LoginHelper that "safe" mode may be exited.If \a safe_mode is \c TRUE, but the return value is \c FALSE,the requesting client may wish to deny services to the ::LoginHelper, for instance avoid raising its toplevels.The return value is purely advisory, and no guarantees are intended about what the implementing LoginHelper will do to improve security when in "safe" mode. + + + + + whether the ::LoginHelper is now "safe" or not. + + + + + +

getDeviceReqs:

+ +

Query a ::LoginHelper for the types of + device I/O it requires, in order to do its job. + For instance, a ::LoginHelper which needs to receive keyboard + events will include + Accessibility_LoginHelper_CORE_KEYBOARD in this list.

+
+ + + A sequence of ::LoginHelper_DeviceReq indicatingthe device I/O required in order to facilitate end-user access to the system. + + +
+ + +

getRaiseWindows:

+ +

Get a list of window IDs that need raising on login.

+
+ + + a sequence containing window IDS for toplevels whichneed to be raised/made visible during user authentication, inorder for the ::LoginHelper to facilitate end-user access to the system. + + +
+ + +

\cond + unImplemented:

+ +

placeholders for future expansion.

+
+
+ + + + + + +
+
diff --git a/xml/Accessibility_Registry.xml b/xml/Accessibility_Registry.xml new file mode 100644 index 0000000..91ec2a9 --- /dev/null +++ b/xml/Accessibility_Registry.xml @@ -0,0 +1,692 @@ + + +AT-SPI - Assistive Technology Service Provider Interface +Copyright 2008 Novell, Inc. +Copyright 2001 Sun Microsystems 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.

+
+ + +

The Registry is a service through which applications providing + accessibility services (servers) can rendezvous with consumers of those + services (Assistive Technologies). The Registry is the first "port of call" for + accessible applications and for assistive technologies wishing to query and + interact with those applications.

+ +

The Registry service provides four basic functions to Assistive Technology (AT) clients: + \li it provides a list of the applications who have registered with the AT-SPI + framework, thereby announcing their participation in the AT-SPI framework; + \li it allows AT clients to register for notification of changes in application + state (at-spi Events); + \li it dispatches/relays said events from participating applications to + the registered listeners; + \li it gives access to system device events via the associated DeviceEventController + interface.

+ +

From the point of view of accessible applications (i.e. AT-SPI service producers), + the Registry is primarily a registration and event delivery service. Applications + normally only call the registerApplication and deregisterApplication Registry methods, + and its inherited EventListener::notifyEvent method.

+ +

@note Although all application events are dispatched via the Registry, other AT client + calls are serviced directly by the applications, rather than being relayed via the + Registry. The AT client obtains references to these application objects + via the enumeration of Desktop instances whose children are Application instances + (Registry::getDesktopList) and via examination of the 'source' member of the Event + structure.

+ +

The Registry normally lives in its own process space; communication via Registry and + both application services and AT clients takes place via IPC. A process space diagram + illustrating the relationship between applications, Registry, and AT is shown below. + @image html "http://developer.gnome.org/projects/gap/tech-docs/SPIBlockDiagram.png"

+ +

@see Desktop, Application, Event, EventListener

+
+ + + Register a new application with the accessibility broker. + + + + a reference to the requesting Application + + + + + +

De-register an application previously registered with the broker. + deregisterApplication:

+
+ + + a reference to the Application to be deregistered. + + +
+ + +

Register a client's interest in (all) application events of + a certain type.

+
+ + + a reference to the requesting ::EventListener. + + + + + a string which indicates the type of events about which the client desires notification. + + +
+ + + deregisterGlobalEventListenerAll: + + + + the requesting EventListenerRequest that a previously registered client stop receivingglobal notifications for all events for which it was registered. + + + + + + deregisterGlobalEventListener: + + + + the requesting EventListener + + + + + a string indicating the type of eventsRequest that a previously registered client stop receivingglobal notifications for events of a certain type. + + + + + +

event types: "Window" "Desktop" + "Window:Create" "Window:Destroy" + "Window:Iconify" "Window:Restore" + "Window:Fullscreen" "Window:Resize" + "Desktop:Create" "Desktop:Destroy" + "Desktop:Focus" "Desktop:Defocus" + "Desktop:Reorder" + "Focus" + "GtkWidget:show" + "GObject:notify:<propertyname>"

+ +

( not sure we should allow these last 2 forms, + since they are toolkit-specific, but they're powerful )

+ +

getDesktopCount:

+ +

Get the current number of desktops.

+
+ + + a short integer indicating the current number of Desktops. + + +
+ + +

getDesktop: + @n: the index of the requested Desktop.

+ +

Get the nth accessible desktop.

+
+ + + + a reference to the requested Desktop. + + +
+ + +

Get a list of accessible desktops.

+
+ + + a sequence containing references tothe Desktops. + + +
+ + +

Obtain an object which can be used to request device event notifications.

+
+ + + an object implementing DeviceEventController + + +
+ + +

\cond + unImplemented:

+ +

placeholders for future expansion.

+
+
+ + + + + + + + + + +
+ + + Deprecated, DO NOT USE! + + + + + + +

Used to specify the event types of interest to an EventListener, or + to identify the type of an event for which notification has been sent. + @see EventTypeSeq, DeviceEvent::type

+
+ + + < key on a keyboard device was pressed. + + + + + < key on a keyboard device was released. + + + + +

< button on a non-keyboard human interface device + (HID) was pressed

+
+
+ + +

< button on a non-keyboard human interface device + (HID) was pressed

+
+
+
+ + + Used when synthesizing keyboard input via DeviceEventController:generateKeyboardEvent. + + + + emulate the pressing of a hardware keyboard key. + + + + + emulate the release of a hardware keyboard key. + + + + + a hardware keyboard key is pressed and immediately released. + + + + +

a symbolic key event is generated, without specifying a hardware key. + @note if the keysym is not present in the current keyboard map, + the DeviceEventController instance has a limited ability to generate + such keysyms on-the-fly. Reliability of generateKeyboardEvent calls + using out-of-keymap keysyms will vary from system to system, and on the + number of different out-of-keymap being generated in quick succession. + In practice this is rarely significant, since the keysyms of interest to + AT clients and keyboard emulators are usually part of the current keymap, i.e. + present on the system keyboard for the current locale (even if a physical + hardware keyboard is not connected.

+
+
+ + +

a string is converted to its equivalent keyboard events and emitted. + If the string consists of complex character or composed characters + which are not in the current keymap, string emission is subject to the + out-of-keymap limitations described for KeySynthType::KEY_SYM. + In practice this limitation primarily effects Chinese and Japanese locales.

+
+
+
+ + + + The left or right 'Shift' key + + + + + The ShiftLock or CapsLock key + + + + + 'Control'/'Ctrl' + + + + + The Alt key (as opposed to AltGr) + + + + +

depending on the platform this may map to 'Window', 'Function', 'Meta', + 'Menu', or 'NumLock'. + Such 'Meta keys' will map to one of META, META2, META3. + On X Windows platforms these META values map to + the modifier masks Mod1Mask, Mod2Mask, Mod3Mask, e.g. an event having + ModifierType::MODIFIER_META2 means that the 'Mod2Mask' bit is + set in the corresponding XEvent.

+
+
+ + + + +

A symbolic meta key name that is mapped by AT-SPI to the + appropriate META value, for the convenience of the client.

+
+
+
+ + +

A structure that encapsulates the characteristics of the event notifications + that should be sent to an EventListener in response to a call to + DeviceEventController::registerKeystrokeListener or + DeviceEventController::registerDeviceEventListener.

+
+ + +

< If \c True, specifies that + DeviceEventController should block while waiting + for client to process the requested event notifications; + ordinarily should be used only when client needs to perform + operations synchronously with event delivery. Note that because + of the architecture of device event systems in general, + use of this flag may not block delivery of the event to + the currently focussed application unless it is used in + conjunction with the preemptive flag.

+
+
+ + +

< If \c True, specifies that + Listener is allowed to pre-empt the delivery of the event, + effectively "consuming" it such that it is not delivered + to the currently focussed desktop application. + Key events consumed via this API will not be + available for use by other applications or services, so this + option should be used sparingly.

+
+
+ + +

< If \c True, specifies that + Event notifications should be sent regardless of whether the + currently focussed application participates in the AT-SPI + infrastructure. On systems with the XEvIE X extension, this flag + also allows access to events which are already subject to + interception via a "system keygrab" (as described in the X Window System + documentation for XGrabKey). The 'global' and 'preemptive' flags + should only be used together for the purposes of registering + "system global key shortcuts" i.e. command keys for use by the + assistive technology.

+
+
+
+ + + A structure which encapsulates information about a device event. + + + + < Identifies the type of the containing DeviceEvent. + + + + +

< an identifier which identifies this event in the event stream. + On X Window systems this corresponds to the XEvent serial number.

+
+
+ + +

< a numeric code which is hardware and system-dependent, identifying the + specific hardware button or key on the device for which the event has + occurred. On X Window systems, for global key notifications and for most + non-global key notifications as well, this code corresponds to the + XKeycode. For switch and button events it indicates the switch + or button number. + @note + For technical reasons, this code may differ from the XKeycode + when generated by Java applications for consumption by non-global + key listeners. This is subject to change in future versions of the + DeviceEventController implementation.

+
+
+ + +

< an unsigned short int consisting of zero or more of the following + values OR'ed together: + \li \c 1<<::MODIFIER_SHIFT (=1, corresponds to Xlib's ShiftMask) + \li \c 1<<::MODIFIER_SHIFTLOCK (=2, corresponds to Xlib's LockMask) + \li \c 1<<::MODIFIER_CONTROL (=4, corresponds to Xlib's ControlMask) + \li \c 1<<::MODIFIER_ALT (=8, corresponds to Xlib's Mod1Mask) + \li \c 1<<::MODIFIER_META (=16, corresponds to Xlib's Mod2Mask) + \li \c 1<<::MODIFIER_META2 (=32, corresponds to Xlib's Mod3Mask) + \li \c 1<<::MODIFIER_META3 (=64, corresponds to Xlib's Mod4Mask)

+
+
+ + +

< an unsigned integer representing the time that the + event occurred. On X Window systems this event is + a time in milliseconds from some arbitrary starting + point; it therefore has a cycle time of approximately + 50 days.

+
+
+ + +

< A string representation of the event. If is_text is + \c True, then this string represents the character or typographic + sequence that would be received by a focussed text input field. + event_string is in general suitable for exposure to the + end-user for purposes of keyboard echo.

+
+
+ + +

< \c True if the event results in the insertion of characters + into an input text buffer, or would do so if delivered to a focussed + text input field. ¨Typographical¨ key events have this field set to + \c True, whereas ¨control¨ key events generally do not.

+
+
+
+ + +

A structure which defines the identity of a key for which notifications + are to be requested. The data in the members of a ::KeyDefinition are used to + determine which keyboard events 'match' the notification request filed by a client.

+ +

@note Ordinarily a KeyDefinition specifies one and only one of the criteria below; + the result of using a KeyDefinition with multiple members defined as nonzero is + undefined.

+ +

@param keycode if nonzero, the numeric, system-dependent value corresponding to a + physical key on the keyboard. Keycode values have no semantic meaning to the end-user, + and may depend on the user's hardware and operating environment. They therefore are + rarely useful "as-is" to AT clients, unless the client has used operating system + services to identify the hardward keycode associated with a particular key symbol. + Notifications for key events requested by keycode are less dependent on modifier state + than \c keysym based notifications, but some hardware (notably many laptops) may generate + more than one keycode for the same physical key, depending on the state of physical + shift/modifier keys. + @param keysym if nonzero, the numeric value corresponding to the X Keysym of the key for which + notification is requested. Note that the presence of active modifiers will affect + whether notification for key events requested via "keysym" specification takes place, + since the keysym depends on the modifier state for most keys. + @param keystring if non-NULL, the string value of the inserted characters if the corresponding + key event has ::KeyEvent:is_text set to \c True, or the string representing the + 'name' of the key. On X11 systems, the string 'name' of non-printing keysyms corresponds + to the values in "keysymdef.h" as provided by Xlib, with the leading "XK_" stripped off.

+
+ + + + +
+ + +

This interface should be implemented by AT-SPI clients who wish to + make use of the DeviceEventController to receive device event notifications. + DeviceEvents include keyboard events and mouse button/motion events.

+
+ + + Notify an interested DeviceEventListener that a DeviceEvent has occurred. + + + + + \c True if the recipient/consumer wishes to consume the event, i.e.prevent it from being delivered to the desktop, \c False if the event should continue to be delivered as normal. + + + + + + \cond + + + + + + + + + + + + +
+ + +

The interface via which clients request notification of device events, and + through which device events may be simulated.

+
+ + +

Register to intercept keyboard events, and either pass them on or + consume them.

+
+ + + a DeviceEventListener which will intercept key events. + + + + + a KeySet indicating which keys to intercept, or KEYSET_ALL_KEYS. + + + + + a ControllerEventMask filtering the intercepted key events. + + + + + a KeyEventTypeSeq that may created by ORing event types together. + + + + + an EventListenerMode indicating whether the listener should receive the events synchronously, potentially consuming them,or just be notified asynchronously of those events that havebeen generated.@note Some platforms have limited support for global, preemptive EventListenerMode.Such a registration may fail if another client already has priority for preemptiveaccess to one or more of the members of the KeySet. AT consumers have the optionof re-trying the request without the global flag, or without the preemptive flag,or of re-trying with a different KeySet. The best support for pre-emptiveglobal keyboard listeners is provided on platforms whose Xserver implementationprovides the XEvIE extension. + + + + + \c True if the DeviceEventListener was successfully registeredfor the requested KeySet, ControllerEventMask, event types, and EventListenerMode; otherwise returns \c False. + + +
+ + + De-register a previously registered keyboard eventlistener. + + + + a DeviceEventListener which will intercept key events. + + + + + a KeySet indicating which keys to intercept, or KEYSET_ALL_KEYS. + + + + + a ControllerEventMask filtering the intercepted key events. + + + + + an EventType mask that may created by ORing event types together. + + + + + +

Register to intercept events, and either pass them on or + consume them. To listen to keyboard events use registerKeystrokeListener + instead.

+
+ + + a DeviceEventListener which will intercept events. + + + + + an EventTypeSeq indicating which event types to listen for. + + + + + \c True if successful, \c False if not + + +
+ + + De-register a previously registered keyboard eventlistener. + + + + a DeviceEventListener which will intercept events. + + + + + an EventTypeSeq indicating which event types to stoplistening for. + + + + + +

Notify the Registry instance that a device event has taken place, and + allow pre-emptive listeners the opportunity to 'consume' the event + and thus prevent its further issuance/forwarding. This is the + method used by accessibility bridges to forward "toolkit dependent" + device events to the Registry from the application's process space.

+ +

@note AT clients do not normally need to use this method, it is intended for use + by toolkit bridges and special-purpose applications.

+
+ + + + \c True if the event was consumed by a (pre-emptive) listener,\c False if not (in which case the device event will be forwardedas normal to any application which would normally receive it, e.g.the currently active application in the case of mouse or keyboard events). + + +
+ + +

Notify the Registry instance that a device event has taken place in + an asynchronous manner. This is the + method used by accessibility bridges to forward "toolkit dependent" + device events to the Registry from the application's process space. + If the event in question is potentially pre-emptible. + ::notifyListenersSync should be used instead.

+ +

@note AT clients do not normally need to use this method, it is intended for use + by toolkit bridges and special-purpose applications.

+
+ +
+ + + Synthesize a keyboard event. + + + + a long integer indicating the keycode ofthe keypress to be synthesized. + + + + + an optional UTF-8 string indicating a complexkeyboard input event. + + + + + a KeySynthType indicating the type of event(s) to be synthesized: a key press, release, press-release pair,or a complex input string (for instance from aninternationalized or complex text input method, ora composed character).@note keycode may be truncated before beingprocessed, as keycode length may be platform-dependentand keycode ranges are generally much smaller thanCORBA_long. One or the other of keycode or keystring are generally NULL, (but not both), depending on the value of \c type. + + + + + + Synthesize a mouse event. + + + + a long integer indicating the screen x coord for the mouse event. + + + + + a long integer indicating the screen y coord for the mouse event. + + + + + a string indicating the type of mouse event, e.g. "button1up" + + + + + +

\cond + unImplemented:

+ +

placeholders for future expansion.

+
+
+ + + + + + +
+
diff --git a/xml/Accessibility_Selection.xml b/xml/Accessibility_Selection.xml new file mode 100644 index 0000000..3450308 --- /dev/null +++ b/xml/Accessibility_Selection.xml @@ -0,0 +1,184 @@ + + +AT-SPI - Assistive Technology Service Provider Interface +Copyright 2008 Novell, Inc. +Copyright 2001 Sun Microsystems, 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.

+
+ + +

An interface which indicates that an object exposes a 'selection' model, + allowing the selection of one or more of its children. Read-only Selection + instances are possible, in which case the interface is used to programmatically + determine the selected-ness of its children. A selected child has ::State::STATE_SELECTED, + and a child which may hypothetically be selected (though possibly not programmatically + selectable) has ::State::STATE_SELECTABLE. + @note Events emitted by implementors of Selection include: + \li \c "object:selection-changed" An instance of Selection has undergone a change in the + 'selected-ness' of its children, i.e. had a selection added, + removed, and/or modified. Usually accompanied by + corresponding \c "object:state-changed:selected" events + from the corresponding children, unless the children are + previously un-queried via AT-SPI and the Selection instance + has ::State::STATE_MANAGES_DESCENDANTS.

+
+ + +

The number of children of a Selection implementor which are + currently selected.

+
+
+ + +

Get the i-th selected Accessible child of a Selection. + @note \c selectedChildIndex refers to the index in the list of + 'selected' children as opposed to the more general 'child index' + of an object; as such it generally differs from that used in + Accessible::getChildAtIndex() or returned by + Accessible::getIndexInParent(). + \c selectedChildIndex must lie between 0 + and Selection::nSelectedChildren-1, inclusive.

+
+ + + a long integer indicating which of the selected children of an object is being requested. + + + + + a pointer to a selected Accessible child object,specified by \c selectedChildIndex. + + +
+ + +

Add a child to the selected children list of a Selection. + @note For Selection implementors that only allow + single selections, this call may result in the + replacement of the (single) current + selection. The call may return \c False if + the child is not selectable (i.e. does not have ::State::STATE_SELECTABLE), + if the user does not have permission to change the selection, + or if the Selection instance does not have ::State::STATE_SENSITIVE.

+
+ + + a long integer indicating which child of theSelection is to be selected. + + + + + \c True if the child was successfully selected, \c False otherwise. + + +
+ + +

Remove a child to the selected children list of a Selection. + @note \c childIndex is the index in the selected-children list, + not the index in the parent container. \c selectedChildIndex in this + method, and \c childIndex in Selection::selectChild + are asymmettric.

+
+ + + a long integer indicating which of the selected children of the Selection is to be deselected. The indexis a zero-offset index into the 'selected child list', nota zero-offset index into the list of all children of the Selection. + + + + + \c True if the child was successfully deselected, \c False otherwise.@see deselectChild + + +
+ + +

Determine whether a particular child of an Selection implementor + is currently selected. Note that \c childIndex is the zero-offset + index into the standard Accessible container's list of children.

+
+ + + an index into the Selection's list of children. + + + + + \c True if the specified child is currently selected,\c False otherwise. + + +
+ + +

Attempt to select all of the children of a Selection implementor. + Not all Selection implementors support this operation (for instance, + implementations which support only "single selection" do not support this operation).

+
+ + + \c True if successful, \c False otherwise. + + +
+ + +

Attempt to clear all selections (i.e. deselect all children) of a Selection. + Not all Selection implementations allow the removal of all selections.

+ +

@note this operation may fail if the object must have at least one selected child, + if the user does not have permission to change the selection, or if the Selection + does not have ::State::STATE_SENSITIVE.

+
+ + + \c True if the selections were successfully cleared, \c False otherwise. + + +
+ + +

Remove a child from the selected children list of a Selection, + if the child is currently selected.

+ +

@note unlike deselectSelectedChild, \c childIndex is the zero-offset + index into the Accessible instance's list of children, + not the index into the 'selected child list'.

+
+ + + a long integer (the zero offset index into the Accessibleobject's list of children) indicating which child of theSelection is to be selected. + + + + + \c True if the child was successfully selected, \c False otherwise.@see deselectSelectedChild@since AT-SPI 1.8.0 + + +
+ + +

unImplemented:

+ +

placeholders for future expansion.

+
+
+ + + + +
+
diff --git a/xml/Accessibility_Selector.xml b/xml/Accessibility_Selector.xml new file mode 100644 index 0000000..50f9f57 --- /dev/null +++ b/xml/Accessibility_Selector.xml @@ -0,0 +1,173 @@ + + +AT-SPI - Assistive Technology Service Provider Interface +Copyright 2008 Novell, Inc. +Copyright 2001 Sun Microsystems 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.

+
+ + + A structure which encapsulates both a string representation of a command and a unique command ID + + + + + + +

Notify the CommandListener instance of changes to the currently + available commands, by sending the current ::CommandList.

+ +

@param commands The newly-available list of ::Command objects which + may be invoked by the listener.

+
+ +
+ + +

This interface is intended for use by assistive technologies + and related user-agents. Via this interface, an assistive technology or + user agent may expose a series of choices or selections in textual form, + which can be activated on demand by a client of the Selector interface.

+ +

Examples of the use of this interface include voice-command and remote-control + applications, in which the user interaction is wholly or partly delegated by the + implementor to an external agent. + @since AT-SPI 1.7.0

+
+ + +

A code returned by a call to ::activateCommand, indicating + the result of the activation request.

+
+ + +

< The command was invalid or ill-formed; usually indicates + an error condition.

+
+
+ + + < The command was successfully activated. + + + + +

< The command was valid, but could not be activated. + This may be due to problems with permissions or error conditions.

+
+
+ + +

< The command is no longer valid in the current program context. + This may mean that the application has changed state in such a + way that the specified command it no longer applicable, or + because changes to the application state have rendered it + ambiguous. Commands should be re-fetched and a new selection + made.

+
+
+ + +

< Defines size of enumeration; + do not use this value as a parameter.

+
+
+
+ + + This attribute is TRUE if this Selector allows its ::CommandList to be specified by the client + + + + +

Query the ::Selector for the current ::CommandList.

+
+ + + the currently available ::CommandList + + +
+ + + + + TRUE if the replacement request was successful, FALSE if the request could not be honored. + + + + + +

Ask the ::Selector to re-calculate its ::CommandList. + @note in most cases the ::Selector will continuously + update its ::CommandList without recourse to this call. + This call is equivalent to ::getCommands, except that + after ::refreshCommands the new ::CommandList will be returned + via any registered ::CommandListener instances rather than + synchronously via this call.

+
+ + + TRUE if the ::CommandList changed. + + +
+ + +

Request that the ::Selector invoke the specified ::Command. + @param cmd the ::Command to activate/invoke.

+
+ + + + a ::CommandResult indicating whether the request was honored, and the reason for failure if the::Command could not be activated or invoked. + + +
+ + +

Register a :CommandListener instance for notification of + changes to the command set. + @param listener the ::CommandListener to be notified of changes.

+
+ +
+ + +

Tell the ::Selector instance to cease notifying the + specified ::CommandListener of changes to the command list. + @param listener the ::CommandListener to remove from the + notification list.

+
+ +
+ + +

\cond + unImplemented:

+ +

placeholders for future expansion.

+
+
+ + + + + + +
+
diff --git a/xml/Accessibility_StreamableContent.xml b/xml/Accessibility_StreamableContent.xml new file mode 100644 index 0000000..ae7b19c --- /dev/null +++ b/xml/Accessibility_StreamableContent.xml @@ -0,0 +1,226 @@ + + +AT-SPI - Assistive Technology Service Provider Interface +Copyright 2008 Novell, Inc. +Copyright 2001 Sun Microsystems, 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.

+
+ + +

An interface by which the requested data from a StreamableContent object + may be read by the client. + @note this interface supercedes the use of BonoboStream by previous + versions of StreamableContent.

+ +

@since AT-SPI 1.7.0

+
+
+ + +

Specifies the meaning of a seek 'offset'. Not all SeekTypes are + supported by all StreamableContent data sources, for instance + some streams may not support seeking from the beginning or other + types of 'backwards' seeks.

+
+ + + < Seek from the start of the stream or data source. + + + + + < Seek relative to the current position. + + + + + < Seek from the end of the file, stream, or data source. + + +
+ + + + Indicates that a transmission error has occurred while reading or seeking the stream or data source. + + + + + Indicates that the requested operation is not supported by the stream instance. + + + + + The operation is supported, but the current requestor does not havepermission to t the request, for instance does not have permission to read the stream. + + + + + +

Seek to a specified position in the Stream. + @param offset an offset specifying the requested position in the stream, + relative to the SeekType specified in \c whence. + @param whence a SeekType specifying the reference point from which the + seek offset is calculated. Some forms of seek are not supported by certain + implementations of Stream, in which case a NotSupported exception will be raised.

+
+ + + + + the actual resulting offset, if no exception was raised. + + + + + + + +
+ + + Request/read a specified amount of data from a Stream. + + + + + + the number of bytes actually read into the client buffer. + + + + + + + + + +

close the stream and release associated resources. + A client should not perform further operations on a + StreamableContent::Stream object after closing it.

+
+
+ + + /cond + + + + + + +

An interface whereby an object allows its backing content + to be streamed to clients. Negotiation of content type + is allowed. Clients may examine the backing data and + transform, convert, or parse the content in order to + present it in an alternate form to end-users.

+ +

@note The StreamableContent interface is particularly useful for saving, + printing, or post-processing entire documents, or for persisting + alternate views of a document. + If document content itself is being serialized, stored, or converted, + then use of the StreamableContent interface can help address performance + issues. Unlike most AT-SPI/Accessibility interfaces, this interface + is not strongly tied to the current user-agent view of the + a particular document, but may in some cases give access to the + underlying model data.

+
+ + + getContentTypes: + + + + the list of available mimetypes for this object's content. + + + + + +

\n DEPRECATED, use getStream instead. + getContent: + Retrieve this object's content, in a format appropriate to a + requested mimetype.

+ +

@note the data is returned as an object of type ::Bonobo::Stream. + The primary methods which are supported on Bonobo::Streams for the + purposes of the ::StreamableContent API are \c seek and \c read. + \c seek may not be supported for all mimetypes or + all implementors.

+ +

\verbatim + long Bonobo::Stream:seek (in long offset, in SeekType whence) + raises (NoPermission, IOError) + void Bonobo::Stream:read (in long count, out iobuf buffer) + raises (NoPermission, IOError) + \endverbatim

+ +

@see ::Bonobo::Stream

+
+ + + + a ::Bonobo::Stream whose mimetype matches \a contentType,if available, or \c NIL. + + +
+ + +

Retrieve this object's content, in a format appropriate to a + requested mimetype, as a ::ContentStream instance.

+ +

@note This method supercedes the older getContent method, which + relied on the Bonobo::Stream API. + \c seek may not be supported for all mimetypes or + all implementors.

+ +

@param contentType a string specifying the desired mimetype for the content stream.

+
+ + + + a Stream whose mimetype matches \a contentType,if available, or \c NIL.@since AT-SPI 1.8.0 + + +
+ + +

Get a URI pointing to the content of the specified type, if such a URI + can be obtained. Not all streamable content providers have URI representations.

+ +

@param contentType a string specifying the desired mimetype for the content stream. + If NULL, then a URI for the default content type will be returned, if available.

+
+ + + + a string which constitutes a URI for a stream of the specifiedcontent type, or NULL if no such URI can be obtained. + + +
+ + +

\cond + unImplemented:

+ +

placeholders for future expansion.

+
+
+ + +
+
diff --git a/xml/Accessibility_Table.xml b/xml/Accessibility_Table.xml new file mode 100644 index 0000000..56761ac --- /dev/null +++ b/xml/Accessibility_Table.xml @@ -0,0 +1,482 @@ + + +AT-SPI - Assistive Technology Service Provider Interface +Copyright 2008 Novell, Inc. +Copyright 2001 Sun Microsystems, 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.

+
+ + +

An interface used by containers whose contained data is arranged in + a "tabular" (i.e.\ row-column) fashion. Tables may resemble a two-dimensional + grid, as in a spreadsheet, or may feature objects which span multiple rows and/or + columns, but whose bounds are aligned on a row/column matrix. Thus, the Table + interface may be used to represent "spreadsheets" as well as "frames".

+ +

Objects within tables are children of the Table instance, and they may be referenced + either via a child index or via a row/column pair. + Their role may be ROLE_TABLE_CELL, but table 'cells' may have other roles as well. + These 'cells' may implement other interfaces, such as Text, Action, Image, + and Component, and should do so as appropriate to their onscreen representation + and/or behavior.

+
+ + +

The total number of rows in this table (including empty rows), + exclusive of any rows which are programmatically hidden. + Rows which are merely scrolled out of view are included.

+
+
+ + +

The total number of columns in this table (including empty columns), + exclusive of columns which are programmatically hidden. + Columns which are scrolled out of view or clipped by the current + viewport are included.

+
+
+ + + An Accessible which represents of a caption for a Table. + + + + +

An accessible object which summarizes the contents of a Table. + This object is frequently itself a Table instance, albeit a simplified one.

+
+
+ + +

The number of rows currently selected. + A selected row is one in which all included cells are selected. + @note Not all tables support row selection.

+
+
+ + +

The number of columns currently selected. + A selected column is one in which all included cells are selected. + @note Not all tables support column selection.

+
+
+ + +

Get the table cell at the specified row and column indices. + @note To get the accessible object at a particular (x, y) screen coordinate, + use Accessible::getAccessibleAtPoint ().

+
+ + + the specified table row, zero-indexed. + + + + + the specified table column, zero-indexed. + + + + + an Accessible object representing the specified table cell. + + +
+ + +

Get the 1-D child index corresponding to the specified 2-D row and column indices. + @note To get the accessible object at a particular (x, y) screen coordinate, + use Accessible::getAccessibleAtPoint.

+
+ + + the specified table row, zero-indexed. + + + + + the specified table column, zero-indexed.@see getRowAtIndex, getColumnAtIndex + + + + + a long integer which serves as the index of a specified cell in thetable, in a form usable by Accessible::getChildAtIndex. + + +
+ + +

Get the table row index occupied by the child at a particular 1-D child index.

+
+ + + the specified child index, zero-indexed.@see getIndexAt(), getColumnAtIndex() + + + + + a long integer indicating the first row spanned by the child of atable, at the specified 1-D (zero-offset) \c index. + + +
+ + +

Get the table column index occupied by the child at a particular 1-D child index.

+
+ + + the specified child index, zero-indexed.@see getIndexAt(), getRowAtIndex() + + + + + a long integer indicating the first column spanned by the child of atable, at the specified 1-D (zero-offset) \c index. + + +
+ + +

Get a text description of a particular table row. This differs from + AccessibleTable_getRowHeader, which returns an Accessible.

+
+ + + the specified table row, zero-indexed. + + + + + a UTF-8 string describing the specified table row, if available. + + +
+ + +

Get a text description of a particular table column. This differs from + AccessibleTable_getColumnHeader, which returns an Accessible.

+
+ + + the specified table column, zero-indexed. + + + + + a UTF-8 string describing the specified table column, if available. + + +
+ + +

Get the number of rows spanned by the table cell at the specific row and column. + (some tables can have cells which span multiple rows and/or columns).

+
+ + + the specified table row, zero-indexed. + + + + + the specified table column, zero-indexed. + + + + + a long integer indicating the number of rows spanned by the specified cell. + + +
+ + +

Get the number of columns spanned by the table cell at the specific row and column. + (some tables can have cells which span multiple rows and/or columns).

+
+ + + the specified table row, zero-indexed. + + + + + the specified table column, zero-indexed. + + + + + a long integer indicating the number of columns spanned by the specified cell. + + +
+ + +

Get the header associated with a table row, if available. This differs from + getRowDescription, which returns a string.

+
+ + + the specified table row, zero-indexed. + + + + + an Accessible representatin of the specified table row, if available. + + +
+ + +

Get the header associated with a table column, if available, as an + instance of Accessible. This differs from + getColumnDescription, which returns a string.

+
+ + + the specified table column, zero-indexed. + + + + + an Accessible representatin of the specified table column, if available. + + +
+ + +

Obtain the indices of all rows which are currently selected. + @note Not all tables support row selection.

+
+ + + a sequence of integers comprising the indices of rows currently selected. + + +
+ + +

Obtain the indices of all columns which are currently selected. + @note Not all tables support column selection.

+
+ + + a sequence of integers comprising the indices of columns currently selected. + + +
+ + +

Determine whether a table row is selected. + @note Not all tables support row selection.

+
+ + + the row being queried. + + + + + \c True if the specified row is currently selected, \c False if not. + + +
+ + +

Determine whether a table column is selected. + @note Not all tables support column selection.

+
+ + + the column being queried. + + + + + \c True if the specified column is currently selected, \c False if not. + + +
+ + +

Determine whether the cell at a specific row and column is selected. + @param row a row occupied by the cell whose state is being queried. + @param column a column occupied by the cell whose state is being queried.

+
+ + + + + \c True if the specified cell is currently selected, \c False if not. + + +
+ + +

Select the specified row, adding it to the current row selection, + if the table's selection model permits it.

+ +

@param row + @note Possible reasons for addRowSelection to return \c False + include: + \li The table does not support Selection + \li The table row includes cells which do not have STATE_SELECTABLE + \li The table does not support selection by row + \li The table does not support selection of multiple rows, and + one row is already selected. + \li The table does not support non-contiguous selections (i.e. + does not include STATE_MULTISELECTABLE), and the specified row + would result in selection of non-contiguous rows. + \li The table does not support user-instigated selection.

+
+ + + + \c True if the specified row was successfully selected, \c False if not. + + +
+ + +

Select the specified column, adding it to the current column selection, + if the table's selection model permits it.

+ +

@param column + @note Possible reasons for addColumnSelection to return \c False + include: + \li The table does not support Selection + \li The table column includes cells which do not have STATE_SELECTABLE + \li The table does not support selection by column + \li The table does not support selection of multiple columns, and + one column is already selected. + \li The table does not support non-contiguous selections (i.e. + does not include STATE_MULTISELECTABLE), and the specified column + would result in selection of non-contiguous columns. + \li The table does not support user-instigated selection.

+
+ + + + \c True if the specified column was successfully selected, \c False if not. + + +
+ + +

Remove the specified row from current row selection, + if the table's selection model permits it.

+ +

@param row + @note Possible reasons for removeRowSelection to return \c False + include: + \li The table does not support user-instigated Selection + \li The table has no selected rows or does not support deselection by row

+
+ + + + \c True if the specified row was successfully de-selected, \c False if not. + + +
+ + +

Remove the specified column from current column selection, + if the table's selection model permits it.

+ +

@param column + @note Possible reasons for removeColumnSelection to return \c False + include: + \li The table does not support user-instigated modification of + selection state + \li The table has no selected columns or does not support + deselection by column.

+
+ + + + \c True if the specified column was successfully de-selected, \c False if not. + + +
+ + +

Given a child index, determine the row and column indices and + extents, and whether the cell is currently selected. If + the child at \c index is not a cell (for instance, if it is + a summary, caption, etc.), \c False is returned.

+ +

@param index the index of the Table child whose row/column + extents are requested. + @param row back-filled with the first table row associated with + the cell with child index \c index. + @param col back-filled with the first table column associated + with the cell with child index \c index. + @param row_extents back-filled with the number of table rows + across which child \c i extends. + @param col_extents back-filled with the number of table columns + across which child \c i extends. + @param is_selected a boolean which is back-filled with \c True + if the child at index \c i corresponds to a selected table cell, + \c False otherwise.

+ +

Example: + If the Table child at index '6' extends across columns 5 and 6 of + row 2 of a Table instance, and is currently selected, then + \code + retval = table::getRowColumnExtentsAtIndex (6, row, col, + row_extents, + col_extents, + is_selected); + \endcode + will return True, and after the call + \c row, \c col, \c row_extents, \c col_extents, + and \c is_selected will contain \c 2, \c 5, \c 1, \c 2, and + \c True, respectively.

+
+ + + + + + + + + \c True if the index is associated with a valid tablecell, \c False if the index does not correspond to a cell. If \c False is returned, the values of the out parameters are undefined.@since AT-SPI 1.7.0 + + +
+ + +

\cond + unImplemented:

+ +

placeholders for future expansion.

+
+
+ + + + + + + + + + + + +
+
diff --git a/xml/Accessibility_Text.xml b/xml/Accessibility_Text.xml new file mode 100644 index 0000000..9f4033f --- /dev/null +++ b/xml/Accessibility_Text.xml @@ -0,0 +1,586 @@ + + +AT-SPI - Assistive Technology Service Provider Interface +Copyright 2008 Novell, Inc. +Copyright 2001 Sun Microsystems, 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.

+
+ + +

Specifies the boundary conditions determining a run of text as returned from + getTextAtOffset, getTextAfterOffset, and getTextBeforeOffset.

+
+ + +

< Text is bounded by this character only. + Start and end offsets differ by one, by definition, for this value.

+
+
+ + +

< Boundary condition is start of a word; i.e. range is from start of + one word to the start of another word.

+
+
+ + +

< Boundary condition is the end of a word; i.e. range is from + the end of one word to the end of another. + @note some locales may not distinguish between words and + characters or glyphs, in particular those locales which use + wholly or partially ideographic character sets. In these cases, + characters may be returned in lieu of multi-character substrings.

+
+
+ + +

< Boundary condition is start of a sentence, as determined + by the application. + @note Some locales or character sets may not include explicit sentence + delimiters, so this boundary type can not always be honored. + Some locales will return lines of text instead of grammatical sentences.

+
+
+ + +

< Boundary condition is end of a sentence, as determined by the application, + including the sentence-delimiting character, for instance '.' + @note Some locales or character sets may not include explicit sentence + delimiters, so this boundary type can not always be honored. + Some locales will return lines of text instead of grammatical sentences.

+
+
+ + +

< Boundary condition is the start of a line; i.e. range is + from start of one line to the start of another. This generally + means that an end-of-line character will appear at the end of the range.

+
+
+ + +

< Boundary condition is the end of a line; i.e. range is + from start of one line to the start of another. This generally + means that an end-of-line character will be the first character of the range.

+
+
+
+ + +

TEXT_CLIP_TYPE: + CLIP_MIN means text clipped by min coordinate is omitted, + CLIP_MAX clips text interescted by the max coord, and CLIP_BOTH + will retain only text falling fully within the min/max bounds.

+
+ + + + < characters/glyphs clipped by the minimum coordinate are omitted + + + + + < characters/glyphs which intersect the maximum coordinate are omitted + + + + + < only glyphs falling entirely within the region bounded by min and max are retained. + + +
+ + +

The text interface should be implemented by objects which place textual information onscreen as character + strings or glyphs. The text interface allows access to textual content, including display attributes and + semantic hints associated with runs of text, and access to bounding box information for glyphs and substrings. + It also allows portions of textual content to be selected, if the object's StateSet includes + STATE_SELECTABLE_TEXT.

+ +

In some cases a Text object may have, as its content, an empty string. In particular this can + occur in the case of Hypertext objects which do not display explicitly textual information onscreen, + as Hypertext is derived from the Text interface. @see Hypertext.

+ +

Typographic and semantic attributes of onscreen textual content, for instance typeface, weight, + language, and such qualities as 'emphasis' or 'blockquote', are represented as text attributes. + Contiguous sequences of characters over which these attributes are unchanged are referred to as + "attribute runs", and are available via Text::getAttributeRun. Where possible, implementing clients + will report textual attributes which are the same over the entire text object, for instance those + inherited from a default or document-scope style, via getDefaultAttributes instead of reporting them + explicitly for each character. Therefore, for any span of text, the attributes in effect are the union + of the set returned by Text::getDefaultAttributes, and the set returned at a particular character + offset via Text::getAttributeRun.

+ +

@note Events that may be emitted by instances of Text include: + \li \c "object:text-attributes-changed" The attributes of a range of text, or the range over + which attributes apply, has changed. + \li \c "object:text-changed" The text content of this object has changed. + \li \c "object:text-bounds-changed" The character bounds of a text object have changed, + for instance in response to a reformatting or reflow operation. + \li \c "object:text-caret-moved" The character offset of the text caret (visible or notional) within + this object has changed. Events of this type may also be generated when an onscreen + text caret appears or disappears. + \li \c "object:text-selection-changed" The range or number of text selections within this text object + has changed.

+ +

@note In some cases, objects which are not onscreen may implement Text, but if such objects + implement Component, their potential visibility should be examined (via comparison with STATE_VISIBLE + and STATE_SHOWING) before exposing them to the user. Objects which implement Text but not Component + may be encountered in special-purpose interfaces or as special ¨accessibility¨ extensions to visual + interfaces to allow non-graphical access to application features. These instances should be considered + the exception, rather than the rule.

+
+ + +

A structure used to define a continguous range of text, including its + (unattributed) textual content.

+
+ + + + +
+ + +

The total current number of characters in the Text object, + including whitespace and non-spacing characters.

+
+
+ + +

The current offset of the text caret in the Text object. + This caret may be virtual, e.g. non-visual and notional-only, but if an + onscreen representation of the caret position is visible, it will correspond to this offset. + The caret offset is given as a character offset, as opposed to a byte offset into + a text buffer or a column offset.

+
+
+ + +

Obtain all or part of the onscreen textual content of a Text object. If endOffset is specified as + "-1", then this method will return the entire onscreen textual contents of the Text object. + @note 'onscreen' in this context means "potentially onscreen", this method does not perform any sort + of coordinate visibility clipping or window-stack-ordering clipping. The text thus reported + corresponds to the text which would be presented onscreen if the object implementing the Text interface + were entirely unobscured.

+
+ + + + + the textual content of the current Text object beginning startOffset (inclusive) up to but not including the character at endOffset. + + +
+ + +

Programmatically move the text caret (visible or virtual, as above) to a given position. + @param offset a long int indicating the desired character offset. Not all implementations of + Text will honor setCaretOffset requests, so the return value below should be checked by the client.

+
+ + + + \c TRUE if the request was carried out, or \c FALSE if the caret could not be moved to the requested position. + + +
+ + +

Obtain a subset of the text content of an object which entirely precedes \c offset, + delimited by character, word, line, or sentence boundaries as specified by \c type. The + starting and ending offsets of the resulting substring are returned in \c startOffset + and \c endOffset. By definition, if such a substring exists, \c endOffset is less than or + equal to \c offset. + @param offset the offset from which the substring search begins. + @param type the text-boundary delimiter which determines whether the returned text constitures + a character, word, line, or sentence (and possibly attendant whitespace), + and whether the start or ending of such a substring forms the boundary condition. + @param startOffset back-filled with the starting offset of the resulting substring, if one exists. + @param endOffset back-filled with the offset of the character immediately following the resulting + substring, if one exists. + @see TEXT_BOUNDARY_TYPE

+
+ + + + + + + a string which is a substring of the text content of the object, delimited by thespecified boundary condition. + + +
+ + +

Obtain a subset of the text content of an object which includes the specified \c offset, + delimited by character, word, line, or sentence boundaries as specified by \c type. The + starting and ending offsets of the resulting substring are returned in \c startOffset + and \c endOffset. + @param offset the offset from which the substring search begins, and which must + lie within the returned substring. + @param type the text-boundary delimiter which determines whether the returned text constitures + a character, word, line, or sentence (and possibly attendant whitespace), + and whether the start or ending of such a substring forms the boundary condition. + @param startOffset back-filled with the starting offset of the resulting substring, if one exists. + @param endOffset back-filled with the offset of the character immediately following the resulting + substring, if one exists. + @see TEXT_BOUNDARY_TYPE

+
+ + + + + + + a string which is a substring of the text content of the object, delimited by thespecified boundary condition. + + +
+ + +

Obtain a subset of the text content of an object which entirely follows \c offset, + delimited by character, word, line, or sentence boundaries as specified by \c type. The + starting and ending offsets of the resulting substring are returned in \c startOffset + and \c endOffset. By definition, if such a substring exists, \c startOffset must be greater than + \c offset. + @param offset the offset from which the substring search begins, and which must + lie before the returned substring. + @param type the text-boundary delimiter which determines whether the returned text constitures + a character, word, line, or sentence (and possibly attendant whitespace), + and whether the start or ending of such a substring forms the boundary condition. + @param startOffset back-filled with the starting offset of the resulting substring, if one exists. + @param endOffset back-filled with the offset of the character immediately following the resulting + substring, if one exists. + @see TEXT_BOUNDARY_TYPE

+
+ + + + + + + a string which is a substring of the text content of the object, delimited by thespecified boundary condition. + + +
+ + +

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. + @param startOffset back-filled with the offset of the first character in the attribute run + containing the character at \c offset. + @param endOffset back-filled with the offset of the first character past the end of the + attribute run containing the character at \c offset. + @param defined back-filled with \c True if the attributeName has a defined value at \c offset, + \c False otherwise.

+
+ + + + + + + + the value of attribute (name-value pair) corresponding to "name", if defined. + + +
+ + + getAttributes is deprecated in favor of getAttributeRun. + + + + + + + the attributes at offset, as a semicolon-delimited set of colon-delimited name-value pairs. @see getAttributeRun + + + + + + Deprecated in favor of getDefaultAttributeSet. + + + + the attributes which apply to the entire text content, but which were not explicitlyspecified by the content creator.@see getDefaultAttributeSet + + + + + +

Obtain a the bounding box, as x, y, width, and height, of the character or glyph at a particular + character offset in this object's text content. The coordinate system in which the results are + reported is specified by coordType. If an onscreen glyph corresponds to multiple character offsets, + for instance if the glyph is a ligature, the bounding box reported will include the entire glyph and + therefore may apply to more than one character offset. + @param offset the character offset of the character or glyph being queried. + @param x the minimum horizontal coordinate of the bounding box of the glyph representing + the character at \c offset. + @param y the minimum vertical coordinate of the bounding box of the glyph representing + the character at \c offset. + @param width the horizontal extent of the bounding box of the glyph representing + the character at \c offset. + @param height the vertical extent of the bounding box of the glyph representing + the character at \c offset. + @param coordType If 0, the results will be reported in screen coordinates, i.e. in pixels + relative to the upper-left corner of the screen, with the x axis pointing right + and the y axis pointing down. + If 1, the results will be reported relative to the containing toplevel window, + with the x axis pointing right and the y axis pointing down.

+
+ + + + + + +
+ + +

Get the offset of the character at a given onscreen coordinate. The coordinate system used to interpret + x and y is determined by parameter coordType. + @param x + @param y + @param coordType if 0, the input coordinates are interpreted relative to the entire screen, if 1, + they are relative to the toplevel window containing this Text object.

+
+ + + + + + the text offset (as an offset into the character array) of the glyph whose onscreen bounds contain the point x,y, or -1 if the point is outside the bounds of any glyph. + + +
+ + +

Obtain the number of separate, contiguous selections in the current Text object. + Text objects which do not implement selection of discontiguous text regions will always + return '0' or '1'. Note that "contiguous" is defined by continuity of the offsets, i.e. + a text 'selection' is defined by a start/end offset pair. In the case of bidirectional text, + this means that a continguous selection may appear visually discontiguous, and vice-versa.

+
+ + + the number of contiguous selections in the current Text object. + + +
+ + +

The result of calling getSelection with an out-of-range selectionNum (i.e. for a selection + which does not exist) is not strictly defined, but should set endOffset equal to startOffset.

+
+ + + +
+ + +

The result of calling addSelection on objects which already have one selection present, and which + do not include STATE_MULTISELECTABLE, is undefined, other than the return value.

+
+ + + + + \c True of the selection was successfully added, \c False otherwise. Selection mayfail if the object does not support selection of text (see STATE_SELECTABLE_TEXT), if theobject does not support multiple selections and a selection is already defined, or for other reasons(for instance if the user does not have permission to copy the text into the relevant selection buffer). + + +
+ + +

Deselect the text contained in the specified selectionNum, if such a selection + exists, otherwise do nothing. Removal of a non-existant selectionNum has no effect.

+
+ + + + \c True if the selection was successfully removed, \c False otherwise. + + +
+ + +

Modify an existing selection's start or ending offset.

+ +

Calling setSelection for a selectionNum that is not already defined has no effect. + The result of calling setSelection with a selectionNum greater than 0 for objects that + do not include STATE_MULTISELECTABLE is undefined. + @param selectionNum indicates which of a set of non-contiguous selections to modify. + @param startOffset the new starting offset for the selection + @param endOffset the new ending offset for the selection

+
+ + + + + + \c True if the selection corresponding to selectionNum is successfully modified, \c False otherwise. + + +
+ + +

Obtain the bounding box which entirely contains a given text range. + Negative values may be returned for the bounding box parameters in the event + that all or part of the text range is offscreen or not mapped to the screen. + @param startOffset the offset of the first character in the specified range. + @param endOffset the offset of the character immediately after the last + character in the specified range. + @param x an integer parameter which is back-filled with the minimum + horizontal coordinate of the resulting bounding box. + @param y an integer parameter which is back-filled with the minimum + vertical coordinate of the resulting bounding box. + @param width an integer parameter which is back-filled with the + horizontal extent of the bounding box. + @param height an integer parameter which is back-filled with the + vertical extent of the bounding box. + @param coordType If 0, the above coordinates are reported in pixels relative to + corner of the screen; if 1, the coordinates are reported relative to the + corner of the containing toplevel window.

+
+ + + + + + + +
+ + +

Return the text content within a bounding box, + as a list of Range structures. + Depending on the TEXT_CLIP_TYPE parameters, glyphs which are clipped by the + bounding box (i.e. which lie partially inside and partially outside it) + may or may not be included in the ranges returned. + @note This method may be of particular interest to screen review algorithms. + @see TEXT_CLIP_TYPE. + @param x the minimum x ( i.e. leftmost) coordinate of the bounding box. + @param y the minimum y coordinate of the bounding box. + @param width the horizontal size of the bounding box. The rightmost bound of the bounding box + is (x + width); + @param height the vertical size of the bounding box. The maximum y value of the bounding box + is (y + height); + @param coordType If 0, the above coordinates are interpreted as pixels relative to + corner of the screen; if 1, the coordinates are interpreted as pixels relative to the + corner of the containing toplevel window. + @param xClipType determines whether text which intersects the bounding box in the x direction + is included. + @param yClipType determines whether text which intersects the bounding box in the y direction + is included.

+
+ + + + + + + + +
+ + +

Query a particular text object for the text attributes defined at a given offset, + obtaining the start and end of the "attribute run" over which these attributes are currently + invariant. Text attributes are those presentational, typographic, or semantic attributes or + qualitites which apply to a range of text specifyable by starting and ending offsets. + Attributes relevant to localization should be provided in + accordance with the w3c "Internationalization and Localization Markup Requirements", + http://www.w3.org/TR/2005/WD-itsreq-20051122/ + Other text attributes should choose their names and value semantics in accordance with relevant + standards such as CSS level 2 (http://www.w3.org/TR/1998/REC-CSS2-19980512), + XHTML 1.0 (http://www.w3.org/TR/2002/REC-xhtml1-20020801), and + WICD (http://www.w3.org/TR/2005/WD-WICD-20051121/). Those attributes from the aforementioned + specifications and recommendations which do not concern typographic, presentational, or + semantic aspects of text should be exposed via the more general Accessible::getAttributes() API + (if at all).

+ +

For example, CSS attributes which should be exposed on text (either as default attributes, or + as explicitly-set attributes when non-default values are specified in the content view) include + the Font attributes (i.e. "css2:font-weight", "css2:font-style"), + the "css2:color" and "css2:background-color" attributes, and "css2:text-decoration" attribute.

+ +

If includeDefaults is TRUE, then this AttributeSet should include the default + attributes as well as those which are explicitly assigned to the attribute run in question. + startOffset and endOffset will be back-filled to indicate the start and end of the attribute run + which contains 'offset' - an attribute run is a contiguous section of text whose attributes are + homogeneous. + @param offset the offset of the character whose attributes will be reported. + @param startOffset backfilled with the starting offset of the character range over which all + text attributes match those of \c offset, i.e. the start of the homogeneous + attribute run including \c offset. + @param endOffset backfilled with the offset of the first character past the character range over which all + text attributes match those of \c offset, i.e. the character immediately after + the homogeneous attribute run including \c offset. + @param includeDefaults if False, the call should only return those attributes which are + explicitly set on the current attribute run, omitting any attributes which are inherited from + the default values. See also Text::getDefaultAttributes.

+ +

@note Clients seeking annotations or properties of a more general nature, which + are not specific to the onscreen textual content of objects and cannot logically be applied + to specific character offset ranges, + should use Accessible::getAttributes instead. + The attributes returned by Text::getAttributeRun (with or without 'default attributes'), + are distinct from the properties/attributes returned by Accessible::getAttributes.

+ +

@see Accessible::getAttributes

+
+ + + + + + + the AttributeSet defined at offset, optionally including the 'default' attributes. @since AT-SPI 1.7.0 + + +
+ + +

Return an ::AttributeSet containing the text attributes which apply to all text in the object + by virtue of the default settings of the document, view, or user agent; e.g. those + attributes which are implied rather than explicitly applied to the text object. + For instance, an object whose entire text content has been explicitly marked as 'bold' will + report the 'bold' attribute via getAttributeRun(), whereas an object whose text weight is + inspecified may report the default or implied text weight in the default AttributeSet.

+ +

@since AT-SPI 1.7.0

+
+ +
+ + +

\cond + unImplemented:

+ +

placeholders for future expansion.

+
+
+ + +
+
diff --git a/xml/Accessibility_Value.xml b/xml/Accessibility_Value.xml new file mode 100644 index 0000000..aac2378 --- /dev/null +++ b/xml/Accessibility_Value.xml @@ -0,0 +1,70 @@ + + +AT-SPI - Assistive Technology Service Provider Interface +Copyright 2008 Novell, Inc. +Copyright 2001 Sun Microsystems, 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.

+
+ + +

An interface supporting controls which allow a + one-dimensional, scalar quantity to be modified or which + reflect a scalar quantity. (If STATE_EDITABLE is not present, + the valuator is treated as "read only".

+ +

@note Events generated by Image instances include: + \li \c "object:value-changed"

+
+ + + The minimum value allowed by this valuator. + + + + + The maximum value allowed by this valuator. + + + + +

The smallest incremental change which this valuator allows. + If 0, the incremental changes to the valuator are + limited only by the precision of a double precision value + on the platform.

+
+
+ + + The current value of the valuator. + + + + +

\cond + unImplemented:

+ +

placeholders for future expansion.

+
+
+ + + + + + +
+
diff --git a/xml/Makefile.am b/xml/Makefile.am new file mode 100644 index 0000000..d562661 --- /dev/null +++ b/xml/Makefile.am @@ -0,0 +1,27 @@ +XML= \ + Accessibility.xml \ + Accessibility_Accessible.xml \ + Accessibility_Action.xml \ + Accessibility_Application.xml \ + Accessibility_Component.xml \ + Accessibility_Document.xml \ + Accessibility_EditableText.xml \ + Accessibility_Event.xml \ + Accessibility_Hyperlink.xml \ + Accessibility_Hypertext.xml \ + Accessibility_Image.xml \ + Accessibility_LoginHelper.xml \ + Accessibility_Registry.xml \ + Accessibility_Selection.xml \ + Accessibility_Selector.xml \ + Accessibility_StreamableContent.xml \ + Accessibility_Table.xml \ + Accessibility_Text.xml \ + Accessibility_Value.xml + +spec.xml: $(XML) + xsltproc --xinclude ../tools/identity.xsl $< >$@ + +EXTRA_DIST = $(XML) + +BUILT_SOURCES = spec.xml -- 2.7.4