summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Doffman <mdoff@altair-voyager.(none)>2009-06-11 15:26:42 +0100
committerMark Doffman <mdoff@altair-voyager.(none)>2009-06-11 15:26:42 +0100
commita41d247913d13949f259e89e4222753643af04aa (patch)
tree8d6b4bf19f172c2dc70f5bbeef3518472bc20113
parent36a4131a9cc9fc8d474058d2a9448bc9eac91f17 (diff)
downloadat-spi2-core-a41d247913d13949f259e89e4222753643af04aa.tar.gz
2009-06-11 Mark Doffman <mark.doffman@codethink.co.uk>
Remove the atk-bridge library as well as the client libaries pyatspi and cspi. Beginning commit in splitting the project into two repositories The atk and client code will be located in at-spi2-atk.
-rw-r--r--INSTALL5
-rw-r--r--Makefile.am8
-rw-r--r--atk-adaptor/Makefile.am45
-rw-r--r--atk-adaptor/accessible-adaptor.c577
-rw-r--r--atk-adaptor/accessible-marshaller.c316
-rw-r--r--atk-adaptor/accessible-marshaller.h44
-rw-r--r--atk-adaptor/accessible-register.c687
-rw-r--r--atk-adaptor/accessible-register.h49
-rw-r--r--atk-adaptor/action-adaptor.c204
-rw-r--r--atk-adaptor/adaptors.h48
-rw-r--r--atk-adaptor/application-adaptor.c120
-rw-r--r--atk-adaptor/bridge.c336
-rw-r--r--atk-adaptor/bridge.h42
-rw-r--r--atk-adaptor/collection-adaptor.c1033
-rw-r--r--atk-adaptor/component-adaptor.c310
-rw-r--r--atk-adaptor/document-adaptor.c123
-rw-r--r--atk-adaptor/editabletext-adaptor.c219
-rw-r--r--atk-adaptor/event.c810
-rw-r--r--atk-adaptor/event.h34
-rw-r--r--atk-adaptor/hyperlink-adaptor.c150
-rw-r--r--atk-adaptor/hypertext-adaptor.c112
-rw-r--r--atk-adaptor/image-adaptor.c145
-rw-r--r--atk-adaptor/relation-adaptor.c169
-rw-r--r--atk-adaptor/selection-adaptor.c261
-rw-r--r--atk-adaptor/streamablecontent-adaptor.c316
-rw-r--r--atk-adaptor/table-adaptor.c692
-rw-r--r--atk-adaptor/text-adaptor.c840
-rw-r--r--atk-adaptor/tree-adaptor.c141
-rw-r--r--atk-adaptor/tree-adaptor.h37
-rw-r--r--atk-adaptor/value-adaptor.c182
-rw-r--r--configure.ac67
-rw-r--r--cspi-1.0-uninstalled.pc.in8
-rw-r--r--cspi-1.0.pc.in11
-rw-r--r--cspi/Makefile.am42
-rw-r--r--cspi/cspi-lowlevel.h89
-rw-r--r--cspi/spi-accessible.c1462
-rw-r--r--cspi/spi-action.c190
-rw-r--r--cspi/spi-application.c208
-rw-r--r--cspi/spi-component.c346
-rw-r--r--cspi/spi-editabletext.c264
-rw-r--r--cspi/spi-event.c1262
-rw-r--r--cspi/spi-hyperlink.c180
-rw-r--r--cspi/spi-hypertext.c138
-rw-r--r--cspi/spi-image.c199
-rw-r--r--cspi/spi-impl.h100
-rw-r--r--cspi/spi-listener.c406
-rw-r--r--cspi/spi-listener.h220
-rw-r--r--cspi/spi-main.c1108
-rw-r--r--cspi/spi-private.h119
-rw-r--r--cspi/spi-registry.c422
-rw-r--r--cspi/spi-roletypes.h273
-rw-r--r--cspi/spi-selection.c274
-rw-r--r--cspi/spi-statetypes.h127
-rw-r--r--cspi/spi-streamablecontent.c429
-rw-r--r--cspi/spi-table.c815
-rw-r--r--cspi/spi-text.c967
-rw-r--r--cspi/spi-value.c162
-rw-r--r--cspi/spi.h1232
-rw-r--r--dbind/dbind-config.h.in (renamed from dbind-config.h.in)0
-rw-r--r--libloginhelper-1.0.pc.in11
-rw-r--r--login-helper/Makefile.am22
-rw-r--r--login-helper/login-helper.c159
-rw-r--r--login-helper/login-helper.h78
-rw-r--r--pyatspi/Accessibility.py41
-rw-r--r--pyatspi/Makefile.am35
-rw-r--r--pyatspi/__init__.py30
-rw-r--r--pyatspi/accessible.py283
-rw-r--r--pyatspi/accessiblecache.py196
-rw-r--r--pyatspi/action.py111
-rw-r--r--pyatspi/application.py68
-rw-r--r--pyatspi/applicationcache.py248
-rw-r--r--pyatspi/base.py203
-rw-r--r--pyatspi/collection.py110
-rw-r--r--pyatspi/component.py189
-rw-r--r--pyatspi/constants.py144
-rw-r--r--pyatspi/desktop.py364
-rw-r--r--pyatspi/deviceevent.py549
-rw-r--r--pyatspi/document.py74
-rw-r--r--pyatspi/editabletext.py124
-rw-r--r--pyatspi/event.py262
-rw-r--r--pyatspi/factory.py28
-rw-r--r--pyatspi/hyperlink.py109
-rw-r--r--pyatspi/hypertext.py71
-rw-r--r--pyatspi/image.py110
-rw-r--r--pyatspi/interfaces.py40
-rw-r--r--pyatspi/loginhelper.py147
-rw-r--r--pyatspi/registry.py482
-rw-r--r--pyatspi/relation.py137
-rw-r--r--pyatspi/role.py297
-rw-r--r--pyatspi/selection.py136
-rw-r--r--pyatspi/state.py256
-rw-r--r--pyatspi/table.py376
-rw-r--r--pyatspi/text.py592
-rw-r--r--pyatspi/utils.py331
-rw-r--r--pyatspi/value.py74
-rw-r--r--spi-common/Makefile.am7
-rw-r--r--tests/Makefile.am11
-rw-r--r--tests/apps/Makefile.am47
-rw-r--r--tests/apps/accessible-app.c57
-rw-r--r--tests/apps/action-app.c29
-rw-r--r--tests/apps/atk-object-xml-loader.c95
-rw-r--r--tests/apps/atk-object-xml-loader.h29
-rw-r--r--tests/apps/component-app.c55
-rw-r--r--tests/apps/noop-app.c26
-rw-r--r--tests/apps/relation-app.c90
-rw-r--r--tests/apps/test-application.c286
-rw-r--r--tests/cspi/Makefile.am18
-rw-r--r--tests/cspi/accessible-test.c37
-rw-r--r--tests/cspi/classy-test-suite.c211
-rw-r--r--tests/cspi/classy-test-suite.h76
-rw-r--r--tests/cspi/classy-test.c145
-rw-r--r--tests/cspi/classy-test.h99
-rw-r--r--tests/cspi/key-listener-test.c201
-rw-r--r--tests/cspi/keysynth-test.c65
-rw-r--r--tests/cspi/simple-at.c615
-rw-r--r--tests/cspi/simple-test.c46
-rw-r--r--tests/cspi/test-simple.c816
-rw-r--r--tests/data/Makefile.am3
-rw-r--r--tests/data/accessible-test-results.xml136
-rw-r--r--tests/data/accessible-test.xml136
-rw-r--r--tests/dummyatk/Makefile.am38
-rw-r--r--tests/dummyatk/my-atk-action.c222
-rw-r--r--tests/dummyatk/my-atk-action.h58
-rw-r--r--tests/dummyatk/my-atk-component.c403
-rw-r--r--tests/dummyatk/my-atk-component.h41
-rw-r--r--tests/dummyatk/my-atk-hyperlink.c137
-rw-r--r--tests/dummyatk/my-atk-hyperlink.h35
-rw-r--r--tests/dummyatk/my-atk-hypertext.c172
-rw-r--r--tests/dummyatk/my-atk-hypertext.h33
-rw-r--r--tests/dummyatk/my-atk-object.c186
-rw-r--r--tests/dummyatk/my-atk-object.h37
-rw-r--r--tests/dummyatk/my-atk-selection.c332
-rw-r--r--tests/dummyatk/my-atk-selection.h55
-rw-r--r--tests/dummyatk/my-atk-streamable-content.c96
-rw-r--r--tests/dummyatk/my-atk-streamable-content.h35
-rw-r--r--tests/dummyatk/my-atk-table.c177
-rw-r--r--tests/dummyatk/my-atk-table.h86
-rw-r--r--tests/dummyatk/my-atk-text.c1290
-rw-r--r--tests/dummyatk/my-atk-text.h60
-rw-r--r--tests/dummyatk/my-atk-value.c113
-rw-r--r--tests/dummyatk/my-atk-value.h34
-rw-r--r--tests/dummyatk/my-atk.h14
-rw-r--r--tests/dummyatk/resources_storage.c34
-rw-r--r--tests/dummyatk/resources_storage.h16
-rw-r--r--tests/dummyatk/useful_functions.c29
-rw-r--r--tests/dummyatk/useful_functions.h30
-rw-r--r--tests/dummyatk/user_marshal.c41
-rw-r--r--tests/dummyatk/user_marshal.h60
-rw-r--r--tests/pyatspi/Makefile.am20
-rw-r--r--tests/pyatspi/accessibletest.py219
-rw-r--r--tests/pyatspi/actiontest.py73
-rw-r--r--tests/pyatspi/componenttest.py145
-rw-r--r--tests/pyatspi/desktoptest.py184
-rw-r--r--tests/pyatspi/pasytest/Events.py78
-rw-r--r--tests/pyatspi/pasytest/Makefile.am6
-rw-r--r--tests/pyatspi/pasytest/Pasy.py146
-rw-r--r--tests/pyatspi/pasytest/__init__.py16
-rw-r--r--tests/pyatspi/relationtest.py70
-rwxr-xr-xtests/pyatspi/runtests.sh12
-rw-r--r--tests/pyatspi/setvars.sh6
-rw-r--r--tests/pyatspi/statetest.py101
-rwxr-xr-xtests/pyatspi/testrunner94
-rw-r--r--tools/Makefile.am5
-rw-r--r--tools/doc-generator.xsl689
164 files changed, 19 insertions, 34707 deletions
diff --git a/INSTALL b/INSTALL
index 5bf92eed..cbe9e7b4 100644
--- a/INSTALL
+++ b/INSTALL
@@ -17,15 +17,10 @@ Requirements
pkg-config
- python
-
glib
- gtk+
- gail
dbus
dbus-glib
- dbus-python
X
XEVIE (Reccomended)
diff --git a/Makefile.am b/Makefile.am
index 3525ebe8..067574e5 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,9 +1,3 @@
-SUBDIRS=xml tools dbind droute spi-common atk-adaptor registryd cspi pyatspi login-helper tests
+SUBDIRS=xml tools dbind droute spi-common registryd
pkgconfigdir = $(libdir)/pkgconfig
-pkgconfig_DATA = cspi-1.0.pc libloginhelper-1.0.pc
-
-EXTRA_DIST = \
- cspi-1.0.pc.in \
- cspi-1.0-uninstalled.pc.in \
- libloginhelper-1.0.pc.in
diff --git a/atk-adaptor/Makefile.am b/atk-adaptor/Makefile.am
deleted file mode 100644
index 2ae7a749..00000000
--- a/atk-adaptor/Makefile.am
+++ /dev/null
@@ -1,45 +0,0 @@
-gtkmoduledir = $(libdir)/$(GTK_MODULE_DIR)
-gtkmodule_LTLIBRARIES = libspiatk.la
-
-libspiatk_la_CFLAGS = $(DBUS_GLIB_CFLAGS)\
- $(ATK_CFLAGS)\
- -I$(top_srcdir)\
- -I$(top_srcdir)/atk-adaptor/adaptors\
- -DATSPI_INTROSPECTION_PATH=\"$(pkgdatadir)/$(DEFAULT_ATSPI_INTROSPECTION_PATH)\"
-
-libspiatk_la_LDFLAGS = -no-undefined \
- -module \
- -avoid-version \
- -rpath $(gtkmoduledir)
-
-libspiatk_la_LIBADD = $(DBUS_GLIB_LIBS) \
- $(ATK_LIBS) \
- $(top_builddir)/droute/libdroute.la\
- $(top_builddir)/spi-common/libspicommon.la
-
-libspiatk_la_SOURCES = \
- accessible-adaptor.c \
- accessible-marshaller.c \
- accessible-marshaller.h \
- accessible-register.c \
- accessible-register.h \
- action-adaptor.c \
- adaptors.h \
- application-adaptor.c \
- bridge.c \
- bridge.h \
- collection-adaptor.c \
- component-adaptor.c \
- document-adaptor.c \
- editabletext-adaptor.c \
- event.c \
- event.h \
- hyperlink-adaptor.c \
- hypertext-adaptor.c \
- image-adaptor.c \
- selection-adaptor.c \
- table-adaptor.c \
- text-adaptor.c \
- tree-adaptor.c \
- tree-adaptor.h \
- value-adaptor.c
diff --git a/atk-adaptor/accessible-adaptor.c b/atk-adaptor/accessible-adaptor.c
deleted file mode 100644
index 5029acc4..00000000
--- a/atk-adaptor/accessible-adaptor.c
+++ /dev/null
@@ -1,577 +0,0 @@
-/*
- * 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.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#include <atk/atk.h>
-#include <droute/droute.h>
-
-#include "spi-common/spi-dbus.h"
-#include "accessible-marshaller.h"
-#include "accessible-register.h"
-
-static dbus_bool_t
-impl_get_name (DBusMessageIter *iter, void *user_data)
-{
- AtkObject *object = (AtkObject *) user_data;
-
- g_return_val_if_fail (ATK_IS_OBJECT (user_data), FALSE);
-
- return droute_return_v_string (iter, atk_object_get_name (object));
-}
-
-static dbus_bool_t
-impl_set_name (DBusMessageIter *iter, void *user_data)
-{
- AtkObject *object = (AtkObject *) user_data;
- const char *name = droute_get_v_string (iter);
-
- g_return_val_if_fail (ATK_IS_OBJECT (user_data), FALSE);
-
- atk_object_set_name (object, name);
- return TRUE;
-}
-
-static dbus_bool_t
-impl_get_description (DBusMessageIter *iter, void *user_data)
-{
- AtkObject *object = (AtkObject *) user_data;
-
- g_return_val_if_fail (ATK_IS_OBJECT (user_data), FALSE);
-
- return droute_return_v_string (iter, atk_object_get_description (object));
-}
-
-static dbus_bool_t
-impl_set_description (DBusMessageIter *iter, void *user_data)
-{
- AtkObject *object = (AtkObject *) user_data;
- const char *description = droute_get_v_string (iter);
-
- g_return_val_if_fail (ATK_IS_OBJECT (user_data), FALSE);
-
- atk_object_set_description (object, description);
- return TRUE;
-}
-
-static dbus_bool_t
-impl_get_parent (DBusMessageIter *iter, void *user_data)
-{
- AtkObject *object = (AtkObject *) user_data;
-
- g_return_val_if_fail (ATK_IS_OBJECT (user_data), FALSE);
-
- return spi_dbus_return_v_object (iter,
- atk_object_get_parent (object),
- FALSE);
-}
-
-static dbus_bool_t
-impl_get_childCount (DBusMessageIter *iter, void *user_data)
-{
- AtkObject *object = (AtkObject *) user_data;
-
- g_return_val_if_fail (ATK_IS_OBJECT (user_data), FALSE);
-
- return droute_return_v_int32 (iter,
- atk_object_get_n_accessible_children
- (object));
-}
-
-static DBusMessage *
-impl_getChildAtIndex (DBusConnection *bus,
- DBusMessage *message,
- void *user_data)
-{
- AtkObject *object = (AtkObject *) user_data;
- DBusError error;
- dbus_int32_t i;
- AtkObject *child;
-
- dbus_error_init (&error);
- g_return_val_if_fail (ATK_IS_OBJECT (user_data),
- droute_not_yet_handled_error (message));
- if (!dbus_message_get_args (message, &error, DBUS_TYPE_INT32, &i, DBUS_TYPE_INVALID))
- return spi_dbus_general_error (message);
- child = atk_object_ref_accessible_child (object, i);
- return spi_dbus_return_object (message, child, FALSE);
-}
-
-static DBusMessage *
-impl_getChildren (DBusConnection *bus,
- DBusMessage *message,
- void *user_data)
-{
- AtkObject *object = (AtkObject *) user_data;
- gint i;
- gint count;
- DBusMessage *reply;
- DBusMessageIter iter, iter_array;
-
- g_return_val_if_fail (ATK_IS_OBJECT (user_data),
- droute_not_yet_handled_error (message));
- count = atk_object_get_n_accessible_children (object);
- reply = dbus_message_new_method_return (message);
- if (!reply) goto oom;
- 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 = atk_dbus_object_to_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;
-}
-
-static DBusMessage *
-impl_getIndexInParent (DBusConnection *bus,
- DBusMessage *message,
- void *user_data)
-{
- AtkObject *object = (AtkObject *) user_data;
- dbus_uint32_t rv;
- DBusMessage *reply;
-
- g_return_val_if_fail (ATK_IS_OBJECT (user_data),
- droute_not_yet_handled_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;
-}
-
-static gboolean
-spi_init_relation_type_table (Accessibility_RelationType *types)
-{
- gint i;
-
- for (i = 0; i < ATK_RELATION_LAST_DEFINED; i++)
- types[i] = Accessibility_RELATION_NULL;
-
- types[ATK_RELATION_CONTROLLED_BY] = Accessibility_RELATION_CONTROLLED_BY;
- types[ATK_RELATION_CONTROLLER_FOR] = Accessibility_RELATION_CONTROLLER_FOR;
- types[ATK_RELATION_LABEL_FOR] = Accessibility_RELATION_LABEL_FOR;
- types[ATK_RELATION_LABELLED_BY] = Accessibility_RELATION_LABELLED_BY;
- types[ATK_RELATION_MEMBER_OF] = Accessibility_RELATION_MEMBER_OF;
- types[ATK_RELATION_NODE_CHILD_OF] = Accessibility_RELATION_NODE_CHILD_OF;
- types[ATK_RELATION_FLOWS_TO] = Accessibility_RELATION_FLOWS_TO;
- types[ATK_RELATION_FLOWS_FROM] = Accessibility_RELATION_FLOWS_FROM;
- types[ATK_RELATION_SUBWINDOW_OF] = Accessibility_RELATION_SUBWINDOW_OF;
- types[ATK_RELATION_EMBEDS] = Accessibility_RELATION_EMBEDS;
- types[ATK_RELATION_EMBEDDED_BY] = Accessibility_RELATION_EMBEDDED_BY;
- types[ATK_RELATION_POPUP_FOR] = Accessibility_RELATION_POPUP_FOR;
- types[ATK_RELATION_PARENT_WINDOW_OF] = Accessibility_RELATION_PARENT_WINDOW_OF;
- types[ATK_RELATION_DESCRIPTION_FOR] = Accessibility_RELATION_DESCRIPTION_FOR;
- types[ATK_RELATION_DESCRIBED_BY] = Accessibility_RELATION_DESCRIBED_BY;
-
- return TRUE;
-}
-
-static Accessibility_RelationType
-spi_relation_type_from_atk_relation_type (AtkRelationType type)
-{
- static gboolean is_initialized = FALSE;
- static Accessibility_RelationType spi_relation_type_table [ATK_RELATION_LAST_DEFINED];
- Accessibility_RelationType spi_type;
-
- if (!is_initialized)
- is_initialized = spi_init_relation_type_table (spi_relation_type_table);
-
- if (type > ATK_RELATION_NULL && type < ATK_RELATION_LAST_DEFINED)
- spi_type = spi_relation_type_table[type];
- else
- spi_type = Accessibility_RELATION_EXTENDED;
- return spi_type;
-}
-
-static DBusMessage *
-impl_getRelationSet (DBusConnection *bus,
- DBusMessage *message,
- void *user_data)
-{
- AtkObject *object = (AtkObject *) user_data;
- DBusMessage *reply;
- AtkRelationSet *set;
- DBusMessageIter iter, iter_array, iter_struct, iter_targets;
- gint count;
- gint i, j;
-
- g_return_val_if_fail (ATK_IS_OBJECT (user_data),
- droute_not_yet_handled_error (message));
- reply = dbus_message_new_method_return (message);
- if (!reply) return NULL;
- set = atk_object_ref_relation_set (object);
- dbus_message_iter_init_append (reply, &iter);
- if (!dbus_message_iter_open_container (&iter, DBUS_TYPE_ARRAY, "(uao)", &iter_array))
- {
- goto oom;
- }
- count = atk_relation_set_get_n_relations (set);
- for (i = 0; i < count; i++)
- {
- AtkRelation *r = atk_relation_set_get_relation (set, i);
- AtkRelationType rt;
- GPtrArray *target;
- dbus_uint32_t type;
- if (!r) continue;
- rt= atk_relation_get_relation_type (r);
- type = spi_relation_type_from_atk_relation_type (rt);
- target = atk_relation_get_target (r);
- if (!dbus_message_iter_open_container (&iter_array, DBUS_TYPE_STRUCT, NULL, &iter_struct))
- {
- goto oom;
- }
- dbus_message_iter_append_basic (&iter_struct, DBUS_TYPE_UINT32, &type);
- if (!dbus_message_iter_open_container (&iter_struct, DBUS_TYPE_ARRAY, "o", &iter_targets))
- {
- goto oom;
- }
- for (j = 0; j < target->len; j++)
- {
- AtkObject *obj = target->pdata[j];
- char *path;
- if (!obj) continue;
- path = atk_dbus_object_to_path (obj);
- dbus_message_iter_append_basic (&iter_targets, DBUS_TYPE_OBJECT_PATH, &path);
- }
- dbus_message_iter_close_container (&iter_struct, &iter_targets);
- dbus_message_iter_close_container (&iter_array, &iter_struct);
- }
- dbus_message_iter_close_container (&iter, &iter_array);
-oom:
- // TODO: handle out of memory */
- return reply;
-}
-
-static gboolean
-spi_init_role_lookup_table (Accessibility_Role * role_table)
-{
- 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;
-}
-
-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 (!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;
-}
-
-static DBusMessage *
-impl_getRole (DBusConnection *bus, DBusMessage *message, void *user_data)
-{
- AtkObject *object = (AtkObject *) user_data;
- gint role;
- dbus_uint32_t rv;
- DBusMessage *reply;
-
- g_return_val_if_fail (ATK_IS_OBJECT (user_data),
- droute_not_yet_handled_error (message));
- role = atk_object_get_role (object);
- 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;
-}
-
-static char *
-impl_get_role_str (void *datum)
-{
- g_return_val_if_fail (ATK_IS_OBJECT (datum), g_strdup (""));
- return g_strdup_printf ("%d",
- spi_accessible_role_from_atk_role
- (atk_object_get_role ((AtkObject *) datum)));
-}
-
-static DBusMessage *
-impl_getRoleName (DBusConnection *bus,
- DBusMessage *message,
- void *user_data)
-{
- AtkObject *object = (AtkObject *) user_data;
- gint role;
- const char *role_name;
- DBusMessage *reply;
-
- g_return_val_if_fail (ATK_IS_OBJECT (user_data),
- droute_not_yet_handled_error (message));
- role = atk_object_get_role (object);
- role_name = atk_role_get_name (role);
- 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 DBusMessage *
-impl_getLocalizedRoleName (DBusConnection *bus,
- DBusMessage *message,
- void *user_data)
-{
- AtkObject *object = (AtkObject *) user_data;
- gint role;
- const char *role_name;
- DBusMessage *reply;
-
- g_return_val_if_fail (ATK_IS_OBJECT (user_data),
- droute_not_yet_handled_error (message));
- role = atk_object_get_role (object);
- role_name = atk_role_get_localized_name (role);
- 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 DBusMessage *
-impl_getState (DBusConnection *bus,
- DBusMessage *message,
- void *user_data)
-{
- AtkObject *object = (AtkObject *) user_data;
- dbus_uint32_t rv[2];
- dbus_uint32_t *array = rv;
- DBusMessage *reply;
-
- g_return_val_if_fail (ATK_IS_OBJECT (user_data),
- droute_not_yet_handled_error (message));
- spi_atk_state_to_dbus_array (object, rv);
- reply = dbus_message_new_method_return (message);
- if (reply)
- {
- dbus_message_append_args (reply, DBUS_TYPE_ARRAY, DBUS_TYPE_UINT32, &array,
- 2, DBUS_TYPE_INVALID);
- }
- return reply;
-}
-
-static DBusMessage *
-impl_getAttributes (DBusConnection *bus,
- DBusMessage *message,
- void *user_data)
-{
- AtkObject *object = (AtkObject *) user_data;
- DBusMessage *reply;
-
- AtkAttributeSet *attributes;
- DBusMessageIter iter;
-
- g_return_val_if_fail (ATK_IS_OBJECT (user_data),
- droute_not_yet_handled_error (message));
-
- attributes = atk_object_get_attributes (object);
-
- reply = dbus_message_new_method_return (message);
- dbus_message_iter_init_append (reply, &iter);
- spi_atk_append_attribute_set (&iter, attributes);
-
- if (attributes)
- atk_attribute_set_free (attributes);
-
- return reply;
-}
-
-static DBusMessage *
-impl_getApplication (DBusConnection *bus,
- DBusMessage *message,
- void *user_data)
-{
- AtkObject *root = atk_get_root ();
- return spi_dbus_return_object (message, root, FALSE);
-}
-
-static DRouteMethod methods[] = {
- {impl_getChildAtIndex, "getChildAtIndex"},
- {impl_getChildren, "getChildren"},
- {impl_getIndexInParent, "getIndexInParent"},
- {impl_getRelationSet, "getRelationSet"},
- {impl_getRole, "getRole"},
- {impl_getRoleName, "getRoleName"},
- {impl_getLocalizedRoleName, "getLocalizedRoleName"},
- {impl_getState, "getState"},
- {impl_getAttributes, "getAttributes"},
- {impl_getApplication, "getApplication"},
- {NULL, NULL}
-};
-
-static DRouteProperty properties[] = {
- {impl_get_name, impl_set_name, "name"},
- {impl_get_description, impl_set_description, "description"},
- {impl_get_parent, NULL, "parent"},
- {impl_get_childCount, NULL, "childCount"},
- {NULL, NULL, NULL}
-};
-
-void
-spi_initialize_accessible (DRoutePath *path)
-{
- droute_path_add_interface (path,
- SPI_DBUS_INTERFACE_ACCESSIBLE,
- methods,
- properties);
-};
diff --git a/atk-adaptor/accessible-marshaller.c b/atk-adaptor/accessible-marshaller.c
deleted file mode 100644
index d8d069fb..00000000
--- a/atk-adaptor/accessible-marshaller.c
+++ /dev/null
@@ -1,316 +0,0 @@
-/*
- * AT-SPI - Assistive Technology Service Provider Interface
- * (Gnome Accessibility Project; http://developer.gnome.org/projects/gap)
- *
- * Copyright 2008 Novell, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#include "spi-common/spi-dbus.h"
-
-#include "accessible-register.h"
-#include "accessible-marshaller.h"
-
-/*---------------------------------------------------------------------------*/
-
-/*
- * Marshals the D-Bus path of an AtkObject into a D-Bus message.
- *
- * Unrefs the AtkObject if unref is true.
- */
-DBusMessage *
-spi_dbus_return_object (DBusMessage *message, AtkObject *obj, gboolean unref)
-{
- DBusMessage *reply;
- gchar *path;
-
- path = atk_dbus_object_to_path (obj);
-
- if (obj && unref)
- g_object_unref (obj);
-
- if (!path)
- path = g_strdup (SPI_DBUS_PATH_NULL);
-
- reply = dbus_message_new_method_return (message);
- if (reply)
- {
- dbus_message_append_args (reply, DBUS_TYPE_OBJECT_PATH, &path,
- DBUS_TYPE_INVALID);
- }
-
- g_free (path);
-
- return reply;
-}
-
-/*---------------------------------------------------------------------------*/
-
-/*
- * Marshals a variant containing the D-Bus path of an AtkObject into a D-Bus
- * message.
- *
- * Unrefs the object if unref is true.
- */
-dbus_bool_t
-spi_dbus_return_v_object (DBusMessageIter *iter, AtkObject *obj, int unref)
-{
- char *path;
-
- path = atk_dbus_object_to_path (obj);
-
- if (unref)
- g_object_unref (obj);
-
- return droute_return_v_object (iter, path);
-}
-
-/*---------------------------------------------------------------------------*/
-
-static void
-append_atk_object_interfaces (AtkObject *object, DBusMessageIter *iter)
-{
- const gchar *itf;
-
- itf = SPI_DBUS_INTERFACE_ACCESSIBLE;
- dbus_message_iter_append_basic (iter, DBUS_TYPE_STRING, &itf);
-
- if (ATK_IS_ACTION (object))
- {
- itf = SPI_DBUS_INTERFACE_ACTION;
- dbus_message_iter_append_basic (iter, DBUS_TYPE_STRING, &itf);
- }
-
- if (ATK_IS_COMPONENT (object))
- {
- itf = SPI_DBUS_INTERFACE_COMPONENT;
- dbus_message_iter_append_basic (iter, DBUS_TYPE_STRING, &itf);
- }
-
- if (ATK_IS_EDITABLE_TEXT (object))
- {
- itf = SPI_DBUS_INTERFACE_EDITABLE_TEXT;
- dbus_message_iter_append_basic (iter, DBUS_TYPE_STRING, &itf);
- }
-
- if (ATK_IS_TEXT (object))
- {
- itf = SPI_DBUS_INTERFACE_TEXT;
- dbus_message_iter_append_basic (iter, DBUS_TYPE_STRING, &itf);
- }
-
- if (ATK_IS_HYPERTEXT (object))
- {
- itf = SPI_DBUS_INTERFACE_HYPERTEXT;
- dbus_message_iter_append_basic (iter, DBUS_TYPE_STRING, &itf);
- }
-
- if (ATK_IS_IMAGE (object))
- {
- itf = SPI_DBUS_INTERFACE_IMAGE;
- dbus_message_iter_append_basic (iter, DBUS_TYPE_STRING, &itf);
- }
-
- if (ATK_IS_SELECTION (object))
- {
- itf = SPI_DBUS_INTERFACE_SELECTION;
- dbus_message_iter_append_basic (iter, DBUS_TYPE_STRING, &itf);
- }
-
- if (ATK_IS_TABLE (object))
- {
- itf = SPI_DBUS_INTERFACE_TABLE;
- dbus_message_iter_append_basic (iter, DBUS_TYPE_STRING, &itf);
- }
-
- if (ATK_IS_VALUE (object))
- {
- itf = SPI_DBUS_INTERFACE_VALUE;
- dbus_message_iter_append_basic (iter, DBUS_TYPE_STRING, &itf);
- }
-
- if (ATK_IS_STREAMABLE_CONTENT (object))
- {
- itf = "org.freedesktop.atspi.StreamableContent";
- dbus_message_iter_append_basic (iter, DBUS_TYPE_STRING, &itf);
- }
-
- if (ATK_IS_DOCUMENT (object))
- {
- itf = "org.freedesktop.atspi.Collection";
- dbus_message_iter_append_basic (iter, DBUS_TYPE_STRING, &itf);
- itf = SPI_DBUS_INTERFACE_DOCUMENT;
- dbus_message_iter_append_basic (iter, DBUS_TYPE_STRING, &itf);
- }
-
- if (ATK_IS_HYPERLINK_IMPL (object))
- {
- itf = SPI_DBUS_INTERFACE_HYPERLINK;
- dbus_message_iter_append_basic (iter, DBUS_TYPE_STRING, &itf);
- }
-}
-
-/*---------------------------------------------------------------------------*/
-
-/*
- * Marshals the given AtkObject into the provided D-Bus iterator.
- *
- * The object is marshalled including all its client side cache data.
- * The format of the structure is (ooaoassusau).
- * This is used in the updateTree signal and the getTree method
- * of the org.freedesktop.atspi.Tree interface.
- *
- * To marshal an object its parent, and all its children must already
- * be registered with D-Bus and have been given a D-Bus object path.
- */
-void
-spi_atk_append_accessible(AtkObject *obj, gpointer iter)
-{
- DBusMessageIter *iter_array;
- DBusMessageIter iter_struct, iter_sub_array;
- dbus_int32_t states [2];
- int count;
-
- const char *name, *desc;
- int i;
- dbus_uint32_t role;
- GSList *l;
-
- iter_array = (DBusMessageIter *) iter;
-
- dbus_message_iter_open_container (iter_array, DBUS_TYPE_STRUCT, NULL, &iter_struct);
- {
- AtkObject *parent;
- gchar *path, *path_parent;
-
- /* Marshall object path */
- path = atk_dbus_object_to_path (obj);
- dbus_message_iter_append_basic (&iter_struct, DBUS_TYPE_OBJECT_PATH, &path);
-
- /* Marshall parent */
- parent = atk_object_get_parent(obj);
- if (parent == NULL)
- {
- path_parent = atk_dbus_desktop_object_path ();
- }
- else
- {
- path_parent = atk_dbus_object_to_path (parent);
- if (!path_parent)
- {
- /* This should only happen if a widget is re-parented to
- * an AtkObject that has not been registered and is then
- * updated. Ideally objects would be de-registered when
- * they are removed from a registered tree object, but
- * this would invalidate a huge amount of cache when
- * re-parenting.
- */
-#if SPI_ATK_DEBUG
- g_warning ("AT-SPI: Registered accessible marshalled when parent not registered");
-#endif
- path_parent = atk_dbus_desktop_object_path ();
- }
- }
- dbus_message_iter_append_basic (&iter_struct, DBUS_TYPE_OBJECT_PATH, &path_parent);
- g_free(path_parent);
-
- /* Marshall children */
- dbus_message_iter_open_container (&iter_struct, DBUS_TYPE_ARRAY, "o", &iter_sub_array);
- {
- gint childcount, i;
-
- childcount = atk_object_get_n_accessible_children (obj);
- for (i = 0; i < childcount; i++)
- {
- AtkObject *child;
- gchar *child_path;
-
- child = atk_object_ref_accessible_child (obj, i);
- child_path = atk_dbus_object_to_path (child);
- if (child_path)
- {
- dbus_message_iter_append_basic (&iter_sub_array, DBUS_TYPE_OBJECT_PATH, &child_path);
- g_free (child_path);
- }
- g_object_unref(G_OBJECT(child));
- }
- }
- dbus_message_iter_close_container (&iter_struct, &iter_sub_array);
-
- /* Marshall interfaces */
- dbus_message_iter_open_container (&iter_struct, DBUS_TYPE_ARRAY, "s", &iter_sub_array);
- append_atk_object_interfaces (obj, &iter_sub_array);
- dbus_message_iter_close_container (&iter_struct, &iter_sub_array);
-
- /* Marshall name */
- name = atk_object_get_name (obj);
- if (!name)
- name = "";
- dbus_message_iter_append_basic (&iter_struct, DBUS_TYPE_STRING, &name);
-
- /* Marshall role */
- role = spi_accessible_role_from_atk_role (atk_object_get_role (obj));
- dbus_message_iter_append_basic (&iter_struct, DBUS_TYPE_UINT32, &role);
-
- /* Marshall description */
- desc = atk_object_get_description (obj);
- if (!desc)
- desc = "";
- dbus_message_iter_append_basic (&iter_struct, DBUS_TYPE_STRING, &desc);
-
- g_free(path);
-
- /* Marshall state set */
- spi_atk_state_to_dbus_array (obj, &states);
- dbus_message_iter_open_container (&iter_struct, DBUS_TYPE_ARRAY, "u", &iter_sub_array);
- for (count = 0; count < 2; count++)
- {
- dbus_message_iter_append_basic (&iter_sub_array, DBUS_TYPE_UINT32, &states[count]);
- }
- dbus_message_iter_close_container (&iter_struct, &iter_sub_array);
- }
- dbus_message_iter_close_container (iter_array, &iter_struct);
-}
-
-void
-spi_atk_append_attribute_set (DBusMessageIter *iter, AtkAttributeSet *attr)
-{
- DBusMessageIter dictIter;
-
- dbus_message_iter_open_container (iter, DBUS_TYPE_ARRAY, "{ss}", &dictIter);
- spi_atk_append_attribute_set_inner (&dictIter, attr);
- dbus_message_iter_close_container (iter, &dictIter);
-}
-
-void
-spi_atk_append_attribute_set_inner (DBusMessageIter *iter, AtkAttributeSet *attr)
-{
- DBusMessageIter dictEntryIter;
-
- while (attr)
- {
- AtkAttribute *attribute = (AtkAttribute *) attr->data;
- dbus_message_iter_open_container (iter, DBUS_TYPE_DICT_ENTRY, NULL, &dictEntryIter);
- dbus_message_iter_append_basic (&dictEntryIter, DBUS_TYPE_STRING, &attribute->name);
- dbus_message_iter_append_basic (&dictEntryIter, DBUS_TYPE_STRING, &attribute->value);
- dbus_message_iter_close_container (iter, &dictEntryIter);
- attr = g_slist_next (attr);
- }
-}
-
-/*END------------------------------------------------------------------------*/
-
diff --git a/atk-adaptor/accessible-marshaller.h b/atk-adaptor/accessible-marshaller.h
deleted file mode 100644
index a150fe51..00000000
--- a/atk-adaptor/accessible-marshaller.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * AT-SPI - Assistive Technology Service Provider Interface
- * (Gnome Accessibility Project; http://developer.gnome.org/projects/gap)
- *
- * Copyright 2008 Novell, Inc.
- * Copyright 2008, 2009 Codethink Ltd.
- *
- * 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.
- */
-
-#ifndef ACCESSIBLE_MARSHALLER
-#define ACCESSIBLE_MARSHALLER
-
-#include <dbus/dbus.h>
-#include <atk/atk.h>
-
-DBusMessage *
-spi_dbus_return_object (DBusMessage *message, AtkObject *obj, gboolean unref);
-
-dbus_bool_t
-spi_dbus_return_v_object (DBusMessageIter *iter, AtkObject *obj, int unref);
-
-void
-spi_atk_append_accessible(AtkObject *obj, gpointer iter);
-
-void
-spi_atk_append_attribute_set (DBusMessageIter *iter, AtkAttributeSet *attr);
-
-void
-spi_atk_append_attribute_set_inner (DBusMessageIter *iter, AtkAttributeSet *attr);
-#endif /* ACCESSIBLE_MARSHALLER */
diff --git a/atk-adaptor/accessible-register.c b/atk-adaptor/accessible-register.c
deleted file mode 100644
index 1256fc17..00000000
--- a/atk-adaptor/accessible-register.c
+++ /dev/null
@@ -1,687 +0,0 @@
-/*
- * AT-SPI - Assistive Technology Service Provider Interface
- * (Gnome Accessibility Project; http://developer.gnome.org/projects/gap)
- *
- * Copyright 2008 Novell, Inc.
- * Copyright 2008, 2009 Codethink Ltd.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "bridge.h"
-#include "accessible-register.h"
-
-/*
- * This module is responsible for keeping track of all the AtkObjects in
- * the application, so that they can be accessed remotely and placed in
- * a client side cache.
- *
- * To access an AtkObject remotely we need to provide a D-Bus object
- * path for it. The D-Bus object paths used have a standard prefix
- * (SPI_ATK_OBJECT_PATH_PREFIX). Appended to this prefix is a string
- * representation of an integer reference. So to access an AtkObject
- * remotely we keep a Hashtable that maps the given reference to
- * the AtkObject pointer. An object in this hash table is said to be 'registered'.
- *
- * The architecture of AT-SPI dbus is such that AtkObjects are not
- * remotely reference counted. This means that we need to keep track of
- * object destruction. When an object is destroyed it must be 'deregistered'
- * To do this lookup we keep a dbus-id attribute on each AtkObject.
- *
- * In addition to accessing the objects remotely we must be able to update
- * the client side cache. This is done using the 'update' signal of the
- * org.freedesktop.atspi.Tree interface. The update signal should send out
- * all of the cacheable data for an Accessible object.
- *
- */
-
-/*
- * FIXME
- *
- * This code seems very brittle.
- * I would prefer changes to be made to
- * gail and the ATK interface so that all Accessible
- * objects are registered with an exporting module.
- *
- * This is the same system as Qt has with the QAccessibleBridge
- * and QAccessibleBridgePlugin. It entails some rather
- * large structural changes to ATK though:
- *
- * Removing infinite spaces (Child access no longer references child).
- * Removing lazy creation of accessible objects.
- */
-
-#define SPI_ATK_OBJECT_PATH_PREFIX "/org/freedesktop/atspi/accessible"
-#define SPI_ATK_OBJECT_PATH_DESKTOP "/root"
-
-#define SPI_ATK_PATH_PREFIX_LENGTH 33
-#define SPI_ATK_OBJECT_REFERENCE_TEMPLATE SPI_ATK_OBJECT_PATH_PREFIX "/%d"
-
-
-static GHashTable *ref2ptr = NULL; /* Used for converting a D-Bus path (Reference) to the object pointer */
-
-static guint reference_counter = 0;
-
-static GStaticRecMutex registration_mutex = G_STATIC_REC_MUTEX_INIT;
-
-/*---------------------------------------------------------------------------*/
-
-static GStaticMutex recursion_check_guard = G_STATIC_MUTEX_INIT;
-static gboolean recursion_check = FALSE;
-
-static gboolean
-recursion_check_and_set ()
-{
- gboolean ret;
- g_static_mutex_lock (&recursion_check_guard);
- ret = recursion_check;
- recursion_check = TRUE;
- g_static_mutex_unlock (&recursion_check_guard);
- return ret;
-}
-
-static void
-recursion_check_unset ()
-{
- g_static_mutex_lock (&recursion_check_guard);
- recursion_check = FALSE;
- g_static_mutex_unlock (&recursion_check_guard);
-}
-
-/*---------------------------------------------------------------------------*/
-
-/*
- * Each AtkObject must be asssigned a D-Bus path (Reference)
- *
- * This function provides an integer reference for a new
- * AtkObject.
- */
-static guint
-assign_reference(void)
-{
- reference_counter++;
- /* Reference of 0 not allowed as used as direct key in hash table */
- if (reference_counter == 0)
- reference_counter++;
- return reference_counter;
-}
-
-/*
- * Returns the reference of the object, or 0 if it is not registered.
- */
-static guint
-object_to_ref (AtkObject *accessible)
-{
- return GPOINTER_TO_INT(g_object_get_data (G_OBJECT (accessible), "dbus-id"));
-}
-
-/*
- * Converts the Accessible object reference to its D-Bus object path
- */
-gchar *
-atk_dbus_ref_to_path (guint ref)
-{
- return g_strdup_printf(SPI_ATK_OBJECT_REFERENCE_TEMPLATE, ref);
-}
-
-/*---------------------------------------------------------------------------*/
-
-/*
- * Callback for when a registered AtkObject is destroyed.
- *
- * Removes the AtkObject from the reference lookup tables, meaning
- * it is no longer exposed over D-Bus.
- */
-static void
-deregister_accessible (gpointer data, GObject *accessible)
-{
- guint ref;
- g_return_if_fail (ATK_IS_OBJECT (accessible));
-
- ref = object_to_ref (ATK_OBJECT(accessible));
- if (ref != 0)
- {
- g_hash_table_remove(ref2ptr, GINT_TO_POINTER(ref));
- }
-}
-
-/*
- * Called to register an AtkObject with AT-SPI and expose it over D-Bus.
- */
-static void
-register_accessible (AtkObject *accessible)
-{
- guint ref;
- g_return_if_fail (ATK_IS_OBJECT(accessible));
-
- ref = assign_reference();
-
- g_hash_table_insert (ref2ptr, GINT_TO_POINTER(ref), accessible);
- g_object_set_data (G_OBJECT(accessible), "dbus-id", GINT_TO_POINTER(ref));
- g_object_weak_ref(G_OBJECT(accessible), deregister_accessible, NULL);
-}
-
-/*---------------------------------------------------------------------------*/
-
-#ifdef SPI_ATK_DEBUG
-/*
- * This function checks that the ref-count of an accessible
- * is greater than 1.
- *
- * There is not currently any remote reference counting
- * in AT-SPI D-Bus so objects that are remotely owned are not
- * allowed.
- *
- * TODO Add debug wrapper
- */
-static gboolean
-non_owned_accessible (AtkObject *accessible)
-{
- if ((G_OBJECT (accessible))->ref_count <= 1)
- {
- g_warning ("AT-SPI: Child referenced that is not owned by its parent");
- return TRUE;
- }
- else
- {
- return FALSE;
- }
-}
-#endif /* SPI_ATK_DEBUG */
-
-/*---------------------------------------------------------------------------*/
-
-static gboolean
-has_manages_descendants (AtkObject *accessible)
-{
- AtkStateSet *state;
- gboolean result = FALSE;
-
- /* This is dangerous, refing the state set
- * seems to do wierd things to the tree & cause recursion
- * by modifying the tree alot.
- */
- state = atk_object_ref_state_set (accessible);
- if (atk_state_set_contains_state (state, ATK_STATE_MANAGES_DESCENDANTS))
- {
-#ifdef SPI_ATK_DEBUG
- g_warning ("AT-SPI: Object with 'Manages descendants' states not currently handled by AT-SPI");
-#endif
- result = TRUE;
- }
- g_object_unref (state);
-
- return result;
-}
-
-static void
-append_children (AtkObject *accessible, GQueue *traversal)
-{
- AtkObject *current;
- guint i;
- gint count = atk_object_get_n_accessible_children (accessible);
-
- if (count < 0) count = 0;
- for (i =0; i < count; i++)
- {
- current = atk_object_ref_accessible_child (accessible, i);
- if (current)
- {
-#ifdef SPI_ATK_DEBUG
- non_owned_accessible (current);
-#endif
- if (!has_manages_descendants (current))
- g_queue_push_tail (traversal, current);
- else
- g_object_unref (G_OBJECT (current));
- }
- }
-}
-
-/*
- * Registers a subtree of accessible objects
- * rooted at the accessible object provided.
- *
- * The leaf nodes do not have their children
- * registered. A node is considered a leaf
- * if it has the state "manages-descendants"
- * or if it has already been registered.
- */
-void
-register_subtree (AtkObject *accessible)
-{
- AtkObject *current;
- GQueue *traversal;
- GQueue *emit_update;
-
- g_return_if_fail (ATK_IS_OBJECT (accessible));
-
- traversal = g_queue_new ();
- emit_update = g_queue_new ();
-
- g_object_ref (accessible);
- g_queue_push_tail (traversal, accessible);
-
- while (!g_queue_is_empty (traversal))
- {
- current = g_queue_pop_head (traversal);
- g_queue_push_tail (emit_update, current);
- if (!object_to_ref (current))
- {
- register_accessible (current);
-#ifdef SPI_ATK_DEBUG
- g_debug ("REG - %s - %d - %s", atk_object_get_name (current),
- atk_object_get_role (current),
- atk_dbus_object_to_path (current));
-#endif
- append_children (current, traversal);
- }
- }
-
- while (!g_queue_is_empty (emit_update))
- {
- current = g_queue_pop_head (emit_update);
- spi_emit_cache_update (current, atk_adaptor_app_data->bus);
- g_object_unref (G_OBJECT (current));
- }
-
- g_queue_free (traversal);
- g_queue_free (emit_update);
-}
-
-/*---------------------------------------------------------------------------*/
-
-/*
- * Called when an already registered object is updated in such a
- * way that client side cache needs to be updated.
- */
-static void
-update_accessible (AtkObject *accessible)
-{
- guint ref = 0;
- g_return_if_fail (ATK_IS_OBJECT(accessible));
-
- ref = object_to_ref (accessible);
- if (ref)
- {
- spi_emit_cache_update (accessible, atk_adaptor_app_data->bus);
- }
-}
-
-/*---------------------------------------------------------------------------*/
-
-void
-atk_dbus_foreach_registered(GHFunc func, gpointer data)
-{
- g_hash_table_foreach(ref2ptr, func, data);
-}
-
-/*
- * Used to lookup an AtkObject from its D-Bus path.
- */
-AtkObject *
-atk_dbus_path_to_object (const char *path)
-{
- guint index;
- void *data;
-
- g_return_val_if_fail (path, NULL);
-
- if (strncmp(path, SPI_ATK_OBJECT_PATH_PREFIX, SPI_ATK_PATH_PREFIX_LENGTH) != 0)
- return NULL;
-
- path += SPI_ATK_PATH_PREFIX_LENGTH; /* Skip over the prefix */
-
- if (!g_strcmp0 (SPI_ATK_OBJECT_PATH_DESKTOP, path))
- return atk_get_root();
- if (path[0] != '/')
- return NULL;
-
- path++;
- index = atoi (path);
- data = g_hash_table_lookup (ref2ptr, GINT_TO_POINTER(index));
- if (data)
- return ATK_OBJECT (data);
- else
- return NULL;
-}
-
-/*
- * TODO WARNING HACK This function is dangerous.
- * It should only be called before sending an event on an
- * object that has not already been registered.
- */
-gchar *
-atk_dbus_object_attempt_registration (AtkObject *accessible)
-{
- guint ref;
-
- ref = object_to_ref (accessible);
- if (!ref)
- {
- /* See if the object is attached to the main tree */
- AtkObject *current, *prev = NULL;
- guint cref = 0;
-
- /* This should iterate until it hits a NULL or registered parent */
- prev = accessible;
- current = atk_object_get_parent (accessible);
- if (current)
- cref = object_to_ref (current);
- while (current && !cref)
- {
- prev = current;
- current = atk_object_get_parent (current);
- if (current)
- cref = object_to_ref (current);
- }
-
- /* A registered parent, with non-registered child, has been found */
- if (current)
- {
- register_subtree (prev);
- }
-
- /* The object SHOULD be registered now. If it isn't - I give up */
- ref = object_to_ref (accessible);
- if (ref)
- {
- return atk_dbus_ref_to_path (ref);
- }
- else
- {
-#ifdef SPI_ATK_DEBUG
- g_debug ("AT-SPI: Could not register a non-attached accessible object");
-#endif
- return NULL;
- }
- }
- else
- {
- return atk_dbus_ref_to_path (ref);
- }
-}
-
-
-/*
- * Used to lookup a D-Bus path from the AtkObject.
- */
-gchar *
-atk_dbus_object_to_path (AtkObject *accessible)
-{
- guint ref;
-
- ref = object_to_ref (accessible);
- if (!ref)
- return NULL;
- else
- return atk_dbus_ref_to_path (ref);
-}
-
-gchar *
-atk_dbus_desktop_object_path ()
-{
- return g_strdup (SPI_ATK_OBJECT_PATH_PREFIX SPI_ATK_OBJECT_PATH_DESKTOP);
-}
-
-/*---------------------------------------------------------------------------*/
-
-typedef gboolean (*TreeUpdateAction) (GSignalInvocationHint *signal_hint,
- guint n_param_values,
- const GValue *param_values,
- gpointer data,
- AtkObject *accessible);
-
-/*
- * Events are not evaluated for non-registered accessibles.
- *
- * When a property change is made on a registered accessible
- * the client side cache should be updated.
- *
- * When a parent is changed the subtree is de-registered
- * if the parent is not attached to the root accessible.
- */
-/* TODO Turn this function into a macro? */
-static gboolean
-tree_update_wrapper (GSignalInvocationHint *signal_hint,
- guint n_param_values,
- const GValue *param_values,
- gpointer data,
- TreeUpdateAction action)
-{
- AtkObject *accessible;
-
- g_static_rec_mutex_lock (&registration_mutex);
-
- /* Ensure that only registered accessibles
- * have their signals processed.
- */
- accessible = ATK_OBJECT(g_value_get_object (&param_values[0]));
- g_return_val_if_fail (ATK_IS_OBJECT (accessible), TRUE);
-
- if (object_to_ref (accessible))
- {
-#ifdef SPI_ATK_DEBUG
- if (recursion_check_and_set ())
- g_warning ("AT-SPI: Recursive use of registration module");
-
- g_debug ("AT-SPI: Tree update listener");
-#endif
- action (signal_hint, n_param_values, param_values, data, accessible);
-
- recursion_check_unset ();
- }
-
- g_static_rec_mutex_unlock (&registration_mutex);
-
- return TRUE;
-}
-
-static gboolean
-tree_update_state_action (GSignalInvocationHint *signal_hint,
- guint n_param_values,
- const GValue *param_values,
- gpointer data,
- AtkObject *accessible)
-{
- update_accessible (accessible);
- return TRUE;
-}
-
-static gboolean
-tree_update_state_listener (GSignalInvocationHint *signal_hint,
- guint n_param_values,
- const GValue *param_values,
- gpointer data)
-{
- tree_update_wrapper (signal_hint, n_param_values, param_values, data, tree_update_state_action);
- return TRUE;
-}
-
-static gboolean
-tree_update_property_action (GSignalInvocationHint *signal_hint,
- guint n_param_values,
- const GValue *param_values,
- gpointer data,
- AtkObject *accessible)
-{
- AtkPropertyValues *values;
- const gchar *pname = NULL;
-
- values = (AtkPropertyValues*) g_value_get_pointer (&param_values[1]);
- pname = values[0].property_name;
- if (strcmp (pname, "accessible-name") == 0 ||
- strcmp (pname, "accessible-description") == 0 ||
- strcmp (pname, "accessible-parent") == 0)
- {
- update_accessible (accessible);
- }
- /* Parent value us updated by child-add signal of parent object */
- return TRUE;
-}
-
-static gboolean
-tree_update_property_listener (GSignalInvocationHint *signal_hint,
- guint n_param_values,
- const GValue *param_values,
- gpointer data)
-{
- tree_update_wrapper (signal_hint, n_param_values, param_values, data, tree_update_property_action);
- return TRUE;
-}
-
-static gboolean
-tree_update_children_action (GSignalInvocationHint *signal_hint,
- guint n_param_values,
- const GValue *param_values,
- gpointer data,
- AtkObject *accessible)
-{
- const gchar *detail = NULL;
- AtkObject *child;
-
- if (has_manages_descendants (accessible)) return TRUE;
- if (signal_hint->detail)
- detail = g_quark_to_string (signal_hint->detail);
-
- if (!strcmp (detail, "add"))
- {
- gpointer child;
- int index = g_value_get_uint (param_values + 1);
- child = g_value_get_pointer (param_values + 2);
-
- if (!ATK_IS_OBJECT (child))
- {
- child = atk_object_ref_accessible_child (accessible, index);
-#ifdef SPI_ATK_DEBUG
- non_owned_accessible (child);
-#endif
- }
- register_subtree (child);
- update_accessible (accessible);
- }
- return TRUE;
-}
-
-static gboolean
-tree_update_children_listener (GSignalInvocationHint *signal_hint,
- guint n_param_values,
- const GValue *param_values,
- gpointer data)
-{
- tree_update_wrapper (signal_hint, n_param_values, param_values, data, tree_update_children_action);
- return TRUE;
-}
-
-/*---------------------------------------------------------------------------*/
-
-static void
-spi_atk_register_toplevel_added (AtkObject *accessible,
- guint index,
- AtkObject *child)
-{
- g_static_rec_mutex_lock (&registration_mutex);
-
- g_return_if_fail (ATK_IS_OBJECT (accessible));
-
- if (object_to_ref (accessible))
- {
-#ifdef SPI_ATK_DEBUG
- if (recursion_check_and_set ())
- g_warning ("AT-SPI: Recursive use of registration module");
-
- g_debug ("AT-SPI: Toplevel added listener");
-#endif
- if (!ATK_IS_OBJECT (child))
- {
- child = atk_object_ref_accessible_child (accessible, index);
-#ifdef SPI_ATK_DEBUG
- non_owned_accessible (child);
-#endif
- }
- register_subtree (child);
- update_accessible (accessible);
-
- recursion_check_unset ();
- }
-
- g_static_rec_mutex_unlock (&registration_mutex);
-}
-
-static void
-spi_atk_register_toplevel_removed (AtkObject *accessible,
- guint index,
- AtkObject *child)
-{
- g_static_rec_mutex_lock (&registration_mutex);
-
- g_return_if_fail (ATK_IS_OBJECT (accessible));
-
- if (object_to_ref (accessible))
- {
-#ifdef SPI_ATK_DEBUG
- if (recursion_check_and_set ())
- g_warning ("AT-SPI: Recursive use of registration module");
-
- g_debug ("AT-SPI: Toplevel removed listener");
-#endif
- update_accessible (accessible);
- recursion_check_unset ();
- }
-
- g_static_rec_mutex_unlock (&registration_mutex);
-}
-
-/*
- * Initializes required global data. The update and removal lists
- * and the reference lookup tables.
- *
- * Initializes all of the required D-Bus interfaces.
- */
-void
-atk_dbus_initialize (AtkObject *root)
-{
- if (!ref2ptr)
- ref2ptr = g_hash_table_new(g_direct_hash, g_direct_equal);
-
-#ifdef SPI_ATK_DEBUG
- if (g_thread_supported ())
- g_message ("AT-SPI: Threads enabled");
-
- g_debug ("AT-SPI: Initial Atk tree regisration");
-#endif
-
- register_subtree (root);
-
- atk_add_global_event_listener (tree_update_property_listener, "Gtk:AtkObject:property-change");
- atk_add_global_event_listener (tree_update_children_listener, "Gtk:AtkObject:children-changed");
- atk_add_global_event_listener (tree_update_state_listener, "Gtk:AtkObject:state-change");
-
- g_signal_connect (root,
- "children-changed::add",
- (GCallback) spi_atk_register_toplevel_added,
- NULL);
- g_signal_connect (root,
- "children-changed::remove",
- (GCallback) spi_atk_register_toplevel_removed,
- NULL);
-}
-
-/*END------------------------------------------------------------------------*/
diff --git a/atk-adaptor/accessible-register.h b/atk-adaptor/accessible-register.h
deleted file mode 100644
index b238af7a..00000000
--- a/atk-adaptor/accessible-register.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * AT-SPI - Assistive Technology Service Provider Interface
- * (Gnome Accessibility Project; http://developer.gnome.org/projects/gap)
- *
- * Copyright 2008 Novell, Inc.
- * Copyright 2008, 2009 Codethink Ltd.
- *
- * 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.
- */
-
-#ifndef ACCESSIBLE_REGISTER
-#define ACCESSIBLE_REGISTER
-
-#include <atk/atk.h>
-#include <glib.h>
-
-void
-atk_dbus_foreach_registered(GHFunc func, gpointer data);
-
-/*---------------------------------------------------------------------------*/
-
-AtkObject *
-atk_dbus_path_to_object (const char *path);
-
-gchar *
-atk_dbus_object_attempt_registration (AtkObject *accessible);
-
-gchar *
-atk_dbus_object_to_path (AtkObject *accessible);
-
-gchar *
-atk_dbus_desktop_object_path ();
-
-gchar *
-atk_dbus_ref_to_path (guint ref);
-#endif /* ACCESSIBLE_REGISTER */
diff --git a/atk-adaptor/action-adaptor.c b/atk-adaptor/action-adaptor.c
deleted file mode 100644
index b26a7688..00000000
--- a/atk-adaptor/action-adaptor.c
+++ /dev/null
@@ -1,204 +0,0 @@
-/*
- * 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.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#include <atk/atk.h>
-#include <droute/droute.h>
-
-#include "spi-common/spi-dbus.h"
-
-static dbus_bool_t
-impl_get_nActions (DBusMessageIter *iter, void *user_data)
-{
- AtkAction *action = (AtkAction *) user_data;
-
- g_return_val_if_fail (ATK_IS_ACTION (user_data), FALSE);
- return droute_return_v_int32 (iter, atk_action_get_n_actions (action));
-}
-
-static DBusMessage *
-impl_get_description (DBusConnection *bus, DBusMessage *message, void *user_data)
-{
- AtkAction *action = (AtkAction *) user_data;
- DBusError error;
- DBusMessage *reply;
- dbus_int32_t index;
- const char *desc;
-
- dbus_error_init (&error);
- g_return_val_if_fail (ATK_IS_ACTION (user_data),
- droute_not_yet_handled_error (message));
- if (!dbus_message_get_args (message, &error, DBUS_TYPE_INT32, &index, DBUS_TYPE_INVALID))
- {
- return droute_invalid_arguments_error (message);
- }
- desc = atk_action_get_description(action, index);
- if (!desc) desc = "";
- reply = dbus_message_new_method_return (message);
- if (reply)
- {
- dbus_message_append_args (reply, DBUS_TYPE_STRING, &desc, DBUS_TYPE_INVALID);
- }
- return reply;
-}
-
-static DBusMessage *
-impl_get_name (DBusConnection *bus, DBusMessage *message, void *user_data)
-{
- DBusMessage *reply;
- DBusError error;
- dbus_int32_t index;
- const char *name;
- AtkAction *action = (AtkAction *) user_data;
-
- dbus_error_init (&error);
- g_return_val_if_fail (ATK_IS_ACTION (user_data),
- droute_not_yet_handled_error (message));
- if (!dbus_message_get_args (message, &error, DBUS_TYPE_INT32, &index, DBUS_TYPE_INVALID))
- {
- return droute_invalid_arguments_error (message);
- }
- name = atk_action_get_name(action, index);
- if (!name) name = "";
- reply = dbus_message_new_method_return (message);
- if (reply)
- {
- dbus_message_append_args (reply, DBUS_TYPE_STRING, &name, DBUS_TYPE_INVALID);
- }
- return reply;
-}
-
-static DBusMessage *
-impl_get_keybinding (DBusConnection *bus, DBusMessage *message, void *user_data)
-{
- DBusMessage *reply;
- DBusError error;
- dbus_int32_t index;
- const char *kb;
- AtkAction *action = (AtkAction *) user_data;
-
- dbus_error_init (&error);
- g_return_val_if_fail (ATK_IS_ACTION (user_data),
- droute_not_yet_handled_error (message));
- if (!dbus_message_get_args (message, &error, DBUS_TYPE_INT32, &index, DBUS_TYPE_INVALID))
- {
- return droute_invalid_arguments_error (message);
- }
- kb = atk_action_get_keybinding(action, index);
- if (!kb) kb = "";
- reply = dbus_message_new_method_return (message);
- if (reply)
- {
- dbus_message_append_args (reply, DBUS_TYPE_STRING, &kb, DBUS_TYPE_INVALID);
- }
- return reply;
-}
-
-static DBusMessage *impl_getActions(DBusConnection *bus, DBusMessage *message, void *user_data)
-{
- AtkAction *action = (AtkAction *) user_data;
- DBusMessage *reply;
- gint count;
- gint i;
- DBusMessageIter iter, iter_array, iter_struct;
-
- g_return_val_if_fail (ATK_IS_ACTION (user_data),
- droute_not_yet_handled_error (message));
- count = atk_action_get_n_actions(action);
- reply = dbus_message_new_method_return (message);
- if (!reply) goto oom;
- dbus_message_iter_init_append (reply, &iter);
- if (!dbus_message_iter_open_container
- (&iter, DBUS_TYPE_ARRAY, "(sss)", &iter_array))
- goto oom;
- for (i = 0; i < count; i++)
- {
- const char *name = atk_action_get_name(action, i);
- const char *desc = atk_action_get_description(action, i);
- const char *kb = atk_action_get_keybinding(action, i);
- if (!name) name = "";
- if (!desc) desc = "";
- if (!kb) kb = "";
- if (!dbus_message_iter_open_container(&iter_array, DBUS_TYPE_STRUCT, NULL, &iter_struct)) goto oom;
- dbus_message_iter_append_basic(&iter_struct, DBUS_TYPE_STRING, &name);
- dbus_message_iter_append_basic(&iter_struct, DBUS_TYPE_STRING, &desc);
- dbus_message_iter_append_basic(&iter_struct, DBUS_TYPE_STRING, &kb);
- if (!dbus_message_iter_close_container(&iter_array, &iter_struct)) goto oom;
- }
- if (!dbus_message_iter_close_container (&iter, &iter_array))
- goto oom;
- return reply;
-oom:
- // TODO: handle out-of-memory
- return reply;
-}
-
-static DBusMessage *impl_doAction(DBusConnection *bus, DBusMessage *message, void *user_data)
-{
- AtkAction *action = (AtkAction *) user_data;
- DBusError error;
- dbus_int32_t index;
- dbus_bool_t rv;
- DBusMessage *reply;
-
- g_return_val_if_fail (ATK_IS_ACTION (user_data),
- droute_not_yet_handled_error (message));
- dbus_error_init (&error);
- if (!dbus_message_get_args
- (message, &error, DBUS_TYPE_INT32, &index, DBUS_TYPE_INVALID))
- {
- return droute_invalid_arguments_error (message);
- }
- rv = atk_action_do_action(action, index);
- reply = dbus_message_new_method_return (message);
- if (reply)
- {
- dbus_message_append_args (reply, DBUS_TYPE_BOOLEAN, &rv, DBUS_TYPE_INVALID);
- }
- return reply;
-}
-
-DRouteMethod methods[] =
-{
- { impl_get_description, "getDescription" },
- { impl_get_name, "getName" },
- { impl_get_keybinding, "getKeyBinding" },
- {impl_getActions, "getActions"},
- {impl_doAction, "doAction"},
- {NULL, NULL }
-};
-
-static DRouteProperty properties[] =
-{
- { impl_get_nActions, NULL, "nActions" },
- { NULL, NULL }
-};
-
-void
-spi_initialize_action (DRoutePath *path)
-{
- droute_path_add_interface (path,
- SPI_DBUS_INTERFACE_ACTION,
- methods,
- properties);
-};
diff --git a/atk-adaptor/adaptors.h b/atk-adaptor/adaptors.h
deleted file mode 100644
index d871a7b1..00000000
--- a/atk-adaptor/adaptors.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * AT-SPI - Assistive Technology Service Provider Interface
- * (Gnome Accessibility Project; http://developer.gnome.org/projects/gap)
- *
- * Copyright 2001, 2002 Sun Microsystems Inc.,
- * Copyright 2001, 2002 Ximian, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifndef ADAPTORS_H
-#define ADAPTORS_H
-
-#include <atk/atk.h>
-#include <droute/droute.h>
-
-Accessibility_Role spi_accessible_role_from_atk_role (AtkRole role);
-
-void spi_initialize_accessible (DRoutePath *path);
-void spi_initialize_action (DRoutePath *path);
-void spi_initialize_application (DRoutePath *path);
-void spi_initialize_collection (DRoutePath *path);
-void spi_initialize_component (DRoutePath *path);
-void spi_initialize_document (DRoutePath *path);
-void spi_initialize_editabletext (DRoutePath *path);
-void spi_initialize_hyperlink (DRoutePath *path);
-void spi_initialize_hypertext (DRoutePath *path);
-void spi_initialize_image (DRoutePath *path);
-void spi_initialize_selection (DRoutePath *path);
-void spi_initialize_table (DRoutePath *path);
-void spi_initialize_text (DRoutePath *path);
-void spi_initialize_value (DRoutePath *path);
-void spi_initialize_tree (DRoutePath *path);
-
-#endif /* ADAPTORS_H */
diff --git a/atk-adaptor/application-adaptor.c b/atk-adaptor/application-adaptor.c
deleted file mode 100644
index cf6b689e..00000000
--- a/atk-adaptor/application-adaptor.c
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
- * 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.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#include <atk/atk.h>
-#include <droute/droute.h>
-
-#include "spi-common/spi-dbus.h"
-
-static dbus_bool_t
-impl_get_toolkitName (DBusMessageIter * iter,
- void *user_data)
-{
- return droute_return_v_string (iter, atk_get_toolkit_name ());
-}
-
-static dbus_bool_t
-impl_get_version (DBusMessageIter * iter, void *user_data)
-{
- return droute_return_v_string (iter, atk_get_toolkit_version ());
-}
-
-static dbus_int32_t id;
-
-static dbus_bool_t
-impl_get_id (DBusMessageIter * iter, void *user_data)
-{
- return droute_return_v_int32 (iter, id);
-}
-
-static dbus_bool_t
-impl_set_id (DBusMessageIter * iter, void *user_data)
-{
- id = droute_get_v_int32 (iter);
- return TRUE;
-}
-
-static DBusMessage *
-impl_registerToolkitEventListener (DBusConnection * bus,
- DBusMessage * message, void *user_data)
-{
- return NULL;
-}
-
-static DBusMessage *
-impl_registerObjectEventListener (DBusConnection * bus, DBusMessage * message,
- void *user_data)
-{
- return NULL;
-}
-
-static DBusMessage *
-impl_pause (DBusConnection * bus, DBusMessage * message, void *user_data)
-{
- return NULL;
-}
-
-static DBusMessage *
-impl_resume (DBusConnection * bus, DBusMessage * message, void *user_data)
-{
- return NULL;
-}
-
-static DBusMessage *
-impl_getLocale (DBusConnection * bus, DBusMessage * message, void *user_data)
-{
- return NULL;
-}
-
-static DRouteMethod methods[] = {
- {impl_registerToolkitEventListener, "registerToolkitEventListener"},
- {impl_registerObjectEventListener, "registerObjectEventListener"},
- {impl_pause, "pause"},
- {impl_resume, "resume"},
- {impl_getLocale, "getLocale"},
- {NULL, NULL}
-};
-
-static DRouteProperty properties[] = {
- {impl_get_toolkitName, NULL, "toolkitName"},
- {impl_get_version, NULL, "version"},
- {impl_get_id, impl_set_id, "id"},
- {NULL, NULL, NULL}
-};
-
-/*static long
-obj_is_root (const char *path, void *user_data)
-{
- AtkObject *obj = atk_dbus_get_object (path);
- return (obj == atk_get_root ());
-}*/
-
-void
-spi_initialize_application (DRoutePath *path)
-{
- droute_path_add_interface (path,
- SPI_DBUS_INTERFACE_APPLICATION,
- methods,
- properties);
-};
diff --git a/atk-adaptor/bridge.c b/atk-adaptor/bridge.c
deleted file mode 100644
index eb2fa759..00000000
--- a/atk-adaptor/bridge.c
+++ /dev/null
@@ -1,336 +0,0 @@
-/*
- * AT-SPI - Assistive Technology Service Provider Interface
- * (Gnome Accessibility Project; http://developer.gnome.org/projects/gap)
- *
- * Copyright 2008, 2009 Codethink Ltd.
- * Copyright 2001, 2002, 2003 Sun Microsystems Inc.,
- * Copyright 2001, 2002, 2003 Ximian, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#include "config.h"
-#include "dbus/dbus-glib-lowlevel.h"
-
-#include <X11/Xlib.h>
-#include <X11/Xatom.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include <stdarg.h>
-#include <atk/atk.h>
-
-#include <droute/droute.h>
-
-#include "bridge.h"
-#include "event.h"
-#include "accessible-register.h"
-#include "adaptors.h"
-
-#include "spi-common/spi-dbus.h"
-
-/*
- * Provides the path for the introspection directory.
- */
-#if !defined ATSPI_INTROSPECTION_PATH
- #error "No introspection XML directory defined"
-#endif
-
-/*---------------------------------------------------------------------------*/
-
-SpiAppData *atk_adaptor_app_data = NULL;
-
-static const AtkMisc *atk_misc = NULL;
-
-/*static Display *bridge_display = NULL;*/
-
-/*---------------------------------------------------------------------------*/
-
-/*
- * Returns a 'canonicalized' value for DISPLAY,
- * with the screen number stripped off if present.
- *
- * Not currently used in D-Bus version but may be
- * useful in future if we make use of XAtom.
- */
-#if 0
-static const gchar*
-spi_display_name (void)
-{
- static const char *canonical_display_name = NULL;
- if (!canonical_display_name)
- {
- const gchar *display_env = g_getenv ("AT_SPI_DISPLAY");
- if (!display_env)
- {
- display_env = g_getenv ("DISPLAY");
- if (!display_env || !display_env[0])
- canonical_display_name = ":0";
- else
- {
- gchar *display_p, *screen_p;
- canonical_display_name = g_strdup (display_env);
- display_p = strrchr (canonical_display_name, ':');
- screen_p = strrchr (canonical_display_name, '.');
- if (screen_p && display_p && (screen_p > display_p))
- {
- *screen_p = '\0';
- }
- }
- }
- else
- {
- canonical_display_name = display_env;
- }
- }
- return canonical_display_name;
-}
-#endif
-
-/*---------------------------------------------------------------------------*/
-
-/*
- * Gets the IOR from the XDisplay.
- * Not currently used in D-Bus version, but something similar
- * may be employed in the future for accessing the registry daemon
- * bus name.
- */
-#if 0
-static gchar *
-spi_atk_bridge_get_registry_ior (void)
-{
- Atom AT_SPI_IOR;
- Atom actual_type;
- int actual_format;
- unsigned char *data = NULL;
- unsigned long nitems;
- unsigned long leftover;
- if (!bridge_display)
- bridge_display = XOpenDisplay (spi_display_name ());
-
- AT_SPI_IOR = XInternAtom (bridge_display, "AT_SPI_IOR", False);
- XGetWindowProperty(bridge_display,
- XDefaultRootWindow (bridge_display),
- AT_SPI_IOR, 0L,
- (long)BUFSIZ, False,
- (Atom) 31, &actual_type, &actual_format,
- &nitems, &leftover, &data);
- if (data == NULL)
- g_warning (_("AT_SPI_REGISTRY was not started at session startup."));
- return (gchar *) data;
-}
-#endif
-
-/*---------------------------------------------------------------------------*/
-
-static void
-register_application (SpiAppData *app)
-{
- DBusMessage *message;
- DBusMessageIter iter;
- DBusError error;
- const char *uname;
-
- dbus_error_init (&error);
-
- message = dbus_message_new_method_call (SPI_DBUS_NAME_REGISTRY,
- SPI_DBUS_PATH_REGISTRY,
- SPI_DBUS_INTERFACE_REGISTRY,
- "registerApplication");
- dbus_message_set_no_reply (message, TRUE);
-
- uname = dbus_bus_get_unique_name(app->bus);
-
- dbus_message_iter_init_append(message, &iter);
- dbus_message_iter_append_basic(&iter, DBUS_TYPE_STRING, &uname);
- dbus_connection_send (app->bus, message, NULL);
- if (message) dbus_message_unref (message);
-}
-
-/*---------------------------------------------------------------------------*/
-
-static void
-deregister_application (SpiAppData *app)
-{
- DBusMessage *message;
- DBusMessageIter iter;
- DBusError error;
- const char *uname;
-
- dbus_error_init (&error);
-
- message = dbus_message_new_method_call (SPI_DBUS_NAME_REGISTRY,
- SPI_DBUS_PATH_REGISTRY,
- SPI_DBUS_INTERFACE_REGISTRY,
- "deregisterApplication");
- dbus_message_set_no_reply (message, TRUE);
-
- uname = dbus_bus_get_unique_name(app->bus);
-
- dbus_message_iter_init_append(message, &iter);
- dbus_message_iter_append_basic(&iter, DBUS_TYPE_STRING, &uname);
- dbus_connection_send (app->bus, message, NULL);
- if (message) dbus_message_unref (message);
-}
-
-/*---------------------------------------------------------------------------*/
-
-static void
-exit_func (void)
-{
- if (!atk_adaptor_app_data)
- {
- return;
- }
-
- spi_atk_tidy_windows ();
- spi_atk_deregister_event_listeners();
- deregister_application (atk_adaptor_app_data);
-
- g_free(atk_adaptor_app_data);
- atk_adaptor_app_data = NULL;
-
- /* Not currently creating an XDisplay */
-#if 0
- if (bridge_display)
- XCloseDisplay (bridge_display);
-#endif
-}
-
-/*---------------------------------------------------------------------------*/
-
-static gchar *atspi_dbus_name;
-static gboolean atspi_no_register;
-
-static GOptionEntry atspi_option_entries[] =
-{
- {"atspi-dbus-name", 0, 0, G_OPTION_ARG_STRING, &atspi_dbus_name, "D-Bus bus name to register as", NULL},
- {"atspi-no-register", 0, 0, G_OPTION_ARG_NONE, &atspi_no_register, "Do not register with Registry Daemon", NULL},
- {NULL}
-};
-
-/*
- * spi_app_init
- *
- * The following needs to be initialized.
- *
- * - DRoute for routing message to their accessible objects.
- * - Event handlers for emmitting signals on specific ATK events.
- * - Application registration with the AT-SPI registry.
- *
- */
-static int
-adaptor_init (gint *argc, gchar **argv[])
-{
- GOptionContext *opt;
- GError *err = NULL;
- DBusError error;
- DBusConnection *bus;
- AtkObject *root;
- gchar *introspection_directory;
-
- DRoutePath *treepath, *accpath;
-
- root = atk_get_root ();
- g_return_val_if_fail (root, 0);
-
- /* Parse command line options */
- opt = g_option_context_new(NULL);
- g_option_context_add_main_entries(opt, atspi_option_entries, NULL);
- g_option_context_set_ignore_unknown_options(opt, TRUE);
- if (!g_option_context_parse(opt, argc, argv, &err))
- g_warning("AT-SPI Option parsing failed: %s\n", err->message);
-
- /* Allocate global data and do ATK initializations */
- atk_adaptor_app_data = g_new0 (SpiAppData, 1);
- atk_misc = atk_misc_get_instance ();
- atk_adaptor_app_data->root = root;
-
- /* Set up D-Bus connection and register bus name */
- dbus_error_init (&error);
- atk_adaptor_app_data->bus = dbus_bus_get (DBUS_BUS_SESSION, &error);
- if (!atk_adaptor_app_data->bus)
- {
- g_warning ("AT-SPI Couldn't connect to D-Bus: %s\n", error.message);
- g_free(atk_adaptor_app_data);
- atk_adaptor_app_data = NULL;
- return 0;
- }
- if (atspi_dbus_name != NULL &&
- dbus_bus_request_name(atk_adaptor_app_data->bus, atspi_dbus_name, 0, &error))
- {
- g_print("AT-SPI Recieved D-Bus name - %s\n", atspi_dbus_name);
- }
-
- dbus_connection_setup_with_g_main(atk_adaptor_app_data->bus, g_main_context_default());
-
- /* Get D-Bus introspection directory */
- introspection_directory = (char *) g_getenv("ATSPI_INTROSPECTION_PATH");
- if (introspection_directory == NULL)
- introspection_directory = ATSPI_INTROSPECTION_PATH;
-
- /* Register droute for routing AT-SPI messages */
- atk_adaptor_app_data->droute = droute_new (atk_adaptor_app_data->bus, introspection_directory);
-
- treepath = droute_add_one (atk_adaptor_app_data->droute,
- "/org/freedesktop/atspi/tree",
- NULL);
-
- accpath = droute_add_many (atk_adaptor_app_data->droute,
- "/org/freedesktop/atspi/accessible",
- NULL,
- (DRouteGetDatumFunction) atk_dbus_path_to_object);
-
- /* Register all interfaces with droute and set up application accessible db */
- spi_initialize_tree (treepath);
-
- spi_initialize_accessible (accpath);
- spi_initialize_application (accpath);
- spi_initialize_action(accpath);
- spi_initialize_collection (accpath);
- spi_initialize_component (accpath);
- spi_initialize_document (accpath);
- spi_initialize_editabletext (accpath);
- spi_initialize_hyperlink (accpath);
- spi_initialize_hypertext (accpath);
- spi_initialize_image (accpath);
- spi_initialize_selection (accpath);
- spi_initialize_table (accpath);
- spi_initialize_text (accpath);
- spi_initialize_value (accpath);
-
- /* Initialize the AtkObject registration */
- atk_dbus_initialize (atk_adaptor_app_data->root);
-
- /* Register methods to send D-Bus signals on certain ATK events */
- spi_atk_register_event_listeners ();
-
- /* Register this app by sending a signal out to AT-SPI registry daemon */
- register_application (atk_adaptor_app_data);
-
- g_atexit (exit_func);
-
- return 0;
-}
-
-/*---------------------------------------------------------------------------*/
-
-int
-gtk_module_init (gint *argc, gchar **argv[])
-{
- return adaptor_init (argc, argv);
-}
-
-/*END------------------------------------------------------------------------*/
diff --git a/atk-adaptor/bridge.h b/atk-adaptor/bridge.h
deleted file mode 100644
index 3e41531b..00000000
--- a/atk-adaptor/bridge.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * AT-SPI - Assistive Technology Service Provider Interface
- * (Gnome Accessibility Project; http://developer.gnome.org/projects/gap)
- *
- * Copyright 2001, 2002, 2003 Sun Microsystems Inc.,
- * Copyright 2001, 2002, 2003 Ximian, Inc.
- * Copyright 2008, 2009 Codethink Ltd.
- *
- * 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.
- */
-
-#ifndef BRIDGE_H
-#define BRIDGE_H
-
-#include <atk/atk.h>
-#include <droute/droute.h>
-
-typedef struct _SpiAppData SpiAppData;
-struct _SpiAppData
-{
- AtkObject *root;
-
- DBusConnection *bus;
- DRouteContext *droute;
-};
-
-extern SpiAppData *atk_adaptor_app_data;
-
-#endif /* BRIDGE_H */
diff --git a/atk-adaptor/collection-adaptor.c b/atk-adaptor/collection-adaptor.c
deleted file mode 100644
index 2826febb..00000000
--- a/atk-adaptor/collection-adaptor.c
+++ /dev/null
@@ -1,1033 +0,0 @@
-/*
- * AT-SPI - Assistive Technology Service Provider Interface
- * (Gnome Accessibility Project; http://developer.gnome.org/projects/gap)
- *
- * Copyright 2007 IBM Corp.
- *
- * 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.
- */
-
-/* collection.c: implements the Collection interface */
-
-#include <string.h>
-
-#include <atk/atk.h>
-#include <droute/droute.h>
-
-#include "accessible-register.h"
-#include "accessible-marshaller.h"
-
-#include "spi-common/bitarray.h"
-#include "spi-common/spi-dbus.h"
-
-typedef struct _MatchRulePrivate MatchRulePrivate;
-struct _MatchRulePrivate
-{
- gint *states;
- Accessibility_Collection_MatchType statematchtype;
- AtkAttributeSet *attributes;
- Accessibility_Collection_MatchType attributematchtype;
- gint *roles;
- Accessibility_Collection_MatchType rolematchtype;
- gchar **ifaces;
- Accessibility_Collection_MatchType interfacematchtype;
- gboolean invert;
-};
-
-static gboolean
-child_interface_p (AtkObject *child,
- gchar *repo_id)
-{
- if (!strcasecmp(repo_id, "action")) return atk_is_action(child);
- if (!strcasecmp(repo_id, "component")) return atk_is_component(child);
- if (!strcasecmp(repo_id, "editabletext")) return atk_is_editable_text(child);
- if (!strcasecmp(repo_id, "text")) return atk_is_text(child);
- if (!strcasecmp(repo_id, "hypertext")) return atk_is_hypertext(child);
- if (!strcasecmp(repo_id, "image")) return atk_is_image(child);
- if (!strcasecmp(repo_id, "selection")) return atk_is_selection(child);
- if (!strcasecmp(repo_id, "table")) return atk_is_table(child);
- if (!strcasecmp(repo_id, "value")) return atk_is_value(child);
- if (!strcasecmp(repo_id, "streamablecontent")) return atk_is_streamable_content(child);
- if (!strcasecmp(repo_id, "document")) return atk_is_document(child);
- return FALSE;
-}
-
-#define child_collection_p(ch) (TRUE)
-
-static gboolean
-match_states_all_p (AtkObject *child,
- gint *set)
-{
- AtkStateSet *chs;
- gint i;
- gboolean ret = TRUE;
-
- if (set == NULL)
- return TRUE;
-
- chs = atk_object_ref_state_set (child);
-
- // TODO: use atk-state_set_contains_states; would be more efficient
- for (i = 0; set[i] != BITARRAY_SEQ_TERM; i++)
- {
- if (!atk_state_set_contains_state(chs, set[i]))
- {
- ret = FALSE;
- break;
- }
- }
-
- g_object_unref(chs);
- return ret;
-}
-
-static gboolean
-match_states_any_p (AtkObject *child,
- gint *set)
-{
- AtkStateSet *chs;
- gint i;
- gboolean ret = FALSE;
-
- if (set == NULL)
- return TRUE;
-
- chs = atk_object_ref_state_set (child);
-
- for (i = 0; set[i] != BITARRAY_SEQ_TERM; i++)
- {
- if (!atk_state_set_contains_state(chs, set[i]))
- {
- ret = TRUE;
- break;
- }
- }
-
- g_object_unref(chs);
- return ret;
-}
-
-static gboolean
-match_states_none_p (AtkObject *child,
- gint *set)
-{
- AtkStateSet *chs;
- gint i;
- gboolean ret = TRUE;
-
- if (set == NULL)
- return TRUE;
-
- chs = atk_object_ref_state_set (child);
-
- for (i = 0; set[i] != BITARRAY_SEQ_TERM; i++)
- {
- if (atk_state_set_contains_state(chs, set[i]))
- {
- ret = FALSE;
- break;
- }
- }
-
- g_object_unref(chs);
- return ret;
-}
-
-// TODO: need to convert at-spi roles/states to atk roles/states */
-static gboolean
-match_states_lookup (AtkObject *child,
- MatchRulePrivate *mrp)
-{
- switch (mrp->statematchtype){
- case Accessibility_Collection_MATCH_ALL :
- if (match_states_all_p (child, mrp->states))
- return TRUE;
- break;
-
- case Accessibility_Collection_MATCH_ANY :
- if (match_states_any_p (child, mrp->states))
- return TRUE;
- break;
-
- case Accessibility_Collection_MATCH_NONE :
- if (match_states_none_p (child, mrp->states))
- return TRUE;
- break;
-
- default : break;
- }
-
- return FALSE;
-}
-
-// TODO: Map at-spi -> atk roles at mrp creation instead of doing this;
-// would be more efficient
-#define spi_get_role(obj) spi_accessible_role_from_atk_role(atk_object_get_role(obj))
-
-static gboolean
-match_roles_all_p (AtkObject *child,
- gint *roles)
-{
- Accessibility_Role role;
-
- if (roles == NULL || roles[0] == BITARRAY_SEQ_TERM) return TRUE;
- else if (roles[1] != BITARRAY_SEQ_TERM) return FALSE;
-
- return (atk_object_get_role(child) == roles[0]);
-
-}
-
-static gboolean
-match_roles_any_p (AtkObject *child,
- gint *roles)
-{
- AtkRole role;
- int i;
-
- if (roles == NULL || roles[0] == BITARRAY_SEQ_TERM) return TRUE;
-
- role = atk_object_get_role(child);
-
- for (i = 0; roles[i] != BITARRAY_SEQ_TERM; i++)
- if (role == roles[i])
- return TRUE;
-
- return FALSE;
-}
-
-static gboolean
-match_roles_none_p (AtkObject *child,
- gint *roles)
-{
- AtkRole role;
- int i;
-
- if (roles == NULL || roles[0] == BITARRAY_SEQ_TERM) return TRUE;
-
- role = atk_object_get_role(child);
-
- for (i = 0; roles[i] != BITARRAY_SEQ_TERM; i++)
- if (role == roles[i])
- return FALSE;
-
- return TRUE;
-}
-
-static gboolean
-match_roles_lookup (AtkObject *child,
- MatchRulePrivate *mrp)
-{
- switch (mrp->rolematchtype){
- case Accessibility_Collection_MATCH_ALL :
- if (match_roles_all_p (child, mrp->roles))
- return TRUE;
- break;
-
- case Accessibility_Collection_MATCH_ANY :
- if (match_roles_any_p (child, mrp->roles))
- return TRUE;
- break;
-
- case Accessibility_Collection_MATCH_NONE :
- if (match_roles_none_p (child, mrp->roles))
- return TRUE;
- break;
-
- default : break;
-
- }
- return FALSE;
-}
-
-static gboolean
-match_interfaces_all_p (AtkObject *obj,
- gchar **ifaces)
-{
- gint i;
-
- if (ifaces == NULL)
- return TRUE;
-
- for (i = 0; ifaces[i]; i++)
- if (!child_interface_p (obj, ifaces [i])){
- return FALSE;
- }
- return TRUE;
-}
-
-static gboolean
-match_interfaces_any_p (AtkObject *obj,
- gchar **ifaces)
-{
- gint i;
-
- if (ifaces == NULL)
- return TRUE;
-
-
- for (i = 0; ifaces[i]; i++)
- if (child_interface_p (obj, ifaces [i])){
- return TRUE;
- }
- return FALSE;
-}
-
-static gboolean
-match_interfaces_none_p (AtkObject *obj,
- gchar **ifaces)
-{
- gint i;
-
- for (i = 0; ifaces[i]; i++)
- if (child_interface_p (obj, ifaces [i]))
- return FALSE;
-
- return TRUE;
-}
-
-static gboolean
-match_interfaces_lookup (AtkObject *child,
- MatchRulePrivate *mrp)
-{
- switch (mrp->interfacematchtype){
-
- case Accessibility_Collection_MATCH_ALL :
- if (match_interfaces_all_p (child, mrp->ifaces))
- return TRUE;
- break;
-
- case Accessibility_Collection_MATCH_ANY :
- if (match_interfaces_any_p (child, mrp->ifaces))
- return TRUE;
- break;
-
- case Accessibility_Collection_MATCH_NONE :
- if (match_interfaces_none_p (child, mrp->ifaces))
- return TRUE;
- break;
-
- default : break;
- }
-
- return FALSE;
-}
-
-#define split_attributes(attributes) (g_strsplit (attributes, ";", 0))
-
-static gboolean
-match_attributes_all_p (AtkObject *child,
- AtkAttributeSet *attributes)
-{
- int i, k;
- AtkAttributeSet *oa;
- gint length, oa_length;
- gboolean flag = FALSE;
-
- if (attributes == NULL || g_slist_length (attributes) == 0)
- return TRUE;
-
- oa = atk_object_get_attributes(child);
- length = g_slist_length(attributes);
- oa_length = g_slist_length(oa);
-
- for (i = 0; i < length; i++) {
- AtkAttribute *attr = g_slist_nth_data(attributes, i);
- for (k = 0; k < oa_length; k++) {
- AtkAttribute *oa_attr = g_slist_nth_data(attributes, i);
- if (!g_ascii_strcasecmp (oa_attr->name, attr->name) &&
- !g_ascii_strcasecmp (oa_attr->value, attr->value)){
- flag = TRUE;
- break;
- }
- else
- flag = FALSE;
- }
- if (!flag) {
- atk_attribute_set_free(oa);
- return FALSE;
- }
- }
- atk_attribute_set_free(oa);
- return TRUE;
-}
-
-static gboolean
-match_attributes_any_p (AtkObject *child,
- AtkAttributeSet *attributes)
-{
- int i, k;
-
- AtkAttributeSet *oa;
- gint length, oa_length;
-
- length = g_slist_length(attributes);
- if (length == 0)
- return TRUE;
-
- oa = atk_object_get_attributes(child);
- oa_length = g_slist_length(oa);
-
- for (i = 0; i < length; i++){
- AtkAttribute *attr = g_slist_nth_data(attributes, i);
- for (k = 0; k < oa_length; k++){
- AtkAttribute *oa_attr = g_slist_nth_data(attributes, i);
- if (!g_ascii_strcasecmp (oa_attr->name, attr->name) &&
- !g_ascii_strcasecmp (oa_attr->value, attr->value)){
- atk_attribute_set_free(oa);
- return TRUE;
- }
- }
- }
- atk_attribute_set_free(oa);
- return FALSE;
-}
-
-static gboolean
-match_attributes_none_p (AtkObject *child,
- AtkAttributeSet *attributes)
-{
- int i, k;
-
- AtkAttributeSet *oa;
- gint length, oa_length;
-
- length = g_slist_length(attributes);
- if (length == 0)
- return TRUE;
-
- oa = atk_object_get_attributes(child);
- oa_length = g_slist_length(oa);
-
- for (i = 0; i < length; i++){
- AtkAttribute *attr = g_slist_nth_data(attributes, i);
- for (k = 0; k < oa_length; k++){
- AtkAttribute *oa_attr = g_slist_nth_data(attributes, i);
- if (!g_ascii_strcasecmp (oa_attr->name, attr->name) &&
- !g_ascii_strcasecmp (oa_attr->value, attr->value)){
- atk_attribute_set_free(oa);
- return FALSE;
- }
- }
- }
- atk_attribute_set_free(oa);
- return TRUE;
-}
-
-static gboolean
-match_attributes_lookup (AtkObject *child, MatchRulePrivate *mrp)
-{
- switch (mrp->attributematchtype){
-
- case Accessibility_Collection_MATCH_ALL :
- if (match_attributes_all_p (child, mrp->attributes))
- return TRUE;
- break;
-
- case Accessibility_Collection_MATCH_ANY :
- if (match_attributes_any_p (child, mrp->attributes))
- return TRUE;
- break;
-
- case Accessibility_Collection_MATCH_NONE :
- if (match_attributes_none_p (child, mrp->attributes))
- return TRUE;
- break;
-
- default : break;
- }
- return FALSE;
-}
-
-static gboolean
-traverse_p (AtkObject *child,
- const gboolean traverse)
-{
- if (traverse)
- return TRUE;
- else return !child_collection_p (child);
-}
-
-static int
-sort_order_canonical (MatchRulePrivate *mrp, GList *ls,
- gint kount, gint max,
- AtkObject *obj, glong index, gboolean flag,
- AtkObject *pobj, gboolean recurse,
- gboolean traverse)
-{
- gint i = index;
- glong acount = atk_object_get_n_accessible_children (obj);
- gboolean prev = pobj? TRUE : FALSE;
-
- for (; i < acount && (max == 0 || kount < max); i++){
- AtkObject *child =
- atk_object_ref_accessible_child(obj, i);
-
- g_object_unref(child);
- if (prev && child == pobj){
- return kount;
- }
-
- if (flag && match_interfaces_lookup (child, mrp)
- && match_states_lookup (child, mrp)
- && match_roles_lookup (child, mrp)
- && match_attributes_lookup (child, mrp)
- ){
-
- ls = g_list_append (ls, child);
- kount++;
- }
-
- if (!flag)
- flag = TRUE;
-
- if (recurse && traverse_p (child, traverse))
- kount = sort_order_canonical (mrp, ls, kount,
- max, child, 0, TRUE,
- pobj, recurse, traverse);
- }
- return kount;
-}
-
-static int
-sort_order_rev_canonical (MatchRulePrivate *mrp, GList *ls,
- gint kount, gint max,
- AtkObject *obj, gboolean flag,
- AtkObject *pobj)
-{
- AtkObject *nextobj;
- AtkObject *parent;
- glong indexinparent;
-
- /* This breaks us out of the recursion. */
- if (!obj || obj == pobj)
- {
- return kount;
- }
-
- /* Add to the list if it matches */
- if (flag && match_interfaces_lookup (obj, mrp)
- && match_states_lookup (obj, mrp)
- && match_roles_lookup (obj, mrp)
- && match_attributes_lookup (obj, mrp))
- {
- ls = g_list_append (ls, obj);
- kount++;
- }
-
- if(!flag) flag = TRUE;
-
- /* Get the current nodes index in it's parent and the parent object. */
- indexinparent = atk_object_get_index_in_parent (obj);
- parent = atk_object_get_parent(obj);
-
- if(indexinparent > 0)
- {
- /* there are still some siblings to visit so get the previous sibling
- and get it's last descendant.
- First, get the previous sibling */
- nextobj = atk_object_ref_accessible_child (parent,
- indexinparent-1);
- g_object_unref(nextobj);
-
- /* Now, drill down the right side to the last descendant */
- while(atk_object_get_n_accessible_children (nextobj) > 0)
- {
- nextobj = atk_object_ref_accessible_child(nextobj,
- atk_object_get_n_accessible_children (nextobj)-1);
- g_object_unref (nextobj);
- }
- /* recurse with the last descendant */
- kount = sort_order_rev_canonical (mrp, ls, kount, max,
- nextobj, TRUE, pobj);
- }
- else
- {
- /* no more siblings so next node must be the parent */
- kount = sort_order_rev_canonical (mrp, ls, kount, max,
- parent, TRUE, pobj);
-
- }
- return kount;
-}
-
-static int
-query_exec (MatchRulePrivate *mrp, Accessibility_Collection_SortOrder sortby,
- GList *ls, gint kount, gint max,
- AtkObject *obj, glong index,
- gboolean flag,
- AtkObject *pobj,
- gboolean recurse, gboolean traverse)
-{
- switch (sortby) {
- case Accessibility_Collection_SORT_ORDER_CANONICAL :
- kount = sort_order_canonical(mrp, ls, 0, max, obj, index, flag,
- pobj, recurse, traverse);
- break;
- case Accessibility_Collection_SORT_ORDER_REVERSE_CANONICAL :
- kount = sort_order_canonical(mrp, ls, 0, max, obj, index, flag,
- pobj, recurse, traverse);
- break;
- default:
- kount = 0;
- g_warning ("Sort method not implemented yet");
- break;
- }
-
- return kount;
-}
-
-static dbus_bool_t
-read_mr(DBusMessageIter *iter, MatchRulePrivate *mrp)
-{
- DBusMessageIter mrc, arrayc;
- dbus_uint32_t *array;
- dbus_int32_t matchType;
- int array_count;
- char *str;
- AtkAttribute *attr;
- int i;
- char *interfaces = NULL;
-
- // TODO: error checking
- dbus_message_iter_recurse(iter, &mrc);
- dbus_message_iter_recurse(&mrc, &arrayc);
- dbus_message_iter_get_fixed_array(&arrayc, &array, &array_count);
- bitarray_to_seq(array, array_count, &mrp->states);
- for (i = 0; mrp->states[i] != BITARRAY_SEQ_TERM; i++)
- {
- mrp->states[i] = spi_atk_state_from_spi_state (mrp->states[i]);
- }
- dbus_message_iter_next(&mrc);
- dbus_message_iter_read_basic(&mrc, &matchType);
- dbus_message_iter_next(&mrc);
- mrp->statematchtype = matchType;;
- /* attributes */
- dbus_message_iter_recurse(&mrc, &arrayc);
- mrp->attributes = NULL;
- while (dbus_message_iter_get_arg_type(&arrayc) != DBUS_TYPE_INVALID)
- {
- dbus_message_iter_get_basic(&arrayc, &str);
- // TODO: remove this print
- g_print("Got attribute: %s\n", str);
- attr = g_new (AtkAttribute, 1);
- if (attr)
- {
- int len = strcspn(str, ":");
- attr->name = g_strndup(str, len);
- if (str[len] == ':')
- {
- len++;
- if (str[len] == ' ') len++;
- attr->value = g_strdup(str + len);
- }
- else attr->value = NULL;
- mrp->attributes = g_slist_prepend(mrp->attributes, attr);
- }
- dbus_message_iter_next(&arrayc);
- }
- dbus_message_iter_next(&mrc);
- dbus_message_iter_read_basic(&mrc, &matchType);
- mrp->attributematchtype = matchType;;
- dbus_message_iter_next(&mrc);
- /* Get roles and role match */
- dbus_message_iter_recurse(&mrc, &arrayc);
- dbus_message_iter_get_fixed_array(&arrayc, &array, &array_count);
- bitarray_to_seq(array, array_count, &mrp->roles);
- dbus_message_iter_next(&mrc);
- dbus_message_iter_read_basic(&mrc, &matchType);
- mrp->rolematchtype = matchType;;
- dbus_message_iter_next(&mrc);
- /* Get interfaces and interface match */
- dbus_message_iter_read_basic(&mrc, &interfaces);
- dbus_message_iter_next(&mrc);
- mrp->ifaces = g_strsplit(interfaces, ";", 0);
- dbus_message_iter_read_basic(&mrc, &matchType);
- mrp->interfacematchtype = matchType;;
- dbus_message_iter_next(&mrc);
- /* get invert */
- dbus_message_iter_read_basic(&mrc, &mrp->invert);
- dbus_message_iter_next(iter);
- return TRUE;
-}
-
-static DBusMessage *
-return_and_free_list(DBusMessage *message, GList *ls)
-{
- DBusMessage *reply;
- DBusMessageIter iter, iter_array;
- GList *item;
-
- reply = dbus_message_new_method_return(message);
- if (!reply) return NULL;
- dbus_message_iter_init_append(reply, &iter);
- if (!dbus_message_iter_open_container(&iter, DBUS_TYPE_ARRAY, "o", &iter_array)) goto oom;
- for (item = ls; item; item = g_list_next(item))
- {
- char *path = (char *) spi_dbus_object_to_path ((AtkObject *)item->data);
- dbus_message_iter_append_basic(&iter_array, DBUS_TYPE_OBJECT_PATH, &path);
- g_free(path);
- }
- if (!dbus_message_iter_close_container(&iter, &iter_array)) goto oom;
- g_list_free (ls);
- return reply;
-oom:
- // TODO: Handle out of memory
- g_list_free (ls);
- return reply;
-}
-
-static void free_mrp_data(MatchRulePrivate *mrp)
-{
- g_free(mrp->states);
- atk_attribute_set_free(mrp->attributes);
- g_free(mrp->roles);
- g_strfreev(mrp->ifaces);
-}
-
-static DBusMessage *
-getMatchesFrom (DBusMessage *message,
- AtkObject *current_object,
- MatchRulePrivate *mrp,
- const Accessibility_Collection_SortOrder sortby,
- const dbus_bool_t isrestrict,
- dbus_int32_t count,
- const dbus_bool_t traverse)
-{
- GList *ls = NULL;
- AtkObject *parent;
- glong index =
- atk_object_get_index_in_parent (current_object);
- gint kount = 0;
-
- ls = g_list_append (ls, current_object);
-
- if (!isrestrict)
- {
- parent = atk_object_get_parent (current_object);
- kount = query_exec (mrp, sortby, ls, 0, count, parent, index,
- FALSE, NULL, TRUE, traverse);
- }
- else
- kount = query_exec (mrp, sortby, ls, 0, count,
- current_object, 0, FALSE, NULL,
- TRUE, traverse);
-
- ls = g_list_remove (ls, ls->data);
-
- if (sortby == Accessibility_Collection_SORT_ORDER_REVERSE_CANONICAL)
- ls = g_list_reverse (ls);
-
- free_mrp_data (mrp);
- return return_and_free_list (message, ls);
-}
-
-/*
- inorder traversal from a given object in the hierarchy
-*/
-
-static int
-inorder (AtkObject *collection, MatchRulePrivate *mrp,
- GList *ls, gint kount, gint max,
- AtkObject *obj,
- gboolean flag,
- AtkObject *pobj,
- dbus_bool_t traverse)
-{
- int i = 0;
-
- /* First, look through the children recursively. */
- kount = sort_order_canonical (mrp, ls, kount, max, obj, 0, TRUE,
- NULL, TRUE, TRUE);
-
- /* Next, we look through the right subtree */
- while ((max == 0 || kount < max)
- && obj != collection)
- {
- AtkObject *parent =
- atk_object_get_parent (obj);
- i = atk_object_get_index_in_parent (obj);
- kount = sort_order_canonical (mrp, ls, kount, max, parent,
- i+1, TRUE, FALSE, TRUE, TRUE);
- obj = parent;
- }
-
- if (kount < max)
- {
- kount = sort_order_canonical (mrp, ls, kount, max,
- obj, i + 1, TRUE, FALSE,
- TRUE, TRUE);
- }
-
- return kount;
-}
-
-/*
- GetMatchesInOrder: get matches from a given object in an inorder traversal.
-*/
-
-static DBusMessage *
-getMatchesInOrder (DBusMessage *message,
- AtkObject *current_object,
- MatchRulePrivate *mrp,
- const Accessibility_Collection_SortOrder sortby,
- const dbus_bool_t recurse,
- dbus_int32_t count,
- const dbus_bool_t traverse)
-{
- GList *ls = NULL;
- AtkObject *obj;
- gint kount = 0;
-
- ls = g_list_append (ls, current_object);
-
- obj = atk_dbus_path_to_object (dbus_message_get_path (message));
-
- kount = inorder (obj, mrp, ls, 0, count,
- current_object, TRUE, NULL, traverse);
-
- ls = g_list_remove (ls, ls->data);
-
- if (sortby == Accessibility_Collection_SORT_ORDER_REVERSE_CANONICAL)
- ls = g_list_reverse (ls);
-
- free_mrp_data (mrp);
- return return_and_free_list (message, ls);
-}
-
-/*
- GetMatchesInBackOrder: get matches from a given object in a
- reverse order traversal.
-*/
-
-static DBusMessage *
-getMatchesInBackOrder (DBusMessage *message,
- AtkObject *current_object,
- MatchRulePrivate *mrp,
- const Accessibility_Collection_SortOrder sortby,
- dbus_int32_t count)
-{
- GList *ls = NULL;
- AtkObject *collection;
- gint kount = 0;
-
- ls = g_list_append (ls, current_object);
-
- collection = atk_dbus_path_to_object (dbus_message_get_path (message));
-
- kount = sort_order_rev_canonical (mrp, ls, 0, count, current_object,
- FALSE, collection);
-
- ls = g_list_remove (ls, ls->data);
-
- if (sortby == Accessibility_Collection_SORT_ORDER_REVERSE_CANONICAL)
- ls = g_list_reverse (ls);
-
- free_mrp_data (mrp);
- return return_and_free_list (message, ls);
-}
-
-static DBusMessage *
-getMatchesTo (DBusMessage *message,
- AtkObject *current_object,
- MatchRulePrivate *mrp,
- const Accessibility_Collection_SortOrder sortby,
- const dbus_bool_t recurse,
- const dbus_bool_t isrestrict,
- dbus_int32_t count,
- const dbus_bool_t traverse)
-{
- GList *ls = NULL;
- AtkObject *obj;
- gint kount = 0;
-
- ls = g_list_append (ls, current_object);
-
- if (recurse){
- obj = atk_object_get_parent (current_object);
- kount = query_exec (mrp, sortby, ls, 0, count,
- obj, 0, TRUE, current_object, TRUE, traverse);
- }
- else{
- obj = atk_dbus_path_to_object (dbus_message_get_path (message));
- kount = query_exec (mrp, sortby, ls, 0, count,
- obj, 0, TRUE, current_object, TRUE, traverse);
-
- }
-
- ls = g_list_remove (ls, ls->data);
-
- if (sortby != Accessibility_Collection_SORT_ORDER_REVERSE_CANONICAL)
- ls = g_list_reverse (ls);
-
- free_mrp_data (mrp);
- return return_and_free_list (message, ls);
-}
-
-static DBusMessage *
-impl_getMatchesFrom (DBusConnection *bus, DBusMessage *message, void *user_data)
-{
- char *current_object_path = NULL;
- AtkObject *current_object;
- DBusMessageIter iter;
- MatchRulePrivate rule;
- dbus_uint16_t sortby;
- dbus_uint16_t tree;
- dbus_int32_t count;
- dbus_bool_t traverse;
- GList *ls = NULL;
-
- dbus_message_iter_init(message, &iter);
- dbus_message_iter_get_basic (&iter, current_object_path);
- current_object = atk_dbus_path_to_object (current_object_path);
- if (!current_object)
- {
- // TODO: object-not-found error
- return spi_dbus_general_error (message);
- }
- dbus_message_iter_next (&iter);
- if (!read_mr(&iter, &rule))
- {
- return spi_dbus_general_error (message);
- }
- dbus_message_iter_get_basic(&iter, &sortby);
- dbus_message_iter_next(&iter);
- dbus_message_iter_get_basic(&iter, &tree);
- dbus_message_iter_next(&iter);
- dbus_message_iter_get_basic(&iter, &count);
- dbus_message_iter_next(&iter);
- dbus_message_iter_get_basic(&iter, &traverse);
- dbus_message_iter_next(&iter);
-
- switch (tree){
- case Accessibility_Collection_TREE_RESTRICT_CHILDREN :
- return getMatchesFrom (message, current_object,
- &rule, sortby, TRUE, count, traverse);
- break;
- case Accessibility_Collection_TREE_RESTRICT_SIBLING :
- return getMatchesFrom (message, current_object,
- &rule, sortby, FALSE, count, traverse);
- break;
- case Accessibility_Collection_TREE_INORDER :
- return getMatchesInOrder (message, current_object,
- &rule, sortby, TRUE, count, traverse);
- break;
- default : return NULL;
- }
-}
-
-static DBusMessage *
-impl_getMatchesTo (DBusConnection *bus, DBusMessage *message, void *user_data)
-{
- char *current_object_path = NULL;
- AtkObject *current_object;
- DBusMessageIter iter;
- MatchRulePrivate rule;
- dbus_uint16_t sortby;
- dbus_uint16_t tree;
- dbus_bool_t recurse;
- dbus_int32_t count;
- dbus_bool_t traverse;
- GList *ls = NULL;
-
- dbus_message_iter_init(message, &iter);
- dbus_message_iter_get_basic (&iter, current_object_path);
- current_object = atk_dbus_path_to_object (current_object_path);
- if (!current_object)
- {
- // TODO: object-not-found error
- return spi_dbus_general_error (message);
- }
- dbus_message_iter_next (&iter);
- if (!read_mr(&iter, &rule))
- {
- return spi_dbus_general_error (message);
- }
- dbus_message_iter_get_basic(&iter, &sortby);
- dbus_message_iter_next(&iter);
- dbus_message_iter_get_basic(&iter, &tree);
- dbus_message_iter_next(&iter);
- dbus_message_iter_get_basic(&iter, &recurse);
- dbus_message_iter_next(&iter);
- dbus_message_iter_get_basic(&iter, &count);
- dbus_message_iter_next(&iter);
- dbus_message_iter_get_basic(&iter, &traverse);
- dbus_message_iter_next(&iter);
-
- switch (tree){
- case Accessibility_Collection_TREE_RESTRICT_CHILDREN :
- return getMatchesTo (message, current_object,
- &rule, sortby, recurse, TRUE, count, traverse);
- break;
- case Accessibility_Collection_TREE_RESTRICT_SIBLING :
- return getMatchesTo (message, current_object,
- &rule, sortby, recurse, FALSE, count, traverse);
- break;
- case Accessibility_Collection_TREE_INORDER :
- return getMatchesInBackOrder (message, current_object,
- &rule, sortby, count);
- break;
- default : return NULL;
- }
-}
-
-static DBusMessage *
-impl_getMatches(DBusConnection *bus, DBusMessage *message, void *user_data)
-{
- AtkObject *obj = atk_dbus_path_to_object (dbus_message_get_path (message));
- DBusMessageIter iter;
- MatchRulePrivate rule;
- dbus_uint16_t sortby;
- dbus_int32_t count;
- dbus_bool_t traverse;
- GList *ls = NULL;
-
- dbus_message_iter_init(message, &iter);
- if (!read_mr(&iter, &rule))
- {
- return spi_dbus_general_error (message);
- }
- dbus_message_iter_get_basic(&iter, &sortby);
- dbus_message_iter_next(&iter);
- dbus_message_iter_get_basic(&iter, &count);
- dbus_message_iter_next(&iter);
- dbus_message_iter_get_basic(&iter, &traverse);
- dbus_message_iter_next(&iter);
- ls = g_list_prepend (ls, obj);
- count = query_exec (&rule, sortby, ls, 0, count,
- obj, 0, TRUE, NULL, TRUE, traverse);
- ls = g_list_remove (ls, ls->data);
-
- if (sortby == Accessibility_Collection_SORT_ORDER_REVERSE_CANONICAL)
- ls = g_list_reverse (ls);
- free_mrp_data (&rule);
- return return_and_free_list (message, ls);
-}
-
-static DRouteMethod methods[] = {
- { impl_getMatchesFrom, "getMatchesFrom" },
- { impl_getMatchesTo, "getMatchesTo" },
- { impl_getMatches, "getMatches" },
- {NULL, NULL}
-};
-
-void
-spi_initialize_collection (DRoutePath *path)
-{
- droute_path_add_interface (path,
- SPI_DBUS_INTERFACE_COLLECTION,
- methods,
- NULL);
-};
diff --git a/atk-adaptor/component-adaptor.c b/atk-adaptor/component-adaptor.c
deleted file mode 100644
index 7e96ef9e..00000000
--- a/atk-adaptor/component-adaptor.c
+++ /dev/null
@@ -1,310 +0,0 @@
-/*
- * 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.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#include <atk/atk.h>
-#include <droute/droute.h>
-
-#include "accessible-marshaller.h"
-#include "spi-common/spi-dbus.h"
-
-static DBusMessage *
-impl_contains (DBusConnection * bus, DBusMessage * message, void *user_data)
-{
- AtkComponent *component = (AtkComponent *) user_data;
- dbus_int32_t x, y;
- dbus_uint32_t coord_type;
- DBusError error;
- dbus_bool_t retval;
- DBusMessage *reply;
-
- g_return_val_if_fail (ATK_IS_COMPONENT (user_data),
- droute_not_yet_handled_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 droute_invalid_arguments_error (message);
- }
- 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;
-}
-
-static DBusMessage *
-impl_getAccessibleAtPoint (DBusConnection * bus, DBusMessage * message,
- void *user_data)
-{
- AtkComponent *component = (AtkComponent *) user_data;
- dbus_int32_t x, y;
- dbus_uint32_t coord_type;
- DBusError error;
- AtkObject *child;
-
- g_return_val_if_fail (ATK_IS_COMPONENT (user_data),
- droute_not_yet_handled_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 droute_invalid_arguments_error (message);
- }
- child =
- atk_component_ref_accessible_at_point (component, x, y,
- (AtkCoordType) coord_type);
- return spi_dbus_return_object (message, child, TRUE);
-}
-
-static DBusMessage *
-impl_getExtents (DBusConnection * bus, DBusMessage * message, void *user_data)
-{
- AtkComponent *component = (AtkComponent *) user_data;
- DBusError error;
- dbus_uint32_t coord_type;
- gint ix, iy, iwidth, iheight;
-
- g_return_val_if_fail (ATK_IS_COMPONENT (user_data),
- droute_not_yet_handled_error (message));
-
- dbus_error_init (&error);
- if (!dbus_message_get_args
- (message, &error, DBUS_TYPE_UINT32, &coord_type, DBUS_TYPE_INVALID))
- {
- return droute_invalid_arguments_error (message);
- }
- atk_component_get_extents (component, &ix, &iy, &iwidth, &iheight,
- (AtkCoordType) coord_type);
- return spi_dbus_return_rect (message, ix, iy, iwidth, iheight);
-}
-
-static DBusMessage *
-impl_getPosition (DBusConnection * bus, DBusMessage * message,
- void *user_data)
-{
- AtkComponent *component = (AtkComponent *) user_data;
- DBusError error;
- dbus_uint32_t coord_type;
- gint ix = 0, iy = 0;
- dbus_int32_t x, y;
- DBusMessage *reply;
-
- g_return_val_if_fail (ATK_IS_COMPONENT (user_data),
- droute_not_yet_handled_error (message));
-
- dbus_error_init (&error);
- if (!dbus_message_get_args
- (message, &error, DBUS_TYPE_UINT32, &coord_type, DBUS_TYPE_INVALID))
- {
- return droute_invalid_arguments_error (message);
- }
- 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;
-}
-
-static DBusMessage *
-impl_getSize (DBusConnection * bus, DBusMessage * message, void *user_data)
-{
- AtkComponent *component = (AtkComponent *) user_data;
- gint iwidth = 0, iheight = 0;
- dbus_int32_t width, height;
- DBusMessage *reply;
-
- g_return_val_if_fail (ATK_IS_COMPONENT (user_data),
- droute_not_yet_handled_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 DBusMessage *
-impl_getLayer (DBusConnection * bus, DBusMessage * message, void *user_data)
-{
- AtkComponent *component = (AtkComponent *) user_data;
- AtkLayer atklayer;
- dbus_uint32_t rv;
- DBusMessage *reply;
-
- g_return_val_if_fail (ATK_IS_COMPONENT (user_data),
- droute_not_yet_handled_error (message));
-
- atklayer = atk_component_get_layer (component);
-
- switch (atklayer)
- {
- 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;
- }
- reply = dbus_message_new_method_return (message);
- if (reply)
- {
- dbus_message_append_args (reply, DBUS_TYPE_UINT32, &rv,
- DBUS_TYPE_INVALID);
- }
- return reply;
-}
-
-static DBusMessage *
-impl_getMDIZOrder (DBusConnection * bus, DBusMessage * message,
- void *user_data)
-{
- AtkComponent *component = (AtkComponent *) user_data;
- dbus_int16_t rv;
- DBusMessage *reply;
-
- g_return_val_if_fail (ATK_IS_COMPONENT (user_data),
- droute_not_yet_handled_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_INT16, &rv, DBUS_TYPE_INVALID);
- }
- return reply;
-}
-
-static DBusMessage *
-impl_grabFocus (DBusConnection * bus, DBusMessage * message, void *user_data)
-{
- AtkComponent *component = (AtkComponent *) user_data;
- dbus_bool_t rv;
- DBusMessage *reply;
-
- g_return_val_if_fail (ATK_IS_COMPONENT (user_data),
- droute_not_yet_handled_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;
-}
-
-#if 0
-static DBusMessage *
-impl_registerFocusHandler (DBusConnection * bus, DBusMessage * message,
- void *user_data)
-{
-}
-
-static DBusMessage *
-impl_deregisterFocusHandler (DBusConnection * bus, DBusMessage * message,
- void *user_data)
-{
-}
-#endif
-
-static DBusMessage *
-impl_getAlpha (DBusConnection * bus, DBusMessage * message, void *user_data)
-{
- AtkComponent *component = (AtkComponent *) user_data;
- double rv;
- DBusMessage *reply;
-
- g_return_val_if_fail (ATK_IS_COMPONENT (user_data),
- droute_not_yet_handled_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;
-}
-
-static DRouteMethod methods[] = {
- {impl_contains, "contains"},
- {impl_getAccessibleAtPoint, "getAccessibleAtPoint"},
- {impl_getExtents, "getExtents"},
- {impl_getPosition, "getPosition"},
- {impl_getSize, "getSize"},
- {impl_getLayer, "getLayer"},
- {impl_getMDIZOrder, "getMDIZOrder"},
- {impl_grabFocus, "grabFocus"},
- //{impl_registerFocusHandler, "registerFocusHandler"},
- //{impl_deregisterFocusHandler, "deregisterFocusHandler"},
- {impl_getAlpha, "getAlpha"},
- {NULL, NULL}
-};
-
-void
-spi_initialize_component (DRoutePath *path)
-{
- droute_path_add_interface (path,
- SPI_DBUS_INTERFACE_COMPONENT,
- methods,
- NULL);
-};
diff --git a/atk-adaptor/document-adaptor.c b/atk-adaptor/document-adaptor.c
deleted file mode 100644
index 449368f2..00000000
--- a/atk-adaptor/document-adaptor.c
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
- * 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.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#include <atk/atk.h>
-#include <droute/droute.h>
-
-#include "spi-common/spi-dbus.h"
-
-static DBusMessage *
-impl_getLocale (DBusConnection *bus,
- DBusMessage *message,
- void *user_data)
-{
- AtkDocument *document = (AtkDocument *) user_data;
- const gchar *lc;
- DBusMessage *reply;
-
- g_return_val_if_fail (ATK_IS_DOCUMENT (user_data),
- droute_not_yet_handled_error (message));
- lc = atk_document_get_locale (document);
- 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 DBusMessage *
-impl_getAttributeValue (DBusConnection * bus, DBusMessage * message,
- void *user_data)
-{
- AtkDocument *document = (AtkDocument *) user_data;
- DBusError error;
- gchar *attributename;
- const gchar *atr;
- DBusMessage *reply;
-
- g_return_val_if_fail (ATK_IS_DOCUMENT (user_data),
- droute_not_yet_handled_error (message));
- dbus_error_init (&error);
- if (!dbus_message_get_args
- (message, &error, DBUS_TYPE_STRING, &attributename, DBUS_TYPE_INVALID))
- {
- return droute_invalid_arguments_error (message);
- }
- atr = atk_document_get_attribute_value (document, attributename);
- 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 DBusMessage *
-impl_getAttributes (DBusConnection * bus, DBusMessage * message,
- void *user_data)
-{
- AtkDocument *document = (AtkDocument *) user_data;
- DBusMessage *reply;
- AtkAttributeSet *attributes;
- DBusMessageIter iter;
-
- g_return_val_if_fail (ATK_IS_DOCUMENT (user_data),
- droute_not_yet_handled_error (message));
-
- attributes = atk_document_get_attributes (document);
-
- reply = dbus_message_new_method_return (message);
- if (reply)
- {
- dbus_message_iter_init_append (reply, &iter);
- spi_atk_append_attribute_set (&iter, attributes);
- }
-
- if (attributes)
- atk_attribute_set_free (attributes);
- return reply;
-}
-
-static DRouteMethod methods[] = {
- {impl_getLocale, "getLocale"},
- {impl_getAttributeValue, "getAttributeValue"},
- {impl_getAttributes, "getAttributes"},
- {NULL, NULL}
-};
-
-void
-spi_initialize_document (DRoutePath *path)
-{
- droute_path_add_interface (path,
- SPI_DBUS_INTERFACE_DOCUMENT,
- methods,
- NULL);
-};
diff --git a/atk-adaptor/editabletext-adaptor.c b/atk-adaptor/editabletext-adaptor.c
deleted file mode 100644
index 417b24d5..00000000
--- a/atk-adaptor/editabletext-adaptor.c
+++ /dev/null
@@ -1,219 +0,0 @@
-/*
- * 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.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#include <atk/atk.h>
-#include <droute/droute.h>
-
-#include "spi-common/spi-dbus.h"
-
-static DBusMessage *
-impl_setTextContents (DBusConnection * bus, DBusMessage * message,
- void *user_data)
-{
- AtkEditableText *editable = (AtkEditableText *) user_data;
- const char *newContents;
- dbus_bool_t rv;
- DBusError error;
- DBusMessage *reply;
-
- g_return_val_if_fail (ATK_IS_EDITABLE_TEXT (user_data),
- droute_not_yet_handled_error (message));
- dbus_error_init (&error);
- if (!dbus_message_get_args
- (message, &error, DBUS_TYPE_STRING, &newContents, DBUS_TYPE_INVALID))
- {
- return droute_invalid_arguments_error (message);
- }
- atk_editable_text_set_text_contents (editable, newContents);
- 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 DBusMessage *
-impl_insertText (DBusConnection * bus, DBusMessage * message, void *user_data)
-{
- AtkEditableText *editable = (AtkEditableText *) user_data;
- dbus_int32_t position, length;
- char *text;
- dbus_bool_t rv;
- DBusError error;
- DBusMessage *reply;
- gint ip;
-
- g_return_val_if_fail (ATK_IS_EDITABLE_TEXT (user_data),
- droute_not_yet_handled_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 droute_invalid_arguments_error (message);
- }
- ip = position;
- 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 DBusMessage *
-impl_copyText (DBusConnection * bus, DBusMessage * message, void *user_data)
-{
- AtkEditableText *editable = (AtkEditableText *) user_data;
- dbus_int32_t startPos, endPos;
- DBusError error;
-
- g_return_val_if_fail (ATK_IS_EDITABLE_TEXT (user_data),
- droute_not_yet_handled_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 droute_invalid_arguments_error (message);
- }
- atk_editable_text_copy_text (editable, startPos, endPos);
- return dbus_message_new_method_return (message);
-}
-
-static DBusMessage *
-impl_cutText (DBusConnection * bus, DBusMessage * message, void *user_data)
-{
- AtkEditableText *editable = (AtkEditableText *) user_data;
- dbus_int32_t startPos, endPos;
- DBusError error;
- dbus_bool_t rv;
- DBusMessage *reply;
-
- g_return_val_if_fail (ATK_IS_EDITABLE_TEXT (user_data),
- droute_not_yet_handled_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 droute_invalid_arguments_error (message);
- }
- atk_editable_text_cut_text (editable, startPos, endPos);
- 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 DBusMessage *
-impl_deleteText (DBusConnection * bus, DBusMessage * message, void *user_data)
-{
- AtkEditableText *editable = (AtkEditableText *) user_data;
- dbus_int32_t startPos, endPos;
- DBusError error;
- dbus_bool_t rv;
- DBusMessage *reply;
-
- g_return_val_if_fail (ATK_IS_EDITABLE_TEXT (user_data),
- droute_not_yet_handled_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 droute_invalid_arguments_error (message);
- }
- atk_editable_text_delete_text (editable, startPos, endPos);
- 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 DBusMessage *
-impl_pasteText (DBusConnection * bus, DBusMessage * message, void *user_data)
-{
- AtkEditableText *editable = (AtkEditableText *) user_data;
- dbus_int32_t position;
- DBusError error;
- dbus_bool_t rv;
- DBusMessage *reply;
-
- g_return_val_if_fail (ATK_IS_EDITABLE_TEXT (user_data),
- droute_not_yet_handled_error (message));
- dbus_error_init (&error);
- if (!dbus_message_get_args
- (message, &error, DBUS_TYPE_INT32, &position, DBUS_TYPE_INVALID))
- {
- return droute_invalid_arguments_error (message);
- }
- atk_editable_text_paste_text (editable, position);
- 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[] = {
- {impl_setTextContents, "setTextContents"},
- {impl_insertText, "insertText"},
- {impl_copyText, "copyText"},
- {impl_cutText, "cutText"},
- {impl_deleteText, "deleteText"},
- {impl_pasteText, "pasteText"},
- {NULL, NULL}
-};
-
-void
-spi_initialize_editabletext (DRoutePath *path)
-{
- droute_path_add_interface (path,
- SPI_DBUS_INTERFACE_EDITABLE_TEXT,
- methods,
- NULL);
-};
diff --git a/atk-adaptor/event.c b/atk-adaptor/event.c
deleted file mode 100644
index 3d1250ef..00000000
--- a/atk-adaptor/event.c
+++ /dev/null
@@ -1,810 +0,0 @@
-/*
- * AT-SPI - Assistive Technology Service Provider Interface
- * (Gnome Accessibility Project; http://developer.gnome.org/projects/gap)
- *
- * Copyright 2008, 2009, Codethink Ltd.
- * Copyright 2001, 2002, 2003 Sun Microsystems Inc.,
- * Copyright 2001, 2002, 2003 Ximian, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#include <string.h>
-
-#include <atk/atk.h>
-#include <droute/droute.h>
-
-#include "bridge.h"
-#include "accessible-register.h"
-
-#include "spi-common/spi-dbus.h"
-
-static GArray *listener_ids = NULL;
-
-static gint atk_bridge_key_event_listener_id;
-static gint atk_bridge_focus_tracker_id;
-
-/*---------------------------------------------------------------------------*/
-
-#define ITF_EVENT_OBJECT "org.freedesktop.atspi.Event.Object"
-#define ITF_EVENT_WINDOW "org.freedesktop.atspi.Event.Window"
-#define ITF_EVENT_DOCUMENT "org.freedekstop.atspi.Event.Document"
-#define ITF_EVENT_FOCUS "org.freedesktop.atspi.Event.Focus"
-
-/*---------------------------------------------------------------------------*/
-
-static void
-set_reply (DBusPendingCall *pending, void *user_data)
-{
- void **replyptr = (void **)user_data;
-
- *replyptr = dbus_pending_call_steal_reply (pending);
-}
-
-static DBusMessage *
-send_and_allow_reentry (DBusConnection *bus, DBusMessage *message)
-{
- DBusPendingCall *pending;
- DBusMessage *reply = NULL;
-
- if (!dbus_connection_send_with_reply (bus, message, &pending, -1))
- {
- return NULL;
- }
- dbus_pending_call_set_notify (pending, set_reply, (void *)&reply, NULL);
- while (!reply)
- {
- if (!dbus_connection_read_write_dispatch (bus, -1)) return NULL;
- }
- return reply;
-}
-
-static gboolean
-Accessibility_DeviceEventController_notifyListenersSync(const Accessibility_DeviceEvent *key_event)
-{
- DBusMessage *message;
- DBusError error;
- dbus_bool_t consumed = FALSE;
-
- message =
- dbus_message_new_method_call(SPI_DBUS_NAME_REGISTRY,
- SPI_DBUS_PATH_DEC,
- SPI_DBUS_INTERFACE_DEC,
- "notifyListenersSync");
-
- dbus_error_init(&error);
- if (spi_dbus_marshal_deviceEvent(message, key_event))
- {
- DBusMessage *reply = send_and_allow_reentry (atk_adaptor_app_data->bus, message);
- if (reply)
- {
- DBusError error;
- dbus_error_init(&error);
- dbus_message_get_args(reply, &error, DBUS_TYPE_BOOLEAN, &consumed, DBUS_TYPE_INVALID);
- dbus_message_unref(reply);
- }
- }
- dbus_message_unref(message);
- return consumed;
-}
-
-static void
-spi_init_keystroke_from_atk_key_event (Accessibility_DeviceEvent *keystroke,
- AtkKeyEventStruct *event)
-{
- keystroke->id = (dbus_int32_t) event->keyval;
- keystroke->hw_code = (dbus_int16_t) event->keycode;
- keystroke->timestamp = (dbus_uint32_t) event->timestamp;
- keystroke->modifiers = (dbus_uint16_t) (event->state & 0xFFFF);
- if (event->string)
- {
- gunichar c;
-
- keystroke->event_string = g_strdup (event->string);
- c = g_utf8_get_char_validated (event->string, -1);
- if (c > 0 && g_unichar_isprint (c))
- keystroke->is_text = TRUE;
- else
- keystroke->is_text = FALSE;
- }
- else
- {
- keystroke->event_string = g_strdup ("");
- keystroke->is_text = FALSE;
- }
- switch (event->type)
- {
- case (ATK_KEY_EVENT_PRESS):
- keystroke->type = Accessibility_KEY_PRESSED_EVENT;
- break;
- case (ATK_KEY_EVENT_RELEASE):
- keystroke->type = Accessibility_KEY_RELEASED_EVENT;
- break;
- default:
- keystroke->type = 0;
- break;
- }
-#if 0
- g_print ("key_event type %d; val=%d code=%d modifiers=%x name=%s is_text=%d, time=%lx\n",
- (int) keystroke->type, (int) keystroke->id, (int) keystroke->hw_code,
- (int) keystroke->modifiers,
- keystroke->event_string, (int) keystroke->is_text, (unsigned long) keystroke->timestamp);
-#endif
-}
-
-
-static gint
-spi_atk_bridge_key_listener (AtkKeyEventStruct *event, gpointer data)
-{
- gboolean result;
- Accessibility_DeviceEvent key_event;
-
- spi_init_keystroke_from_atk_key_event (&key_event, event);
-
- result = Accessibility_DeviceEventController_notifyListenersSync (&key_event);
-
- if (key_event.event_string) g_free (key_event.event_string);
-
- return result;
-}
-
-
-/*---------------------------------------------------------------------------*/
-
-/*
- * Emits an AT-SPI event.
- * AT-SPI events names are split into three parts:
- * class:major:minor
- * This is mapped onto D-Bus events as:
- * D-Bus Interface:Signal Name:Detail argument
- *
- * Marshals a basic type into the 'any_data' attribute of
- * the AT-SPI event.
- */
-
-static void
-emit(AtkObject *accessible,
- const char *klass,
- const char *major,
- const char *minor,
- dbus_int32_t detail1,
- dbus_int32_t detail2,
- const char *type,
- const void *val)
-{
- gchar *path;
-
- /* TODO this is a hack, used becuase child-added events are not guaranteed.
- * On recieving an event from a non-registered object we check if it can be safely
- * registered before sending the event.
- */
- path = atk_dbus_object_attempt_registration (accessible);
-
- /* Tough decision here
- * We won't send events from accessible
- * objects that have not yet been added to the accessible tree.
- */
- if (path == NULL)
- {
-#ifdef SPI_ATK_DEBUG
- g_debug ("AT-SPI: Event recieved from non-registered object");
-#endif
- return;
- }
-
- spi_dbus_emit_signal (atk_adaptor_app_data->bus, path, klass, major, minor, detail1, detail2, type, val);
- g_free(path);
-}
-
-/*---------------------------------------------------------------------------*/
-
-/*
- * Emits an AT-SPI event, marshalling a BoundingBox structure into the
- * 'any_data' variant of the event.
- */
-static void
-emit_rect(AtkObject *accessible,
- const char *klass,
- const char *major,
- const char *minor,
- AtkRectangle *rect)
-{
- DBusMessage *sig;
- DBusMessageIter iter, variant, sub;
- gchar *path, *cname, *t;
- dbus_int32_t dummy = 0;
-
- path = atk_dbus_object_to_path (accessible);
-
- /* Tough decision here
- * We won't send events from accessible
- * objects that have not yet been added to the accessible tree.
- */
- if (path == NULL)
- return;
-
- if (!klass) klass = "";
- if (!major) major = "";
- if (!minor) minor = "";
-
- /*
- * This is very annoying, but as '-' isn't a legal signal
- * name in D-Bus (Why not??!?) The names need converting
- * on this side, and again on the client side.
- */
- cname = g_strdup(major);
- while ((t = strchr(cname, '-')) != NULL) *t = '_';
-
- sig = dbus_message_new_signal(path, klass, cname);
- g_free(path);
- g_free(cname);
-
- dbus_message_iter_init_append (sig, &iter);
- dbus_message_iter_append_basic(&iter, DBUS_TYPE_STRING, &minor);
- dbus_message_iter_append_basic (&iter, DBUS_TYPE_INT32, &dummy);
- dbus_message_iter_append_basic (&iter, DBUS_TYPE_INT32, &dummy);
-
- dbus_message_iter_open_container (&iter, DBUS_TYPE_VARIANT, "(iiii)", &variant);
- dbus_message_iter_open_container (&variant, DBUS_TYPE_STRUCT, NULL, &sub);
- dbus_message_iter_append_basic (&sub, DBUS_TYPE_INT32, &(rect->x));
- dbus_message_iter_append_basic (&sub, DBUS_TYPE_INT32, &(rect->y));
- dbus_message_iter_append_basic (&sub, DBUS_TYPE_INT32, &(rect->width));
- dbus_message_iter_append_basic (&sub, DBUS_TYPE_INT32, &(rect->height));
- dbus_message_iter_close_container (&variant, &sub);
- dbus_message_iter_close_container (&iter, &variant);
-
- dbus_connection_send(atk_adaptor_app_data->bus, sig, NULL);
-}
-
-/*---------------------------------------------------------------------------*/
-
-/*
- * The focus listener handles the ATK 'focus' signal and forwards it
- * as the AT-SPI event, 'focus:'
- */
-static void
-focus_tracker (AtkObject *accessible)
-{
- emit(accessible, ITF_EVENT_FOCUS, "focus", "", 0, 0, DBUS_TYPE_INT32_AS_STRING, 0);
-}
-
-/*---------------------------------------------------------------------------*/
-
-#define PCHANGE "property-change"
-
-/*
- * This handler handles the following ATK signals and
- * converts them to AT-SPI events:
- *
- * Gtk:AtkObject:property-change -> object:property-change:(property-name)
- *
- * The property-name is part of the ATK property-change signal.
- */
-static gboolean
-property_event_listener (GSignalInvocationHint *signal_hint,
- guint n_param_values,
- const GValue *param_values,
- gpointer data)
-{
- AtkObject *accessible;
- AtkPropertyValues *values;
-
- const gchar *pname = NULL;
-
- AtkObject *otemp;
- const gchar *stemp;
- gint i;
-
- accessible = g_value_get_object (&param_values[0]);
- values = (AtkPropertyValues*) g_value_get_pointer (&param_values[1]);
-
- pname = values[0].property_name;
- if (strcmp (pname, "accessible-name") == 0 ||
- strcmp (pname, "accessible-description") == 0 ||
- strcmp (pname, "accessible-parent") == 0)
- {
- return TRUE;
- }
-
- /* TODO Could improve this control statement by matching
- * on only the end of the signal names,
- */
- if (strcmp (pname, "accessible-table-summary") == 0)
- {
- otemp = atk_table_get_summary(ATK_TABLE (accessible));
- stemp = atk_dbus_object_to_path (otemp);
- if (stemp != NULL)
- emit(accessible, ITF_EVENT_OBJECT, PCHANGE, pname, 0, 0, DBUS_TYPE_OBJECT_PATH_AS_STRING, stemp);
- }
- else if (strcmp (pname, "accessible-table-column-header") == 0)
- {
- i = g_value_get_int (&(values->new_value));
- otemp = atk_table_get_column_header(ATK_TABLE (accessible), i);
- stemp = atk_dbus_object_to_path (otemp);
- if (stemp != NULL)
- emit(accessible, ITF_EVENT_OBJECT, PCHANGE, pname, 0, 0, DBUS_TYPE_OBJECT_PATH_AS_STRING, stemp);
- }
- else if (strcmp (pname, "accessible-table-row-header") == 0)
- {
- i = g_value_get_int (&(values->new_value));
- otemp = atk_table_get_row_header(ATK_TABLE (accessible), i);
- stemp = atk_dbus_object_to_path (otemp);
- if (stemp != NULL)
- emit(accessible, ITF_EVENT_OBJECT, PCHANGE, pname, 0, 0, DBUS_TYPE_OBJECT_PATH_AS_STRING, stemp);
- }
- else if (strcmp (pname, "accessible-table-row-description") == 0)
- {
- i = g_value_get_int (&(values->new_value));
- stemp = atk_table_get_row_description(ATK_TABLE (accessible), i);
- emit(accessible, ITF_EVENT_OBJECT, PCHANGE, pname, 0, 0, DBUS_TYPE_STRING_AS_STRING, stemp);
- }
- else if (strcmp (pname, "accessible-table-column-description") == 0)
- {
- i = g_value_get_int (&(values->new_value));
- stemp = atk_table_get_column_description(ATK_TABLE (accessible), i);
- emit(accessible, ITF_EVENT_OBJECT, PCHANGE, pname, 0, 0, DBUS_TYPE_STRING_AS_STRING, stemp);
- }
- else if (strcmp (pname, "accessible-table-caption-object") == 0)
- {
- otemp = atk_table_get_caption(ATK_TABLE(accessible));
- stemp = atk_object_get_name(otemp);
- emit(accessible, ITF_EVENT_OBJECT, PCHANGE, pname, 0, 0, DBUS_TYPE_STRING_AS_STRING, stemp);
- }
- else
- {
- emit(accessible, ITF_EVENT_OBJECT, PCHANGE, pname, 0, 0, DBUS_TYPE_INT32_AS_STRING, 0);
- }
- return TRUE;
-}
-
-/*---------------------------------------------------------------------------*/
-
-#define STATE_CHANGED "state-changed"
-
-/*
- * The state event listener handles 'Gtk:AtkObject:state-change' ATK signals
- * and forwards them as object:state-changed:(param-name) AT-SPI events. Where
- * the param-name is part of the ATK state-change signal.
- */
-static gboolean
-state_event_listener (GSignalInvocationHint *signal_hint,
- guint n_param_values,
- const GValue *param_values,
- gpointer data)
-{
- AtkObject *accessible;
- gchar *pname;
- guint detail1;
-
- accessible = ATK_OBJECT(g_value_get_object (&param_values[0]));
- pname = g_strdup (g_value_get_string (&param_values[1]));
-
- /* TODO - Possibly ignore a change to the 'defunct' state.
- * This is because without reference counting defunct objects should be removed.
- */
- detail1 = (g_value_get_boolean (&param_values[2])) ? 1 : 0;
- emit(accessible, ITF_EVENT_OBJECT, STATE_CHANGED, pname, detail1, 0, DBUS_TYPE_INT32_AS_STRING, 0);
- g_free (pname);
- return TRUE;
-}
-
-/*---------------------------------------------------------------------------*/
-
-/*
- * The window event listener handles the following ATK signals and forwards
- * them as AT-SPI events:
- *
- * window:create -> window:create
- * window:destroy -> window:destroy
- * window:minimize -> window:minimize
- * window:maximize -> window:maximize
- * window:activate -> window:activate
- * window:deactivate -> window:deactivate
- */
-static gboolean
-window_event_listener (GSignalInvocationHint *signal_hint,
- guint n_param_values,
- const GValue *param_values,
- gpointer data)
-{
- AtkObject *accessible;
- GSignalQuery signal_query;
- const gchar *name, *s;
-
- g_signal_query (signal_hint->signal_id, &signal_query);
- name = signal_query.signal_name;
-
- accessible = ATK_OBJECT(g_value_get_object(&param_values[0]));
- s = atk_object_get_name (accessible);
- emit(accessible, ITF_EVENT_WINDOW, name, "", 0, 0, DBUS_TYPE_STRING_AS_STRING, s);
-
- return TRUE;
-}
-
-/*---------------------------------------------------------------------------*/
-
-/*
- * The document event listener handles the following ATK signals
- * and converts them to AT-SPI events:
- *
- * Gtk:AtkDocument:load-complete -> document:load-complete
- * Gtk:AtkDocument:load-stopped -> document:load-stopped
- * Gtk:AtkDocument:reload -> document:reload
- */
-static gboolean
-document_event_listener (GSignalInvocationHint *signal_hint,
- guint n_param_values,
- const GValue *param_values,
- gpointer data)
-{
- AtkObject *accessible;
- GSignalQuery signal_query;
- const gchar *name, *s;
-
- g_signal_query (signal_hint->signal_id, &signal_query);
- name = signal_query.signal_name;
-
- accessible = ATK_OBJECT(g_value_get_object(&param_values[0]));
- s = atk_object_get_name (accessible);
- emit(accessible, ITF_EVENT_DOCUMENT, name, "", 0, 0, DBUS_TYPE_STRING_AS_STRING, s);
-
- return TRUE;
-}
-
-/*---------------------------------------------------------------------------*/
-
-/*
- * Signal handler for "Gtk:AtkComponent:bounds-changed". Converts
- * this to an AT-SPI event - "object:bounds-changed".
- */
-static gboolean
-bounds_event_listener (GSignalInvocationHint *signal_hint,
- guint n_param_values,
- const GValue *param_values,
- gpointer data)
-{
- AtkObject *accessible;
- AtkRectangle *atk_rect;
- GSignalQuery signal_query;
- const gchar *name, *s;
-
- g_signal_query (signal_hint->signal_id, &signal_query);
- name = signal_query.signal_name;
-
- accessible = ATK_OBJECT(g_value_get_object(&param_values[0]));
-
- if (G_VALUE_HOLDS_BOXED (param_values + 1))
- atk_rect = g_value_get_boxed (param_values + 1);
-
- emit_rect(accessible, ITF_EVENT_OBJECT, name, "", atk_rect);
- return TRUE;
-}
-
-/*---------------------------------------------------------------------------*/
-
-/*
- * Handles the ATK signal 'Gtk:AtkObject:active-descendant-changed' and
- * converts it to the AT-SPI signal - 'object:active-descendant-changed'.
- *
- */
-static gboolean
-active_descendant_event_listener (GSignalInvocationHint *signal_hint,
- guint n_param_values,
- const GValue *param_values,
- gpointer data)
-{
- AtkObject *accessible;
- AtkObject *child;
- GSignalQuery signal_query;
- const gchar *name, *minor;
- gchar *s;
- gint detail1;
-
- g_signal_query (signal_hint->signal_id, &signal_query);
- name = signal_query.signal_name;
-
- accessible = ATK_OBJECT(g_value_get_object(&param_values[0]));
- child = ATK_OBJECT(g_value_get_pointer (&param_values[1]));
- g_return_val_if_fail (ATK_IS_OBJECT (child), TRUE);
- minor = g_quark_to_string (signal_hint->detail);
-
- detail1 = atk_object_get_index_in_parent (child);
- s = atk_dbus_object_to_path (child);
- if (s == NULL)
- {
- g_free (s);
- return TRUE;
- }
-
- emit(accessible, ITF_EVENT_OBJECT, name, "", detail1, 0, DBUS_TYPE_OBJECT_PATH_AS_STRING, s);
- g_free(s);
- return TRUE;
-}
-
-/*---------------------------------------------------------------------------*/
-
-/*
- * Handles the ATK signal 'Gtk:AtkHypertext:link-selected' and
- * converts it to the AT-SPI signal - 'object:link-selected'
- *
- */
-static gboolean
-link_selected_event_listener (GSignalInvocationHint *signal_hint,
- guint n_param_values,
- const GValue *param_values,
- gpointer data)
-{
- AtkObject *accessible;
- GSignalQuery signal_query;
- const gchar *name, *minor;
- gint detail1;
-
- g_signal_query (signal_hint->signal_id, &signal_query);
- name = signal_query.signal_name;
-
- accessible = ATK_OBJECT(g_value_get_object(&param_values[0]));
- minor = g_quark_to_string (signal_hint->detail);
-
- if (G_VALUE_TYPE (&param_values[1]) == G_TYPE_INT)
- detail1 = g_value_get_int (&param_values[1]);
-
- emit(accessible, ITF_EVENT_OBJECT, name, minor, detail1, 0, DBUS_TYPE_INT32_AS_STRING, 0);
- return TRUE;
-}
-
-/*---------------------------------------------------------------------------*/
-
-/*
- * Handles the ATK signal 'Gtk:AtkText:text-changed' and
- * converts it to the AT-SPI signal - 'object:text-changed'
- *
- */
-static gboolean
-text_changed_event_listener (GSignalInvocationHint *signal_hint,
- guint n_param_values,
- const GValue *param_values,
- gpointer data)
-{
- AtkObject *accessible;
- GSignalQuery signal_query;
- const gchar *name, *minor;
- gchar *selected;
- gint detail1, detail2;
-
- g_signal_query (signal_hint->signal_id, &signal_query);
- name = signal_query.signal_name;
-
- accessible = ATK_OBJECT(g_value_get_object(&param_values[0]));
- minor = g_quark_to_string (signal_hint->detail);
-
- if (G_VALUE_TYPE (&param_values[1]) == G_TYPE_INT)
- detail1 = g_value_get_int (&param_values[1]);
-
- if (G_VALUE_TYPE (&param_values[2]) == G_TYPE_INT)
- detail2 = g_value_get_int (&param_values[2]);
-
- selected = atk_text_get_text (ATK_TEXT (accessible), detail1, detail1+detail2);
-
- emit(accessible, ITF_EVENT_OBJECT, name, minor, detail1, detail2, DBUS_TYPE_STRING_AS_STRING, selected);
- return TRUE;
-}
-
-/*---------------------------------------------------------------------------*/
-
-/*
- * Handles the ATK signal 'Gtk:AtkText:text-selection-changed' and
- * converts it to the AT-SPI signal - 'object:text-selection-changed'
- *
- */
-static gboolean
-text_selection_changed_event_listener (GSignalInvocationHint *signal_hint,
- guint n_param_values,
- const GValue *param_values,
- gpointer data)
-{
- AtkObject *accessible;
- GSignalQuery signal_query;
- const gchar *name, *minor;
- gint detail1, detail2;
-
- g_signal_query (signal_hint->signal_id, &signal_query);
- name = signal_query.signal_name;
-
- accessible = ATK_OBJECT(g_value_get_object(&param_values[0]));
- minor = g_quark_to_string (signal_hint->detail);
-
- if (G_VALUE_TYPE (&param_values[1]) == G_TYPE_INT)
- detail1 = g_value_get_int (&param_values[1]);
-
- if (G_VALUE_TYPE (&param_values[2]) == G_TYPE_INT)
- detail2 = g_value_get_int (&param_values[2]);
-
- emit(accessible, ITF_EVENT_OBJECT, name, minor, detail1, detail2, DBUS_TYPE_STRING_AS_STRING, "");
- return TRUE;
-}
-
-/*---------------------------------------------------------------------------*/
-
-/*
- * Generic signal converter and forwarder.
- *
- * Klass (Interface) org.freedesktop.atspi.Event.Object
- * Major is the signal name.
- * Minor is NULL.
- * detail1 is 0.
- * detail2 is 0.
- * any_data is NULL.
- */
-static gboolean
-generic_event_listener (GSignalInvocationHint *signal_hint,
- guint n_param_values,
- const GValue *param_values,
- gpointer data)
-{
- AtkObject *accessible;
- GSignalQuery signal_query;
- const gchar *name;
-
- g_signal_query (signal_hint->signal_id, &signal_query);
- name = signal_query.signal_name;
-
- accessible = ATK_OBJECT(g_value_get_object(&param_values[0]));
- emit(accessible, ITF_EVENT_OBJECT, name, "", 0, 0, DBUS_TYPE_INT32_AS_STRING, 0);
- return TRUE;
-}
-
-/*---------------------------------------------------------------------------*/
-
-/*
- * Registers the provided function as a handler for the given signal name
- * and stores the signal id returned so that the function may be
- * de-registered later.
- */
-static void
-add_signal_listener (GSignalEmissionHook listener, const char *signal_name)
-{
- guint id;
-
- id = atk_add_global_event_listener (listener, signal_name);
- g_array_append_val (listener_ids, id);
-}
-
-/*
- * Initialization for the signal handlers.
- *
- * Registers all required signal handlers.
- */
-void
-spi_atk_register_event_listeners (void)
-{
- /*
- * Kludge to make sure the Atk interface types are registered, otherwise
- * the AtkText signal handlers below won't get registered
- */
- GObject *ao = g_object_new (ATK_TYPE_OBJECT, NULL);
- AtkObject *bo = atk_no_op_object_new (ao);
-
- g_object_unref (G_OBJECT (bo));
- g_object_unref (ao);
-
- /* Register for focus event notifications, and register app with central registry */
- listener_ids = g_array_sized_new (FALSE, TRUE, sizeof (guint), 16);
-
- atk_bridge_focus_tracker_id = atk_add_focus_tracker (focus_tracker);
-
- add_signal_listener (property_event_listener, "Gtk:AtkObject:property-change");
- add_signal_listener (window_event_listener, "window:create");
- add_signal_listener (window_event_listener, "window:destroy");
- add_signal_listener (window_event_listener, "window:minimize");
- add_signal_listener (window_event_listener, "window:maximize");
- add_signal_listener (window_event_listener, "window:restore");
- add_signal_listener (window_event_listener, "window:activate");
- add_signal_listener (window_event_listener, "window:deactivate");
- add_signal_listener (document_event_listener, "Gtk:AtkDocument:load-complete");
- add_signal_listener (document_event_listener, "Gtk:AtkDocument:reload");
- add_signal_listener (document_event_listener, "Gtk:AtkDocument:load-stopped");
- /* TODO Fake this event on the client side */
- add_signal_listener (state_event_listener, "Gtk:AtkObject:state-change");
- /* TODO */
- add_signal_listener (active_descendant_event_listener, "Gtk:AtkObject:active-descendant-changed");
- add_signal_listener (bounds_event_listener, "Gtk:AtkComponent:bounds-changed");
- add_signal_listener (text_selection_changed_event_listener, "Gtk:AtkText:text-selection-changed");
- add_signal_listener (text_changed_event_listener, "Gtk:AtkText:text-changed");
- add_signal_listener (link_selected_event_listener, "Gtk:AtkHypertext:link-selected");
- add_signal_listener (generic_event_listener, "Gtk:AtkObject:visible-data-changed");
- add_signal_listener (generic_event_listener, "Gtk:AtkSelection:selection-changed");
- add_signal_listener (generic_event_listener, "Gtk:AtkText:text-caret-moved");
- add_signal_listener (generic_event_listener, "Gtk:AtkTable:row-inserted");
- add_signal_listener (generic_event_listener, "Gtk:AtkTable:row-reordered");
- add_signal_listener (generic_event_listener, "Gtk:AtkTable:row-deleted");
- add_signal_listener (generic_event_listener, "Gtk:AtkTable:column-inserted");
- add_signal_listener (generic_event_listener, "Gtk:AtkTable:column-reordered");
- add_signal_listener (generic_event_listener, "Gtk:AtkTable:column-deleted");
- add_signal_listener (generic_event_listener, "Gtk:AtkTable:model-changed");
-
- /*
- * May add the following listeners to implement preemptive key listening for GTK+
- *
- * atk_add_global_event_listener (spi_atk_bridge_widgetkey_listener, "Gtk:GtkWidget:key-press-event");
- * atk_add_global_event_listener (spi_atk_bridge_widgetkey_listener, "Gtk:GtkWidget:key-release-event");
- */
- atk_bridge_key_event_listener_id = atk_add_key_event_listener (spi_atk_bridge_key_listener, NULL);
-}
-
-/*---------------------------------------------------------------------------*/
-
-/*
- * De-registers all ATK signal handlers.
- */
-void
-spi_atk_deregister_event_listeners (void)
-{
- gint i;
- GArray *ids = listener_ids;
- listener_ids = NULL;
-
- if (atk_bridge_focus_tracker_id)
- atk_remove_focus_tracker (atk_bridge_focus_tracker_id);
-
- for (i = 0; ids && i < ids->len; i++)
- {
- atk_remove_global_event_listener (g_array_index (ids, guint, i));
- }
-
- if (atk_bridge_key_event_listener_id)
- atk_remove_key_event_listener (atk_bridge_key_event_listener_id);
-}
-
-/*---------------------------------------------------------------------------*/
-
-/*
- * TODO This function seems out of place here.
- *
- * Emits fake deactivate signals on all top-level windows.
- * Used when shutting down AT-SPI, ensuring that all
- * windows have been removed on the client side.
- */
-void
-spi_atk_tidy_windows (void)
-{
- AtkObject *root;
- gint n_children;
- gint i;
-
- root = atk_get_root ();
- n_children = atk_object_get_n_accessible_children (root);
- for (i = 0; i < n_children; i++)
- {
- AtkObject *child;
- AtkStateSet *stateset;
- const gchar *name;
-
- child = atk_object_ref_accessible_child (root, i);
- stateset = atk_object_ref_state_set (child);
-
- name = atk_object_get_name (child);
- if (atk_state_set_contains_state (stateset, ATK_STATE_ACTIVE))
- {
- emit(child, ITF_EVENT_WINDOW, "deactivate", NULL, 0, 0, DBUS_TYPE_STRING_AS_STRING, name);
- }
- g_object_unref (stateset);
-
- emit(child, ITF_EVENT_WINDOW, "destroy", NULL, 0, 0, DBUS_TYPE_STRING_AS_STRING, name);
- g_object_unref (child);
- }
-}
-
-/*END------------------------------------------------------------------------*/
diff --git a/atk-adaptor/event.h b/atk-adaptor/event.h
deleted file mode 100644
index d62f9ceb..00000000
--- a/atk-adaptor/event.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * AT-SPI - Assistive Technology Service Provider Interface
- * (Gnome Accessibility Project; http://developer.gnome.org/projects/gap)
- *
- * Copyright 2001, 2002 Sun Microsystems Inc.,
- * Copyright 2001, 2002 Ximian, Inc.
- * Copyright 2008, 2009 Codethink Ltd.
- *
- * 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.
- */
-
-#ifndef EVENT_H
-#define EVENT_H
-
-#include <spi-common/spi-types.h>
-
-void spi_atk_register_event_listeners (void);
-void spi_atk_deregister_event_listeners (void);
-void spi_atk_tidy_windows (void);
-
-#endif /* EVENT_H */
diff --git a/atk-adaptor/hyperlink-adaptor.c b/atk-adaptor/hyperlink-adaptor.c
deleted file mode 100644
index 98ae486f..00000000
--- a/atk-adaptor/hyperlink-adaptor.c
+++ /dev/null
@@ -1,150 +0,0 @@
-/*
- * 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.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#include <atk/atk.h>
-#include <droute/droute.h>
-
-#include "accessible-marshaller.h"
-#include "spi-common/spi-dbus.h"
-
-static dbus_bool_t
-impl_get_nAnchors (DBusMessageIter * iter, void *user_data)
-{
- AtkHyperlink *link = (AtkHyperlink *) user_data;
- g_return_val_if_fail (ATK_IS_HYPERLINK (user_data), FALSE);
- return droute_return_v_int32 (iter, atk_hyperlink_get_n_anchors (link));
-}
-
-
-static dbus_bool_t
-impl_get_startIndex (DBusMessageIter * iter,
- void *user_data)
-{
- AtkHyperlink *link = (AtkHyperlink *) user_data;
- g_return_val_if_fail (ATK_IS_HYPERLINK (user_data), FALSE);
- return droute_return_v_int32 (iter, atk_hyperlink_get_start_index (link));
-}
-
-static dbus_bool_t
-impl_get_endIndex (DBusMessageIter * iter, void *user_data)
-{
- AtkHyperlink *link = (AtkHyperlink *) user_data;
- g_return_val_if_fail (ATK_IS_HYPERLINK (user_data), FALSE);
- return droute_return_v_int32 (iter, atk_hyperlink_get_end_index (link));
-}
-
-static DBusMessage *
-impl_getObject (DBusConnection * bus, DBusMessage * message, void *user_data)
-{
- AtkHyperlink *link = (AtkHyperlink *) user_data;
- DBusError error;
- dbus_int32_t i;
- AtkObject *atk_object;
-
- g_return_val_if_fail (ATK_IS_HYPERLINK (user_data),
- droute_not_yet_handled_error (message));
- dbus_error_init (&error);
- if (!dbus_message_get_args
- (message, &error, DBUS_TYPE_INT32, &i, DBUS_TYPE_INVALID))
- {
- return droute_invalid_arguments_error (message);
- }
- atk_object = atk_hyperlink_get_object (link, i);
- return spi_dbus_return_object (message, atk_object, FALSE);
-}
-
-static DBusMessage *
-impl_getURI (DBusConnection * bus, DBusMessage * message, void *user_data)
-{
- AtkHyperlink *link = (AtkHyperlink *) user_data;
- dbus_int32_t i;
- DBusError error;
- gchar *rv;
- DBusMessage *reply;
-
- g_return_val_if_fail (ATK_IS_HYPERLINK (user_data),
- droute_not_yet_handled_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 droute_invalid_arguments_error (message);
- }
-
- 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 DBusMessage *
-impl_isValid (DBusConnection * bus, DBusMessage * message, void *user_data)
-{
- AtkHyperlink *link = (AtkHyperlink *) user_data;
- dbus_bool_t rv;
- DBusMessage *reply;
-
- g_return_val_if_fail (ATK_IS_HYPERLINK (user_data),
- droute_not_yet_handled_error (message));
-
- 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[] = {
- {impl_getObject, "getObject"},
- {impl_getURI, "getURI"},
- {impl_isValid, "isValid"},
- {NULL, NULL}
-};
-
-static DRouteProperty properties[] = {
- {impl_get_nAnchors, NULL, "nAnchors"},
- {impl_get_startIndex, NULL, "startIndex"},
- {impl_get_endIndex, NULL, "endIndex"},
- {NULL, NULL, NULL}
-};
-
-void
-spi_initialize_hyperlink (DRoutePath *path)
-{
- droute_path_add_interface (path,
- SPI_DBUS_INTERFACE_HYPERLINK,
- methods,
- properties);
-};
diff --git a/atk-adaptor/hypertext-adaptor.c b/atk-adaptor/hypertext-adaptor.c
deleted file mode 100644
index 09a6d651..00000000
--- a/atk-adaptor/hypertext-adaptor.c
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- * 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.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#include <atk/atk.h>
-#include <droute/droute.h>
-
-#include "spi-common/spi-dbus.h"
-
-static DBusMessage *
-impl_getNLinks (DBusConnection * bus, DBusMessage * message, void *user_data)
-{
- AtkHypertext *hypertext = (AtkHypertext *) user_data;
- gint rv;
- DBusMessage *reply;
-
- g_return_val_if_fail (ATK_IS_HYPERTEXT (user_data),
- droute_not_yet_handled_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 DBusMessage *
-impl_getLink (DBusConnection * bus, DBusMessage * message, void *user_data)
-{
- AtkHypertext *hypertext = (AtkHypertext *) user_data;
- DBusError error;
- dbus_int32_t linkIndex;
- AtkHyperlink *link;
-
- g_return_val_if_fail (ATK_IS_HYPERTEXT (user_data),
- droute_not_yet_handled_error (message));
- dbus_error_init (&error);
- if (!dbus_message_get_args
- (message, &error, DBUS_TYPE_INT32, &linkIndex, DBUS_TYPE_INVALID))
- {
- return droute_invalid_arguments_error (message);
- }
- link = atk_hypertext_get_link (hypertext, linkIndex);
- return NULL; // TODO
- //return spi_dbus_return_object (message, ATK_OBJECT (link), FALSE);
-}
-
-static DBusMessage *
-impl_getLinkIndex (DBusConnection * bus, DBusMessage * message,
- void *user_data)
-{
- AtkHypertext *hypertext = (AtkHypertext *) user_data;
- DBusError error;
- dbus_int32_t characterIndex;
- dbus_int32_t rv;
- DBusMessage *reply;
-
- g_return_val_if_fail (ATK_IS_HYPERTEXT (user_data),
- droute_not_yet_handled_error (message));
- dbus_error_init (&error);
- if (!dbus_message_get_args
- (message, &error, DBUS_TYPE_INT32, &characterIndex, DBUS_TYPE_INVALID))
- {
- return droute_invalid_arguments_error (message);
- }
- 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[] = {
- {impl_getNLinks, "getNLinks"},
- {impl_getLink, "getLink"},
- {impl_getLinkIndex, "getLinkIndex"},
- {NULL, NULL}
-};
-
-void
-spi_initialize_hypertext (DRoutePath *path)
-{
- droute_path_add_interface (path,
- SPI_DBUS_INTERFACE_HYPERTEXT,
- methods,
- NULL);
-};
diff --git a/atk-adaptor/image-adaptor.c b/atk-adaptor/image-adaptor.c
deleted file mode 100644
index 966ec38a..00000000
--- a/atk-adaptor/image-adaptor.c
+++ /dev/null
@@ -1,145 +0,0 @@
-/*
- * 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.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#include <atk/atk.h>
-#include <droute/droute.h>
-
-#include "spi-common/spi-dbus.h"
-
-static dbus_bool_t
-impl_get_imageDescription (DBusMessageIter * iter,
- void *user_data)
-{
- AtkImage *image = (AtkImage *) user_data;
- g_return_val_if_fail (ATK_IS_IMAGE (user_data), FALSE);
- return droute_return_v_string (iter,
- atk_image_get_image_description (image));
-}
-
-static dbus_bool_t
-impl_get_imageLocale (DBusMessageIter * iter,
- void *user_data)
-{
- AtkImage *image = (AtkImage *) user_data;
- g_return_val_if_fail (ATK_IS_IMAGE (user_data), FALSE);
- return droute_return_v_string (iter, atk_image_get_image_locale (image));
-}
-
-static DBusMessage *
-impl_getImageExtents (DBusConnection * bus, DBusMessage * message,
- void *user_data)
-{
- AtkImage *image = (AtkImage *) user_data;
- DBusError error;
- dbus_uint32_t coordType;
- gint ix, iy, iwidth, iheight;
-
- g_return_val_if_fail (ATK_IS_IMAGE (user_data),
- droute_not_yet_handled_error (message));
- dbus_error_init (&error);
- if (!dbus_message_get_args
- (message, &error, DBUS_TYPE_UINT32, &coordType, DBUS_TYPE_INVALID))
- {
- return droute_invalid_arguments_error (message);
- }
- 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 DBusMessage *
-impl_getImagePosition (DBusConnection * bus, DBusMessage * message,
- void *user_data)
-{
- AtkImage *image = (AtkImage *) user_data;
- DBusError error;
- dbus_uint32_t coord_type;
- gint ix = 0, iy = 0;
- dbus_int32_t x, y;
- DBusMessage *reply;
-
- g_return_val_if_fail (ATK_IS_IMAGE (user_data),
- droute_not_yet_handled_error (message));
- dbus_error_init (&error);
- if (!dbus_message_get_args
- (message, &error, DBUS_TYPE_UINT32, &coord_type, DBUS_TYPE_INVALID))
- {
- return droute_invalid_arguments_error (message);
- }
- atk_image_get_image_position (image, &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;
-}
-
-static DBusMessage *
-impl_getImageSize (DBusConnection * bus, DBusMessage * message,
- void *user_data)
-{
- AtkImage *image = (AtkImage *) user_data;
- gint iwidth = 0, iheight = 0;
- dbus_int32_t width, height;
- DBusMessage *reply;
-
- g_return_val_if_fail (ATK_IS_IMAGE (user_data),
- droute_not_yet_handled_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 DRouteMethod methods[] = {
- {impl_getImageExtents, "getImageExtents"},
- {impl_getImagePosition, "getImagePosition"},
- {impl_getImageSize, "getImageSize"},
- {NULL, NULL}
-};
-
-static DRouteProperty properties[] = {
- {impl_get_imageDescription, NULL, "imageDescription"},
- {impl_get_imageLocale, NULL, "imageLocale"},
- {NULL, NULL, NULL}
-};
-
-void
-spi_initialize_image (DRoutePath *path)
-{
- droute_path_add_interface (path,
- SPI_DBUS_INTERFACE_IMAGE,
- methods,
- properties);
-};
diff --git a/atk-adaptor/relation-adaptor.c b/atk-adaptor/relation-adaptor.c
deleted file mode 100644
index 12edc7a2..00000000
--- a/atk-adaptor/relation-adaptor.c
+++ /dev/null
@@ -1,169 +0,0 @@
-/*
- * AT-SPI - Assistive Technology Service Provider Interface
- * (Gnome Accessibility Project; http://developer.gnome.org/projects/gap)
- *
- * Copyright 2001, 2002 Sun Microsystems Inc.,
- * Copyright 2001, 2002 Ximian, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-/* relation.c : implements the Relation interface */
-
-#include <config.h>
-#include <stdio.h>
-
-#include <atk/atk.h>
-#include <droute/droute.h>
-
-#include "spi-common/spi-types.h"
-#include "spi-common/spi-dbus.h"
-
-static gboolean
-spi_init_relation_type_table (Accessibility_RelationType *types)
-{
- gint i;
-
- for (i = 0; i < ATK_RELATION_LAST_DEFINED; i++)
- types[i] = Accessibility_RELATION_NULL;
-
- types[ATK_RELATION_CONTROLLED_BY] = Accessibility_RELATION_CONTROLLED_BY;
- types[ATK_RELATION_CONTROLLER_FOR] = Accessibility_RELATION_CONTROLLER_FOR;
- types[ATK_RELATION_LABEL_FOR] = Accessibility_RELATION_LABEL_FOR;
- types[ATK_RELATION_LABELLED_BY] = Accessibility_RELATION_LABELLED_BY;
- types[ATK_RELATION_MEMBER_OF] = Accessibility_RELATION_MEMBER_OF;
- types[ATK_RELATION_NODE_CHILD_OF] = Accessibility_RELATION_NODE_CHILD_OF;
- types[ATK_RELATION_FLOWS_TO] = Accessibility_RELATION_FLOWS_TO;
- types[ATK_RELATION_FLOWS_FROM] = Accessibility_RELATION_FLOWS_FROM;
- types[ATK_RELATION_SUBWINDOW_OF] = Accessibility_RELATION_SUBWINDOW_OF;
- types[ATK_RELATION_EMBEDS] = Accessibility_RELATION_EMBEDS;
- types[ATK_RELATION_EMBEDDED_BY] = Accessibility_RELATION_EMBEDDED_BY;
- types[ATK_RELATION_POPUP_FOR] = Accessibility_RELATION_POPUP_FOR;
- types[ATK_RELATION_PARENT_WINDOW_OF] = Accessibility_RELATION_PARENT_WINDOW_OF;
- types[ATK_RELATION_DESCRIPTION_FOR] = Accessibility_RELATION_DESCRIPTION_FOR;
- types[ATK_RELATION_DESCRIBED_BY] = Accessibility_RELATION_DESCRIBED_BY;
-
- return TRUE;
-}
-
-
-
-static Accessibility_RelationType
-spi_relation_type_from_atk_relation_type (AtkRelationType type)
-{
- static gboolean is_initialized = FALSE;
- static Accessibility_RelationType spi_relation_type_table [ATK_RELATION_LAST_DEFINED];
- Accessibility_RelationType spi_type;
-
- if (!is_initialized)
- is_initialized = spi_init_relation_type_table (spi_relation_type_table);
-
- if (type > ATK_RELATION_NULL && type < ATK_RELATION_LAST_DEFINED)
- spi_type = spi_relation_type_table[type];
- else
- spi_type = Accessibility_RELATION_EXTENDED;
- return spi_type;
-}
-
-
-
-static AtkRelation *
-get_relation_from_servant (PortableServer_Servant servant)
-{
- SpiBase *base = SPI_BASE (bonobo_object_from_servant(servant));
-
- g_return_val_if_fail (base, NULL);
- return ATK_RELATION(base->gobj);
-}
-
-
-
-static Accessibility_RelationType
-impl_getRelationType (PortableServer_Servant servant,
- CORBA_Environment * ev)
-{
- AtkRelation *relation = get_relation_from_servant (servant);
- AtkRelationType type;
-
- g_return_val_if_fail (relation != NULL, 0);
- type = atk_relation_get_relation_type (relation);
- return spi_relation_type_from_atk_relation_type (type);
-}
-
-
-static CORBA_short
-impl_getNTargets (PortableServer_Servant servant,
- CORBA_Environment * ev)
-{
- AtkRelation *relation = get_relation_from_servant(servant);
- g_return_val_if_fail (relation != NULL, 0);
-
- return relation->target ? relation->target->len : 0;
-}
-
-
-static CORBA_Object
-impl_getTarget (PortableServer_Servant servant,
- const CORBA_short index,
- CORBA_Environment * ev)
-{
- AtkObject *atk_object;
- AtkRelation *relation = get_relation_from_servant (servant);
- g_return_val_if_fail (relation, NULL);
-
- if (!relation->target ||
- index < 0 ||
- index >= relation->target->len)
- return CORBA_OBJECT_NIL;
-
- atk_object = g_ptr_array_index (relation->target, index);
- if (!atk_object)
- return CORBA_OBJECT_NIL;
-
- return spi_accessible_new_return (atk_object, FALSE, ev);
-}
-
-
-SpiRelation *
-spi_relation_new (AtkRelation *obj)
-{
- SpiRelation *new_relation = g_object_new (SPI_RELATION_TYPE, NULL);
- spi_base_construct (SPI_BASE (new_relation), G_OBJECT (obj));
- return new_relation;
-}
-
-
-static void
-spi_relation_class_init (SpiRelationClass *klass)
-{
- POA_Accessibility_Relation__epv *epv = &klass->epv;
-
- epv->getRelationType = impl_getRelationType;
- epv->getNTargets = impl_getNTargets;
- epv->getTarget = impl_getTarget;
-}
-
-
-static void
-spi_relation_init (SpiRelation *relation)
-{
-}
-
-
-BONOBO_TYPE_FUNC_FULL (SpiRelation,
- Accessibility_Relation,
- SPI_TYPE_BASE,
- spi_relation)
diff --git a/atk-adaptor/selection-adaptor.c b/atk-adaptor/selection-adaptor.c
deleted file mode 100644
index 5e1c4ab9..00000000
--- a/atk-adaptor/selection-adaptor.c
+++ /dev/null
@@ -1,261 +0,0 @@
-/*
- * 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.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#include <atk/atk.h>
-#include <droute/droute.h>
-
-#include "spi-common/spi-dbus.h"
-#include "accessible-marshaller.h"
-
-static dbus_bool_t
-impl_get_nSelectedChildren (DBusMessageIter * iter,
- void *user_data)
-{
- AtkSelection *selection = (AtkSelection *) user_data;
- g_return_val_if_fail (ATK_IS_SELECTION (user_data), FALSE);
- return droute_return_v_int32 (iter,
- atk_selection_get_selection_count
- (selection));
-}
-
-/*static char *
-impl_get_nSelectedChildren_str (void *datum)
-{
- g_return_val_if_fail (ATK_IS_SELECTION (user_data), FALSE);
- return g_strdup_printf ("%d",
- atk_selection_get_selection_count ((AtkSelection *)
- datum));
-}*/
-
-static DBusMessage *
-impl_getSelectedChild (DBusConnection * bus, DBusMessage * message,
- void *user_data)
-{
- AtkSelection *selection = (AtkSelection *) user_data;
- DBusError error;
- dbus_int32_t selectedChildIndex;
- AtkObject *atk_object;
-
- g_return_val_if_fail (ATK_IS_SELECTION (user_data),
- droute_not_yet_handled_error (message));
- dbus_error_init (&error);
- if (!dbus_message_get_args
- (message, &error, DBUS_TYPE_INT32, &selectedChildIndex,
- DBUS_TYPE_INVALID))
- {
- return droute_invalid_arguments_error (message);
- }
- atk_object = atk_selection_ref_selection (selection, selectedChildIndex);
- return spi_dbus_return_object (message, atk_object, TRUE);
-}
-
-static DBusMessage *
-impl_selectChild (DBusConnection * bus, DBusMessage * message,
- void *user_data)
-{
- AtkSelection *selection = (AtkSelection *) user_data;
- DBusError error;
- dbus_int32_t childIndex;
- dbus_bool_t rv;
- DBusMessage *reply;
-
- g_return_val_if_fail (ATK_IS_SELECTION (user_data),
- droute_not_yet_handled_error (message));
- dbus_error_init (&error);
- if (!dbus_message_get_args
- (message, &error, DBUS_TYPE_INT32, &childIndex, DBUS_TYPE_INVALID))
- {
- return droute_invalid_arguments_error (message);
- }
- 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 DBusMessage *
-impl_deselectSelectedChild (DBusConnection * bus, DBusMessage * message,
- void *user_data)
-{
- AtkSelection *selection = (AtkSelection *) user_data;
- DBusError error;
- dbus_int32_t selectedChildIndex;
- dbus_bool_t rv;
- DBusMessage *reply;
-
- g_return_val_if_fail (ATK_IS_SELECTION (user_data),
- droute_not_yet_handled_error (message));
- dbus_error_init (&error);
- if (!dbus_message_get_args
- (message, &error, DBUS_TYPE_INT32, &selectedChildIndex,
- DBUS_TYPE_INVALID))
- {
- return droute_invalid_arguments_error (message);
- }
- rv = atk_selection_remove_selection (selection, selectedChildIndex);
- 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_isChildSelected (DBusConnection * bus, DBusMessage * message,
- void *user_data)
-{
- AtkSelection *selection = (AtkSelection *) user_data;
- DBusError error;
- dbus_int32_t childIndex;
- dbus_bool_t rv;
- DBusMessage *reply;
-
- g_return_val_if_fail (ATK_IS_SELECTION (user_data),
- droute_not_yet_handled_error (message));
- dbus_error_init (&error);
- if (!dbus_message_get_args
- (message, &error, DBUS_TYPE_INT32, &childIndex, DBUS_TYPE_INVALID))
- {
- return droute_invalid_arguments_error (message);
- }
- rv = atk_selection_is_child_selected (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 DBusMessage *
-impl_selectAll (DBusConnection * bus, DBusMessage * message, void *user_data)
-{
- AtkSelection *selection = (AtkSelection *) user_data;
- dbus_bool_t rv;
- DBusMessage *reply;
-
- g_return_val_if_fail (ATK_IS_SELECTION (user_data),
- droute_not_yet_handled_error (message));
- rv = atk_selection_select_all_selection (selection);
- 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_clearSelection (DBusConnection * bus, DBusMessage * message,
- void *user_data)
-{
- AtkSelection *selection = (AtkSelection *) user_data;
- dbus_bool_t rv;
- DBusMessage *reply;
-
- g_return_val_if_fail (ATK_IS_SELECTION (user_data),
- droute_not_yet_handled_error (message));
- rv = atk_selection_clear_selection (selection);
- 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_deselectChild (DBusConnection * bus, DBusMessage * message,
- void *user_data)
-{
- AtkSelection *selection = (AtkSelection *) user_data;
- DBusError error;
- dbus_int32_t selectedChildIndex;
- dbus_bool_t rv = FALSE;
- gint i, nselected;
- DBusMessage *reply;
-
- g_return_val_if_fail (ATK_IS_SELECTION (user_data),
- droute_not_yet_handled_error (message));
- dbus_error_init (&error);
- if (!dbus_message_get_args
- (message, &error, DBUS_TYPE_INT32, &selectedChildIndex,
- DBUS_TYPE_INVALID))
- {
- return droute_invalid_arguments_error (message);
- }
- 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 DRouteMethod methods[] = {
- {impl_getSelectedChild, "getSelectedChild"},
- {impl_selectChild, "selectChild"},
- {impl_deselectSelectedChild, "deselectSelectedChild"},
- {impl_isChildSelected, "isChildSelected"},
- {impl_selectAll, "selectAll"},
- {impl_clearSelection, "clearSelection"},
- {impl_deselectChild, "deselectChild"},
- {NULL, NULL}
-};
-
-static DRouteProperty properties[] = {
- {impl_get_nSelectedChildren, NULL, "nSelectedChildren"},
- {NULL, NULL, NULL}
-};
-
-void
-spi_initialize_selection (DRoutePath *path)
-{
- droute_path_add_interface (path,
- SPI_DBUS_INTERFACE_SELECTION,
- methods,
- properties);
-};
diff --git a/atk-adaptor/streamablecontent-adaptor.c b/atk-adaptor/streamablecontent-adaptor.c
deleted file mode 100644
index 8b3d40b4..00000000
--- a/atk-adaptor/streamablecontent-adaptor.c
+++ /dev/null
@@ -1,316 +0,0 @@
-/*
- * AT-SPI - Assistive Technology Service Provider Interface
- * (Gnome Accessibility Project; http://developer.gnome.org/projects/gap) *
- * Copyright 2001, 2002 Sun Microsystems Inc.,
- * Copyright 2001, 2002 Ximian, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-/* streamablecontent.c : implements the StreamableContent interface */
-
-#include <config.h>
-#include <stdio.h>
-#include <string.h>
-
-#include <libspi/component.h>
-#include <libspi/streamablecontent.h>
-
-/* Our parent Gtk object type */
-#define PARENT_TYPE SPI_TYPE_BASE
-
-/* A pointer to our parent object class */
-static GObjectClass *spi_streamable_parent_class;
-
-#define SPI_CONTENT_STREAM_TYPE (spi_content_stream_get_type ())
-#define SPI_CONTENT_STREAM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SPI_CONTENT_STREAM_TYPE, SpiContentStream))
-#define SPI_CONTENT_STREAM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), SPI_CONTENT_STREAM_TYPE, SpiContentStreamClass))
-#define SPI_IS_CONTENT_STREAM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SPI_CONTENT_STREAM_TYPE))
-#define SPI_IS_CONTENT_STREAM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SPI_CONTENT_STREAM_TYPE))
-
-typedef struct _SpiContentStream SpiContentStream;
-typedef struct _SpiContentStreamClass SpiContentStreamClass;
-
-struct _SpiContentStream {
- BonoboObject parent;
- GIOChannel *gio;
-};
-
-struct _SpiContentStreamClass {
- BonoboObjectClass parent_class;
- POA_Accessibility_ContentStream__epv epv;
-};
-
-GType spi_content_stream_get_type (void);
-
-static SpiContentStream*
-spi_content_stream_new (GIOChannel *gio)
-{
- SpiContentStream *new_stream = g_object_new (SPI_CONTENT_STREAM_TYPE, NULL);
- new_stream->gio = gio;
- return new_stream;
-}
-
-static void
-spi_content_stream_dispose (GObject *o)
-{
- if (SPI_IS_CONTENT_STREAM (o))
- {
- SpiContentStream *stream = SPI_CONTENT_STREAM (o);
- if (stream->gio) g_io_channel_unref (stream->gio);
- }
-}
-
-static CORBA_long
-impl_content_stream_seek (PortableServer_Servant servant,
- const CORBA_long offset,
- const Accessibility_ContentStream_SeekType whence,
- CORBA_Environment *ev)
-{
- SpiContentStream *stream = SPI_CONTENT_STREAM (bonobo_object_from_servant(servant));
- if (stream && stream->gio)
- {
- GError *err;
- GSeekType seektype = G_SEEK_SET;
- switch (whence) {
- case Accessibility_ContentStream_SEEK_CURRENT:
- seektype = G_SEEK_CUR;
- break;
- case Accessibility_ContentStream_SEEK_END:
- seektype = G_SEEK_END;
- break;
- }
- if (g_io_channel_seek_position (stream->gio, (gint64) offset,
- seektype, &err) == G_IO_STATUS_NORMAL)
- return offset;
- else
- return -1;
- }
- else
- return -1;
-}
-
-static CORBA_long
-impl_content_stream_read (PortableServer_Servant servant,
- const CORBA_long count,
- Accessibility_ContentStream_iobuf** buffer,
- CORBA_Environment *ev)
-{
- SpiContentStream *stream = SPI_CONTENT_STREAM (bonobo_object_from_servant(servant));
- CORBA_long realcount = 0;
-
- if (stream && stream->gio)
- {
- gchar *gbuf = NULL;
- GIOStatus status;
- GError *err = NULL;
-
- /* read the giochannel and determine the actual bytes read...*/
- if (count != -1) {
- gbuf = g_malloc (count+1);
- status = g_io_channel_read_chars (stream->gio, gbuf, count, &realcount, &err);
- }
- else
- status = g_io_channel_read_to_end (stream->gio, &gbuf, &realcount, &err);
-
- if (status == G_IO_STATUS_NORMAL || status == G_IO_STATUS_EOF)
- {
- *buffer = Bonobo_Stream_iobuf__alloc ();
- CORBA_sequence_set_release (*buffer, TRUE);
-
- (*buffer)->_buffer = CORBA_sequence_CORBA_octet_allocbuf (realcount);
- (*buffer)->_length = realcount;
-
- g_memmove ((*buffer)->_buffer, gbuf, realcount);
- }
-
- g_free (gbuf);
- }
-
- return realcount;
-}
-
-static void
-impl_content_stream_close (PortableServer_Servant servant,
- CORBA_Environment *ev)
-{
- GIOStatus status;
- GError *err;
- SpiContentStream *stream = SPI_CONTENT_STREAM (bonobo_object_from_servant(servant));
- if (stream && stream->gio) {
- status = g_io_channel_shutdown (stream->gio, TRUE, &err);
- g_io_channel_unref (stream->gio);
- }
- if (err) g_free (err);
-}
-
-static void
-spi_content_stream_class_init (SpiContentStreamClass *klass)
-{
- POA_Accessibility_ContentStream__epv *epv = &klass->epv;
- GObjectClass * object_class = (GObjectClass *) klass;
-
- epv->seek = impl_content_stream_seek;
- epv->read = impl_content_stream_read;
- epv->close = impl_content_stream_close;
-
- object_class->dispose = spi_content_stream_dispose;
-}
-
-
-static void
-spi_content_stream_init (SpiContentStream *stream)
-{
-}
-
-
-BONOBO_TYPE_FUNC_FULL (SpiContentStream,
- Accessibility_ContentStream,
- BONOBO_TYPE_OBJECT,
- spi_content_stream)
-
-static AtkStreamableContent *
-get_streamable_from_servant (PortableServer_Servant servant)
-{
- SpiBase *object = SPI_BASE (bonobo_object_from_servant (servant));
- g_return_val_if_fail (object != NULL, NULL);
- g_return_val_if_fail (ATK_IS_STREAMABLE_CONTENT(object->gobj), NULL);
- return ATK_STREAMABLE_CONTENT (object->gobj);
-}
-
-/*
- * CORBA Accessibility::StreamableContent::getContentTypes method implementation
- */
-static Accessibility_StringSeq*
-impl_accessibility_streamable_get_content_types (PortableServer_Servant servant,
- CORBA_Environment *ev)
-{
- Accessibility_StringSeq *typelist = Accessibility_StringSeq__alloc ();
- AtkStreamableContent *streamable = get_streamable_from_servant (servant);
- int n_types, i;
-
- typelist->_length = typelist->_maximum = 0;
-
- g_return_val_if_fail (streamable != NULL, typelist);
-
- n_types = atk_streamable_content_get_n_mime_types (streamable);
-
- if (n_types)
- {
- typelist->_length = typelist->_maximum = n_types;
- typelist->_buffer = Accessibility_StringSeq_allocbuf (n_types);
- for (i = 0; i < n_types; ++i) {
- const gchar *mimetype = atk_streamable_content_get_mime_type (streamable, i);
- typelist->_buffer[i] = CORBA_string_dup (mimetype ? mimetype : "");
- }
- }
- return typelist;
-}
-
-/*
- * CORBA Accessibility::StreamableContent::getContent method implementation
- */
-static Bonobo_Stream
-impl_accessibility_streamable_get_content (PortableServer_Servant servant,
- const CORBA_char * content_type,
- CORBA_Environment *ev)
-{
- Bonobo_Stream stream;
- AtkStreamableContent *streamable = get_streamable_from_servant (servant);
- GIOChannel *gio;
-
- g_return_val_if_fail (streamable != NULL, NULL);
-
- gio = atk_streamable_content_get_stream (streamable, content_type);
-
- stream = CORBA_OBJECT_NIL; /* deprecated,
- * and it was never implemented,
- * so don't bother fixing this
- */
- return stream;
-}
-
-/*
- * CORBA Accessibility::StreamableContent::getStream method implementation
- */
-static Accessibility_ContentStream
-impl_accessibility_streamable_get_stream (PortableServer_Servant servant,
- const CORBA_char * content_type,
- CORBA_Environment *ev)
-{
- SpiContentStream *stream;
- AtkStreamableContent *streamable = get_streamable_from_servant (servant);
- GIOChannel *gio;
-
- g_return_val_if_fail (streamable != NULL, NULL);
-
- gio = atk_streamable_content_get_stream (streamable, content_type);
-
- stream = spi_content_stream_new (gio);
-
- return bonobo_object_dup_ref (BONOBO_OBJREF (stream), ev);
-}
-
-/*
- * CORBA Accessibility::StreamableContent::getURI method implementation
- */
-static CORBA_string
-impl_accessibility_streamable_get_uri (PortableServer_Servant servant,
- const CORBA_char * content_type,
- CORBA_Environment *ev)
-{
- gchar *uri;
- AtkStreamableContent *streamable = get_streamable_from_servant (servant);
-
- g_return_val_if_fail (streamable != NULL, NULL);
-
- uri = atk_streamable_content_get_uri (streamable, content_type);
-
- return (uri != NULL ? CORBA_string_dup (uri) : CORBA_string_dup (""));
-}
-
-static void
-spi_streamable_class_init (SpiStreamableClass *klass)
-{
- POA_Accessibility_StreamableContent__epv *epv = &klass->epv;
- spi_streamable_parent_class = g_type_class_peek_parent (klass);
-
- epv->getContentTypes = impl_accessibility_streamable_get_content_types;
- epv->getContent = impl_accessibility_streamable_get_content;
- epv->getStream = impl_accessibility_streamable_get_stream;
- epv->getURI = impl_accessibility_streamable_get_uri;
-}
-
-static void
-spi_streamable_init (SpiStreamable *streamable)
-{
-}
-
-
-SpiStreamable *
-spi_streamable_interface_new (AtkObject *o)
-{
- SpiStreamable *retval = g_object_new (SPI_STREAMABLE_TYPE, NULL);
-
- spi_base_construct (SPI_BASE (retval), G_OBJECT(o));
-
- return retval;
-}
-
-BONOBO_TYPE_FUNC_FULL (SpiStreamable,
- Accessibility_StreamableContent,
- PARENT_TYPE,
- spi_streamable)
diff --git a/atk-adaptor/table-adaptor.c b/atk-adaptor/table-adaptor.c
deleted file mode 100644
index 7ba03f24..00000000
--- a/atk-adaptor/table-adaptor.c
+++ /dev/null
@@ -1,692 +0,0 @@
-/*
- * 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.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#include <atk/atk.h>
-#include <droute/droute.h>
-
-#include "accessible-marshaller.h"
-#include "spi-common/spi-dbus.h"
-
-static dbus_bool_t
-impl_get_nRows (DBusMessageIter * iter, void *user_data)
-{
- AtkTable *table = (AtkTable *) user_data;
- g_return_val_if_fail (ATK_IS_TABLE (user_data), FALSE);
- return droute_return_v_int32 (iter, atk_table_get_n_rows (table));
-}
-
-static dbus_bool_t
-impl_get_nColumns (DBusMessageIter * iter, void *user_data)
-{
- AtkTable *table = (AtkTable *) user_data;
- g_return_val_if_fail (ATK_IS_TABLE (user_data), FALSE);
- return droute_return_v_int32 (iter, atk_table_get_n_columns (table));
-}
-
-static dbus_bool_t
-impl_get_caption (DBusMessageIter * iter, void *user_data)
-{
- AtkTable *table = (AtkTable *) user_data;
- g_return_val_if_fail (ATK_IS_TABLE (user_data), FALSE);
- return spi_dbus_return_v_object (iter, atk_table_get_caption (table),
- FALSE);
-}
-
-static dbus_bool_t
-impl_get_summary (DBusMessageIter * iter, void *user_data)
-{
- AtkTable *table = (AtkTable *) user_data;
- g_return_val_if_fail (ATK_IS_TABLE (user_data), FALSE);
- return spi_dbus_return_v_object (iter, atk_table_get_summary (table),
- FALSE);
-}
-
-static dbus_bool_t
-impl_get_nSelectedRows (DBusMessageIter * iter,
- void *user_data)
-{
- AtkTable *table = (AtkTable *) user_data;
- gint *selected_rows = NULL;
- int count;
- g_return_val_if_fail (ATK_IS_TABLE (user_data), 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 dbus_bool_t
-impl_get_nSelectedColumns (DBusMessageIter * iter,
- void *user_data)
-{
- AtkTable *table = (AtkTable *) user_data;
- gint *selected_columns = NULL;
- int count;
- g_return_val_if_fail (ATK_IS_TABLE (user_data), FALSE);
- count = atk_table_get_selected_columns (table, &selected_columns);
- if (selected_columns)
- g_free (selected_columns);
- return droute_return_v_int32 (iter, count);
-}
-
-static DBusMessage *
-impl_getAccessibleAt (DBusConnection * bus, DBusMessage * message,
- void *user_data)
-{
- AtkTable *table = (AtkTable *) user_data;
- dbus_int32_t row, column;
- DBusError error;
- AtkObject *obj;
-
- g_return_val_if_fail (ATK_IS_TABLE (user_data),
- droute_not_yet_handled_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 droute_invalid_arguments_error (message);
- }
- obj = atk_table_ref_at (table, row, column);
- return spi_dbus_return_object (message, obj, TRUE);
-}
-
-static DBusMessage *
-impl_getIndexAt (DBusConnection * bus, DBusMessage * message, void *user_data)
-{
- AtkTable *table = (AtkTable *) user_data;
- dbus_int32_t row, column;
- dbus_int32_t index;
- DBusError error;
- DBusMessage *reply;
-
- g_return_val_if_fail (ATK_IS_TABLE (user_data),
- droute_not_yet_handled_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 droute_invalid_arguments_error (message);
- }
- index = atk_table_get_index_at (table, row, column);
- reply = dbus_message_new_method_return (message);
- if (reply)
- {
- dbus_message_append_args (reply, DBUS_TYPE_INT32, &index,
- DBUS_TYPE_INVALID);
- }
- return reply;
-}
-
-static DBusMessage *
-impl_getRowAtIndex (DBusConnection * bus, DBusMessage * message,
- void *user_data)
-{
- AtkTable *table = (AtkTable *) user_data;
- dbus_int32_t index;
- dbus_int32_t row;
- DBusError error;
- DBusMessage *reply;
-
- g_return_val_if_fail (ATK_IS_TABLE (user_data),
- droute_not_yet_handled_error (message));
- dbus_error_init (&error);
- if (!dbus_message_get_args
- (message, &error, DBUS_TYPE_INT32, &index, DBUS_TYPE_INVALID))
- {
- return droute_invalid_arguments_error (message);
- }
- row = atk_table_get_row_at_index (table, index);
- reply = dbus_message_new_method_return (message);
- if (reply)
- {
- dbus_message_append_args (reply, DBUS_TYPE_INT32, &row,
- DBUS_TYPE_INVALID);
- }
- return reply;
-}
-
-static DBusMessage *
-impl_getColumnAtIndex (DBusConnection * bus, DBusMessage * message,
- void *user_data)
-{
- AtkTable *table = (AtkTable *) user_data;
- dbus_int32_t index;
- dbus_int32_t column;
- DBusError error;
- DBusMessage *reply;
-
- g_return_val_if_fail (ATK_IS_TABLE (user_data),
- droute_not_yet_handled_error (message));
- dbus_error_init (&error);
- if (!dbus_message_get_args
- (message, &error, DBUS_TYPE_INT32, &index, DBUS_TYPE_INVALID))
- {
- return droute_invalid_arguments_error (message);
- }
- 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 DBusMessage *
-impl_getRowDescription (DBusConnection * bus, DBusMessage * message,
- void *user_data)
-{
- dbus_int32_t row;
- AtkTable *table = (AtkTable *) user_data;
- const gchar *description;
- DBusError error;
- DBusMessage *reply;
-
- g_return_val_if_fail (ATK_IS_TABLE (user_data),
- droute_not_yet_handled_error (message));
- dbus_error_init (&error);
- if (!dbus_message_get_args
- (message, &error, DBUS_TYPE_INT32, &row, DBUS_TYPE_INVALID))
- {
- return droute_invalid_arguments_error (message);
- }
- 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 DBusMessage *
-impl_getColumnDescription (DBusConnection * bus, DBusMessage * message,
- void *user_data)
-{
- AtkTable *table = (AtkTable *) user_data;
- dbus_int32_t column;
- const char *description;
- DBusError error;
- DBusMessage *reply;
-
- g_return_val_if_fail (ATK_IS_TABLE (user_data),
- droute_not_yet_handled_error (message));
- dbus_error_init (&error);
- if (!dbus_message_get_args
- (message, &error, DBUS_TYPE_INT32, &column, DBUS_TYPE_INVALID))
- {
- return droute_invalid_arguments_error (message);
- }
- 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 DBusMessage *
-impl_getRowExtentAt (DBusConnection * bus, DBusMessage * message,
- void *user_data)
-{
- AtkTable *table = (AtkTable *) user_data;
- dbus_int32_t row, column;
- dbus_int32_t extent;
- DBusError error;
- DBusMessage *reply;
-
- g_return_val_if_fail (ATK_IS_TABLE (user_data),
- droute_not_yet_handled_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 droute_invalid_arguments_error (message);
- }
- 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 DBusMessage *
-impl_getColumnExtentAt (DBusConnection * bus, DBusMessage * message,
- void *user_data)
-{
- AtkTable *table = (AtkTable *) user_data;
- dbus_int32_t row, column;
- dbus_int32_t extent;
- DBusError error;
- DBusMessage *reply;
-
- g_return_val_if_fail (ATK_IS_TABLE (user_data),
- droute_not_yet_handled_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 droute_invalid_arguments_error (message);
- }
- 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 DBusMessage *
-impl_getRowHeader (DBusConnection * bus, DBusMessage * message,
- void *user_data)
-{
- AtkTable *table = (AtkTable *) user_data;
- dbus_int32_t row;
- DBusError error;
- AtkObject *obj;
-
- g_return_val_if_fail (ATK_IS_TABLE (user_data),
- droute_not_yet_handled_error (message));
- dbus_error_init (&error);
- if (!dbus_message_get_args
- (message, &error, DBUS_TYPE_INT32, &row, DBUS_TYPE_INVALID))
- {
- return droute_invalid_arguments_error (message);
- }
- obj = atk_table_get_row_header (table, row);
- return spi_dbus_return_object (message, obj, FALSE);
-}
-
-static DBusMessage *
-impl_getColumnHeader (DBusConnection * bus, DBusMessage * message,
- void *user_data)
-{
- AtkTable *table = (AtkTable *) user_data;
- dbus_int32_t column;
- DBusError error;
- AtkObject *obj;
-
- g_return_val_if_fail (ATK_IS_TABLE (user_data),
- droute_not_yet_handled_error (message));
- dbus_error_init (&error);
- if (!dbus_message_get_args
- (message, &error, DBUS_TYPE_INT32, &column, DBUS_TYPE_INVALID))
- {
- return droute_invalid_arguments_error (message);
- }
- obj = atk_table_get_column_header (table, column);
- return spi_dbus_return_object (message, obj, FALSE);
-}
-
-static DBusMessage *
-impl_getSelectedRows (DBusConnection * bus, DBusMessage * message,
- void *user_data)
-{
- AtkTable *table = (AtkTable *) user_data;
- gint *selected_rows = NULL;
- gint count;
- DBusMessage *reply;
-
- g_return_val_if_fail (ATK_IS_TABLE (user_data),
- droute_not_yet_handled_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)
- {
- /* 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 (selected_rows)
- g_free (selected_rows);
- return reply;
-}
-
-static DBusMessage *
-impl_getSelectedColumns (DBusConnection * bus, DBusMessage * message,
- void *user_data)
-{
- AtkTable *table = (AtkTable *) user_data;
- gint *selected_columns = NULL;
- gint count;
- DBusMessage *reply;
-
- g_return_val_if_fail (ATK_IS_TABLE (user_data),
- droute_not_yet_handled_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 DBusMessage *
-impl_isRowSelected (DBusConnection * bus, DBusMessage * message,
- void *user_data)
-{
- AtkTable *table = (AtkTable *) user_data;
- dbus_int32_t row;
- DBusError error;
- DBusMessage *reply;
- dbus_bool_t ret;
-
- g_return_val_if_fail (ATK_IS_TABLE (user_data),
- droute_not_yet_handled_error (message));
- dbus_error_init (&error);
- if (!dbus_message_get_args
- (message, &error, DBUS_TYPE_INT32, &row, DBUS_TYPE_INVALID))
- {
- return droute_invalid_arguments_error (message);
- }
- 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 DBusMessage *
-impl_isColumnSelected (DBusConnection * bus, DBusMessage * message,
- void *user_data)
-{
- AtkTable *table = (AtkTable *) user_data;
- dbus_int32_t column;
- DBusError error;
- DBusMessage *reply;
- dbus_bool_t ret;
-
- g_return_val_if_fail (ATK_IS_TABLE (user_data),
- droute_not_yet_handled_error (message));
- dbus_error_init (&error);
- if (!dbus_message_get_args
- (message, &error, DBUS_TYPE_INT32, &column, DBUS_TYPE_INVALID))
- {
- return droute_invalid_arguments_error (message);
- }
- 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 DBusMessage *
-impl_isSelected (DBusConnection * bus, DBusMessage * message, void *user_data)
-{
- AtkTable *table = (AtkTable *) user_data;
- dbus_int32_t row, column;
- DBusError error;
- DBusMessage *reply;
- dbus_bool_t ret;
-
- g_return_val_if_fail (ATK_IS_TABLE (user_data),
- droute_not_yet_handled_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 droute_invalid_arguments_error (message);
- }
- 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 DBusMessage *
-impl_addRowSelection (DBusConnection * bus, DBusMessage * message,
- void *user_data)
-{
- AtkTable *table = (AtkTable *) user_data;
- dbus_int32_t row;
- DBusError error;
- DBusMessage *reply;
- dbus_bool_t ret;
-
- g_return_val_if_fail (ATK_IS_TABLE (user_data),
- droute_not_yet_handled_error (message));
- dbus_error_init (&error);
- if (!dbus_message_get_args
- (message, &error, DBUS_TYPE_INT32, &row, DBUS_TYPE_INVALID))
- {
- return droute_invalid_arguments_error (message);
- }
- 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 DBusMessage *
-impl_addColumnSelection (DBusConnection * bus, DBusMessage * message,
- void *user_data)
-{
- AtkTable *table = (AtkTable *) user_data;
- dbus_int32_t column;
- DBusError error;
- DBusMessage *reply;
- dbus_bool_t ret;
-
- g_return_val_if_fail (ATK_IS_TABLE (user_data),
- droute_not_yet_handled_error (message));
- dbus_error_init (&error);
- if (!dbus_message_get_args
- (message, &error, DBUS_TYPE_INT32, &column, DBUS_TYPE_INVALID))
- {
- return droute_invalid_arguments_error (message);
- }
- 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 DBusMessage *
-impl_removeRowSelection (DBusConnection * bus, DBusMessage * message,
- void *user_data)
-{
- AtkTable *table = (AtkTable *) user_data;
- dbus_int32_t row;
- DBusError error;
- DBusMessage *reply;
- dbus_bool_t ret;
-
- g_return_val_if_fail (ATK_IS_TABLE (user_data),
- droute_not_yet_handled_error (message));
- dbus_error_init (&error);
- if (!dbus_message_get_args
- (message, &error, DBUS_TYPE_INT32, &row, DBUS_TYPE_INVALID))
- {
- return droute_invalid_arguments_error (message);
- }
- 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 DBusMessage *
-impl_removeColumnSelection (DBusConnection * bus, DBusMessage * message,
- void *user_data)
-{
- AtkTable *table = (AtkTable *) user_data;
- dbus_int32_t column;
- DBusError error;
- DBusMessage *reply;
- dbus_bool_t ret;
-
- g_return_val_if_fail (ATK_IS_TABLE (user_data),
- droute_not_yet_handled_error (message));
- dbus_error_init (&error);
- if (!dbus_message_get_args
- (message, &error, DBUS_TYPE_INT32, &column, DBUS_TYPE_INVALID))
- {
- return droute_invalid_arguments_error (message);
- }
- 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 DBusMessage *
-impl_getRowColumnExtentsAtIndex (DBusConnection * bus, DBusMessage * message,
- void *user_data)
-{
- AtkTable *table = (AtkTable *) user_data;
- 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;
-
- AtkObject *cell;
- AtkRole role;
-
- g_return_val_if_fail (ATK_IS_TABLE (user_data),
- droute_not_yet_handled_error (message));
- dbus_error_init (&error);
- if (!dbus_message_get_args
- (message, &error, DBUS_TYPE_INT32, &index, DBUS_TYPE_INVALID))
- {
- return droute_invalid_arguments_error (message);
- }
- 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 DRouteMethod methods[] = {
- {impl_getAccessibleAt, "getAccessibleAt"},
- {impl_getIndexAt, "getIndexAt"},
- {impl_getRowAtIndex, "getRowAtIndex"},
- {impl_getColumnAtIndex, "getColumnAtIndex"},
- {impl_getRowDescription, "getRowDescription"},
- {impl_getColumnDescription, "getColumnDescription"},
- {impl_getRowExtentAt, "getRowExtentAt"},
- {impl_getColumnExtentAt, "getColumnExtentAt"},
- {impl_getRowHeader, "getRowHeader"},
- {impl_getColumnHeader, "getColumnHeader"},
- {impl_getSelectedRows, "getSelectedRows"},
- {impl_getSelectedColumns, "getSelectedColumns"},
- {impl_isRowSelected, "isRowSelected"},
- {impl_isColumnSelected, "isColumnSelected"},
- {impl_isSelected, "isSelected"},
- {impl_addRowSelection, "addRowSelection"},
- {impl_addColumnSelection, "addColumnSelection"},
- {impl_removeRowSelection, "removeRowSelection"},
- {impl_removeColumnSelection, "removeColumnSelection"},
- {impl_getRowColumnExtentsAtIndex, "getRowColumnExtentsAtIndex"},
- {NULL, NULL}
-};
-
-static DRouteProperty properties[] = {
- {impl_get_nRows, NULL, "nRows"},
- {impl_get_nColumns, NULL, "nColumns"},
- {impl_get_caption, NULL, "caption"},
- {impl_get_summary, NULL, "summary"},
- {impl_get_nSelectedRows, NULL, "nSelectedRows"},
- {impl_get_nSelectedColumns, NULL, "nSelectedColumns"},
- {NULL, NULL, NULL}
-};
-
-void
-spi_initialize_table (DRoutePath *path)
-{
- droute_path_add_interface (path,
- SPI_DBUS_INTERFACE_TABLE,
- methods,
- properties);
-};
diff --git a/atk-adaptor/text-adaptor.c b/atk-adaptor/text-adaptor.c
deleted file mode 100644
index 323f687c..00000000
--- a/atk-adaptor/text-adaptor.c
+++ /dev/null
@@ -1,840 +0,0 @@
-/*
- * 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.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#include <string.h>
-
-#include <atk/atk.h>
-#include <droute/droute.h>
-
-#include "spi-common/spi-dbus.h"
-
-static dbus_bool_t
-impl_get_characterCount (DBusMessageIter * iter,
- void *user_data)
-{
- AtkText *text = (AtkText *) user_data;
- g_return_val_if_fail (ATK_IS_TEXT (user_data), FALSE);
- return droute_return_v_int32 (iter, atk_text_get_character_count (text));
-}
-
-static dbus_bool_t
-impl_get_caretOffset (DBusMessageIter * iter,
- void *user_data)
-{
- AtkText *text = (AtkText *) user_data;
- g_return_val_if_fail (ATK_IS_TEXT (user_data), FALSE);
- return droute_return_v_int32 (iter, atk_text_get_caret_offset (text));
-}
-
-static DBusMessage *
-impl_getText (DBusConnection * bus, DBusMessage * message, void *user_data)
-{
- AtkText *text = (AtkText *) user_data;
- dbus_int32_t startOffset, endOffset;
- gchar *txt;
- DBusError error;
- DBusMessage *reply;
-
- g_return_val_if_fail (ATK_IS_TEXT (user_data),
- droute_not_yet_handled_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 droute_invalid_arguments_error (message);
- }
- 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 = (AtkText *) user_data;
- dbus_int32_t offset;
- dbus_bool_t rv;
- DBusError error;
- DBusMessage *reply;
-
- g_return_val_if_fail (ATK_IS_TEXT (user_data),
- droute_not_yet_handled_error (message));
- dbus_error_init (&error);
- if (!dbus_message_get_args
- (message, &error, DBUS_TYPE_INT32, &offset, DBUS_TYPE_INVALID))
- {
- return droute_invalid_arguments_error (message);
- }
- 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 DBusMessage *
-impl_getTextBeforeOffset (DBusConnection * bus, DBusMessage * message,
- void *user_data)
-{
- AtkText *text = (AtkText *) user_data;
- dbus_int32_t offset;
- dbus_uint32_t type;
- gchar *txt;
- dbus_int32_t startOffset, endOffset;
- gint intstart_offset = 0, intend_offset = 0;
- DBusError error;
- DBusMessage *reply;
-
- g_return_val_if_fail (ATK_IS_TEXT (user_data),
- droute_not_yet_handled_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 droute_invalid_arguments_error (message);
- }
- 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_STRING, &txt, DBUS_TYPE_INT32,
- &startOffset, DBUS_TYPE_INT32, &endOffset,
- DBUS_TYPE_INVALID);
- }
- g_free (txt);
- return reply;
-}
-
-static DBusMessage *
-impl_getTextAtOffset (DBusConnection * bus, DBusMessage * message,
- void *user_data)
-{
- AtkText *text = (AtkText *) user_data;
- dbus_int32_t offset, type;
- gchar *txt;
- dbus_int32_t startOffset, endOffset;
- gint intstart_offset = 0, intend_offset = 0;
- DBusError error;
- DBusMessage *reply;
-
- g_return_val_if_fail (ATK_IS_TEXT (user_data),
- droute_not_yet_handled_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 droute_invalid_arguments_error (message);
- }
- 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_STRING, &txt, DBUS_TYPE_INT32,
- &startOffset, DBUS_TYPE_INT32, &endOffset,
- DBUS_TYPE_INVALID);
- }
- g_free (txt);
- return reply;
-}
-
-static DBusMessage *
-impl_getTextAfterOffset (DBusConnection * bus, DBusMessage * message,
- void *user_data)
-{
- AtkText *text = (AtkText *) user_data;
- dbus_int32_t offset;
- dbus_uint32_t type;
- gchar *txt;
- dbus_int32_t startOffset, endOffset;
- gint intstart_offset = 0, intend_offset = 0;
- DBusError error;
- DBusMessage *reply;
-
- g_return_val_if_fail (ATK_IS_TEXT (user_data),
- droute_not_yet_handled_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 droute_invalid_arguments_error (message);
- }
- 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_STRING, &txt, DBUS_TYPE_INT32,
- &startOffset, DBUS_TYPE_INT32, &endOffset,
- DBUS_TYPE_INVALID);
- }
- g_free (txt);
- return reply;
-}
-
-static DBusMessage *
-impl_getCharacterAtOffset (DBusConnection * bus, DBusMessage * message,
- void *user_data)
-{
- AtkText *text = (AtkText *) user_data;
- dbus_int32_t offset;
- dbus_int32_t ch;
- DBusError error;
- DBusMessage *reply;
-
- g_return_val_if_fail (ATK_IS_TEXT (user_data),
- droute_not_yet_handled_error (message));
- dbus_error_init (&error);
- if (!dbus_message_get_args
- (message, &error, DBUS_TYPE_INT32, &offset, DBUS_TYPE_INVALID))
- {
- return droute_invalid_arguments_error (message);
- }
- ch = atk_text_get_character_at_offset (text, offset);
- reply = dbus_message_new_method_return (message);
- if (reply)
- {
- dbus_message_append_args (reply, DBUS_TYPE_INT32, &ch, DBUS_TYPE_INVALID);
- }
- return reply;
-}
-
-static DBusMessage *
-impl_getAttributeValue (DBusConnection * bus, DBusMessage * message,
- void *user_data)
-{
- AtkText *text = (AtkText *) user_data;
- dbus_int32_t offset;
- char *attributeName;
- dbus_int32_t startOffset, endOffset;
- dbus_bool_t defined;
- gint intstart_offset = 0, intend_offset = 0;
- char *rv = NULL;
- DBusError error;
- DBusMessage *reply;
- AtkAttributeSet *set;
- GSList *cur_attr;
- AtkAttribute *at;
-
- g_return_val_if_fail (ATK_IS_TEXT (user_data),
- droute_not_yet_handled_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 droute_invalid_arguments_error (message);
- }
-
- 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_STRING, &rv, DBUS_TYPE_INT32,
- &startOffset, DBUS_TYPE_INT32, &endOffset,
- DBUS_TYPE_BOOLEAN, &defined, DBUS_TYPE_INVALID);
- }
- atk_attribute_set_free (set);
- return reply;
-}
-
-static char *
-_string_from_attribute_set (AtkAttributeSet * set)
-{
- gchar *attributes, *tmp, *tmp2;
- 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) ? "" : " ",
- at->name, at->value,
- (cur_attr->next) ? ";" : "");
- tmp2 = g_strconcat (attributes, tmp, NULL);
- g_free (tmp);
- g_free (attributes);
- attributes = tmp2;
- cur_attr = cur_attr->next;
- }
- return attributes;
-}
-
-static DBusMessage *
-impl_getAttributes (DBusConnection * bus, DBusMessage * message,
- void *user_data)
-{
- AtkText *text = (AtkText *) user_data;
- dbus_int32_t offset;
- dbus_int32_t startOffset, endOffset;
- gint intstart_offset, intend_offset;
- DBusError error;
- DBusMessage *reply;
- AtkAttributeSet *set;
- DBusMessageIter iter;
-
- g_return_val_if_fail (ATK_IS_TEXT (user_data),
- droute_not_yet_handled_error (message));
- dbus_error_init (&error);
- if (!dbus_message_get_args
- (message, &error, DBUS_TYPE_INT32, &offset, DBUS_TYPE_INVALID))
- {
- return droute_invalid_arguments_error (message);
- }
-
- set = atk_text_get_run_attributes (text, offset,
- &intstart_offset, &intend_offset);
-
- startOffset = intstart_offset;
- endOffset = intend_offset;
- reply = dbus_message_new_method_return (message);
- if (reply)
- {
- dbus_message_iter_init_append (reply, &iter);
- spi_atk_append_attribute_set (&iter, set);
- dbus_message_append_args (reply, DBUS_TYPE_INT32, &startOffset,
- DBUS_TYPE_INT32, &endOffset, DBUS_TYPE_INVALID);
- }
- atk_attribute_set_free (set);
- return reply;
-}
-
-static DBusMessage *
-impl_getDefaultAttributes (DBusConnection * bus, DBusMessage * message,
- void *user_data)
-{
- AtkText *text = (AtkText *) user_data;
- DBusError error;
- DBusMessage *reply;
- AtkAttributeSet *set;
- DBusMessageIter iter;
-
- g_return_val_if_fail (ATK_IS_TEXT (user_data),
- droute_not_yet_handled_error (message));
- dbus_error_init (&error);
-
- set = atk_text_get_default_attributes (text);
- reply = dbus_message_new_method_return (message);
- if (reply)
- {
- dbus_message_iter_init_append (reply, &iter);
- spi_atk_append_attribute_set (&iter, set);
- }
- atk_attribute_set_free (set);
- return reply;
-}
-
-static DBusMessage *
-impl_getCharacterExtents (DBusConnection * bus, DBusMessage * message,
- void *user_data)
-{
- AtkText *text = (AtkText *) user_data;
- 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;
-
- g_return_val_if_fail (ATK_IS_TEXT (user_data),
- droute_not_yet_handled_error (message));
- dbus_error_init (&error);
- if (!dbus_message_get_args
- (message, &error, DBUS_TYPE_INT32, &offset, DBUS_TYPE_UINT32, &coordType,
- DBUS_TYPE_INVALID))
- {
- return droute_invalid_arguments_error (message);
- }
- 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 DBusMessage *
-impl_getOffsetAtPoint (DBusConnection * bus, DBusMessage * message,
- void *user_data)
-{
- AtkText *text = (AtkText *) user_data;
- dbus_int32_t x, y;
- dbus_uint32_t coordType;
- dbus_int32_t rv;
- DBusError error;
- DBusMessage *reply;
-
- g_return_val_if_fail (ATK_IS_TEXT (user_data),
- droute_not_yet_handled_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 droute_invalid_arguments_error (message);
- }
- 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 DBusMessage *
-impl_getNSelections (DBusConnection * bus, DBusMessage * message,
- void *user_data)
-{
- AtkText *text = (AtkText *) user_data;
- dbus_int32_t rv;
- DBusMessage *reply;
-
- g_return_val_if_fail (ATK_IS_TEXT (user_data),
- droute_not_yet_handled_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 DBusMessage *
-impl_getSelection (DBusConnection * bus, DBusMessage * message,
- void *user_data)
-{
- AtkText *text = (AtkText *) user_data;
- dbus_int32_t selectionNum;
- dbus_int32_t startOffset, endOffset;
- gint intstart_offset = 0, intend_offset = 0;
- DBusError error;
- DBusMessage *reply;
-
- g_return_val_if_fail (ATK_IS_TEXT (user_data),
- droute_not_yet_handled_error (message));
- dbus_error_init (&error);
- if (!dbus_message_get_args
- (message, &error, DBUS_TYPE_INT32, &selectionNum, DBUS_TYPE_INVALID))
- {
- return droute_invalid_arguments_error (message);
- }
- /* 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 DBusMessage *
-impl_addSelection (DBusConnection * bus, DBusMessage * message,
- void *user_data)
-{
- AtkText *text = (AtkText *) user_data;
- dbus_int32_t startOffset, endOffset;
- dbus_bool_t rv;
- DBusError error;
- DBusMessage *reply;
-
- g_return_val_if_fail (ATK_IS_TEXT (user_data),
- droute_not_yet_handled_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 droute_invalid_arguments_error (message);
- }
- 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 DBusMessage *
-impl_removeSelection (DBusConnection * bus, DBusMessage * message,
- void *user_data)
-{
- AtkText *text = (AtkText *) user_data;
- dbus_int32_t selectionNum;
- dbus_bool_t rv;
- DBusError error;
- DBusMessage *reply;
-
- g_return_val_if_fail (ATK_IS_TEXT (user_data),
- droute_not_yet_handled_error (message));
- dbus_error_init (&error);
- if (!dbus_message_get_args
- (message, &error, DBUS_TYPE_INT32, &selectionNum, DBUS_TYPE_INVALID))
- {
- return droute_invalid_arguments_error (message);
- }
- 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 DBusMessage *
-impl_setSelection (DBusConnection * bus, DBusMessage * message,
- void *user_data)
-{
- AtkText *text = (AtkText *) user_data;
- dbus_int32_t selectionNum, startOffset, endOffset;
- dbus_bool_t rv;
- DBusError error;
- DBusMessage *reply;
-
- g_return_val_if_fail (ATK_IS_TEXT (user_data),
- droute_not_yet_handled_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 droute_invalid_arguments_error (message);
- }
- 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 DBusMessage *
-impl_getRangeExtents (DBusConnection * bus, DBusMessage * message,
- void *user_data)
-{
- AtkText *text = (AtkText *) user_data;
- dbus_int32_t startOffset, endOffset;
- dbus_uint32_t coordType;
- AtkTextRectangle rect;
- dbus_int32_t x, y, width, height;
- DBusError error;
- DBusMessage *reply;
-
- g_return_val_if_fail (ATK_IS_TEXT (user_data),
- droute_not_yet_handled_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 droute_invalid_arguments_error (message);
- }
- 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;
- 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;
-}
-
-#define MAXRANGELEN 512
-
-static DBusMessage *
-impl_getBoundedRanges (DBusConnection * bus, DBusMessage * message,
- void *user_data)
-{
- AtkText *text = (AtkText *) user_data;
- 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;
-
- g_return_val_if_fail (ATK_IS_TEXT (user_data),
- droute_not_yet_handled_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_UINT32,
- &coordType, DBUS_TYPE_UINT32, &xClipType, DBUS_TYPE_UINT32, &yClipType,
- DBUS_TYPE_INVALID))
- {
- return droute_invalid_arguments_error (message);
- }
- 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);
- 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
- (&struc, 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 = (AtkText *) user_data;
- 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;
- DBusMessageIter iter, iterArray;
-
- g_return_val_if_fail (ATK_IS_TEXT (user_data),
- droute_not_yet_handled_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 droute_invalid_arguments_error (message);
- }
-
- attributes =
- atk_text_get_run_attributes (text, offset, &intstart_offset,
- &intend_offset);
-
- reply = dbus_message_new_method_return (message);
- if (!reply)
- return NULL;
-
- dbus_message_iter_init_append (reply, &iter);
- dbus_message_iter_open_container (&iter, DBUS_TYPE_ARRAY, "{ss}", &iterArray);
- spi_atk_append_attribute_set_inner (&iterArray, attributes);
- if (includeDefaults)
- {
- default_attributes = atk_text_get_default_attributes (text);
- spi_atk_append_attribute_set_inner (&iterArray, default_attributes);
- }
- dbus_message_iter_close_container (&iter, &iterArray);
-
- startOffset = intstart_offset;
- endOffset = intend_offset;
- dbus_message_iter_append_basic (&iter, DBUS_TYPE_INT32, &startOffset);
- dbus_message_iter_append_basic (&iter, DBUS_TYPE_INT32, &endOffset);
-
- atk_attribute_set_free (attributes);
- if (default_attributes)
- atk_attribute_set_free (default_attributes);
-
- return reply;
-}
-
-static DBusMessage *
-impl_getDefaultAttributeSet (DBusConnection * bus, DBusMessage * message,
- void *user_data)
-{
- AtkText *text = (AtkText *) user_data;
- DBusMessage *reply;
- DBusMessageIter iter;
- AtkAttributeSet *attributes;
-
- g_return_val_if_fail (ATK_IS_TEXT (user_data),
- droute_not_yet_handled_error (message));
-
- attributes = atk_text_get_default_attributes (text);
-
- reply = dbus_message_new_method_return (message);
- if (reply)
- {
- dbus_message_iter_init_append (reply, &iter);
- spi_atk_append_attribute_set (&iter, attributes);
- }
-
- if (attributes)
- atk_attribute_set_free (attributes);
-
- return reply;
-}
-
-static DRouteMethod methods[] = {
- {impl_getText, "getText"},
- {impl_setCaretOffset, "setCaretOffset"},
- {impl_getTextBeforeOffset, "getTextBeforeOffset"},
- {impl_getTextAtOffset, "getTextAtOffset"},
- {impl_getTextAfterOffset, "getTextAfterOffset"},
- {impl_getCharacterAtOffset, "getCharacterAtOffset"},
- {impl_getAttributeValue, "getAttributeValue"},
- {impl_getAttributes, "getAttributes"},
- {impl_getDefaultAttributes, "getDefaultAttributes"},
- {impl_getCharacterExtents, "getCharacterExtents"},
- {impl_getOffsetAtPoint, "getOffsetAtPoint"},
- {impl_getNSelections, "getNSelections"},
- {impl_getSelection, "getSelection"},
- {impl_addSelection, "addSelection"},
- {impl_removeSelection, "removeSelection"},
- {impl_setSelection, "setSelection"},
- {impl_getRangeExtents, "getRangeExtents"},
- {impl_getBoundedRanges, "getBoundedRanges"},
- {impl_getAttributeRun, "getAttributeRun"},
- {impl_getDefaultAttributeSet, "getDefaultAttributeSet"},
- {NULL, NULL}
-};
-
-static DRouteProperty properties[] = {
- {impl_get_characterCount, NULL, "characterCount"},
- {impl_get_caretOffset, NULL, "caretOffset"},
- {NULL, NULL, NULL}
-};
-
-void
-spi_initialize_text (DRoutePath *path)
-{
- droute_path_add_interface (path,
- SPI_DBUS_INTERFACE_TEXT,
- methods,
- properties);
-};
diff --git a/atk-adaptor/tree-adaptor.c b/atk-adaptor/tree-adaptor.c
deleted file mode 100644
index 78ba624f..00000000
--- a/atk-adaptor/tree-adaptor.c
+++ /dev/null
@@ -1,141 +0,0 @@
-/*
- * 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.
- * Copyright 2008, 2009 Codethink Ltd.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#include <string.h>
-
-#include <atk/atk.h>
-#include <droute/droute.h>
-
-#include "bridge.h"
-#include "accessible-register.h"
-#include "accessible-marshaller.h"
-#include "spi-common/spi-dbus.h"
-
-/*---------------------------------------------------------------------------*/
-
-/* For use as a GHFunc */
-static void
-append_accessible_hf (gpointer key, gpointer obj_data, gpointer iter)
-{
- spi_atk_append_accessible (ATK_OBJECT(obj_data), iter);
-}
-
-/*---------------------------------------------------------------------------*/
-
-void
-spi_emit_cache_removal (guint ref, DBusConnection *bus)
-{
- DBusMessage *message;
- DBusMessageIter iter;
- gchar *path;
-
- message = dbus_message_new_signal ("/org/freedesktop/atspi/tree", SPI_DBUS_INTERFACE_TREE, "removeAccessible");
-
- dbus_message_iter_init_append (message, &iter);
-
- path = atk_dbus_ref_to_path (ref);
- dbus_message_iter_append_basic (&iter, DBUS_TYPE_STRING, &path);
-
- dbus_connection_send(bus, message, NULL);
-}
-
-void
-spi_emit_cache_update (AtkObject *accessible, DBusConnection *bus)
-{
- DBusMessage *message;
- DBusMessageIter iter;
- message = dbus_message_new_signal ("/org/freedesktop/atspi/tree", SPI_DBUS_INTERFACE_TREE, "updateAccessible");
-
- dbus_message_iter_init_append (message, &iter);
- spi_atk_append_accessible (accessible, &iter);
-
- dbus_connection_send(bus, message, NULL);
-}
-
-
-/*---------------------------------------------------------------------------*/
-
-static DBusMessage *
-impl_getRoot (DBusConnection *bus, DBusMessage *message, void *user_data)
-{
- AtkObject *root = atk_get_root();
- char *path;
- DBusMessage *reply;
- gchar *errmsg;
-
- if (!root)
- {
- reply = dbus_message_new_error (message,
- DBUS_ERROR_FAILED,
- "No root accessible available");
- }
- path = atk_dbus_object_to_path (root);
- if (!path)
- {
- reply = dbus_message_new_error (message,
- DBUS_ERROR_FAILED,
- "No root accessible available");
- }
- reply = dbus_message_new_method_return (message);
- dbus_message_append_args (reply, DBUS_TYPE_OBJECT_PATH, &path, DBUS_TYPE_INVALID);
- g_free (path);
- return reply;
-}
-
-/*---------------------------------------------------------------------------*/
-
-static DBusMessage *
-impl_getTree (DBusConnection *bus, DBusMessage *message, void *user_data)
-{
- DBusMessage *reply;
- DBusMessageIter iter, iter_array;
-
- reply = dbus_message_new_method_return (message);
-
- dbus_message_iter_init_append (reply, &iter);
- dbus_message_iter_open_container(&iter, DBUS_TYPE_ARRAY, "(ooaoassusau)", &iter_array);
- atk_dbus_foreach_registered(append_accessible_hf, &iter_array);
- dbus_message_iter_close_container(&iter, &iter_array);
- return reply;
-}
-
-/*---------------------------------------------------------------------------*/
-
-static DRouteMethod methods[] = {
- {impl_getRoot, "getRoot"},
- {impl_getTree, "getTree"},
- {NULL, NULL}
-};
-
-void
-spi_initialize_tree (DRoutePath *path)
-{
- droute_path_add_interface (path,
- SPI_DBUS_INTERFACE_TREE,
- methods,
- NULL);
-};
-
-/*END------------------------------------------------------------------------*/
diff --git a/atk-adaptor/tree-adaptor.h b/atk-adaptor/tree-adaptor.h
deleted file mode 100644
index b0c99df8..00000000
--- a/atk-adaptor/tree-adaptor.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * AT-SPI - Assistive Technology Service Provider Interface
- * (Gnome Accessibility Project; http://developer.gnome.org/projects/gap)
- *
- * Copyright 2001, 2002 Sun Microsystems Inc.,
- * Copyright 2001, 2002 Ximian, Inc.
- * Copyright 2008, 2009 Codethink Ltd.
- *
- * 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.
- */
-
-#ifndef TREE_ADAPTOR_H
-#define TREE_ADAPTOR_H
-
-#include <atk/atk.h>
-#include <dbus/dbus.h>
-
-void
-spi_emit_cache_update (AtkObject *accessible, DBusConnection *bus);
-
-void
-spi_emit_cache_removal (guint ref, DBusConnection *bus);
-
-#endif /* TREE_ADAPTOR_H */
diff --git a/atk-adaptor/value-adaptor.c b/atk-adaptor/value-adaptor.c
deleted file mode 100644
index 68631de9..00000000
--- a/atk-adaptor/value-adaptor.c
+++ /dev/null
@@ -1,182 +0,0 @@
-/*
- * 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.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#include <math.h>
-
-#include <atk/atk.h>
-#include <droute/droute.h>
-
-#include "spi-common/spi-dbus.h"
-
-static dbus_bool_t
-impl_get_minimumValue (DBusMessageIter * iter,
- void *user_data)
-{
- AtkValue *value = (AtkValue *) user_data;
- GValue src = {0};
- GValue dest = {0};
- gdouble dub;
-
- g_return_val_if_fail (ATK_IS_VALUE (user_data), FALSE);
-
- atk_value_get_minimum_value (value, &src);
- g_value_init (&dest, G_TYPE_DOUBLE);
-
- if (g_value_transform (&src, &dest))
- {
- dub = g_value_get_double (&dest);
- return droute_return_v_double (iter, dub);
- }
- else
- {
- return FALSE;
- }
-}
-
-static dbus_bool_t
-impl_get_maximumValue (DBusMessageIter * iter,
- void *user_data)
-{
- AtkValue *value = (AtkValue *) user_data;
- GValue src = {0};
- GValue dest = {0};
- gdouble dub;
-
- g_return_val_if_fail (ATK_IS_VALUE (user_data), FALSE);
-
- atk_value_get_maximum_value (value, &src);
- g_value_init (&dest, G_TYPE_DOUBLE);
-
- if (g_value_transform (&src, &dest))
- {
- dub = g_value_get_double (&dest);
- return droute_return_v_double (iter, dub);
- }
- else
- {
- return FALSE;
- }
-}
-
-static dbus_bool_t
-impl_get_minimumIncrement (DBusMessageIter * iter,
- void *user_data)
-{
- AtkValue *value = (AtkValue *) user_data;
- GValue src = {0};
- GValue dest = {0};
- gdouble dub;
-
- g_return_val_if_fail (ATK_IS_VALUE (user_data), FALSE);
-
- atk_value_get_minimum_increment (value, &src);
- g_value_init (&dest, G_TYPE_DOUBLE);
-
- if (g_value_transform (&src, &dest))
- {
- dub = g_value_get_double (&dest);
- return droute_return_v_double (iter, dub);
- }
- else
- {
- return FALSE;
- }
-}
-
-static dbus_bool_t
-impl_get_currentValue (DBusMessageIter * iter,
- void *user_data)
-{
- AtkValue *value = (AtkValue *) user_data;
- GValue src = {0};
- GValue dest = {0};
- gdouble dub;
-
- g_return_val_if_fail (ATK_IS_VALUE (user_data), FALSE);
-
- atk_value_get_current_value (value, &src);
- g_value_init (&dest, G_TYPE_DOUBLE);
-
- if (g_value_transform (&src, &dest))
- {
- dub = g_value_get_double (&dest);
- return droute_return_v_double (iter, dub);
- }
- else
- {
- return FALSE;
- }
-}
-
-static dbus_bool_t
-impl_set_currentValue (DBusMessageIter * iter,
- void *user_data)
-{
- AtkValue *value = (AtkValue *) user_data;
- GValue src = {0};
- GValue dest = {0};
- gdouble dub;
- DBusMessageIter iter_variant;
-
- g_return_val_if_fail (ATK_IS_VALUE (user_data), FALSE);
-
- dbus_message_iter_recurse (iter, &iter_variant);
- if (dbus_message_iter_get_arg_type (&iter_variant) != DBUS_TYPE_DOUBLE)
- {
- G_WARNING ("TODO: Support setting value from a non-double");
- return FALSE;
- }
- dbus_message_iter_get_basic (&iter_variant, &dub);
- g_value_init (&src, G_TYPE_DOUBLE);
- g_value_set_double (&src, dub);
-
- atk_value_get_current_value (value, &dest);
-
- if (g_value_transform (&src, &dest))
- {
- atk_value_set_current_value (value, &dest);
- return TRUE;
- }
- else
- {
- return FALSE;
- }
-}
-
-static DRouteProperty properties[] = {
- {impl_get_minimumValue, NULL, "minimumValue"},
- {impl_get_maximumValue, NULL, "maximumValue"},
- {impl_get_minimumIncrement, NULL, "minimumIncrement"},
- {impl_get_currentValue, impl_set_currentValue, "currentValue"},
- {NULL, NULL, NULL}
-};
-
-void
-spi_initialize_value (DRoutePath *path)
-{
- droute_path_add_interface (path,
- SPI_DBUS_INTERFACE_VALUE,
- NULL,
- properties);
-};
diff --git a/configure.ac b/configure.ac
index d56aeffe..69c38da2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,21 +1,20 @@
-
-AC_INIT([at-spi], [1.9.0], [accessibility-atspi@lists.linux-foundation.org])
+AC_INIT([at-spi-core], [1.9.0], [accessibility-atspi@lists.linux-foundation.org])
AC_CONFIG_AUX_DIR(config)
-AT_SPI_MAJOR_VERSION=1
-AT_SPI_MINOR_VERSION=23
-AT_SPI_MICRO_VERSION=3
-AT_SPI_INTERFACE_AGE=0
-AT_SPI_BINARY_AGE=0
-AT_SPI_VERSION="$AT_SPI_MAJOR_VERSION.$AT_SPI_MINOR_VERSION.$AT_SPI_MICRO_VERSION"
-AC_SUBST(AT_SPI_MAJOR_VERSION)
-AC_SUBST(AT_SPI_MINOR_VERSION)
-AC_SUBST(AT_SPI_MICRO_VERSION)
-AC_SUBST(AT_SPI_INTERFACE_AGE)
-AC_SUBST(AT_SPI_BINARY_AGE)
+AT_SPI_CORE_MAJOR_VERSION=1
+AT_SPI_CORE_MINOR_VERSION=23
+AT_SPI_CORE_MICRO_VERSION=3
+AT_SPI_CORE_INTERFACE_AGE=0
+AT_SPI_CORE_BINARY_AGE=0
+AT_SPI_CORE_VERSION="$AT_SPI_CORE_MAJOR_VERSION.$AT_SPI_CORE_MINOR_VERSION.$AT_SPI_CORE_MICRO_VERSION"
+AC_SUBST(AT_SPI_CORE_MAJOR_VERSION)
+AC_SUBST(AT_SPI_CORE_MINOR_VERSION)
+AC_SUBST(AT_SPI_CORE_MICRO_VERSION)
+AC_SUBST(AT_SPI_CORE_INTERFACE_AGE)
+AC_SUBST(AT_SPI_CORE_BINARY_AGE)
# libtool versioning
-LT_RELEASE=$AT_SPI_MAJOR_VERSION.$AT_SPI_MINOR_VERSION
+LT_RELEASE=$AT_SPI_CORE_MAJOR_VERSION.$AT_SPI_CORE_MINOR_VERSION
LT_CURRENT=10
LT_REVISION=11
LT_AGE=10
@@ -28,9 +27,6 @@ AC_SUBST(LT_AGE)
AM_INIT_AUTOMAKE([-Wall foreign])
-dnl translation of any at-spi strings: used only for .server
-dnl IT_PROG_INTLTOOL([0.35.0])
-
AC_PROG_CC
AM_PATH_PYTHON(2.4)
AM_DISABLE_STATIC
@@ -61,10 +57,6 @@ PKG_CHECK_MODULES(DBUS_GLIB, [dbus-glib-1 >= 0.7.0])
AC_SUBST(DBUS_GLIB_LIBS)
AC_SUBST(DBUS_GLIB_CFLAGS)
-PKG_CHECK_MODULES(LIB_XML, [libxml-2.0 >= 2.0.0])
-AC_SUBST(LIB_XML_LIBS)
-AC_SUBST(LIB_XML_CFLAGS)
-
PKG_CHECK_MODULES(GOBJ, [gobject-2.0 >= 2.0.0])
AC_SUBST(GOBJ_LIBS)
AC_SUBST(GOBJ_CFLAGS)
@@ -73,14 +65,6 @@ PKG_CHECK_MODULES(GMODULE, [gmodule-2.0 >= 2.0.0])
AC_SUBST(GMODULE_LIBS)
AC_SUBST(GMODULE_CFLAGS)
-PKG_CHECK_MODULES(ATK, [atk >= 1.17.0])
-AC_SUBST(ATK_LIBS)
-AC_SUBST(ATK_CFLAGS)
-
-PKG_CHECK_MODULES(GTK, [gtk+-2.0 >= 2.10.0])
-AC_SUBST(GTK_LIBS)
-AC_SUBST(GTK_CFLAGS)
-
PKG_CHECK_MODULES(GDK, [gdk-2.0 >= 2.0.0])
AC_SUBST(GDK_LIBS)
AC_SUBST(GDK_CFLAGS)
@@ -147,12 +131,6 @@ if test -z "$DEFAULT_ATSPI_INTROSPECTION_PATH"; then
DEFAULT_ATSPI_INTROSPECTION_PATH=dbus
fi
-AC_ARG_VAR([GTK_MODULE_DIR],
- [Where to place the atk-adaptor gtk module])
-if test -z "$GTK_MODULE_DIR"; then
- GTK_MODULE_DIR=gtk-2.0/modules
-fi
-
dnl find sizes & alignments
orig_CPPFLAGS=$CPPFLAGS
CPPFLAGS="$CPPFLAGS $DBUS_CFLAGS"
@@ -166,32 +144,15 @@ DBIND_CHECK_ALIGNOF(dbind_pointer)
DBIND_CHECK_ALIGNOF(dbind_struct)
CPPFLAGS=$orig_CPPFLAGS
-#libtool option to strip symbols starting with cspi
-#
-LIBTOOL_EXPORT_OPTIONS='-export-symbols-regex "^[[^cspi]].*"'
AC_SUBST(LIBTOOL_EXPORT_OPTIONS)
AC_CONFIG_FILES([Makefile
- libloginhelper-1.0.pc
- cspi-1.0.pc
- cspi-1.0-uninstalled.pc
xml/Makefile
- tests/Makefile
tools/Makefile
droute/Makefile
spi-common/Makefile
registryd/Makefile
- atk-adaptor/Makefile
- login-helper/Makefile
- tests/dummyatk/Makefile
- tests/data/Makefile
- tests/pyatspi/Makefile
- tests/pyatspi/pasytest/Makefile
- tests/apps/Makefile
- tests/cspi/Makefile
dbind/Makefile
- cspi/Makefile
- pyatspi/Makefile
- dbind-config.h])
+ dbind/dbind-config.h])
AC_OUTPUT
diff --git a/cspi-1.0-uninstalled.pc.in b/cspi-1.0-uninstalled.pc.in
deleted file mode 100644
index ea8fe1ad..00000000
--- a/cspi-1.0-uninstalled.pc.in
+++ /dev/null
@@ -1,8 +0,0 @@
-idldir=${pc_top_builddir}/${pcfiledir}/idl
-
-Name: cspi (Uninstalled)
-Description: Accessibility Technology software simple client library
-Requires: libspi-1.0
-Version: @VERSION@
-Libs: ${pc_top_builddir}/${pcfiledir}/cspi/libcspi.la
-Cflags: -I${pc_top_builddir}/${pcfiledir} @X_CFLAGS@
diff --git a/cspi-1.0.pc.in b/cspi-1.0.pc.in
deleted file mode 100644
index c6b3320a..00000000
--- a/cspi-1.0.pc.in
+++ /dev/null
@@ -1,11 +0,0 @@
-prefix=@prefix@
-exec_prefix=@exec_prefix@
-libdir=@libdir@
-includedir=@includedir@
-
-Name: cspi
-Description: Accessibility Technology software simple client library
-Requires: libspi-1.0
-Version: @VERSION@
-Libs: -L${libdir} -lcspi
-Cflags: -I${includedir}/at-spi-1.0 @X_CFLAGS@
diff --git a/cspi/Makefile.am b/cspi/Makefile.am
deleted file mode 100644
index 1cb9033a..00000000
--- a/cspi/Makefile.am
+++ /dev/null
@@ -1,42 +0,0 @@
-lib_LTLIBRARIES = libcspi.la
-
-libcspi_la_LDFLAGS = @LDFLAGS@ @LT_VERSION_INFO@ @LIBTOOL_EXPORT_OPTIONS@ -no-undefined
-
-libcspi_la_CFLAGS = $(DBUS_GLIB_CFLAGS) $(ATK_CFLAGS) -I$(top_srcdir)
-
-LDADD = $(DBUS_GLIB_LIBS) \
- $(top_builddir)/spi-common/libspicommon.la
-
-libcspidir = $(includedir)/at-spi-1.0/cspi
-libcspi_HEADERS = \
- spi.h \
- spi-impl.h \
- spi-listener.h \
- spi-roletypes.h \
- spi-statetypes.h
-
-libcspi_la_SOURCES = \
- cspi-lowlevel.h \
- spi-accessible.c \
- spi-action.c \
- spi-application.c \
- spi-component.c \
- spi-editabletext.c \
- spi-event.c \
- spi-hyperlink.c \
- spi-hypertext.c \
- spi-image.c \
- spi-listener.c \
- spi-main.c \
- spi-registry.c \
- spi-selection.c \
- spi-streamablecontent.c \
- spi-table.c \
- spi-text.c \
- spi-value.c \
- spi-private.h
-
-libcspi_la_LIBADD = \
- $(top_builddir)/spi-common/libspicommon.la \
- $(top_builddir)/dbind/libdbind.la\
- $(LIBCSPI_LIBS) $(X_LIBS)
diff --git a/cspi/cspi-lowlevel.h b/cspi/cspi-lowlevel.h
deleted file mode 100644
index 9cbde8fd..00000000
--- a/cspi/cspi-lowlevel.h
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * AT-SPI - Assistive Technology Service Provider Interface
- * (Gnome Accessibility Project; http://developer.gnome.org/projects/gap)
- *
- * Copyright 2002 Ximian, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifndef _SPI_LOWLEVEL_H_
-#define _SPI_LOWLEVEL_H_
-
-/*
- * Private internal - details of the lowlevel at-spi
- * implementation abstraction
- */
-
-#include "cspi/spi-private.h"
-
-SPIBoolean cspi_check_ev (const char *error_string);
-char *cspi_exception_get_text (void);
-void cspi_main (void);
-void cspi_main_quit (void);
-
-/* Listener bits */
-
-gpointer cspi_event_listener_new (void);
-void cspi_event_listener_unref (AccessibleEventListener *listener);
-char *cspi_device_listener_get_path (CSpiDeviceListener *listener);
-void cspi_event_listener_add_cb (AccessibleEventListener *listener,
- AccessibleEventListenerCB callback,
- void *user_data);
-void cspi_event_listener_remove_cb (AccessibleEventListener *listener,
- AccessibleEventListenerCB callback);
-gpointer cspi_keystroke_listener_new (void);
-void cspi_keystroke_listener_unref (AccessibleKeystrokeListener *listener);
-char *cspi_keystroke_listener_get_path (AccessibleKeystrokeListener *listener);
-void cspi_keystroke_listener_add_cb (AccessibleKeystrokeListener *listener,
- AccessibleKeystrokeListenerCB callback,
- void *user_data);
-void cspi_keystroke_listener_remove_cb (AccessibleKeystrokeListener *listener,
- AccessibleKeystrokeListenerCB callback);
-
-void cspi_dispatch_event (AccessibleEvent *e);
-DBusHandlerResult cspi_dbus_handle_event (DBusConnection *bus, DBusMessage *message, void *user_data);
-DBusHandlerResult cspi_dbus_handle_deviceEvent (DBusConnection *bus, DBusMessage *message, void *user_data);
-
-Accessible *cspi_ref_accessible (const char *app, const char *path);
-Accessible *cspi_ref_related_accessible (Accessible *obj, const char *path);
-
-dbus_bool_t cspi_dbus_call (Accessible *obj, const char *interface, const char *method, DBusError *error, const char *type, ...);
-dbus_bool_t cspi_dbus_get_property (Accessible *obj, const char *interface, const char *name, DBusError *error, const char *type, void *data);
-
-extern const char *spi_bus_registry;
-extern const char *spi_interface_accessible;
-extern const char *spi_interface_action;
-extern const char *spi_interface_application;
-extern const char *spi_interface_component;
-extern const char *spi_interface_dec;
-extern const char *spi_interface_desktop;
-extern const char *spi_interface_device_event_listener;
-extern const char *spi_interface_document;
-extern const char *spi_interface_editable_text;
-extern const char *spi_interface_hyperlink;
-extern const char *spi_interface_hypertext;
-extern const char *spi_interface_image;
-extern const char *spi_interface_registry;
-extern const char *spi_interface_selection;
-extern const char *spi_interface_table;
-extern const char *spi_interface_text;
-extern const char *spi_interface_tree;
-extern const char *spi_interface_value;
-extern const char *spi_path_dec;
-extern const char *spi_path_registry;
-
-#endif /* _SPI_LOWLEVEL_H_ */
diff --git a/cspi/spi-accessible.c b/cspi/spi-accessible.c
deleted file mode 100644
index 345be4f8..00000000
--- a/cspi/spi-accessible.c
+++ /dev/null
@@ -1,1462 +0,0 @@
-/*
- * AT-SPI - Assistive Technology Service Provider Interface
- * (Gnome Accessibility Project; http://developer.gnome.org/projects/gap)
- *
- * Copyright 2001, 2002 Sun Microsystems Inc.,
- * Copyright 2001, 2002 Ximian, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#include <stdlib.h> /* for malloc */
-#include "spi-common/spi-stateset.h"
-#include <cspi/spi-private.h>
-
-static const char *role_names [] =
-{
- "invalid",
- "accel-label",
- "alert",
- "animation",
- "arrow",
- "calendar",
- "canvas",
- "check-box",
- "check-menu-item",
- "color-chooser",
- "column-header",
- "combo-box",
- "date-editor",
- "desktop-icon",
- "desktop-frame",
- "dial",
- "dialog",
- "directory-pane",
- "drawing-area",
- "file-chooser",
- "filler",
- "font-chooser",
- "frame",
- "glass-pane",
- "html-container",
- "icon",
- "image",
- "internalframe",
- "label",
- "layered-pane",
- "list",
- "list-item",
- "menu",
- "menu-bar",
- "menu-item",
- "option-pane",
- "page-tab",
- "page-tab-list",
- "panel",
- "password-text",
- "popup-menu",
- "progress-bar",
- "push-button",
- "radio-button",
- "radio-menu-item",
- "root-pane",
- "row-header",
- "scroll-bar",
- "scroll-pane",
- "separator",
- "slider",
- "spin-button",
- "split-pane",
- "statusbar",
- "table",
- "table-cell",
- "table-column-header",
- "table-row-header",
- "tear-off-menu-item",
- "terminal",
- "text",
- "toggle-button",
- "tool-bar",
- "tool-tip",
- "tree",
- "tree-table",
- "unknown",
- "viewport",
- "window",
- NULL,
- "header",
- "fooler",
- "paragraph",
- "ruler",
- "application",
- "autocomplete",
- "editbar",
- "embedded",
- "entry",
- "chart",
- "caption",
- "document_frame",
- "heading",
- "page",
- "section",
- "form",
- "redundant object",
- "link",
- "input method window"
-};
-
-#define MAX_ROLES (sizeof (role_names) / sizeof (char *))
-
-static SPIBoolean
-cspi_init_role_table (AccessibleRole *role_table)
-{
- int i;
- for (i = 0; i < Accessibility_ROLE_LAST_DEFINED; ++i)
- {
- role_table [i] = SPI_ROLE_UNKNOWN;
- }
- role_table [Accessibility_ROLE_INVALID] = SPI_ROLE_INVALID;
- role_table [Accessibility_ROLE_ACCELERATOR_LABEL] = SPI_ROLE_ACCEL_LABEL;
- role_table [Accessibility_ROLE_ALERT] = SPI_ROLE_ALERT;
- role_table [Accessibility_ROLE_ANIMATION] = SPI_ROLE_ANIMATION;
- role_table [Accessibility_ROLE_ARROW] = SPI_ROLE_ARROW;
- role_table [Accessibility_ROLE_CALENDAR] = SPI_ROLE_CALENDAR;
- role_table [Accessibility_ROLE_CANVAS] = SPI_ROLE_CANVAS;
- role_table [Accessibility_ROLE_CHECK_BOX] = SPI_ROLE_CHECK_BOX;
- role_table [Accessibility_ROLE_CHECK_MENU_ITEM] = SPI_ROLE_CHECK_MENU_ITEM;
- role_table [Accessibility_ROLE_COLOR_CHOOSER] = SPI_ROLE_COLOR_CHOOSER;
- role_table [Accessibility_ROLE_COLUMN_HEADER] = SPI_ROLE_COLUMN_HEADER;
- role_table [Accessibility_ROLE_COMBO_BOX] = SPI_ROLE_COMBO_BOX;
- role_table [Accessibility_ROLE_DATE_EDITOR] = SPI_ROLE_DATE_EDITOR;
- role_table [Accessibility_ROLE_DESKTOP_ICON] = SPI_ROLE_DESKTOP_ICON;
- role_table [Accessibility_ROLE_DESKTOP_FRAME] = SPI_ROLE_DESKTOP_FRAME;
- role_table [Accessibility_ROLE_DIAL] = SPI_ROLE_DIAL;
- role_table [Accessibility_ROLE_DIALOG] = SPI_ROLE_DIALOG;
- role_table [Accessibility_ROLE_DIRECTORY_PANE] = SPI_ROLE_DIRECTORY_PANE;
- role_table [Accessibility_ROLE_DRAWING_AREA] = SPI_ROLE_DRAWING_AREA;
- role_table [Accessibility_ROLE_FILE_CHOOSER] = SPI_ROLE_FILE_CHOOSER;
- role_table [Accessibility_ROLE_FILLER] = SPI_ROLE_FILLER;
- role_table [Accessibility_ROLE_FONT_CHOOSER] = SPI_ROLE_FONT_CHOOSER;
- role_table [Accessibility_ROLE_FRAME] = SPI_ROLE_FRAME;
- role_table [Accessibility_ROLE_GLASS_PANE] = SPI_ROLE_GLASS_PANE;
- role_table [Accessibility_ROLE_HTML_CONTAINER] = SPI_ROLE_HTML_CONTAINER;
- role_table [Accessibility_ROLE_ICON] = SPI_ROLE_ICON;
- role_table [Accessibility_ROLE_IMAGE] = SPI_ROLE_IMAGE;
- role_table [Accessibility_ROLE_INTERNAL_FRAME] = SPI_ROLE_INTERNAL_FRAME;
- role_table [Accessibility_ROLE_LABEL] = SPI_ROLE_LABEL;
- role_table [Accessibility_ROLE_LAYERED_PANE] = SPI_ROLE_LAYERED_PANE;
- role_table [Accessibility_ROLE_LIST] = SPI_ROLE_LIST;
- role_table [Accessibility_ROLE_LIST_ITEM] = SPI_ROLE_LIST_ITEM;
- role_table [Accessibility_ROLE_MENU] = SPI_ROLE_MENU;
- role_table [Accessibility_ROLE_MENU_BAR] = SPI_ROLE_MENU_BAR;
- role_table [Accessibility_ROLE_MENU_ITEM] = SPI_ROLE_MENU_ITEM;
- role_table [Accessibility_ROLE_OPTION_PANE] = SPI_ROLE_OPTION_PANE;
- role_table [Accessibility_ROLE_PAGE_TAB] = SPI_ROLE_PAGE_TAB;
- role_table [Accessibility_ROLE_PAGE_TAB_LIST] = SPI_ROLE_PAGE_TAB_LIST;
- role_table [Accessibility_ROLE_PANEL] = SPI_ROLE_PANEL;
- role_table [Accessibility_ROLE_PASSWORD_TEXT] = SPI_ROLE_PASSWORD_TEXT;
- role_table [Accessibility_ROLE_POPUP_MENU] = SPI_ROLE_POPUP_MENU;
- role_table [Accessibility_ROLE_PROGRESS_BAR] = SPI_ROLE_PROGRESS_BAR;
- role_table [Accessibility_ROLE_PUSH_BUTTON] = SPI_ROLE_PUSH_BUTTON;
- role_table [Accessibility_ROLE_RADIO_BUTTON] = SPI_ROLE_RADIO_BUTTON;
- role_table [Accessibility_ROLE_RADIO_MENU_ITEM] = SPI_ROLE_RADIO_MENU_ITEM;
- role_table [Accessibility_ROLE_ROOT_PANE] = SPI_ROLE_ROOT_PANE;
- role_table [Accessibility_ROLE_ROW_HEADER] = SPI_ROLE_ROW_HEADER;
- role_table [Accessibility_ROLE_SCROLL_BAR] = SPI_ROLE_SCROLL_BAR;
- role_table [Accessibility_ROLE_SCROLL_PANE] = SPI_ROLE_SCROLL_PANE;
- role_table [Accessibility_ROLE_SEPARATOR] = SPI_ROLE_SEPARATOR;
- role_table [Accessibility_ROLE_SLIDER] = SPI_ROLE_SLIDER;
- role_table [Accessibility_ROLE_SPIN_BUTTON] = SPI_ROLE_SPIN_BUTTON;
- role_table [Accessibility_ROLE_SPLIT_PANE] = SPI_ROLE_SPLIT_PANE;
- role_table [Accessibility_ROLE_STATUS_BAR] = SPI_ROLE_STATUS_BAR;
- role_table [Accessibility_ROLE_TABLE] = SPI_ROLE_TABLE;
- role_table [Accessibility_ROLE_TABLE_CELL] = SPI_ROLE_TABLE_CELL;
- role_table[Accessibility_ROLE_TABLE_COLUMN_HEADER] = SPI_ROLE_TABLE_COLUMN_HEADER;
- role_table[Accessibility_ROLE_TABLE_ROW_HEADER] = SPI_ROLE_TABLE_ROW_HEADER;
- role_table [Accessibility_ROLE_TEAROFF_MENU_ITEM] = SPI_ROLE_TEAROFF_MENU_ITEM;
- role_table[Accessibility_ROLE_TERMINAL] = SPI_ROLE_TERMINAL;
- role_table [Accessibility_ROLE_TEXT] = SPI_ROLE_TEXT;
- role_table [Accessibility_ROLE_TOGGLE_BUTTON] = SPI_ROLE_TOGGLE_BUTTON;
- role_table [Accessibility_ROLE_TOOL_BAR] = SPI_ROLE_TOOL_BAR;
- role_table [Accessibility_ROLE_TOOL_TIP] = SPI_ROLE_TOOL_TIP;
- role_table [Accessibility_ROLE_TREE] = SPI_ROLE_TREE;
- role_table [Accessibility_ROLE_TREE_TABLE] = SPI_ROLE_TREE_TABLE;
- role_table [Accessibility_ROLE_VIEWPORT] = SPI_ROLE_VIEWPORT;
- role_table [Accessibility_ROLE_WINDOW] = SPI_ROLE_WINDOW;
- role_table [Accessibility_ROLE_EXTENDED] = SPI_ROLE_EXTENDED;
- role_table [Accessibility_ROLE_HEADER] = SPI_ROLE_HEADER;
- role_table [Accessibility_ROLE_FOOTER] = SPI_ROLE_FOOTER;
- role_table [Accessibility_ROLE_PARAGRAPH] = SPI_ROLE_PARAGRAPH;
- role_table [Accessibility_ROLE_RULER] = SPI_ROLE_RULER;
- role_table [Accessibility_ROLE_APPLICATION] = SPI_ROLE_APPLICATION;
- role_table [Accessibility_ROLE_AUTOCOMPLETE] = SPI_ROLE_AUTOCOMPLETE;
- role_table [Accessibility_ROLE_EDITBAR] = SPI_ROLE_EDITBAR;
- role_table [Accessibility_ROLE_EMBEDDED] = SPI_ROLE_EMBEDDED;
- role_table [Accessibility_ROLE_ENTRY] = SPI_ROLE_ENTRY;
- role_table [Accessibility_ROLE_CHART] = SPI_ROLE_CHART;
- role_table [Accessibility_ROLE_CAPTION] = SPI_ROLE_CAPTION;
- role_table [Accessibility_ROLE_DOCUMENT_FRAME] = SPI_ROLE_DOCUMENT_FRAME;
- role_table [Accessibility_ROLE_HEADING] = SPI_ROLE_HEADING;
- role_table [Accessibility_ROLE_PAGE] = SPI_ROLE_PAGE;
- role_table [Accessibility_ROLE_SECTION] = SPI_ROLE_SECTION;
- role_table [Accessibility_ROLE_FORM] = SPI_ROLE_FORM;
- role_table [Accessibility_ROLE_REDUNDANT_OBJECT] = SPI_ROLE_REDUNDANT_OBJECT;
- role_table [Accessibility_ROLE_LINK] = SPI_ROLE_LINK;
- role_table [Accessibility_ROLE_INPUT_METHOD_WINDOW] = SPI_ROLE_INPUT_METHOD_WINDOW;
-
- return TRUE;
-}
-
-AccessibleRole
-cspi_role_from_spi_role (Accessibility_Role role)
-{
- /* array is sized according to IDL roles because IDL roles are the index */
- static AccessibleRole cspi_role_table [Accessibility_ROLE_LAST_DEFINED];
- static SPIBoolean is_initialized = FALSE;
- AccessibleRole cspi_role;
- if (!is_initialized)
- {
- is_initialized = cspi_init_role_table (cspi_role_table);
- }
- if (role >= 0 && role < Accessibility_ROLE_LAST_DEFINED)
- {
- cspi_role = cspi_role_table [role];
- }
- else
- {
- cspi_role = SPI_ROLE_EXTENDED;
- }
- return cspi_role;
-}
-
-AccessibleAttributeSet *
-_cspi_attribute_set_from_sequence (const GArray *seq)
-{
- AccessibleAttributeSet *set = g_new0 (AccessibleAttributeSet, 1);
- int i;
-
- set->len = seq->len;
- set->attributes = g_new0 (char *, set->len);
- for (i = 0; i < set->len; ++i)
- {
- set->attributes[i] = g_array_index (seq, char *, i);
- }
-
- g_array_free (seq, TRUE);
- return set;
-}
-
-/**
- * AccessibleRole_getName:
- * @role: an #AccessibleRole object to query.
- *
- * Get a localizeable string that indicates the name of an #AccessibleRole.
- * <em>DEPRECATED.</em>
- *
- * Returns: a localizable string name for an #AccessibleRole enumerated type.
- **/
-char *
-AccessibleRole_getName (AccessibleRole role)
-{
- if (role < MAX_ROLES && role_names [(int) role])
- {
- return g_strdup (role_names [(int) role]);
- }
- else
- {
- return g_strdup ("");
- }
-}
-
-/**
- * Accessible_ref:
- * @obj: a pointer to the #Accessible object on which to operate.
- *
- * Increment the reference count for an #Accessible object.
- **/
-void
-Accessible_ref (Accessible *obj)
-{
- cspi_object_ref (obj);
-}
-
-/**
- * Accessible_unref:
- * @obj: a pointer to the #Accessible object on which to operate.
- *
- * Decrement the reference count for an #Accessible object.
- **/
-void
-Accessible_unref (Accessible *obj)
-{
- cspi_object_unref (obj);
-}
-
-/**
- * Accessible_getName:
- * @obj: a pointer to the #Accessible object on which to operate.
- *
- * Get the name of an #Accessible object.
- *
- * Returns: a UTF-8 string indicating the name of the #Accessible object.
- * or NULL on exception
- **/
-char *
-Accessible_getName (Accessible *obj)
-{
- cspi_return_val_if_fail (obj != NULL, NULL);
- return g_strdup (obj->name);
-}
-
-/**
- * Accessible_getDescription:
- * @obj: a pointer to the #Accessible object on which to operate.
- *
- * Get the description of an #Accessible object.
- *
- * Returns: a UTF-8 string describing the #Accessible object.
- * or NULL on exception
- **/
-char *
-Accessible_getDescription (Accessible *obj)
-{
- cspi_return_val_if_fail (obj != NULL, NULL);
-
- return g_strdup (obj->description);
-}
-
-/**
- * Accessible_getParent:
- * @obj: a pointer to the #Accessible object to query.
- *
- * Get an #Accessible object's parent container.
- *
- * Returns: a pointer tothe #Accessible object which contains the given
- * #Accessible instance, or NULL if the @obj has no parent container.
- *
- **/
-Accessible *
-Accessible_getParent (Accessible *obj)
-{
- cspi_return_val_if_fail (obj != NULL, NULL);
-
- return cspi_object_add (obj->parent);
-}
-
-/**
- * Accessible_getChildCount:
- * @obj: a pointer to the #Accessible object on which to operate.
- *
- * Get the number of children contained by an #Accessible object.
- *
- * Returns: a #long indicating the number of #Accessible children
- * contained by an #Accessible object. or -1 on exception
- *
- **/
-long
-Accessible_getChildCount (Accessible *obj)
-{
- cspi_return_val_if_fail (obj != NULL, -1);
-
- return g_list_length (obj->children);
-}
-
-/**
- * Accessible_getChildAtIndex:
- * @obj: a pointer to the #Accessible object on which to operate.
- * @childIndex: a #long indicating which child is specified.
- *
- * Get the #Accessible child of an #Accessible object at a given index.
- *
- * Returns: a pointer to the #Accessible child object at index
- * @childIndex. or NULL on exception
- **/
-Accessible *
-Accessible_getChildAtIndex (Accessible *obj,
- long int childIndex)
-{
- Accessible *child;
-
- cspi_return_val_if_fail (obj != NULL, NULL);
-
- child = g_list_nth_data (obj->children, childIndex);
- return cspi_object_add(child);
-}
-
-/**
- * Accessible_getIndexInParent:
- * @obj: a pointer to the #Accessible object on which to operate.
- *
- * Get the index of an #Accessible object in its containing #Accessible.
- *
- * Returns: a #long indicating the index of the #Accessible object
- * in its parent (i.e. containing) #Accessible instance,
- * or -1 if @obj has no containing parent or on exception.
- **/
-long
-Accessible_getIndexInParent (Accessible *obj)
-{
- GList *l;
- gint i;
-
- cspi_return_val_if_fail (obj != NULL, -1);
- if (!obj->parent) return -1;
- l = obj->parent->children;
- while (l)
- {
- if (l->data == obj) return i;
- l = g_list_next (l);
- i++;
- }
- return -1;
-}
-
-typedef struct
-{
- dbus_uint32_t type;
- GArray *targets;
-} Accessibility_Relation;
-
-/**
- * Accessible_getRelationSet:
- * @obj: a pointer to the #Accessible object on which to operate.
- *
- * Get the set of #AccessibleRelation objects which describe this #Accessible object's
- * relationships with other #Accessible objects.
- *
- * Returns: an array of #AccessibleRelation pointers. or NULL on exception
- **/
-AccessibleRelation **
-Accessible_getRelationSet (Accessible *obj)
-{
- int i;
- int n_relations;
- AccessibleRelation **relations;
- GArray *relation_set;
- DBusError error;
-
- cspi_return_val_if_fail (obj != NULL, NULL);
-
- g_assert (!cspi_exception ());
-
- dbus_error_init (&error);
- cspi_dbus_call (obj, spi_interface_accessible, "getAttributes", &error, "=>a(uao)", &relation_set);
-
- cspi_return_val_if_ev ("getRelationSet", NULL);
-
- n_relations = relation_set->len;
- relations = malloc (sizeof (AccessibleRelation *) * (n_relations + 1));
-
- for (i = 0; i < n_relations; ++i)
- {
- Accessibility_Relation *r = g_array_index (relation_set, Accessibility_Relation *, i);
- relations[i] = g_new (AccessibleRelation, 1);
- if (!relations[i]) continue;
- relations[i]->ref_count = 1;
- relations[i]->type = r->type;
- relations[i]->targets = r->targets;
- }
- relations[i] = NULL;
-
- g_array_free (relation_set, TRUE);
-
- return relations;
-}
-
-/**
- * Accessible_getRole:
- * @obj: a pointer to the #Accessible object on which to operate.
- *
- * Get the UI role of an #Accessible object.
- * A UTF-8 string describing this role can be obtained via Accessible_getRoleName ().
- *
- * Returns: the #AccessibleRole of the object.
- *
- **/
-AccessibleRole
-Accessible_getRole (Accessible *obj)
-{
- cspi_return_val_if_fail (obj != NULL, SPI_ROLE_INVALID);
-
- return obj->role;
-}
-
-/**
- * Accessible_getRoleName:
- * @obj: a pointer to the #Accessible object on which to operate.
- *
- * Get a UTF-8 string describing the role this object plays in the UI.
- * This method will return useful values for roles that fall outside the
- * enumeration used in Accessible_getRole ().
- *
- * Returns: a UTF-8 string specifying the role of this #Accessible object.
- *
- **/
-char *
-Accessible_getRoleName (Accessible *obj)
-{
- char *retval;
-
- cspi_return_val_if_fail (obj != NULL, g_strdup ("invalid"));
-
- cspi_dbus_call (obj, spi_interface_accessible, "getRoleName", NULL, "=>s", &retval);
-
- cspi_return_val_if_ev ("getRoleName", g_strdup ("invalid"));
-
- return retval;
-}
-
-/**
- * Accessible_getLocalizedRoleName:
- * @obj: a pointer to the #Accessible object on which to operate.
- *
- * Get a UTF-8 string describing the (localized) role this object plays in the UI.
- * This method will return useful values for roles that fall outside the
- * enumeration used in Accessible_getRole ().
- *
- * @Since: AT-SPI 1.4
- *
- * Returns: a UTF-8 string specifying the role of this #Accessible object.
- *
- **/
-char *
-Accessible_getLocalizedRoleName (Accessible *obj)
-{
- char *retval;
-
- cspi_return_val_if_fail (obj != NULL, g_strdup ("invalid"));
-
- cspi_dbus_call (obj, spi_interface_accessible, "getLocalizedRoleName", NULL, "=>s", &retval);
-
- cspi_return_val_if_ev ("getLocalizedRoleName", g_strdup ("invalid"));
-
- return retval;
-}
-
-/**
- * Accessible_getStateSet:
- * @obj: a pointer to the #Accessible object on which to operate.
- *
- * Gets the current state of an object.
- *
- * Returns: a pointer to an #AccessibleStateSet representing the object's current state.
- **/
-AccessibleStateSet *
-Accessible_getStateSet (Accessible *obj)
-{
- return obj->states;
-}
-
-/**
- * Accessible_getAttributes:
- * @obj: The #Accessible being queried.
- *
- * Get the #AttributeSet representing any assigned
- * name-value pair attributes or annotations for this object.
- * For typographic, textual, or textually-semantic attributes, see
- * AccessibleText_getAttributes instead.
- *
- * Returns: The name-value-pair attributes assigned to this object.
- */
-AccessibleAttributeSet *
-Accessible_getAttributes (Accessible *obj)
-{
- AccessibleAttributeSet *retval;
- GArray *dbus_seq;
-
- cspi_return_val_if_fail (obj != NULL, NULL);
-
- cspi_dbus_call (obj, spi_interface_accessible, "getAttributes", NULL, "=>as", &dbus_seq);
-
- cspi_return_val_if_ev ("getAttributes", NULL);
-
- retval = _cspi_attribute_set_from_sequence (dbus_seq);
-
- return retval;
-}
-
-/**
- * Accessible_getHostApplication:
- * @obj: The #Accessible being queried.
- *
- * Get the containing #AccessibleApplication for an object.
- *
- * Returns: the containing AccessibleApplication instance for this object.
- */
-AccessibleApplication *
-Accessible_getHostApplication (Accessible *obj)
-{
- while (obj->parent) obj = obj->parent;
- return obj;
-}
-
-/* Interface query methods */
-
-/**
- * Accessible_isAction:
- * @obj: a pointer to the #Accessible instance to query.
- *
- * Query whether the specified #Accessible implements #AccessibleAction.
- *
- * Returns: #TRUE if @obj implements the #AccessibleAction interface,
- * #FALSE otherwise.
- **/
-SPIBoolean
-Accessible_isAction (Accessible *obj)
-{
- return cspi_accessible_is_a (obj,
- spi_interface_action);
-}
-
-/**
- * Accessible_isApplication:
- * @obj: a pointer to the #Accessible instance to query.
- *
- * Query whether the specified #Accessible implements #AccessibleApplication.
- *
- * Returns: #TRUE if @obj implements the #AccessibleApplication interface,
- * #FALSE otherwise.
- **/
-SPIBoolean
-Accessible_isApplication (Accessible *obj)
-{
- return cspi_accessible_is_a (obj,
- spi_interface_application);
-}
-
-/**
- * Accessible_isCollection: * @obj: a pointer to the #Accessible instance to query.
- *
- * Query whether the specified #Accessible implements #AccessibleCollection.
- * Returns: #TRUE if @obj implements the #AccessibleCollection interface,
- * #FALSE otherwise.
- **/
-
-SPIBoolean
-Accessible_isCollection (Accessible *obj)
-{
-#if 0
- g_warning ("Collections not implemented");
- return cspi_accessible_is_a (obj,
- spi_interface_collection);
-#else
- return FALSE;
-#endif
-}
-
-/**
- * Accessible_isComponent:
- * @obj: a pointer to the #Accessible instance to query.
- *
- * Query whether the specified #Accessible implements #AccessibleComponent.
- *
- * Returns: #TRUE if @obj implements the #AccessibleComponent interface,
- * #FALSE otherwise.
- **/
-SPIBoolean
-Accessible_isComponent (Accessible *obj)
-{
- return cspi_accessible_is_a (obj,
- spi_interface_component);
-}
-
-/**
- * Accessible_isDocument:
- * @obj: a pointer to the #Accessible instance to query.
- *
- * Query whether the specified #Accessible implements #AccessibleDocument.
- *
- * Returns: #TRUE if @obj implements the #AccessibleDocument interface,
- * #FALSE otherwise.
- **/
-SPIBoolean
-Accessible_isDocument (Accessible *obj)
-{
- return cspi_accessible_is_a (obj,
- spi_interface_document);
-}
-
-/**
- * Accessible_isEditableText:
- * @obj: a pointer to the #Accessible instance to query.
- *
- * Query whether the specified #Accessible implements #AccessibleEditableText.
- *
- * Returns: #TRUE if @obj implements the #AccessibleEditableText interface,
- * #FALSE otherwise.
- **/
-SPIBoolean
-Accessible_isEditableText (Accessible *obj)
-{
- return cspi_accessible_is_a (obj,
- spi_interface_editable_text);
-}
-
-/**
- * Accessible_isMatchRule:
- * @obj: a pointer to the #Accessible instance to query.
- *
- * Query whether the specified #Accessible implements #AccessibleMatchRule.
- *
- * Returns: #TRUE if @obj implements the #AccessibleMatchRule interface,
- * #FALSE otherwise.
- **/
-SPIBoolean
-Accessible_isMatchRule (Accessible *obj)
-{
-#if 0
- return cspi_accessible_is_a (obj,
- spi_interface_match_rule);
-#else
- g_warning ("Match rules not implemented");
- return FALSE;
-#endif
-}
-
-/**
- * Accessible_isHypertext:
- * @obj: a pointer to the #Accessible instance to query.
- *
- * Query whether the specified #Accessible implements #AccessibleHypertext.
- *
- * Returns: #TRUE if @obj implements the #AccessibleHypertext interface,
- * #FALSE otherwise.
- **/
-SPIBoolean
-Accessible_isHypertext (Accessible *obj)
-{
- return cspi_accessible_is_a (obj,
- spi_interface_hypertext);
-}
-
-/**
- * Accessible_isImage:
- * @obj: a pointer to the #Accessible instance to query.
- *
- * Query whether the specified #Accessible implements #AccessibleImage.
- *
- * Returns: #TRUE if @obj implements the #AccessibleImage interface,
- * #FALSE otherwise.
-**/
-SPIBoolean
-Accessible_isImage (Accessible *obj)
-{
- return cspi_accessible_is_a (obj,
- spi_interface_image);
-}
-
-/**
- * Accessible_isSelection:
- * @obj: a pointer to the #Accessible instance to query.
- *
- * Query whether the specified #Accessible implements #AccessibleSelection.
- *
- * Returns: #TRUE if @obj implements the #AccessibleSelection interface,
- * #FALSE otherwise.
-**/
-SPIBoolean
-Accessible_isSelection (Accessible *obj)
-{
- return cspi_accessible_is_a (obj,
- spi_interface_selection);
-}
-
-/**
- * Accessible_isTable:
- * @obj: a pointer to the #Accessible instance to query.
- *
- * Query whether the specified #Accessible implements #AccessibleTable.
- *
- * Returns: #TRUE if @obj implements the #AccessibleTable interface,
- * #FALSE otherwise.
-**/
-SPIBoolean
-Accessible_isTable (Accessible *obj)
-{
- return cspi_accessible_is_a (obj,
- spi_interface_table);
-}
-
-/**
- * Accessible_isStreamableContent:
- * @obj: a pointer to the #Accessible instance to query.
- *
- * Query whether the specified #Accessible implements
- * #AccessibleStreamableContent.
- *
- * Returns: #TRUE if @obj implements the #AccessibleStreamableContent interface,
- * #FALSE otherwise.
-**/
-SPIBoolean
-Accessible_isStreamableContent (Accessible *obj)
-{
-#if 0
- return cspi_accessible_is_a (obj,
- spi_interface_streamable_content);
-#else
- g_warning ("Streamable content not implemented");
- return FALSE;
-#endif
-}
-
-/**
- * Accessible_isText:
- * @obj: a pointer to the #Accessible instance to query.
- *
- * Query whether the specified #Accessible implements #AccessibleText.
- *
- * Returns: #TRUE if @obj implements the #AccessibleText interface,
- * #FALSE otherwise.
-**/
-SPIBoolean
-Accessible_isText (Accessible *obj)
-{
- return cspi_accessible_is_a (obj,
- spi_interface_text);
-}
-
-/**
- * Accessible_isValue:
- * @obj: a pointer to the #Accessible instance to query.
- *
- * Query whether the specified #Accessible implements #AccessibleValue.
- *
- * Returns: #TRUE if @obj implements the #AccessibleValue interface,
- * #FALSE otherwise.
-**/
-SPIBoolean
-Accessible_isValue (Accessible *obj)
-{
- return cspi_accessible_is_a (obj,
- spi_interface_value);
-}
-
-/**
- * Accessible_getApplication:
- * @obj: a pointer to the #Accessible instance to query.
- *
- * Get the #AccessibleApplication interface for an #Accessible.
- *
- * Returns: a pointer to an #AccessibleApplication interface instance, or
- * NULL if @obj does not implement #AccessibleApplication.
- **/
-AccessibleApplication *
-Accessible_getApplication (Accessible *obj)
-{
- return (AccessibleApplication *) Accessible_queryInterface (
- obj, spi_interface_application);
-}
-
-/**
- * Accessible_getAction:
- * @obj: a pointer to the #Accessible instance to query.
- *
- * Get the #AccessibleAction interface for an #Accessible.
- *
- * Returns: a pointer to an #AccessibleAction interface instance, or
- * NULL if @obj does not implement #AccessibleAction.
- **/
-AccessibleAction *
-Accessible_getAction (Accessible *obj)
-{
- return (AccessibleAction *) Accessible_queryInterface (
- obj, spi_interface_action);
-}
-
-
-/**
- * Accessible_getCollection:
- * @obj: a pointer to the #Accessible instance to query.
- *
- * Get the #AccessibleCollection interface for an #Accessible.
- *
- * Returns: a pointer to an #AccessibleCollection interface instance, or
- * NULL if @obj does not implement #AccessibleCollection.
- **/
-AccessibleCollection *
-Accessible_getCollection (Accessible *obj)
-{
-#if 0
- return (AccessibleCollection *) Accessible_queryInterface (
- obj, spi_interface_collection);
-#else
- g_warning ("Collections not implemented");
- return NULL;
-#endif
-}
-
-/**
- * Accessible_getComponent:
- * @obj: a pointer to the #Accessible instance to query.
- *
- * Get the #AccessibleComponent interface for an #Accessible.
- *
- * Returns: a pointer to an #AccessibleComponent interface instance, or
- * NULL if @obj does not implement #AccessibleComponent.
- **/
-AccessibleComponent *
-Accessible_getComponent (Accessible *obj)
-{
- return (AccessibleComponent *) Accessible_queryInterface (
- obj, spi_interface_component);
-}
-
-/**
- * Accessible_getDocument:
- * @obj: a pointer to the #Accessible instance to query.
- *
- * Get the #AccessibleDocument interface for an #Accessible.
- *
- * Returns: a pointer to an #AccessibleDocument interface instance, or
- * NULL if @obj does not implement #AccessibleDocument.
- **/
-AccessibleDocument *
-Accessible_getDocument (Accessible *obj)
-{
- return (AccessibleDocument *) Accessible_queryInterface (
- obj, spi_interface_document);
-}
-
-/**
- * Accessible_getEditableText:
- * @obj: a pointer to the #Accessible instance to query.
- *
- * Get the #AccessibleEditableText interface for an #Accessible.
- *
- * Returns: a pointer to an #AccessibleEditableText interface instance, or
- * NULL if @obj does not implement #AccessibleEditableText.
- **/
-AccessibleEditableText *
-Accessible_getEditableText (Accessible *obj)
-{
- return (AccessibleEditableText *) Accessible_queryInterface (
- obj, spi_interface_editable_text);
-}
-
-
-/**
- * Accessible_getHypertext:
- * @obj: a pointer to the #Accessible instance to query.
- *
- * Get the #AccessibleHypertext interface for an #Accessible.
- *
- * Returns: a pointer to an #AccessibleHypertext interface instance, or
- * NULL if @obj does not implement #AccessibleHypertext.
- **/
-AccessibleHypertext *
-Accessible_getHypertext (Accessible *obj)
-{
- return (AccessibleHypertext *) Accessible_queryInterface (
- obj, spi_interface_hypertext);
-}
-
-
-
-/**
- * Accessible_getImage:
- * @obj: a pointer to the #Accessible instance to query.
- *
- * Get the #AccessibleImage interface for an #Accessible.
- *
- * Returns: a pointer to an #AccessibleImage interface instance, or
- * NULL if @obj does not implement #AccessibleImage.
- **/
-AccessibleImage *
-Accessible_getImage (Accessible *obj)
-{
- return (AccessibleImage *) Accessible_queryInterface (
- obj, spi_interface_image);
-}
-
-/**
- * Accessible_getMatchRule:
- * @obj: a pointer to the #Accessible instance to query.
- *
- * Get the #AccessibleMatchRule interface for an #Accessible.
- *
- * Returns: a pointer to an #AccessibleMatchRule interface instance, or
- * NULL if @obj does not implement #AccessibleMatchRule.
- **/
-AccessibleMatchRule *
-Accessible_getMatchRule (Accessible *obj)
-{
-#if 0
- return (AccessibleMatchRule *) Accessible_queryInterface (
- obj, spi_interface_match_rule);
-#else
- g_warning ("Match rules not supported");
- return NULL;
-#endif
-}
-
-/**
- * Accessible_getSelection:
- * @obj: a pointer to the #Accessible instance to query.
- *
- * Get the #AccessibleSelection interface for an #Accessible.
- *
- * Returns: a pointer to an #AccessibleSelection interface instance, or
- * NULL if @obj does not implement #AccessibleSelection.
- **/
-AccessibleSelection *
-Accessible_getSelection (Accessible *obj)
-{
- return (AccessibleSelection *) Accessible_queryInterface (
- obj, spi_interface_selection);
-}
-
-
-
-/**
- * Accessible_getStreamableContent:
- * @obj: a pointer to the #Accessible instance to query.
- *
- * Get the #AccessibleStreamableContent interface for an #Accessible.
- *
- * Returns: a pointer to an #AccessibleStreamableContent interface instance, or
- * NULL if @obj does not implement #AccessibleStreamableContent.
- **/
-AccessibleStreamableContent *
-Accessible_getStreamableContent (Accessible *obj)
-{
-#if 0
- return (AccessibleStreamableContent *) Accessible_queryInterface (
- obj, spi_interface_streamable_content);
-#else
- g_warning ("Streamable content not supported");
- return NULL;
-#endif
-}
-
-/**
- * Accessible_getTable:
- * @obj: a pointer to the #Accessible instance to query.
- *
- * Get the #AccessibleTable interface for an #Accessible.
- *
- * Returns: a pointer to an #AccessibleTable interface instance, or
- * NULL if @obj does not implement #AccessibleTable.
- **/
-AccessibleTable *
-Accessible_getTable (Accessible *obj)
-{
- return (AccessibleTable *) Accessible_queryInterface (
- obj, spi_interface_table);
-}
-
-/**
- * Accessible_getText:
- * @obj: a pointer to the #Accessible instance to query.
- *
- * Get the #AccessibleText interface for an #Accessible.
- *
- * Returns: a pointer to an #AccessibleText interface instance, or
- * NULL if @obj does not implement #AccessibleText.
- **/
-AccessibleText *
-Accessible_getText (Accessible *obj)
-{
- return (AccessibleText *) Accessible_queryInterface (
- obj, spi_interface_text);
-}
-
-
-
-/**
- * Accessible_getValue:
- * @obj: a pointer to the #Accessible instance to query.
- *
- * Get the #AccessibleValue interface for an #Accessible.
- *
- * Returns: a pointer to an #AccessibleValue interface instance, or
- * NULL if @obj does not implement #AccessibleValue.
- **/
-AccessibleValue *
-Accessible_getValue (Accessible *obj)
-{
- return (AccessibleValue *) Accessible_queryInterface (
- obj, spi_interface_value);
-}
-
-
-
-/**
- * Accessible_queryInterface:
- * @obj: a pointer to the #Accessible instance to query.
- * @interface_name: a UTF-8 character string specifiying the requested interface.
- *
- * Query an #Accessible object to for a named interface.
- *
- * Returns: an instance of the named interface object, if it is implemented
- * by @obj, or NULL otherwise.
- *
- **/
-AccessibleUnknown *
-Accessible_queryInterface (Accessible *obj,
- const char *interface_name)
-{
- if (cspi_accessible_is_a (obj, interface_name))
- {
- /* The original code called cspi_object_add(obj) instead, but gok and
- * simple-at don't treat interfaces as references, so I'm confused
- * and not going to replicate this bit of code */
- return obj;
- }
- return NULL;
-}
-
-
-/**
- * AccessibleRelation_ref:
- * @obj: a pointer to the #AccessibleRelation object on which to operate.
- *
- * Increment the reference count for an #AccessibleRelation object.
- *
- **/
-void
-AccessibleRelation_ref (AccessibleRelation *obj)
-{
- obj->ref_count++;
-}
-
-/**
- * AccessibleRelation_unref:
- * @obj: a pointer to the #AccessibleRelation object on which to operate.
- *
- * Decrement the reference count for an #AccessibleRelation object.
- *
- **/
-void
-AccessibleRelation_unref (AccessibleRelation *obj)
-{
- obj->ref_count--;
- if (obj->ref_count <= 0)
- {
- g_array_free (obj->targets, TRUE);
- g_free (obj);
- }
-}
-
-static SPIBoolean
-cspi_init_relation_type_table (AccessibleRelationType *relation_type_table)
-{
- int i;
- for (i = 0; i < Accessibility_RELATION_LAST_DEFINED; ++i)
- {
- relation_type_table [i] = SPI_RELATION_NULL;
- }
- relation_type_table [Accessibility_RELATION_NULL] = SPI_RELATION_NULL;
- relation_type_table [Accessibility_RELATION_LABEL_FOR] = SPI_RELATION_LABEL_FOR;
- relation_type_table [Accessibility_RELATION_LABELLED_BY] = SPI_RELATION_LABELED_BY;
- relation_type_table [Accessibility_RELATION_CONTROLLER_FOR] = SPI_RELATION_CONTROLLER_FOR;
- relation_type_table [Accessibility_RELATION_CONTROLLED_BY] = SPI_RELATION_CONTROLLED_BY;
- relation_type_table [Accessibility_RELATION_MEMBER_OF] = SPI_RELATION_MEMBER_OF;
- relation_type_table [Accessibility_RELATION_TOOLTIP_FOR] = SPI_RELATION_NULL;
- relation_type_table [Accessibility_RELATION_NODE_CHILD_OF] = SPI_RELATION_NODE_CHILD_OF;
- relation_type_table [Accessibility_RELATION_EXTENDED] = SPI_RELATION_EXTENDED;
- relation_type_table [Accessibility_RELATION_FLOWS_TO] = SPI_RELATION_FLOWS_TO;
- relation_type_table [Accessibility_RELATION_FLOWS_FROM] = SPI_RELATION_FLOWS_FROM;
- relation_type_table [Accessibility_RELATION_SUBWINDOW_OF] = SPI_RELATION_SUBWINDOW_OF;
- relation_type_table [Accessibility_RELATION_EMBEDS] = SPI_RELATION_EMBEDS;
- relation_type_table [Accessibility_RELATION_EMBEDDED_BY] = SPI_RELATION_EMBEDDED_BY;
- relation_type_table [Accessibility_RELATION_POPUP_FOR] = SPI_RELATION_POPUP_FOR;
- relation_type_table [Accessibility_RELATION_PARENT_WINDOW_OF] = SPI_RELATION_PARENT_WINDOW_OF;
- relation_type_table [Accessibility_RELATION_DESCRIBED_BY] = SPI_RELATION_DESCRIBED_BY;
- relation_type_table [Accessibility_RELATION_DESCRIPTION_FOR] = SPI_RELATION_DESCRIPTION_FOR;
- return TRUE;
-}
-
-static AccessibleRelationType
-cspi_relation_type_from_spi_relation_type (Accessibility_RelationType type)
-{
- /* array is sized according to IDL RelationType because IDL RelationTypes are the index */
- static AccessibleRelationType cspi_relation_type_table [Accessibility_RELATION_LAST_DEFINED];
- static SPIBoolean is_initialized = FALSE;
- AccessibleRelationType cspi_type;
- if (!is_initialized)
- {
- is_initialized = cspi_init_relation_type_table (cspi_relation_type_table);
- }
- if (type >= 0 && type < Accessibility_RELATION_LAST_DEFINED)
- {
- cspi_type = cspi_relation_type_table [type];
- }
- else
- {
- cspi_type = SPI_RELATION_NULL;
- }
- return cspi_type;
-}
-/**
- * AccessibleRelation_getRelationType:
- * @obj: a pointer to the #AccessibleRelation object to query.
- *
- * Get the type of relationship represented by an #AccessibleRelation.
- *
- * Returns: an #AccessibleRelationType indicating the type of relation
- * encapsulated in this #AccessibleRelation object.
- *
- **/
-AccessibleRelationType
-AccessibleRelation_getRelationType (AccessibleRelation *obj)
-{
- cspi_return_val_if_fail (obj, SPI_RELATION_NULL);
- return cspi_relation_type_from_spi_relation_type (obj->type);
-}
-
-/**
- * AccessibleRelation_getNTargets:
- * @obj: a pointer to the #AccessibleRelation object to query.
- *
- * Get the number of objects which this relationship has as its
- * target objects (the subject is the #Accessible from which this
- * #AccessibleRelation originated).
- *
- * Returns: a short integer indicating how many target objects which the
- * originating #Accessible object has the #AccessibleRelation
- * relationship with.
- **/
-int
-AccessibleRelation_getNTargets (AccessibleRelation *obj)
-{
- cspi_return_val_if_fail (obj, -1);
- return obj->targets->len;
-}
-
-/**
- * AccessibleRelation_getTarget:
- * @obj: a pointer to the #AccessibleRelation object to query.
- * @i: a (zero-index) integer indicating which (of possibly several) target is requested.
- *
- * Get the @i-th target of a specified #AccessibleRelation relationship.
- *
- * Returns: an #Accessible which is the @i-th object with which the
- * originating #Accessible has relationship specified in the
- * #AccessibleRelation object.
- *
- **/
-Accessible *
-AccessibleRelation_getTarget (AccessibleRelation *obj, int i)
-{
- cspi_return_val_if_fail (obj, NULL);
-
- if (i < 0 || i >= obj->targets->len) return NULL;
- return cspi_object_add (
- g_array_index (obj->targets, Accessible *, i));
-}
-
-/**
- * AccessibleStateSet_ref:
- * @obj: a pointer to the #AccessibleStateSet object on which to operate.
- *
- * Increment the reference count for an #AccessibleStateSet object.
- *
- **/
-void
-AccessibleStateSet_ref (AccessibleStateSet *obj)
-{
- spi_state_set_cache_ref (obj);
-}
-
-/**
- * AccessibleStateSet_unref:
- * @obj: a pointer to the #AccessibleStateSet object on which to operate.
- *
- * Decrement the reference count for an #AccessibleStateSet object.
- *
- **/
-void
-AccessibleStateSet_unref (AccessibleStateSet *obj)
-{
- spi_state_set_cache_unref (obj);
-}
-
-static Accessibility_StateType
-spi_state_to_dbus (AccessibleState state)
-{
-#define MAP_STATE(a) \
- case SPI_STATE_##a: \
- return Accessibility_STATE_##a
-
- switch (state)
- {
- MAP_STATE (INVALID);
- MAP_STATE (ACTIVE);
- MAP_STATE (ARMED);
- MAP_STATE (BUSY);
- MAP_STATE (CHECKED);
- MAP_STATE (DEFUNCT);
- MAP_STATE (EDITABLE);
- MAP_STATE (ENABLED);
- MAP_STATE (EXPANDABLE);
- MAP_STATE (EXPANDED);
- MAP_STATE (FOCUSABLE);
- MAP_STATE (FOCUSED);
- MAP_STATE (HORIZONTAL);
- MAP_STATE (ICONIFIED);
- MAP_STATE (MODAL);
- MAP_STATE (MULTI_LINE);
- MAP_STATE (MULTISELECTABLE);
- MAP_STATE (OPAQUE);
- MAP_STATE (PRESSED);
- MAP_STATE (RESIZABLE);
- MAP_STATE (SELECTABLE);
- MAP_STATE (SELECTED);
- MAP_STATE (SENSITIVE);
- MAP_STATE (SHOWING);
- MAP_STATE (SINGLE_LINE);
- MAP_STATE (STALE);
- MAP_STATE (TRANSIENT);
- MAP_STATE (VERTICAL);
- MAP_STATE (VISIBLE);
- MAP_STATE (MANAGES_DESCENDANTS);
- MAP_STATE (INDETERMINATE);
- MAP_STATE (TRUNCATED);
- MAP_STATE (REQUIRED);
- MAP_STATE (INVALID_ENTRY);
- MAP_STATE (SUPPORTS_AUTOCOMPLETION);
- MAP_STATE (SELECTABLE_TEXT);
- MAP_STATE (IS_DEFAULT);
- MAP_STATE (VISITED);
- default:
- return Accessibility_STATE_INVALID;
- }
-#undef MAP_STATE
-}
-
-/**
- * AccessibleStateSet_contains:
- * @obj: a pointer to the #AccessibleStateSet object on which to operate.
- * @state: an #AccessibleState for which the specified #AccessibleStateSet
- * will be queried.
- *
- * Determine whether a given #AccessibleStateSet includes a given state; that is,
- * whether @state is true for the stateset in question.
- *
- * Returns: #TRUE if @state is true/included in the given #AccessibleStateSet,
- * otherwise #FALSE.
- *
- **/
-SPIBoolean
-AccessibleStateSet_contains (AccessibleStateSet *obj,
- AccessibleState state)
-{
- return spi_state_set_cache_contains (obj, spi_state_to_dbus (state));
-}
-
-/**
- * AccessibleStateSet_add:
- * @obj: a pointer to the #AccessibleStateSet object on which to operate.
- * @state: an #AccessibleState to be added to the specified #AccessibleStateSet
- *
- * Add a particular #AccessibleState to an #AccessibleStateSet (i.e. set the
- * given state to #TRUE in the stateset.
- *
- **/
-void
-AccessibleStateSet_add (AccessibleStateSet *obj,
- AccessibleState state)
-{
- spi_state_set_cache_add (obj, spi_state_to_dbus (state));
-}
-
-/**
- * AccessibleStateSet_remove:
- * @obj: a pointer to the #AccessibleStateSet object on which to operate.
- * @state: an #AccessibleState to be removed from the specified #AccessibleStateSet
- *
- * Remove a particular #AccessibleState to an #AccessibleStateSet (i.e. set the
- * given state to #FALSE in the stateset.)
- *
- **/
-void
-AccessibleStateSet_remove (AccessibleStateSet *obj,
- AccessibleState state)
-{
- spi_state_set_cache_remove (obj, spi_state_to_dbus (state));
-}
-
-/**
- * AccessibleStateSet_equals:
- * @obj: a pointer to the first #AccessibleStateSet object on which to operate.
- * @obj2: a pointer to the second #AccessibleStateSet object on which to operate.
- *
- * Determine whether two instances of #AccessibleStateSet are equivalent (i.e.
- * consist of the same #AccessibleStates). Useful for checking multiple
- * state variables at once; construct the target state then compare against it.
- *
- * @see AccessibleStateSet_compare().
- *
- * Returns: #TRUE if the two #AccessibleStateSets are equivalent,
- * otherwise #FALSE.
- *
- **/
-SPIBoolean
-AccessibleStateSet_equals (AccessibleStateSet *obj,
- AccessibleStateSet *obj2)
-{
- SPIBoolean eq;
- AtkStateSet *cmp;
-
- if (obj == obj2)
- {
- return TRUE;
- }
-
- cmp = spi_state_set_cache_xor (obj, obj2);
- eq = spi_state_set_cache_is_empty (cmp);
- spi_state_set_cache_unref (cmp);
-
- return eq;
-}
-
-/**
- * AccessibleStateSet_compare:
- * @obj: a pointer to the first #AccessibleStateSet object on which to operate.
- * @obj2: a pointer to the second #AccessibleStateSet object on which to operate.
- *
- * Determine the differences between two instances of #AccessibleStateSet.
- * Not Yet Implemented.
- *.
- * @see AccessibleStateSet_equals().
- *
- * Returns: an #AccessibleStateSet object containing all states contained on one of
- * the two sets but not the other.
- *
- **/
-AccessibleStateSet *
-AccessibleStateSet_compare (AccessibleStateSet *obj,
- AccessibleStateSet *obj2)
-{
- return spi_state_set_cache_xor (obj, obj2);
-}
-
-/**
- * AccessibleStateSet_isEmpty:
- * @obj: a pointer to the #AccessibleStateSet object on which to operate.
- *
- * Determine whether a given #AccessibleStateSet is the empty set.
- *
- * Returns: #TRUE if the given #AccessibleStateSet contains no (true) states,
- * otherwise #FALSE.
- *
- **/
-SPIBoolean
-AccessibleStateSet_isEmpty (AccessibleStateSet *obj)
-{
- return spi_state_set_cache_is_empty (obj);
-}
-
diff --git a/cspi/spi-action.c b/cspi/spi-action.c
deleted file mode 100644
index 7136b45f..00000000
--- a/cspi/spi-action.c
+++ /dev/null
@@ -1,190 +0,0 @@
-/*
- * AT-SPI - Assistive Technology Service Provider Interface
- * (Gnome Accessibility Project; http://developer.gnome.org/projects/gap)
- *
- * Copyright 2001, 2002 Sun Microsystems Inc.,
- * Copyright 2001, 2002 Ximian, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#include <cspi/spi-private.h>
-
-/**
- * AccessibleAction_ref:
- * @obj: a pointer to the #AccessibleAction on which to operate.
- *
- * Increment the reference count for an #AccessibleAction.
- **/
-void
-AccessibleAction_ref (AccessibleAction *obj)
-{
- cspi_object_ref (obj);
-}
-
-/**
- * AccessibleAction_unref:
- * @obj: a pointer to the #AccessibleAction on which to operate.
- *
- * Decrement the reference count for an #AccessibleAction.
- **/
-void
-AccessibleAction_unref (AccessibleAction *obj)
-{
- cspi_object_unref (obj);
-}
-
-/**
- * AccessibleAction_getNActions:
- * @obj: a pointer to the #AccessibleAction to query.
- *
- * Get the number of actions invokable on an #AccessibleAction implementor.
- *
- * Returns: a #long integer indicatin the number of invokable actions.
- **/
-long
-AccessibleAction_getNActions (AccessibleAction *obj)
-{
- dbus_int32_t retval;
-
- cspi_return_val_if_fail (obj != NULL, -1);
-
- cspi_dbus_get_property (obj, spi_interface_action, "nActions", NULL, "i", &retval);
-
- cspi_return_val_if_ev ("getNActions", -1);
-
- return retval;
-}
-
-/**
- * AccessibleAction_getDescription:
- * @obj: a pointer to the #AccessibleAction implementor to query.
- * @i: a long integer indicating which action to query.
- *
- * Get the description of '@i-th' action invokable on an
- * object implementing #AccessibleAction.
- *
- * Returns: a UTF-8 string describing the '@i-th' invokable action.
- **/
-char *
-AccessibleAction_getDescription (AccessibleAction *obj,
- long int i)
-{
- dbus_int32_t d_i = i;
- char *retval;
- cspi_return_val_if_fail (obj != NULL, NULL);
-
- cspi_dbus_call (obj, spi_interface_action, "getDescription", NULL, "i=>s", d_i, &retval);
-
- cspi_return_val_if_ev ("getDescription", NULL);
-
- return retval;
-}
-
-/**
- * AccessibleAction_getKeyBinding:
- * @obj: a pointer to the #AccessibleAction implementor to query.
- * @i: a long integer indicating which action to query.
- *
- * Get the keybindings for the @i-th action invokable on an
- * object implementing #AccessibleAction, if any are defined.
- * The keybindings string format is as follows:
- * there are multiple parts to a keybinding string (typically 3).
- * They are delimited with ";". The first is the action's
- * keybinding which is usable if the object implementing the action
- * is currently posted to the screen, e.g. if a menu is posted
- * then these keybindings for the corresponding menu-items are
- * available. The second keybinding substring is the full key sequence
- * necessary to post the action's widget and activate it, e.g. for
- * a menu item such as "File->Open" it would both post the menu and
- * activate the item. Thus the second keybinding string is available
- * during the lifetime of the containing toplevel window as a whole,
- * whereas the first keybinding string only works while the object
- * implementing AtkAction is posted. The third (and optional)
- * keybinding string is the "keyboard shortcut" which invokes the
- * action without posting any menus.
- * Meta-keys are indicated by the conventional strings
- * "<Control>", "<Alt>", "<Shift>", "<Mod2>",
- * etc. (we use the same string as gtk_accelerator_name() in
- * gtk+-2.X.
- *
- * Returns: a UTF-8 string which can be parsed to determine the @i-th
- * invokable action's keybindings.
- **/
-char *
-AccessibleAction_getKeyBinding (AccessibleAction *obj,
- long int i)
-{
- dbus_int32_t d_i = i;
- char *retval;
- cspi_return_val_if_fail (obj != NULL, NULL);
-
- cspi_dbus_call (obj, spi_interface_action, "getKeyBinding", NULL, "i=>s", d_i, &retval);
-
- cspi_return_val_if_ev ("getKeyBinding", NULL);
-
- return retval;
-}
-
-/**
- * AccessibleAction_getName:
- * @obj: a pointer to the #AccessibleAction implementor to query.
- * @i: a long integer indicating which action to query.
- *
- * Get the name of the '@i-th' action invokable on an
- * object implementing #AccessibleAction.
- *
- * Returns: the 'event type' name of the action, as a UTF-8 string.
- **/
-char *
-AccessibleAction_getName (AccessibleAction *obj,
- long int i)
-{
- dbus_int32_t d_i = i;
- char *retval;
- cspi_return_val_if_fail (obj != NULL, NULL);
-
- cspi_dbus_call (obj, spi_interface_action, "getName", NULL, "i=>s", d_i, &retval);
-
- cspi_return_val_if_ev ("getName", NULL);
-
- return retval;
-}
-
-/**
- * AccessibleAction_doAction:
- * @obj: a pointer to the #AccessibleAction to query.
- * @i: an integer specifying which action to invoke.
- *
- * Invoke the action indicated by #index.
- *
- * Returns: #TRUE if the action is successfully invoked, otherwise #FALSE.
- **/
-SPIBoolean
-AccessibleAction_doAction (AccessibleAction *obj,
- long int i)
-{
- dbus_int32_t d_i = i;
- dbus_bool_t retval;
-
- cspi_return_val_if_fail (obj != NULL, FALSE);
-
- cspi_dbus_call (obj, spi_interface_action, "doAction", NULL, "i=>b", d_i, &retval);
-
- cspi_return_val_if_ev ("doAction", FALSE);
-
- return retval;
-}
diff --git a/cspi/spi-application.c b/cspi/spi-application.c
deleted file mode 100644
index 7b219b0f..00000000
--- a/cspi/spi-application.c
+++ /dev/null
@@ -1,208 +0,0 @@
-/*
- * AT-SPI - Assistive Technology Service Provider Interface
- * (Gnome Accessibility Project; http://developer.gnome.org/projects/gap)
- *
- * Copyright 2001, 2002 Sun Microsystems Inc.,
- * Copyright 2001, 2002 Ximian, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-/*
- *
- * AccessibleApplication function prototypes
- *
- */
-
-#include <cspi/spi-private.h>
-#include <locale.h>
-
-/**
- * AccessibleApplication_ref:
- * @obj: a pointer to the #AccessibleApplication on which to operate.
- *
- * Increment the reference count for an #AccessibleApplication.
- **/
-void
-AccessibleApplication_ref (AccessibleApplication *obj)
-{
- cspi_object_ref (obj);
-}
-
-/**
- * AccessibleApplication_unref:
- * @obj: a pointer to the #AccessibleApplication object on which to operate.
- *
- * Decrement the reference count for an #AccessibleApplication.
- **/
-void
-AccessibleApplication_unref (AccessibleApplication *obj)
-{
- cspi_object_unref (obj);
-}
-
-/**
- * AccessibleApplication_getToolkitName:
- * @obj: a pointer to the #AccessibleApplication to query.
- *
- * Get the name of the UI toolkit used by an #AccessibleApplication.
- *
- * Returns: a UTF-8 string indicating which UI toolkit is
- * used by an application.
- **/
-char *
-AccessibleApplication_getToolkitName (AccessibleApplication *obj)
-{
- char *retval;
-
- cspi_return_val_if_fail (obj != NULL, NULL);
-
- cspi_dbus_get_property (obj, spi_interface_application, "tooklitName", NULL, "s", &retval);
-
- cspi_return_val_if_ev ("toolkitName", NULL);
-
- return retval;
-}
-
-/**
- * AccessibleApplication_getVersion:
- * @obj: a pointer to the #AccessibleApplication being queried.
- *
- * Get the version of the at-spi bridge exported by an
- * #AccessibleApplication instance.
- *
- * Returns: a UTF-8 string indicating the application's
- * at-spi version.
- **/
-char *
-AccessibleApplication_getVersion (AccessibleApplication *obj)
-{
- char *retval;
-
- cspi_return_val_if_fail (obj != NULL, NULL);
-
- cspi_dbus_get_property (obj, spi_interface_application, "version", NULL, "s", &retval);
-
- cspi_return_val_if_ev ("version", NULL);
-
- return retval;
-}
-
-/**
- * AccessibleApplication_getID:
- * @obj: a pointer to the #AccessibleApplication being queried.
- *
- * Get the unique ID assigned by the Registry to an
- * #AccessibleApplication instance.
- * (Not Yet Implemented by the registry).
- *
- * Returns: a unique #long integer associated with the application
- * by the Registry, or 0 if the application is not registered.
- **/
-long
-AccessibleApplication_getID (AccessibleApplication *obj)
-{
- dbus_int32_t retval;
-
- cspi_return_val_if_fail (obj != NULL, 0);
-
- cspi_dbus_get_property (obj, spi_interface_application, "id", NULL, "u", &retval);
-
- cspi_return_val_if_ev ("id", 0);
-
- return retval;
-}
-
-/**
- * AccessibleApplication_getLocale:
- * @obj: a pointer to the #AccessibleApplication being queried.
- * @lc_category: one of the POSIX LC_TYPE enumeration, for instance
- * LC_MESSAGES.
- *
- * Get a POSIX-compliant string describing the application's current
- * locale setting for a particular @lctype category.
- *
- * @Since: AT-SPI 1.4
- *
- * Returns: a POSIX-compliant locale string, e.g. "C", "pt_BR", "sr@latn", etc.
- **/
-char *
-AccessibleApplication_getLocale (AccessibleApplication *obj, int lc_category)
-{
- gchar *retval;
- dbus_uint32_t lctype;
-
- cspi_return_val_if_fail (obj != NULL, g_strdup (""));
-
- switch (lc_category)
- {
- case LC_COLLATE:
- lctype = Accessibility_LOCALE_TYPE_COLLATE;
- break;
- case LC_CTYPE:
- lctype = Accessibility_LOCALE_TYPE_CTYPE;
- break;
- case LC_NUMERIC:
- lctype = Accessibility_LOCALE_TYPE_NUMERIC;
- break;
- case LC_MONETARY:
- lctype = Accessibility_LOCALE_TYPE_MONETARY;
- break;
- case LC_MESSAGES:
- default:
- lctype = Accessibility_LOCALE_TYPE_MESSAGES;
- break;
- }
-
- cspi_dbus_call (obj, spi_interface_application, "getLocale", NULL, "u=>s", lctype, &retval);
-
- cspi_return_val_if_ev ("id", g_strdup (""));
-
- return g_strdup (retval);
-}
-
-/**
- * AccessibleApplication_pause:
- * @obj: a pointer to the #Accessible object on which to operate.
- *
- * Attempt to pause the application (used when client event queue is
- * over-full).
- * Not Yet Implemented.
- *
- * Returns: #TRUE if the application was paused successfully, #FALSE otherwise.
- *
- **/
-SPIBoolean
-AccessibleApplication_pause (AccessibleApplication *obj)
-{
- return FALSE;
-}
-
-/**
- * AccessibleApplication_resume:
- * @obj: a pointer to the #Accessible object on which to operate.
- *
- * Attempt to resume the application (used after #AccessibleApplication_pause).
- * Not Yet Implemented.
- *
- * Returns: #TRUE if application processing resumed successfully, #FALSE otherwise.
- *
- **/
-SPIBoolean
-AccessibleApplication_resume (AccessibleApplication *obj)
-{
- return FALSE;
-}
diff --git a/cspi/spi-component.c b/cspi/spi-component.c
deleted file mode 100644
index 93a30c5b..00000000
--- a/cspi/spi-component.c
+++ /dev/null
@@ -1,346 +0,0 @@
-/*
- * AT-SPI - Assistive Technology Service Provider Interface
- * (Gnome Accessibility Project; http://developer.gnome.org/projects/gap)
- *
- * Copyright 2001, 2002 Sun Microsystems Inc.,
- * Copyright 2001, 2002 Ximian, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-/*
- *
- * AccessibleComponent function implementations
- *
- */
-
-#include <cspi/spi-private.h>
-
-/**
- * AccessibleComponent_ref:
- * @obj: a pointer to an object implementing #AccessibleComponent on which to operate.
- *
- * Increment the reference count for an #AccessibleComponent.
- **/
-void
-AccessibleComponent_ref (AccessibleComponent *obj)
-{
- cspi_object_ref (obj);
-}
-
-/**
- * AccessibleComponent_unref:
- * @obj: a pointer to the object implementing #AccessibleComponent on which to operate.
- *
- * Decrement the reference count for an #AccessibleComponent.
- **/
-void
-AccessibleComponent_unref (AccessibleComponent *obj)
-{
- cspi_object_unref (obj);
-}
-
-/**
- * AccessibleComponent_contains:
- * @obj: a pointer to the #AccessibleComponent to query.
- * @x: a #long specifying the x coordinate in question.
- * @y: a #long specifying the y coordinate in question.
- * @ctype: the desired coordinate system of the point (@x, @y)
- * (e.g. CSPI_COORD_TYPE_WINDOW, CSPI_COORD_TYPE_SCREEN).
- *
- * Query whether a given #AccessibleComponent contains a particular point.
- *
- * Returns: a #TRUE if the specified component contains the point (@x, @y),
- * otherwise #FALSE.
- **/
-SPIBoolean
-AccessibleComponent_contains (AccessibleComponent *obj,
- long int x,
- long int y,
- AccessibleCoordType ctype)
-{
- dbus_bool_t retval;
- dbus_int32_t d_x = x, d_y = y;
- dbus_uint16_t d_ctype = ctype;
-
- cspi_return_val_if_fail (obj != NULL, FALSE);
-
- cspi_dbus_call (obj, spi_interface_component, "contains", NULL, "iin=>b", d_x, d_y, d_ctype, &retval);
-
- cspi_return_val_if_ev ("contains", FALSE);
-
- return retval;
-}
-
-/**
- * AccessibleComponent_getAccessibleAtPoint:
- * @obj: a pointer to the #AccessibleComponent to query.
- * @x: a #long specifying the x coordinate of the point in question.
- * @y: a #long specifying the y coordinate of the point in question.
- * @ctype: the coordinate system of the point (@x, @y)
- * (e.g. CSPI_COORD_TYPE_WINDOW, CSPI_COORD_TYPE_SCREEN).
- *
- * Get the accessible child at a given coordinate within an #AccessibleComponent.
- *
- * Returns: a pointer to an #Accessible child of the specified component which
- * contains the point (@x, @y), or NULL of no child contains the point.
- **/
-Accessible *
-AccessibleComponent_getAccessibleAtPoint (AccessibleComponent *obj,
- long int x,
- long int y,
- AccessibleCoordType ctype)
-{
- dbus_int32_t d_x = x, d_y = y;
- dbus_uint16_t d_ctype = ctype;
- char *path = NULL;
- Accessible *retval;
-
- cspi_return_val_if_fail (obj != NULL, FALSE);
-
- cspi_dbus_call (obj, spi_interface_component, "getAccessibleAtPoint", NULL, "iin=>o", d_x, d_y, d_ctype, &path);
-
- retval = cspi_ref_related_accessible (obj, path);
- g_free (path);
- return retval;
-}
-
-/**
- * AccessibleComponent_getExtents:
- * @obj: a pointer to the #AccessibleComponent to query.
- * @x: a pointer to a #long into which the minimum x coordinate will be returned.
- * @y: a pointer to a #long into which the minimum y coordinate will be returned.
- * @width: a pointer to a #long into which the x extents (width) will be returned.
- * @height: a pointer to a #long into which the y extents (height) will be returned.
- * @ctype: the desired coordinate system into which to return the results,
- * (e.g. CSPI_COORD_TYPE_WINDOW, CSPI_COORD_TYPE_SCREEN).
- *
- * Get the bounding box of the specified #AccessibleComponent.
- *
- **/
-void
-AccessibleComponent_getExtents (AccessibleComponent *obj,
- long int *x,
- long int *y,
- long int *width,
- long int *height,
- AccessibleCoordType ctype)
-{
- dbus_int16_t d_ctype = ctype;
- Accessibility_BoundingBox bbox;
-
- cspi_return_if_fail (obj != NULL);
-
- cspi_dbus_call (obj, spi_interface_component, "getExtents", NULL, "n=>(iiii)", d_ctype, &bbox);
- if (!cspi_check_ev ("getExtents"))
- {
- *x = *y = *width = *height = 0;
- }
- else
- {
- *x = bbox.x;
- *y = bbox.y;
- *width = bbox.width;
- *height = bbox.height;
- }
-}
-
-/**
- * AccessibleComponent_getPosition:
- * @obj: a pointer to the #AccessibleComponent to query.
- * @x: a pointer to a #long into which the minimum x coordinate will be returned.
- * @y: a pointer to a #long into which the minimum y coordinate will be returned.
- * @ctype: the desired coordinate system into which to return the results,
- * (e.g. CSPI_COORD_TYPE_WINDOW, CSPI_COORD_TYPE_SCREEN).
- *
- * Get the minimum x and y coordinates of the specified #AccessibleComponent.
- *
- **/
-void
-AccessibleComponent_getPosition (AccessibleComponent *obj,
- long int *x,
- long int *y,
- AccessibleCoordType ctype)
-{
- dbus_int32_t d_x, d_y;
- dbus_uint16_t d_ctype = ctype;
-
- cspi_return_if_fail (obj != NULL);
-
- cspi_dbus_call (obj, spi_interface_component, "getPosition", NULL, "n=>ii", d_ctype, &d_x, &d_y);
-
- if (!cspi_check_ev ("getPosition"))
- {
- *x = *y = 0;
- }
- else
- {
- *x = d_x;
- *y = d_y;
- }
-}
-
-/**
- * AccessibleComponent_getSize:
- * @obj: a pointer to the #AccessibleComponent to query.
- * @width: a pointer to a #long into which the x extents (width) will be returned.
- * @height: a pointer to a #long into which the y extents (height) will be returned.
- *
- * Get the size of the specified #AccessibleComponent.
- *
- **/
-void
-AccessibleComponent_getSize (AccessibleComponent *obj,
- long int *width,
- long int *height)
-{
- dbus_int32_t d_w, d_h;
-
- cspi_return_if_fail (obj != NULL);
-
- cspi_dbus_call (obj, spi_interface_component, "getSize", NULL, "=>ii", &d_w, &d_h);
- if (cspi_check_ev ("getSize"))
- {
- *width = *height = 0;
- }
- else
- {
- *width = d_w;
- *height = d_h;
- }
-}
-
-/**
- * AccessibleComponent_getLayer:
- * @obj: a pointer to the #AccessibleComponent to query.
- *
- * Query which layer the component is painted into, to help determine its
- * visibility in terms of stacking order.
- *
- * Returns: the #AccessibleComponentLayer into which this component is painted.
- **/
-AccessibleComponentLayer
-AccessibleComponent_getLayer (AccessibleComponent *obj)
-{
- AccessibleComponentLayer retval;
- dbus_uint32_t zlayer;
-
- cspi_return_val_if_fail (obj != NULL, FALSE);
-
- cspi_dbus_call (obj, spi_interface_component, "getLayer", NULL, "=>u", &zlayer);
-
- cspi_return_val_if_ev ("getLayer", SPI_LAYER_INVALID);
-
- switch (zlayer)
- {
- case Accessibility_LAYER_BACKGROUND:
- retval = SPI_LAYER_BACKGROUND;
- break;
- case Accessibility_LAYER_CANVAS:
- retval = SPI_LAYER_CANVAS;
- break;
- case Accessibility_LAYER_WIDGET:
- retval = SPI_LAYER_WIDGET;
- break;
- case Accessibility_LAYER_MDI:
- retval = SPI_LAYER_MDI;
- break;
- case Accessibility_LAYER_POPUP:
- retval = SPI_LAYER_POPUP;
- break;
- case Accessibility_LAYER_OVERLAY:
- retval = SPI_LAYER_OVERLAY;
- break;
- case Accessibility_LAYER_WINDOW:
- retval = SPI_LAYER_WINDOW;
- break;
- default:
- retval = SPI_LAYER_INVALID;
- break;
- }
-
- return retval;
-}
-
-/**
- * AccessibleComponent_getMDIZOrder:
- * @obj: a pointer to the #AccessibleComponent to query.
- *
- * Query the z stacking order of a component which is in the MDI or window
- * layer. (Bigger z-order numbers mean nearer the top)
- *
- * Returns: a short integer indicating the stacking order of the component
- * in the MDI layer, or -1 if the component is not in the MDI layer.
- **/
-short
-AccessibleComponent_getMDIZOrder (AccessibleComponent *obj)
-{
- dbus_uint16_t retval;
-
- cspi_return_val_if_fail (obj != NULL, FALSE);
-
- cspi_dbus_call (obj, spi_interface_component, "getMDIZOrder", NULL, "=>n", &retval);
-
- cspi_return_val_if_ev ("getMDIZOrder", FALSE);
-
- return retval;
-}
-
-/**
- * AccessibleComponent_grabFocus:
- * @obj: a pointer to the #AccessibleComponent on which to operate.
- *
- * Attempt to set the keyboard input focus to the specified
- * #AccessibleComponent.
- *
- * Returns: #TRUE if successful, #FALSE otherwise.
- *
- **/
-SPIBoolean
-AccessibleComponent_grabFocus (AccessibleComponent *obj)
-{
- dbus_bool_t retval;
-
- cspi_return_val_if_fail (obj != NULL, FALSE);
-
- cspi_dbus_call (obj, spi_interface_component, "grabFocus", NULL, "=>b", &retval);
-
- cspi_return_val_if_ev ("grabFocus", FALSE);
-
- return retval;
-}
-
-/**
- * AccessibleComponent_getAlpha:
- * @obj: The #AccessibleComponent to be queried.
- *
- * Get the opacity/alpha value of a component, if alpha blending is in use.
- *
- * Returns: the opacity value of a component, as a double between 0.0 and 1.0.
- **/
-double
-AccessibleComponent_getAlpha (AccessibleComponent *obj)
-{
- double retval;
-
- cspi_return_val_if_fail (obj != NULL, 1.0);
-
- cspi_dbus_call (obj, spi_interface_component, "getAlpha", NULL, "=>d", &retval);
-
- cspi_return_val_if_ev ("getAlpha", 1.0);
-
- return retval;
-}
diff --git a/cspi/spi-editabletext.c b/cspi/spi-editabletext.c
deleted file mode 100644
index 31ae4296..00000000
--- a/cspi/spi-editabletext.c
+++ /dev/null
@@ -1,264 +0,0 @@
-/*
- * AT-SPI - Assistive Technology Service Provider Interface
- * (Gnome Accessibility Project; http://developer.gnome.org/projects/gap)
- *
- * Copyright 2001, 2002 Sun Microsystems Inc.,
- * Copyright 2001, 2002 Ximian, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#include <cspi/spi-private.h>
-
-/**
- * AccessibleEditableText_ref:
- * @obj: a pointer to the #AccessibleEditableText object on which to operate.
- *
- * Increment the reference count for an #AccessibleEditableText object.
- * Since AccessibleEditableText is derived from AccessibleText,
- * this is the same as AccessibleText_ref().
- **/
-void
-AccessibleEditableText_ref (AccessibleEditableText *obj)
-{
- cspi_object_ref (obj);
-}
-
-/**
- * AccessibleEditableText_unref:
- * @obj: a pointer to the #AccessibleEditableText object on which to operate.
- *
- * Decrement the reference count for an #AccessibleEdiitableText object.
- * Since AccessibleEditableText is derived from AccessibleText,
- * this is the same as AccessibleText_unref().
- **/
-void
-AccessibleEditableText_unref (AccessibleEditableText *obj)
-{
- cspi_object_unref (obj);
-}
-
-/**
- * AccessibleEditableText_setAttributes:
- * @obj: a pointer to the #AccessibleEditableText object to modify.
- * @attributes: a character string indicating the attributes to apply to the range,
- * delimited by ':'.
- * @startOffset: a #long indicating the start of the desired text range.
- * @endOffset: a #long indicating the first character past the desired range.
- *
- * Set the attributes applied to a range of text from an #AccessibleEditableText
- * object, and the bounds of the range.
- *
- * Returns: #TRUE if the operation was successful, otherwise #FALSE.
- **/
-SPIBoolean
-AccessibleEditableText_setAttributes (AccessibleEditableText *obj,
- const char *attributes,
- long int startPos,
- long int endPos)
-{
- dbus_int32_t d_startPos = startPos, d_endPos = endPos;
- dbus_bool_t retval;
-
- cspi_return_val_if_fail (obj != NULL, FALSE);
-
- cspi_dbus_call (obj, spi_interface_editable_text, "setAttributes", NULL, "sii=>b", attributes, d_startPos, d_endPos, &retval);
-
- cspi_return_val_if_ev ("setAttributes", FALSE);
-
- return retval;
-}
-
-/**
- * AccessibleEditableText_setTextContents:
- * @obj: a pointer to the #AccessibleEditableText object to modify.
- * @newContents: a character string, encoded in UTF-8, which is to
- * become the new text contents of the #AccessibleEditableText object.
- *
- * Replace the entire text contents of an #AccessibleEditableText object.
- *
- * Returns: #TRUE if the operation was successful, otherwise #FALSE.
- **/
-SPIBoolean
-AccessibleEditableText_setTextContents (AccessibleEditableText *obj,
- const char *newContents)
-{
- dbus_bool_t retval;
-
- cspi_return_val_if_fail (obj != NULL, FALSE);
-
- cspi_dbus_call (obj, spi_interface_editable_text, "setTextContents", NULL, "s=>b", newContents, &retval);
-
- cspi_return_val_if_ev ("setTextContents", FALSE);
-
- return retval;
-}
-
-/**
- * AccessibleEditableText_insertText:
- * @obj: a pointer to the #AccessibleEditableText object to modify.
- * @position: an integer indicating the character offset at which to insert
- * the new text.
- * @text: a char* pointer to the text to insert, in UTF-8 encoding.
- * @length: (frankly I'm not sure this parameter should be here)
- *
- * Insert text into an #AccessibleEditableText object.
- * As with all character offsets, the specified @position may not be the
- * same as the resulting byte offset, since the text is in a
- * variable-width encoding.
- *
- * Returns: #TRUE if the operation was successful, otherwise #FALSE.
- **/
-SPIBoolean
-AccessibleEditableText_insertText (AccessibleEditableText *obj,
- long int position,
- const char *text,
- long int length)
-{
- dbus_int32_t d_position = position, d_length = length;
- dbus_bool_t retval;
-
- cspi_return_val_if_fail (obj != NULL, FALSE);
-
- cspi_dbus_call (obj, spi_interface_editable_text, "insertText", NULL, "isi=>b", d_position, text, d_length, &retval);
-
- cspi_return_val_if_ev ("insertText", FALSE);
-
- return retval;
-}
-
-/**
- * AccessibleEditableText_copyText:
- * @obj: a pointer to the #AccessibleEditableText object to modify.
- * @startPos: an integer indicating the starting character offset
- * of the text to copy.
- * @endPos: an integer indicating the offset of the first character
- * past the end of the text section to be copied.
- *
- * Copy text from an #AccessibleEditableText object into the clipboard.
- *
- * @see: AccessibleEditableText_pasteText
- *
- * Returns: #TRUE if the operation was successful, otherwise #FALSE.
- **/
-SPIBoolean
-AccessibleEditableText_copyText (AccessibleText *obj,
- long int startPos,
- long int endPos)
-{
- dbus_int32_t d_startPos = startPos, d_endPos = endPos;
-
- cspi_return_val_if_fail (obj != NULL, FALSE);
-
- cspi_dbus_call (obj, spi_interface_editable_text, "copyText", NULL, "ii", startPos, endPos);
-
- cspi_return_val_if_ev ("copyText", FALSE);
-
- return TRUE;
-}
-
-/**
- * AccessibleEditableText_cutText:
- * @obj: a pointer to the #AccessibleEditableText object to modify.
- * @startPos: an integer indicating the starting character offset
- * of the text to cut.
- * @endPos: an integer indicating the offset of the first character
- * past the end of the text section to be cut.
- *
- * Delete text from an #AccessibleEditableText object, copying the
- * excised portion into the clipboard.
- *
- * @see: AccessibleEditableText_pasteText
- *
- * Returns: #TRUE if operation was successful, #FALSE otherwise.
- **/
-SPIBoolean
-AccessibleEditableText_cutText (AccessibleEditableText *obj,
- long int startPos,
- long int endPos)
-{
- dbus_int32_t d_startPos = startPos, d_endPos = endPos;
- dbus_bool_t retval;
-
- cspi_return_val_if_fail (obj != NULL, FALSE);
-
- cspi_dbus_call (obj, spi_interface_editable_text, "cutText", NULL, "ii=>b", d_startPos, d_endPos, &retval);
-
- cspi_return_val_if_ev ("cutText", FALSE);
-
- return retval;
-}
-
-/**
- * AccessibleEditableText_deleteText:
- * @obj: a pointer to the #AccessibleEditableText object to modify.
- * @startPos: an integer indicating the starting character offset
- * of the text to delete.
- * @endPos: an integer indicating the offset of the first character
- * past the end of the text section to be deleted.
- *
- * Delete text from an #AccessibleEditableText object, without copying the
- * excised portion into the clipboard.
- *
- * @see: AccessibleEditableText_cutText
- *
- * Returns: #TRUE if the operation was successful, otherwise #FALSE.
- **/
-SPIBoolean
-AccessibleEditableText_deleteText (AccessibleEditableText *obj,
- long startPos,
- long endPos)
-{
- dbus_int32_t d_startPos = startPos, d_endPos = endPos;
- dbus_bool_t retval;
-
- cspi_return_val_if_fail (obj != NULL, FALSE);
-
- cspi_dbus_call (obj, spi_interface_editable_text, "deleteText", NULL, "ii=>b", d_startPos, d_endPos, &retval);
-
- cspi_return_val_if_ev ("deleteText", FALSE);
-
- return retval;
-}
-
-/**
- * AccessibleEditableText_pasteText:
- * @obj: a pointer to the #AccessibleEditableText object to modify.
- * @position: an integer indicating the character offset at which to insert
- * the new text.
- *
- * Insert text from the clipboard into an #AccessibleEditableText object.
- * As with all character offsets, the specified @position may not be the
- * same as the resulting byte offset, since the text is in a
- * variable-width encoding.
- *
- * Returns: #TRUE if the operation was successful, otherwise #FALSE.
- **/
-SPIBoolean
-AccessibleEditableText_pasteText (AccessibleEditableText *obj,
- long int position)
-{
- dbus_int32_t d_position = position;
- dbus_bool_t retval;
-
- cspi_return_val_if_fail (obj != NULL, FALSE);
-
- cspi_dbus_call (obj, spi_interface_editable_text, "pasteText", NULL, "i=>b", d_position, &retval);
-
- cspi_return_val_if_ev ("pasteText", FALSE);
-
- return retval;
-}
diff --git a/cspi/spi-event.c b/cspi/spi-event.c
deleted file mode 100644
index fe704a16..00000000
--- a/cspi/spi-event.c
+++ /dev/null
@@ -1,1262 +0,0 @@
-/*
- * AT-SPI - Assistive Technology Service Provider Interface
- * (Gnome Accessibility Project; http://developer.gnome.org/projects/gap)
- *
- * Copyright 2001, 2002, 2003 Sun Microsystems Inc.,
- * Copyright 2001, 2002, 2003 Ximian, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#include <cspi/spi-private.h>
-
-static GSList *_cspi_event_queue = NULL;
-
-/**
- * SPI_freeAccessibleKeySet:
- * @keyset: An AccessibleKeyset to free.
- *
- * Release the memory used by an AccessibleKeySet.
- *
- **/
-void
-SPI_freeAccessibleKeySet (AccessibleKeySet *keyset)
-{
- int i = 0;
- g_free (keyset->keysyms);
- g_free (keyset->keycodes);
- while (keyset->keystrings [i])
- {
- g_free (keyset->keystrings [i++]);
- }
- g_free (keyset->keystrings);
- g_free (keyset);
-}
-
-/**
- * SPI_createAccessibleKeySet:
- * @len: the number of key values in the key set.
- * @keysyms: a UTF-8 string containing symbolic key values to be matched, or NULL if
- * matching is performed against other key values instead.
- * @keycodes: an array of unsigned short values which are the hardware keycodes
- * to be matched, or NULL if the keyset is specified solely by keysyms
- * and/or keystrings.
- * @keystrings: an array of null-terminated character strings which specify key
- * name values to match, or NULL if the keyset is specified solely by
- * keycodes and/or keysyms.
- *
- * Create a new #AccessibleKeySet of a specified length.
- * A KeySet is used typically to match key event values, and a matches are made
- * using the following criteria: a match exists with a key event if all non-null
- * i-th members of the keyset match the key event.
- * If both keystring and keysym values are NULL, a keycode value match is
- * forced, thus the match for keysym=0, keycode=0, keystring=NULL is
- * keycode 0.
- *
- * Returns: a pointer to a newly-created #AccessibleKeySet.
- *
- **/
-AccessibleKeySet *
-SPI_createAccessibleKeySet (int len, const char *keysyms, short *keycodes,
- const char **keystrings)
-{
- AccessibleKeySet *keyset = g_new0 (AccessibleKeySet, 1);
- int i, keysym_len = 0;
- const char *keysym_ptr = keysyms;
- keyset->len = len;
- keyset->keysyms = g_new0 (unsigned long, len);
- keyset->keycodes = g_new0 (unsigned short, len);
- keyset->keystrings = g_new0 (char *, len);
- if (keysyms)
- {
- keysym_len = g_utf8_strlen (keysyms, -1);
- }
- for (i = 0; i < len; ++i)
- {
- if (i < keysym_len)
- {
- keyset->keysyms [i] = (unsigned long) g_utf8_get_char (keysym_ptr);
- keysym_ptr = g_utf8_find_next_char (keysym_ptr, NULL);
- }
- else
- {
- keyset->keysyms [i] = 0;
- }
- if (keycodes)
- {
- keyset->keycodes [i] = keycodes [i];
- }
- if (keystrings)
- {
- keyset->keystrings [i] = g_strdup (keystrings [i]);
- }
- }
- return keyset;
-}
-
-/**
- * SPI_createAccessibleEventListener:
- * @callback : an #AccessibleEventListenerCB callback function, or NULL.
- * @user_data: a pointer to data which will be passed to the callback when invoked.
- *
- * Create a new #AccessibleEventListener with a specified (in-process) callback function.
- *
- * Returns: a pointer to a newly-created #AccessibleEventListener.
- *
- **/
-AccessibleEventListener *
-SPI_createAccessibleEventListener (AccessibleEventListenerCB callback,
- void *user_data)
-{
- AccessibleEventListener *listener = cspi_event_listener_new ();
- if (callback)
- {
- AccessibleEventListener_addCallback (listener, callback, user_data);
- }
- return listener;
-}
-
-/**
- * AccessibleEventListener_addCallback:
- * @listener: the #AccessibleEventListener instance to modify.
- * @callback: an #AccessibleEventListenerCB function pointer.
- * @user_data: a pointer to data which will be passed to the callback when invoked.
- *
- * Add an in-process callback function to an existing AccessibleEventListener.
- * Note that the callback function must live in the same address
- * space as the AccessibleEventListener implementation code, thus one should not
- * use this function to attach callbacks to a 'remote' event listener
- * (that is, one that was not created by a client call to
- * createAccessibleEventListener ();
- *
- * Returns: #TRUE if successful, otherwise #FALSE.
- *
- **/
-SPIBoolean
-AccessibleEventListener_addCallback (AccessibleEventListener *listener,
- AccessibleEventListenerCB callback,
- void *user_data)
-{
- cspi_event_listener_add_cb (listener, callback, user_data);
- return TRUE;
-}
-
-/**
- * AccessibleEventListener_unref:
- * @listener: a pointer to the #AccessibleEventListener being operated on.
- *
- * Decrements an #AccessibleEventListener's reference count.
- **/
-void
-AccessibleEventListener_unref (AccessibleEventListener *listener)
-{
- cspi_event_listener_unref (listener);
-}
-
-/**
- * AccessibleEventListener_removeCallback:
- * @listener: the #AccessibleEventListener instance to modify.
- * @callback: an #AccessibleEventListenerCB function pointer.
- *
- * Remove an in-process callback function from an existing AccessibleEventListener.
- *
- * Returns: #TRUE if successful, otherwise #FALSE.
- *
- **/
-SPIBoolean
-AccessibleEventListener_removeCallback (AccessibleEventListener *listener,
- AccessibleEventListenerCB callback)
-{
- cspi_event_listener_remove_cb (listener, callback);
- return TRUE;
-}
-
-/**
- * SPI_createAccessibleKeystrokeListener:
- * @callback : an #AccessibleKeystrokeListenerCB callback function, or NULL.
- * @user_data: a pointer to data which will be passed to the callback when invoked.
- *
- * Create a new #AccessibleKeystrokeListener with a specified callback function.
- *
- * Returns: a pointer to a newly-created #AccessibleKeystrokeListener.
- *
- **/
-AccessibleKeystrokeListener *
-SPI_createAccessibleKeystrokeListener (AccessibleKeystrokeListenerCB callback,
- void *user_data)
-{
- AccessibleDeviceListener *listener = cspi_device_listener_new ();
- if (callback)
- {
- AccessibleDeviceListener_addCallback (listener, callback, user_data);
- }
- return listener;
-}
-
-/**
- * AccessibleKeystrokeListener_addCallback:
- * @listener: the #AccessibleKeystrokeListener instance to modify.
- * @callback: an #AccessibleKeystrokeListenerCB function pointer.
- * @user_data: a pointer to data which will be passed to the callback when invoked.
- *
- * Add an in-process callback function to an existing #AccessibleKeystrokeListener.
- *
- * Returns: #TRUE if successful, otherwise #FALSE.
- *
- **/
-SPIBoolean
-AccessibleKeystrokeListener_addCallback (AccessibleKeystrokeListener *listener,
- AccessibleKeystrokeListenerCB callback,
- void *user_data)
-{
- cspi_device_listener_add_cb (listener, callback, user_data);
- return TRUE;
-}
-
-/**
- * AccessibleKeystrokeListener_removeCallback:
- * @listener: the #AccessibleKeystrokeListener instance to modify.
- * @callback: an #AccessibleKeystrokeListenerCB function pointer.
- *
- * Remove an in-process callback function from an existing #AccessibleKeystrokeListener.
- *
- * Returns: #TRUE if successful, otherwise #FALSE.
- *
- **/
-SPIBoolean
-AccessibleKeystrokeListener_removeCallback (AccessibleKeystrokeListener *listener,
- AccessibleKeystrokeListenerCB callback)
-{
- cspi_device_listener_remove_cb (listener, callback);
- return TRUE;
-}
-
-/**
- * AccessibleKeystrokeListener_unref:
- * @listener: a pointer to the #AccessibleKeystrokeListener being operated on.
- *
- * Decrements an #AccessibleKeystrokeListener's reference count.
- **/
-void
-AccessibleKeystrokeListener_unref (AccessibleKeystrokeListener *listener)
-{
- cspi_device_listener_unref (listener);
-}
-
-/**
- * SPI_createAccessibleDeviceListener:
- * @callback : an #AccessibleDeviceListenerCB callback function, or NULL.
- * @user_data: a pointer to data which will be passed to the callback when invoked.
- *
- * Create a new #AccessibleDeviceListener with a specified callback function.
- *
- * Returns: a pointer to a newly-created #AccessibleDeviceListener.
- *
- **/
-AccessibleDeviceListener *
-SPI_createAccessibleDeviceListener (AccessibleDeviceListenerCB callback,
- void *user_data)
-{
- AccessibleDeviceListener *listener = cspi_device_listener_new ();
- if (callback)
- {
- AccessibleDeviceListener_addCallback (listener, callback, user_data);
- }
- return listener;
-}
-
-/**
- * AccessibleDeviceListener_addCallback:
- * @listener: the #AccessibleDeviceListener instance to modify.
- * @callback: an #AccessibleDeviceListenerCB function pointer.
- * @user_data: a pointer to data which will be passed to the callback when invoked.
- *
- * Add an in-process callback function to an existing #AccessibleDeviceListener.
- *
- * Returns: #TRUE if successful, otherwise #FALSE.
- *
- **/
-SPIBoolean
-AccessibleDeviceListener_addCallback (AccessibleDeviceListener *listener,
- AccessibleDeviceListenerCB callback,
- void *user_data)
-{
- cspi_device_listener_add_cb (listener, callback, user_data);
- return TRUE;
-}
-
-/**
- * AccessibleDeviceListener_removeCallback:
- * @listener: the #AccessibleDeviceListener instance to modify.
- * @callback: an #AccessibleDeviceListenerCB function pointer.
- *
- * Remove an in-process callback function from an existing #AccessibleDeviceListener.
- *
- * Returns: #TRUE if successful, otherwise #FALSE.
- *
- **/
-SPIBoolean
-AccessibleDeviceListener_removeCallback (AccessibleDeviceListener *listener,
- AccessibleDeviceListenerCB callback)
-{
- cspi_device_listener_remove_cb (listener, callback);
- return TRUE;
-}
-
-/**
- * AccessibleDeviceListener_unref:
- * @listener: a pointer to the #AccessibleDeviceListener being operated on.
- *
- * Decrements an #AccessibleDeviceListener's reference count.
- **/
-void
-AccessibleDeviceListener_unref (AccessibleDeviceListener *listener)
-{
- cspi_device_listener_unref (listener);
-}
-
-static char *
-cspi_internal_event_get_text (const InternalEvent *e)
-{
- g_return_val_if_fail (e, NULL);
- if (e->event.v_type == EVENT_DATA_STRING)
- {
- return g_strdup (e->event.v.text? e->event.v.text: "");
- }
- return NULL;
-}
-
-static Accessible *
-cspi_internal_event_get_object (const InternalEvent *e)
-{
- g_return_val_if_fail (e, NULL);
- if (e->event.v_type == EVENT_DATA_OBJECT)
- {
- cspi_object_ref (e->event.v.accessible);
- return e->event.v.accessible;
- }
- return NULL;
-}
-
-static SPIRect *
-cspi_internal_event_get_rect (const InternalEvent *e)
-{
- g_return_val_if_fail (e, NULL);
- if (e->event.v_type == EVENT_DATA_RECT)
- {
- SPIRect *rect = g_new (SPIRect, 1);
- if (rect) memcpy (rect, &e->event.v.rect, sizeof(*rect));
- return rect;
- }
- return NULL;
-}
-
-/**
- * AccessibleEvent_getSourceName:
- * @e: an #AccessibleEvent to be queried.
- *
- * Get the 'accessible-name' of the object emitting the event.
- *
- * Returns: The name of the event source, or NULL if the event source cannot be identified
- * or does not report a name.
- */
-char* AccessibleEvent_getSourceName (const AccessibleEvent *e)
-{
- if (e && e->source)
- {
- return Accessible_getName (e->source);
- }
- return NULL;
-}
-
-/**
- * AccessibleEvent_getSourceRole:
- * @e: an #AccessibleEvent to be queried.
- *
- * Get the #AccessibleRole of the object emitting the event.
- *
- * Returns: #AccessibleRole of the event source, or SPI_ROLE_UNKNOWN
- * if the event source's role is unknown or unspecified.
- * (Some kinds of events, such as 'mouse:' events or
- * toolkit events, don't have associated object roles.)
- */
-AccessibleRole AccessibleEvent_getSourceRole (const AccessibleEvent *e)
-{
- if (e && e->source)
- {
- return Accessible_getRole (e->source);
- }
- return SPI_ROLE_UNKNOWN;
-}
-
-/**
- * AccessibleEvent_getSourceApplication:
- * @e: an #AccessibleEvent to be queried.
- *
- * Get the #Application hosting the object which emitted the event.
- *
- * Returns: A pointer to the host #Application contining the event source
- * component.
- */
-#if 0
-AccessibleApplication* AccessibleEvent_getSourceApplication (const AccessibleEvent *e)
-{
-xyzzy
- InternalEvent *ie = (InternalEvent *)e;
- CORBA_any *any = ((ie && ie->data) ? (CORBA_any *)ie->data : NULL);
- if (any &&
- CORBA_TypeCode_equivalent (any->_type,
- TC_Accessibility_EventDetails, NULL))
- {
- Accessibility_EventDetails *details = (Accessibility_EventDetails *) any->_value;
- return cspi_object_take (details->host_application);
- }
- else
- return NULL;
-}
-#endif
-
-/**
- * AccessibleEvent_getSourceDetails:
- * @e: an #AccessibleEvent to be queried.
- * @name: a pointer to a character string which will point to the name of the event source
- * on successful completion of the call.
- * @role: a pointer to an #AccessibleRole which will point to the role of the event source
- * on successful completion of the call.
- * @app: A pointer to an #AccessibleApplication which points to the host application for this event
- * on successful completion of the call.
- *
- * Get the host #Application, "accessible name", and #AccessibleRole
- * of the object which emitted the event.
- *
- * Returns: TRUE if the source details were successfully retrieved,
- * FALSE if they were not, either due to error, incomplete data,
- * or the fact that the event did not encapsulate the required data.
- */
-#if 0
-SPIBoolean AccessibleEvent_getSourceDetails (const AccessibleEvent *e,
- char **name, AccessibleRole *role,
- AccessibleApplication **app)
-{
- InternalEvent *ie = (InternalEvent *)e;
- CORBA_any *any = ((ie && ie->data) ? (CORBA_any *)ie->data : NULL);
- if (any &&
- CORBA_TypeCode_equivalent (any->_type,
- TC_Accessibility_EventDetails, NULL))
- {
- Accessibility_EventDetails *details = (Accessibility_EventDetails *) any->_value;
- *name = CORBA_string_dup (details->source_name);
- *role = cspi_role_from_spi_role (details->source_role);
- *app = cspi_object_take (details->host_application);
- return TRUE;
- }
- else
- {
- *name = NULL;
- *role = SPI_ROLE_UNKNOWN;
- *app = NULL;
- return FALSE;
- }
-}
-#endif
-
-/**
- * AccessibleTextChangedEvent_getChangeString:
- * @e: a pointer to the #AccessibleEvent being queried.
- *
- * Queries an #AccessibleEvent of type "object:text-changed",
- * returning the text inserted or deleted.
- *
- * Returns: a UTF-8 text string indicating the text inserted,
- * deleted, or substituted by this event.
- **/
-char *
-AccessibleTextChangedEvent_getChangeString (const AccessibleEvent *e)
-{
- const InternalEvent *foo = (InternalEvent *) e;
- /* TODO: check the event type. */
- return cspi_internal_event_get_text (foo);
-}
-
-/**
- * AccessibleTextSelectionChangedEvent_getSelectionString:
- * @e: a pointer to the #AccessibleEvent being queried.
- *
- * Queries an #AccessibleEvent of type "object:text-selection-changed",
- * returning the newly added, removed, or modified selection string.
- *
- * Returns: a UTF-8 text string indicating the recently changed selection.
- **/
-char *
-AccessibleTextSelectionChangedEvent_getSelectionString (const AccessibleEvent *e)
-{
- const InternalEvent *foo = (InternalEvent *) e;
- /* TODO: check the event type. */
- return cspi_internal_event_get_text (foo);
-}
-
-/**
- * AccessibleWindowEvent_getTitleString:
- * @e: a pointer to the #AccessibleEvent being queried.
- *
- * Queries an #AccessibleEvent of type "window:",
- * returning the window title.
- *
- * Returns: a UTF-8 text string representing the title of the
- * recently changed window.
- **/
-char *
-AccessibleWindowEvent_getTitleString (const AccessibleEvent *e)
-{
- const InternalEvent *foo = (InternalEvent *) e;
- /* TODO: check the event type. */
- return cspi_internal_event_get_text (foo);
-}
-
-/**
- * AccessibleChildChangedEvent_getChildAccessible:
- * @e: a pointer to the #AccessibleEvent being queried.
- *
- * Queries an #AccessibleEvent of type "object:children_changed"
- * to get a reference to the changed #Accessible.
- * Note that context #Accessibles are not guaranteed to outlive
- * event delivery, in which case this call may return %NULL
- * even if the object existed at the time of dispatch.
- *
- * Returns: the context #Accessible for the event, or %NULL if
- * there is no longer a valid context #Accessible
- * object for the event.
- **/
-Accessible *
-AccessibleChildChangedEvent_getChildAccessible (const AccessibleEvent *e)
-{
- const InternalEvent *foo = (InternalEvent *) e;
- return (Accessible *) cspi_internal_event_get_object (foo);
-}
-
-/**
- * AccessibleParentChangedEvent_getParentAccessible:
- * @e: a pointer to the #AccessibleEvent being queried.
- *
- * Queries an #AccessibleEvent of type "object:property-change:accessible-parent"
- * to get a reference to the changed #Accessible.
- * Note that context #Accessibles are not guaranteed to outlive
- * event delivery, in which case this call may return %NULL
- * even if the object existed at the time of dispatch.
- *
- * Returns: an #Accessible pointer representing the new parent object.
- **/
-Accessible *
-AccessibleParentChangedEvent_getParentAccessible (const AccessibleEvent *e)
-{
- const InternalEvent *foo = (InternalEvent *) e;
- return (Accessible *) cspi_internal_event_get_object (foo);
-}
-
-/**
- * AccessibleActiveDescendantChangedEvent_getActiveDescendant:
- * @e: a pointer to the #AccessibleEvent being queried.
- *
- * Queries an #AccessibleEvent of type "object:active-descendant-changed"
- * to get a reference to the changed #Accessible.
- * Note that context #Accessibles are not guaranteed to outlive
- * event delivery, in which case this call may return %NULL
- * even if the object existed at the time of dispatch.
- *
- * Returns: an #Accessible pointer representing the new active descendant.
- **/
-Accessible *
-AccessibleActiveDescendantChangedEvent_getActiveDescendant (const AccessibleEvent *e)
-{
- const InternalEvent *foo = (InternalEvent *) e;
- return (Accessible *) cspi_internal_event_get_object (foo);
-}
-
-/**
- * AccessibleTableSummaryChangedEvent_getSummaryAccessible:
- * @e: a pointer to the #AccessibleEvent being queried.
- *
- * Queries an #AccessibleEvent of type "object:property-changed:accessible-table-summary"
- * to get a reference to the changed #Accessible.
- * Note that context #Accessibles are not guaranteed to outlive
- * event delivery, in which case this call may return %NULL
- * even if the object existed at the time of dispatch.
- *
- * Returns: an #Accessible pointer representing the new table summary.
- **/
-Accessible *
-AccessibleTableSummaryChangedEvent_getSummaryAccessible (const AccessibleEvent *e)
-{
- const InternalEvent *foo = (InternalEvent *) e;
- return (Accessible *) cspi_internal_event_get_object (foo);
-}
-
-/**
- * AccessibleTableHeaderChangedEvent_getHeaderAccessible:
- * @e: a pointer to the #AccessibleEvent being queried.
- *
- * Queries an #AccessibleEvent of type
- * "object:property-changed:accessible-table-row-header" or
- * "object:property-changed:accessible-table-column-header"
- * to get a reference to the changed #Accessible.
- * Note that context #Accessibles are not guaranteed to outlive
- * event delivery, in which case this call may return %NULL
- * even if the object existed at the time of dispatch.
- *
- * Returns: an #Accessible pointer representing the new table header.
- **/
-Accessible *
-AccessibleTableHeaderChangedEvent_getHeaderAccessible (const AccessibleEvent *e)
-{
- const InternalEvent *foo = (InternalEvent *) e;
- return (Accessible *) cspi_internal_event_get_object (foo);
-}
-
-
-/**
- * AccessibleTableCaptionChangedEvent_getCaptionString:
- * @e: a pointer to the #AccessibleEvent being queried.
- *
- * Queries an #AccessibleEvent of type
- * "object:property-changed:accessible-table-caption-object"
- * returning the text in the caption, if present.
- *
- * Returns: a UTF-8 text string indicating the text in the caption.
- **/
-char *
-AccessibleTableCaptionChangedEvent_getCaptionString (const AccessibleEvent *e)
-{
- const InternalEvent *foo = (InternalEvent *) e;
- /* TODO: check the event type. */
- return cspi_internal_event_get_text (foo);
-}
-
-/**
- * AccessibleTableRowDescriptionChangedEvent_getDescriptionString:
- * @e: a pointer to the #AccessibleEvent being queried.
- *
- * Queries an #AccessibleEvent of type
- * "object:property-changed:accessible-table-row-description"
- * returning the new table row description.
- *
- * Returns: a UTF-8 text string representing the recently changed
- * table row description
- **/
-char *
-AccessibleTableRowDescriptionChangedEvent_getDescriptionString (const AccessibleEvent *e)
-{
- const InternalEvent *foo = (InternalEvent *) e;
- /* TODO: check the event type. */
- return cspi_internal_event_get_text (foo);
-}
-
-/**
- * AccessibleTableColumnDescriptionChangedEvent_getDescriptionString:
- * @e: a pointer to the #AccessibleEvent being queried.
- *
- * Queries an #AccessibleEvent of type
- * "object:property-changed:accessible-table-column-description"
- * returning the new table column description.
- *
- * Returns: a UTF-8 text string representing the recently changed
- * table column description
- **/
-char *
-AccessibleTableColumnDescriptionChangedEvent_getDescriptionString (const AccessibleEvent *e)
-{
- const InternalEvent *foo = (InternalEvent *) e;
- /* TODO: check the event type. */
- return cspi_internal_event_get_text (foo);
-}
-
-/**
- * AccessibleDescriptionChangedEvent_getDescriptionString:
- * @e: a pointer to the #AccessibleEvent being queried.
- *
- * Queries an #AccessibleEvent of type
- * "object:property-changed:accessible-description"
- * returning the new description.
- *
- * Returns: a UTF-8 text string representing the recently changed
- * description
- **/
-char *
-AccessibleDescriptionChangedEvent_getDescriptionString (const AccessibleEvent *e)
-{
- const InternalEvent *foo = (InternalEvent *) e;
- /* TODO: check the event type. */
- return cspi_internal_event_get_text (foo);
-}
-
-/**
- * AccessibleBoundsChangedEvent_getNewBounds:
- * @e: a pointer to the #AccessibleEvent being queried.
- *
- * Queries an #AccessibleEvent of type "object:bounds-changed",
- * returning a pointer to an SPIRect structure containing the
- * new bounds, or NULL on error.
- * The returned structure should be freed with SPI_freeRect when
- * the caller has finished referencing it.
- *
- * @Since: AT-SPI 1.6
- *
- * Returns: a pointer to an SPIRect defining the new object bounds.
- **/
-SPIRect *
-AccessibleBoundsChangedEvent_getNewBounds (const AccessibleEvent *e)
-{
- const InternalEvent *foo = (InternalEvent *) e;
- /* TODO: check the event type. */
- return cspi_internal_event_get_rect (foo);
-}
-
-static gint
-cspi_event_compare (gconstpointer p1, gconstpointer p2)
-{
- const InternalEvent *e1 = p1, *e2 = p2;
- return (gint) ((long) e2->id - (long) e1->id);
-}
-
-static InternalEvent *
-cspi_internal_event_lookup (const InternalEvent *e)
-{
- InternalEvent *internal = NULL;
- GSList *p =
- g_slist_find_custom (_cspi_event_queue, e, cspi_event_compare);
- if (p)
- internal = p->data;
- return internal;
-}
-
-static const InternalEvent *
-cspi_internal_event_check (const AccessibleEvent *e)
-{
- InternalEvent *internal = (InternalEvent *) e;
- if (internal->magic == SPI_INTERNAL_EVENT_MAGIC)
- return internal;
- else
- return NULL;
-}
-
-static InternalEvent *
-cspi_internal_event_add (const InternalEvent *e)
-{
- _cspi_event_queue = g_slist_prepend (_cspi_event_queue, (gpointer) e);
- return (InternalEvent *) e;
-}
-
-static void
-cspi_internal_event_remove (const InternalEvent *e)
-{
- GSList *link = g_slist_find_custom (_cspi_event_queue, e, cspi_event_compare);
- if (link)
- _cspi_event_queue = g_slist_remove_link (_cspi_event_queue, link);
-}
-
-/**
- * AccessibleNameChangedEvent_getNameString:
- * @e: a pointer to the #AccessibleEvent being queried.
- *
- * Queries an #AccessibleEvent of type "object:property-change:accessible_name:",
- * returning the name.
- *
- * Returns: a UTF-8 text string representing the name of the
- * object which recently changed.
- **/
-char *
-AccessibleNameChangedEvent_getNameString (const AccessibleEvent *e)
-{
- const InternalEvent *foo = (InternalEvent *) e;
- return cspi_internal_event_get_text (foo);
-}
-
-/**
- * AccessibleEvent_ref:
- * @e: a pointer to the #AccessibleEvent being referenced.
- *
- * Increments by 1 the reference count of the event
- *
- * Returns: TRUE if the function succeeded; FALSE if the pointer is not a
- * valid event.
- **/
-SPIBoolean
-AccessibleEvent_ref (const AccessibleEvent *e)
-{
- const InternalEvent *private = cspi_internal_event_check (e);
- if (private)
- {
- InternalEvent *event = cspi_internal_event_lookup (private);
- /*
- * put event in the cache if it's not there already,
- * and increment refcount
- */
- if (!event)
- {
- event = cspi_internal_event_add (private);
- }
- event->ref_count++;
- return TRUE;
- }
- else
- return FALSE;
-}
-
-/**
- * AccessibleEvent_unref:
- * @e: a pointer to the #AccessibleEvent being referenced.
- *
- * Decrements by 1 the reference count of the event. The event is destroyed
- * when the reference count recahes zero.
- *
- **/
-void
-AccessibleEvent_unref (const AccessibleEvent *e)
-{
- const InternalEvent *private = cspi_internal_event_check (e);
- /* decrement refcount and remove if appropriate */
- if (private)
- {
- InternalEvent *event = cspi_internal_event_lookup (private);
- if (event)
- {
- event->ref_count--;
- if (event->ref_count < 1)
- {
- cspi_internal_event_remove (event);
- g_free ((gpointer)e->type);
- Accessible_unref (e->source);
- if (event->event.v_type == EVENT_DATA_OBJECT)
- {
- Accessible_unref (event->event.v.accessible);
- }
- g_free ((gpointer)e);
- }
- }
- }
-}
-
-typedef struct
-{
- CSpiEventListener *listener;
- char *category;
- char *name;
- char *detail;
-} CSpiEventListenerEntry;
-
-static GList *event_listeners = NULL;
-
-static dbus_bool_t
-demarshal_rect (DBusMessageIter *iter, SPIRect *rect)
-{
- dbus_int32_t x, y, width, height;
- DBusMessageIter iter_struct;
-
- dbus_message_iter_recurse (iter, &iter_struct);
- if (dbus_message_iter_get_arg_type (&iter_struct) != DBUS_TYPE_INT32) return FALSE;
- dbus_message_iter_get_basic (&iter_struct, &x);
- dbus_message_iter_next (&iter_struct);
- if (dbus_message_iter_get_arg_type (&iter_struct) != DBUS_TYPE_INT32) return FALSE;
- dbus_message_iter_get_basic (&iter_struct, &y);
- dbus_message_iter_next (&iter_struct);
- if (dbus_message_iter_get_arg_type (&iter_struct) != DBUS_TYPE_INT32) return FALSE;
- dbus_message_iter_get_basic (&iter_struct, &width);
- dbus_message_iter_next (&iter_struct);
- if (dbus_message_iter_get_arg_type (&iter_struct) != DBUS_TYPE_INT32) return FALSE;
- dbus_message_iter_get_basic (&iter_struct, &height);
- rect->x = x;
- rect->y = y;
- rect->width = width;
- rect->height = height;
- return TRUE;
-}
-
-static gboolean
-parse_eventType (const char *eventType, char **categoryp, char **namep, char **detailp, char **matchrule)
-{
- char *tmp = g_strdup (eventType);
- char *category = NULL, *name = NULL, *detail = NULL;
- char *saveptr = NULL;
- char *p;
-
- if (tmp == NULL) return FALSE;
- while ((p = strchr (tmp, '-'))) *p = '_';
- category = strtok_r (tmp, ":", &saveptr);
- if (category) category = g_strdup (category);
- if (!category) goto oom;
- name = strtok_r (NULL, ":", &saveptr);
- if (name)
- {
- name = g_strdup (name);
- if (!name) goto oom;
- detail = strtok_r (NULL, ":", &saveptr);
- if (detail) detail = g_strdup (detail);
- }
- else
- {
- name = g_strdup (category);
- if (!name) goto oom;
- }
- if (matchrule)
- {
- *matchrule = g_strdup_printf ("type='signal',interface='org.freedesktop.atspi.event.%c%s',member='%s'", toupper(category[0]), category + 1, name);
- if (!*matchrule) goto oom;
- }
- if (categoryp) *categoryp = category;
- else g_free (category);
- if (namep) *namep = name;
- else if (name) g_free (name);
- if (detailp) *detailp = detail;
- else if (detail) g_free (detail);
- g_free (tmp);
- return TRUE;
-oom:
- if (tmp) g_free (tmp);
- if (category) g_free (category);
- if (name) g_free (name);
- if (detail) g_free (detail);
- return FALSE;
-}
-
-static void listener_data_free (CSpiEventListenerEntry *e)
-{
- g_free (e->category);
- g_free (e->name);
- if (e->detail) g_free (e->detail);
- g_free (e);
-}
-
-/**
- * SPI_registerGlobalEventListener:
- * @listener: the #AccessibleEventListener to be registered against an
- * event type.
- * @eventType: a character string indicating the type of events for which
- * notification is requested. Format is
- * EventClass:major_type:minor_type:detail
- * where all subfields other than EventClass are optional.
- * EventClasses include "object", "window", "mouse",
- * and toolkit events (e.g. "Gtk", "AWT").
- * Examples: "focus:", "Gtk:GtkWidget:button_press_event".
- *
- * Legal object event types:
- *
- * (property change events)
- *
- * object:property-change
- * object:property-change:accessible-name
- * object:property-change:accessible-description
- * object:property-change:accessible-parent
- * object:property-change:accessible-value
- * object:property-change:accessible-role
- * object:property-change:accessible-table-caption
- * object:property-change:accessible-table-column-description
- * object:property-change:accessible-table-column-header
- * object:property-change:accessible-table-row-description
- * object:property-change:accessible-table-row-header
- * object:property-change:accessible-table-summary
- *
- * (other object events)
- *
- * object:state-changed
- * object:children-changed
- * object:visible-data-changed
- * object:selection-changed
- * object:text-selection-changed
- * object:text-changed
- * object:text-caret-moved
- * object:row-inserted
- * object:row-reordered
- * object:row-deleted
- * object:column-inserted
- * object:column-reordered
- * object:column-deleted
- * object:model-changed
- * object:active-descendant-changed
- *
- * (window events)
- *
- * window:minimize
- * window:maximize
- * window:restore
- * window:close
- * window:create
- * window:reparent
- * window:desktop-create
- * window:desktop-destroy
- * window:activate
- * window:deactivate
- * window:raise
- * window:lower
- * window:move
- * window:resize
- * window:shade
- * window:unshade
- * window:restyle
- *
- * (other events)
- *
- * focus:
- * mouse:abs
- * mouse:rel
- * mouse:b1p
- * mouse:b1r
- * mouse:b2p
- * mouse:b2r
- * mouse:b3p
- * mouse:b3r
- *
- * NOTE: this string may be UTF-8, but should not contain byte value 56
- * (ascii ':'), except as a delimiter, since non-UTF-8 string
- * delimiting functions are used internally.
- * In general, listening to
- * toolkit-specific events is not recommended.
- *
- * Add an in-process callback function to an existing AccessibleEventListener.
- *
- * Returns: #TRUE if successful, otherwise #FALSE.
- **/
-SPIBoolean
-SPI_registerGlobalEventListener (AccessibleEventListener *listener,
- const char *eventType)
-{
- CSpiEventListenerEntry *e;
- char *matchrule;
- DBusError error;
- GList *new_list;
-
- if (!listener)
- {
- return FALSE;
- }
-
- e = g_new (CSpiEventListenerEntry, 1);
- if (!e) return FALSE;
- e->listener = listener;
- if (!parse_eventType (eventType, &e->category, &e->name, &e->detail, &matchrule))
- {
- g_free (e);
- return FALSE;
- }
- new_list = g_list_prepend (event_listeners, e);
- if (!new_list)
- {
- listener_data_free (e);
- return FALSE;
- }
- event_listeners = new_list;
- dbus_error_init (&error);
- dbus_bus_add_match (SPI_bus(), matchrule, &error);
- if (error.message)
- {
- g_warning ("Adding match: %s", error.message);
- }
- return TRUE;
-}
-
-/**
- * SPI_deregisterGlobalEventListenerAll:
- * @listener: the #AccessibleEventListener to be registered against
- * an event type.
- *
- * deregisters an AccessibleEventListener from the registry, for all
- * event types it may be listening to. Use
- * AccessibleEventListener_unref to release the
- * listener reference.
- *
- * Returns: #TRUE if successful, otherwise #FALSE.
- **/
-SPIBoolean
-SPI_deregisterGlobalEventListenerAll (AccessibleEventListener *listener)
-{
- GList *l;
-
- if (!listener)
- {
- return FALSE;
- }
-
- for (l = event_listeners; l;)
- {
- CSpiEventListenerEntry *e = l->data;
- if (e->listener == listener)
- {
- listener_data_free (e);
- l = g_list_remove (l, e);
- }
- else l = g_list_next (l);
- }
- return TRUE;
-}
-
-/**
- * SPI_deregisterGlobalEventListener:
- * @listener: the #AccessibleEventListener registered against an event type.
- * @eventType: a string specifying the event type for which this
- * listener is to be deregistered.
- *
- * deregisters an AccessibleEventListener from the registry, for a specific
- * event type.
- *
- * Returns: #TRUE if successful, otherwise #FALSE.
- **/
-SPIBoolean
-SPI_deregisterGlobalEventListener (AccessibleEventListener *listener,
- const char *eventType)
-{
- char *category, *name, *detail, *matchrule;
- GList *l;
-
- if (!parse_eventType (eventType, &category, &name, &detail, &matchrule))
- {
- return FALSE;
- }
- if (!listener)
- {
- return FALSE;
- }
-
- for (l = event_listeners; l;)
- {
- CSpiEventListenerEntry *e = l->data;
- if (e->listener == listener && !strcmp (e->category, category) && !strcmp (e->name, name) && (e->detail == detail || !strcmp (e->detail, detail)))
- {
- DBusError error;
- listener_data_free (e);
- l = g_list_remove (l, e);
- dbus_error_init (&error);
- dbus_bus_remove_match (SPI_bus(), matchrule, &error);
- }
- else l = g_list_next (l);
- }
- g_free (category);
- g_free (name);
- if (detail) g_free (detail);
- g_free (matchrule);
- return TRUE;
-}
-
-void
-cspi_dispatch_event (AccessibleEvent *e)
-{
- char *category, *name, *detail;
- GList *l;
-
- if (!parse_eventType (e->type, &category, &name, &detail, NULL))
- {
- g_warning ("Couldn't parse event: %s\n", e->type);
- return;
- }
- for (l = event_listeners; l; l = g_list_next (l))
- {
- CSpiEventListenerEntry *entry = l->data;
- if (!strcmp (category, entry->category) &&
- (entry->name == NULL || !strcmp (name, entry->name)) &&
- (entry->detail == NULL || !strcmp (detail, entry->detail)))
- {
- CSpiEventListenerClass *klass = CSPI_EVENT_LISTENER_GET_CLASS (entry->listener);
- if (klass->event) (*klass->event)(entry->listener, e);
- }
- }
- if (detail) g_free (detail);
- g_free (name);
- g_free (category);
-}
-
-DBusHandlerResult
-cspi_dbus_handle_event (DBusConnection *bus, DBusMessage *message, void *data)
-{
- char *detail = NULL;
- const char *category = dbus_message_get_interface (message);
- const char *name = dbus_message_get_member (message);
- DBusMessageIter iter, iter_variant;
- dbus_message_iter_init (message, &iter);
- AccessibleEvent e;
- dbus_int32_t detail1, detail2;
- char *p;
-
- if (category)
- {
- category = strrchr (category, '.');
- if (category == NULL)
- {
- // TODO: Error
- return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
- }
- category++;
- }
- g_return_val_if_fail (dbus_message_iter_get_arg_type (&iter) == DBUS_TYPE_STRING, DBUS_HANDLER_RESULT_NOT_YET_HANDLED);
- dbus_message_iter_get_basic (&iter, &detail);
- dbus_message_iter_next (&iter);
- /* TODO: Return error indicating invalid arguments in next line */
- g_return_val_if_fail (dbus_message_iter_get_arg_type (&iter) == DBUS_TYPE_INT32, DBUS_HANDLER_RESULT_NOT_YET_HANDLED);
- dbus_message_iter_get_basic (&iter, &detail1);
- e.detail1 = detail1;
- dbus_message_iter_next (&iter);
- g_return_val_if_fail (dbus_message_iter_get_arg_type (&iter) == DBUS_TYPE_INT32, DBUS_HANDLER_RESULT_NOT_YET_HANDLED);
- dbus_message_iter_get_basic (&iter, &detail2);
- e.detail2 = detail2;
- dbus_message_iter_next (&iter);
- e.type = g_strdup_printf ("%c%s:", tolower (category[0]), category + 1);
- if (strcasecmp (category, name) != 0)
- {
- p = g_strconcat (e.type, ":", name, NULL);
- if (p)
- {
- g_free (e.type);
- e.type = p;
- }
- }
- if (detail[0] != '\0')
- {
- p = g_strconcat (e.type, ":", detail, NULL);
- if (p)
- {
- g_free (e.type);
- e.type = p;
- }
- }
- while ((p = strchr (e.type, '_'))) *p = '-';
- e.source = cspi_ref_accessible (dbus_message_get_sender(message), dbus_message_get_path(message));
- dbus_message_iter_recurse (&iter, &iter_variant);
- switch (dbus_message_iter_get_arg_type (&iter_variant))
- {
- case DBUS_TYPE_OBJECT_PATH:
- {
- dbus_message_iter_get_basic (&iter_variant, &p);
- e.v_type = EVENT_DATA_OBJECT;
- e.v.accessible = cspi_ref_accessible (dbus_message_get_sender(message), p);
- break;
- }
- case DBUS_TYPE_STRING:
- {
- dbus_message_iter_get_basic (&iter_variant, &p);
- e.v_type = EVENT_DATA_STRING;
- e.v.text = g_strdup (p);
- break;
- }
- case DBUS_TYPE_STRUCT:
- {
- if (demarshal_rect (&iter_variant, &e.v.rect))
- {
- e.v_type = EVENT_DATA_RECT;
- }
- break;
- }
- default:
- break;
- }
- cspi_dispatch_event (&e);
- return DBUS_HANDLER_RESULT_HANDLED;
-}
diff --git a/cspi/spi-hyperlink.c b/cspi/spi-hyperlink.c
deleted file mode 100644
index 6bbc82d9..00000000
--- a/cspi/spi-hyperlink.c
+++ /dev/null
@@ -1,180 +0,0 @@
-/*
- * AT-SPI - Assistive Technology Service Provider Interface
- * (Gnome Accessibility Project; http://developer.gnome.org/projects/gap)
- *
- * Copyright 2001, 2002 Sun Microsystems Inc.,
- * Copyright 2001, 2002 Ximian, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#include <cspi/spi-private.h>
-
-/**
- * AccessibleHyperlink_ref:
- * @obj: a pointer to the #AccessibleHyperlink object on which to operate.
- *
- * Increment the reference count for an #AccessibleHyperlink object.
- **/
-void
-AccessibleHyperlink_ref (AccessibleHyperlink *obj)
-{
- cspi_object_ref (obj);
-}
-
-/**
- * AccessibleHyperlink_unref:
- * @obj: a pointer to the #AccessibleHyperlink object on which to operate.
- *
- * Decrement the reference count for an #AccessibleHyperlink object.
- **/
-void
-AccessibleHyperlink_unref (AccessibleHyperlink *obj)
-{
- cspi_object_unref (obj);
-}
-
-/**
- * AccessibleHyperlink_getNAnchors:
- * @obj: a pointer to the #AccessibleHyperlink object on which to operate.
- *
- * Get the total number of anchors which an #AccessibleHyperlink implementor has.
- * Though typical hyperlinks have only one anchor, client-side image maps and
- * other hypertext objects may potentially activate or refer to multiple
- * URIs. For each anchor there is a corresponding URI and object.
- * @see AccessibleHyperlink_getURI() and AccessibleHyperlink_getObject().
- *
- * Returns: a #long indicating the number of anchors in this hyperlink.
- **/
-long
-AccessibleHyperlink_getNAnchors (AccessibleHyperlink *obj)
-{
- dbus_int16_t retval;
-
- cspi_return_val_if_fail (obj != NULL, -1);
-
- cspi_dbus_get_property (obj, spi_interface_hyperlink, "nAnchors", NULL, "n", &retval);
-
- cspi_return_val_if_ev ("getNAnchors", -1);
-
- return retval;
-}
-
-/**
- * AccessibleHyperlink_getURI:
- * @obj: a pointer to the #AccessibleHyperlink implementor on which to operate.
- * @i: a (zero-index) long integer indicating which hyperlink anchor to query.
- *
- * Get the URI associated with a particular hyperlink anchor.
- *
- * Returns: a UTF-8 string giving the URI of the @ith hyperlink anchor.
- **/
-char *
-AccessibleHyperlink_getURI (AccessibleHyperlink *obj,
- long int i)
-{
- dbus_int32_t d_i = i;
- char *retval;
-
- cspi_return_val_if_fail (obj != NULL, NULL);
-
- cspi_dbus_call (obj, spi_interface_hyperlink, "getURI", NULL, "i=>s", d_i, &retval);
-
- cspi_return_val_if_ev ("getURI", NULL);
-
- return retval;
-}
-
-/**
- * AccessibleHyperlink_getObject:
- * @obj: a pointer to the #AccessibleHyperlink implementor on which to operate.
- * @i: a (zero-index) long integer indicating which hyperlink anchor to query.
- *
- * Get the object associated with a particular hyperlink anchor, as an #Accessible.
- *
- * Returns: an #Accessible that represents the object associated with the @ith anchor
- * of the specified #AccessibleHyperlink.
- **/
-Accessible*
-AccessibleHyperlink_getObject (AccessibleHyperlink *obj,
- long int i)
-{
- dbus_int32_t d_i = i;
- char *path;
- Accessible *retval;
-
- cspi_return_val_if_fail (obj != NULL, NULL);
-
- cspi_dbus_call (obj, spi_interface_hyperlink, "getObject", NULL, "i=>o", d_i, &path);
- retval = cspi_ref_related_accessible (obj, path);
- g_free (path);
- return retval;
-}
-
-/**
- * AccessibleHyperlink_getIndexRange:
- * @obj: a pointer to the #AccessibleHyperlink implementor on which to operate.
- * @startIndex: a pointer to a long integer into which the starting
- * offset of the text associated with this #AccessibleHyperlink is returned.
- * @endIndex: a pointer to a long integer into which the offset of the first character
- * after the text associated with this #AccessibleHyperlink is returned.
- *
- *
- * Get the starting and ending character offsets of the text range associated with
- * a #AccessibleHyperlink, in its originating #AccessibleHypertext.
- **/
-void
-AccessibleHyperlink_getIndexRange (AccessibleHyperlink *obj,
- long int *startIndex,
- long int *endIndex)
-{
- dbus_int32_t si, ei;
-
- cspi_return_if_fail (obj != NULL);
-
- cspi_dbus_get_property (obj, spi_interface_hyperlink, "startIndex", NULL, "i", &si);
- cspi_return_if_ev ("startIndex");
- cspi_dbus_get_property (obj, spi_interface_hyperlink, "endIndex", NULL, "i", &ei);
- cspi_return_if_ev ("endIndex");
- *startIndex = si;
- *endIndex = ei;
-}
-
-/**
- * AccessibleHyperlink_isValid:
- * @obj: a pointer to the #AccessibleHyperlink on which to operate.
- *
- * Tell whether an #AccessibleHyperlink object is still valid with respect to its
- * originating hypertext object.
- *
- * Returns: #TRUE of the specified #AccessibleHyperlink is still valid with respect
- * to its originating #AccessibleHypertext object, #FALSE otherwise.
- **/
-SPIBoolean
-AccessibleHyperlink_isValid (AccessibleHyperlink *obj)
-{
- dbus_bool_t retval;
-
- cspi_return_val_if_fail (obj != NULL, FALSE);
-
- cspi_dbus_call (obj, spi_interface_hyperlink, "isValid", NULL, "=>b", &retval);
-
- cspi_return_val_if_ev ("isValid", FALSE);
-
- return retval;
-}
-
-
diff --git a/cspi/spi-hypertext.c b/cspi/spi-hypertext.c
deleted file mode 100644
index e6f7a7b0..00000000
--- a/cspi/spi-hypertext.c
+++ /dev/null
@@ -1,138 +0,0 @@
-/*
- * AT-SPI - Assistive Technology Service Provider Interface
- * (Gnome Accessibility Project; http://developer.gnome.org/projects/gap)
- *
- * Copyright 2001, 2002 Sun Microsystems Inc.,
- * Copyright 2001, 2002 Ximian, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#include <cspi/spi-private.h>
-
-/**
- * AccessibleHypertext_ref:
- * @obj: a pointer to the #AccessibleHypertext object on which to operate.
- *
- * Increment the reference count for an #AccessibleHypertext object.
- * Since AccessibleHypertext is derived from AccessibleText,
- * this is the same as AccessibleText_unref().
- **/
-void
-AccessibleHypertext_ref (AccessibleHypertext *obj)
-{
- cspi_object_ref (obj);
-}
-
-/**
- * AccessibleHypertext_unref:
- * @obj: a pointer to the #AccessibleHypertext object on which to operate.
- *
- * Decrement the reference count for an #AccessibleHypertext object.
- * Since AccessibleHypertext is derived from AccessibleText,
- * this is the same as AccessibleText_unref().
- **/
-void
-AccessibleHypertext_unref (AccessibleHypertext *obj)
-{
- cspi_object_unref (obj);
-}
-
-/**
- * AccessibleHypertext_getNLinks:
- * @obj: a pointer to the #AccessibleHypertext implementor on which to operate.
- *
- * Get the total number of #AccessibleHyperlinks which an
- * #AccessibleHypertext implementor has.
- *
- * Returns: a #long indicating the number of #AccessibleHyperlinks
- * of the #AccessibleHypertext implementor, or -1 if
- * the number cannot be determined (for example, if the
- * #AccessibleHypertext object is so large that it is not
- * all currently in the memory cache).
- **/
-long
-AccessibleHypertext_getNLinks (AccessibleHypertext *obj)
-{
- dbus_int32_t retval;
-
- cspi_return_val_if_fail (obj != NULL, FALSE);
-
- cspi_dbus_call (obj, spi_interface_hypertext, "getNLinks", NULL, "=>i", &retval);
-
- cspi_return_val_if_ev ("getNLinks", -1);
-
- return retval;
-}
-
-/**
- * AccessibleHypertext_getLink:
- * @obj: a pointer to the #AccessibleHypertext implementor on which to operate.
- * @linkIndex: a (zero-index) long integer indicating which hyperlink to query.
- *
- * Get the #AccessibleHyperlink object at a specified index.
- *
- * Returns: the #AccessibleHyperlink object specified by #linkIndex.
- **/
-AccessibleHyperlink *
-AccessibleHypertext_getLink (AccessibleHypertext *obj,
- long int linkIndex)
-{
- dbus_int32_t d_linkIndex = linkIndex;
- char *path;
- AccessibleHyperlink *retval;
-
- cspi_return_val_if_fail (obj != NULL, NULL);
-
- cspi_dbus_call (obj, spi_interface_hypertext, "getLink", NULL, "i=>o", d_linkIndex, &path);
-
- cspi_return_val_if_ev ("getLink", NULL);
-
- retval = cspi_ref_related_accessible (obj, path);
- g_free (path);
-
- return retval;
-}
-
-/**
- * AccessibleHypertext_getLinkIndex:
- * @obj: a pointer to the #AccessibleHypertext implementor on which to operate.
- * @characterOffset: an integer specifying the character offset to query.
- *
- * Get the index of the #AccessibleHyperlink object at a specified
- * character offset.
- *
- * Returns: the linkIndex of the #AccessibleHyperlink active at
- * character offset @characterOffset, or -1 if there is
- * no hyperlink at the specified character offset.
- **/
-long
-AccessibleHypertext_getLinkIndex (AccessibleHypertext *obj,
- long int characterOffset)
-{
- dbus_int32_t d_characterOffset = characterOffset;
- dbus_int32_t retval;
-
- cspi_return_val_if_fail (obj != NULL, -1);
-
- cspi_dbus_call (obj, spi_interface_hypertext, "getLinkIndex", NULL, "i=>i", d_characterOffset, &retval);
-
- cspi_return_val_if_ev ("getLinkIndex", -1);
-
- return retval;
-}
-
-
diff --git a/cspi/spi-image.c b/cspi/spi-image.c
deleted file mode 100644
index 17c6d9f4..00000000
--- a/cspi/spi-image.c
+++ /dev/null
@@ -1,199 +0,0 @@
-/*
- * AT-SPI - Assistive Technology Service Provider Interface
- * (Gnome Accessibility Project; http://developer.gnome.org/projects/gap)
- *
- * Copyright 2001, 2002 Sun Microsystems Inc.,
- * Copyright 2001, 2002 Ximian, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#include <cspi/spi-private.h>
-
-/**
- * AccessibleImage_ref:
- * @obj: a pointer to the #AccessibleImage implementor on which to operate.
- *
- * Increment the reference count for an #AccessibleImage object.
- **/
-void
-AccessibleImage_ref (AccessibleImage *obj)
-{
- cspi_object_ref (obj);
-}
-
-/**
- * AccessibleImage_unref:
- * @obj: a pointer to the #AccessibleImage implementor on which to operate.
- *
- * Decrement the reference count for an #AccessibleImage object.
- **/
-void
-AccessibleImage_unref (AccessibleImage *obj)
-{
- cspi_object_unref (obj);
-}
-
-/**
- * AccessibleImage_getImageDescription:
- * @obj: a pointer to the #AccessibleImage implementor on which to operate.
- *
- * Get the description of the image displayed in an #AccessibleImage object.
- *
- * Returns: a UTF-8 string describing the image.
- **/
-char *
-AccessibleImage_getImageDescription (AccessibleImage *obj)
-{
- char *retval;
-
- cspi_return_val_if_fail (obj != NULL, NULL);
-
- cspi_dbus_get_property (obj, spi_interface_image, "description", NULL, "s", &retval);
-
- cspi_return_val_if_ev ("getImageDescription", NULL);
-
- return retval;
-}
-
-/**
- * AccessibleImage_getImageSize:
- * @obj: a pointer to the #AccessibleImage to query.
- * @width: a pointer to a #long into which the x extents (width) will be returned.
- * @height: a pointer to a #long into which the y extents (height) will be returned.
- *
- * Get the size of the image displayed in a specified #AccessibleImage object.
- **/
-void
-AccessibleImage_getImageSize (AccessibleImage *obj,
- long int *width,
- long int *height)
-{
- dbus_int32_t w, h;
-
- cspi_return_if_fail (obj != NULL);
-
- cspi_dbus_call (obj, spi_interface_image, "getImageSize", NULL, "=>ii", &w, &h);
-
- if (!cspi_check_ev ("getImageSize"))
- {
- *width = 0;
- *height = 0;
- }
- else
- {
- *width = w;
- *height = h;
- }
-}
-
-/**
- * AccessibleImage_getImagePosition:
- * @obj: a pointer to the #AccessibleImage implementor to query.
- * @x: a pointer to a #long into which the minimum x coordinate will be returned.
- * @y: a pointer to a #long into which the minimum y coordinate will be returned.
- * @ctype: the desired coordinate system into which to return the results,
- * (e.g. SPI_COORD_TYPE_WINDOW, SPI_COORD_TYPE_SCREEN).
- *
- * Get the minimum x and y coordinates of the image displayed in a
- * specified #AccessibleImage implementor.
- **/
-void
-AccessibleImage_getImagePosition (AccessibleImage *obj,
- long *x,
- long *y,
- AccessibleCoordType ctype)
-{
- dbus_int32_t dx, dy;
-
- cspi_return_if_fail (obj != NULL);
-
- cspi_dbus_call (obj, spi_interface_image, "getImagePosition", NULL, "=>ii", &dx, &dy);
-
- if (!cspi_check_ev ("getImagePosition"))
- {
- *x = 0;
- *y = 0;
- }
- else
- {
- *x = dx;
- *y = dy;
- }
-}
-
-/**
- * AccessibleImage_getImageExtents:
- * @obj: a pointer to the #AccessibleImage implementor to query.
- * @x: a pointer to a #long into which the minimum x coordinate will be returned.
- * @y: a pointer to a #long into which the minimum y coordinate will be returned.
- * @width: a pointer to a #long into which the image x extent will be returned.
- * @height: a pointer to a #long into which the image y extent will be returned.
- * @ctype: the desired coordinate system into which to return the results,
- * (e.g. SPI_COORD_TYPE_WINDOW, SPI_COORD_TYPE_SCREEN).
- *
- * Get the bounding box of the image displayed in a
- * specified #AccessibleImage implementor.
- **/
-void
-AccessibleImage_getImageExtents (AccessibleImage *obj,
- long *x,
- long *y,
- long *width,
- long *height,
- AccessibleCoordType ctype)
-{
- Accessibility_BoundingBox bbox;
-
- cspi_return_if_fail (obj != NULL);
-
- cspi_dbus_call (obj, spi_interface_image, "getImageExtents", NULL, "=>(iiii)", &bbox);
-
- if (!cspi_check_ev ("getImageExtents"))
- {
- *x = *y = *width = *height = 0;
- }
- else
- {
- *x = bbox.x;
- *y = bbox.y;
- *width = bbox.width;
- *height = bbox.height;
- }
-}
-
-/**
- * AccessibleImage_getImageLocale:
- * @obj: The #AccessibleImage being queried.
- *
- * Get the locale associated with an image and its textual representation.
- *
- * Returns: A POSIX LC_MESSAGES-style Locale value for image description and text.
- **/
-char *
-AccessibleImage_getImageLocale (AccessibleImage *obj)
-{
- char *retval = "C";
-
- cspi_return_val_if_fail (obj != NULL, "C");
-
- cspi_dbus_get_property (obj, spi_interface_image, "imageLocale", NULL, "=>s", &retval);
-
- cspi_return_val_if_ev ("getImageLocale", NULL);
-
- return retval;
-}
-
diff --git a/cspi/spi-impl.h b/cspi/spi-impl.h
deleted file mode 100644
index 60049b33..00000000
--- a/cspi/spi-impl.h
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- * AT-SPI - Assistive Technology Service Provider Interface
- * (Gnome Accessibility Project; http://developer.gnome.org/projects/gap)
- *
- * Copyright 2001, 2002 Sun Microsystems Inc.,
- * Copyright 2001, 2002 Ximian, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-/*
- * A load of opaque handles that people can't poke at.
- */
-#ifndef _SPI_IMPL_H_
-#define _SPI_IMPL_H_
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef struct _Accessible AccessibleUnknown;
-typedef AccessibleUnknown Accessible;
-
-typedef Accessible AccessibleAction;
-typedef Accessible AccessibleApplication;
-typedef Accessible AccessibleCollection;
-typedef Accessible AccessibleComponent;
-typedef Accessible AccessibleDocument;
-typedef Accessible AccessibleEditableText;
-typedef Accessible AccessibleHyperlink;
-typedef Accessible AccessibleHypertext;
-typedef Accessible AccessibleImage;
-typedef Accessible AccessibleMatchRule;
-
-typedef struct _AccessibleRelation AccessibleRelation;
-struct _AccessibleRelation
-{
- gint ref_count;
- Accessibility_RelationType type;
- GArray *targets;
-};
-
-typedef Accessible AccessibleSelection;
-typedef Accessible AccessibleStreamableContent;
-typedef Accessible AccessibleTable;
-typedef Accessible AccessibleText;
-typedef Accessible AccessibleValue;
-typedef Accessible AccessibilityRegistry;
-
-/**
- * AccessibleStateSet:
- * @ref_count: private
- * @states: private
- *
- * An opaque structure representing an accessible object's state,
- * which can then be queried via AccessibleStateSet APIs.
- **/
-typedef void AccessibleStateSet;
-typedef void AccessibleEventListener;
-typedef void AccessibleKeystrokeListener;
-typedef void AccessibleDeviceListener;
-
-typedef unsigned int SPIBoolean;
-#define SPI_FALSE (0)
-#define SPI_TRUE (!SPI_FALSE)
-
-/**
- * SPIRect:
- * @x: The position of the minimum x value of the rectangle (i.e. left hand corner)
- * @y: The position of the minimum y value of the rectangle's bounds.
- * @width: Width of the rectangle in pixels.
- * @height: Height of the rectangle in pixels.
- *
- * A structure encapsulating a rectangle.
- **/
-typedef struct {
- long x;
- long y;
- long width;
- long height;
-} SPIRect;
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/cspi/spi-listener.c b/cspi/spi-listener.c
deleted file mode 100644
index e314999a..00000000
--- a/cspi/spi-listener.c
+++ /dev/null
@@ -1,406 +0,0 @@
-/*
- * AT-SPI - Assistive Technology Service Provider Interface
- * (Gnome Accessibility Project; http://developer.gnome.org/projects/gap)
- *
- * Copyright 2002 Ximian Inc.
- * Copyright 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.
- */
-
-#include "spi-private.h"
-#include <stdio.h>
-
-typedef struct
-{
- union
- {
- AccessibleEventListenerCB event;
- AccessibleDeviceListenerCB device_event;
- gpointer method;
- } cb;
- gpointer user_data;
-} EventHandler;
-
-GObjectClass *event_parent_class;
-GObjectClass *device_parent_class;
-
-static guint32 _e_id = 0;
-
-/*
- * Misc. helpers.
- */
-
-static EventHandler *
-cspi_event_handler_new (gpointer method, gpointer user_data)
-{
- EventHandler *eh = g_new0 (EventHandler, 1);
-
- eh->cb.method = method;
- eh->user_data = user_data;
-
- return eh;
-}
-
-static void
-cspi_event_handler_free (EventHandler *handler)
-{
- g_free (handler);
-}
-
-static GList *
-cspi_event_list_remove_by_cb (GList *list, gpointer callback)
-{
- GList *l, *next;
-
- for (l = list; l; l = next)
- {
- EventHandler *eh = l->data;
- next = l->next;
-
- if (eh->cb.method == callback)
- {
- list = g_list_delete_link (list, l);
- cspi_event_handler_free (eh);
- }
- }
-
- return list;
-}
-
-/*
- * Standard event dispatcher
- */
-
-G_DEFINE_TYPE (CSpiEventListener, cspi_event_listener,
- G_TYPE_OBJECT)
-
-static void
-cspi_event (CSpiEventListener *listener,
- AccessibleEvent *event)
-{
- GList *l;
- CSpiEventListener *clistener = (CSpiEventListener *) listener;
- InternalEvent *ievent;
- AccessibleEvent *aevent;
-
- ievent = g_new0(InternalEvent, 1);
- ievent->event.type = g_strdup (event->type);
- ievent->event.source = event->source;
- ievent->event.detail1 = event->detail1;
- ievent->event.detail2 = event->detail2;
- ievent->event.v_type = event->v_type;
- if (event->v_type == EVENT_DATA_STRING)
- {
- ievent->event.v.text = g_strdup (event->v.text);
- }
- else memcpy (&ievent->event.v, &event->v, sizeof(event->v));
- ievent->id = _e_id++;
- ievent->magic = SPI_INTERNAL_EVENT_MAGIC;
- ievent->ref_count = 0;
- aevent = (AccessibleEvent *)ievent;
- Accessible_ref (aevent->source);
- AccessibleEvent_ref (aevent);
-
- /* FIXME: re-enterancy hazard on this list */
- for (l = clistener->callbacks; l; l = l->next)
- {
- EventHandler *eh = l->data;
- /* cast hides our private stuff from client handlers */
- eh->cb.event (aevent, eh->user_data);
- }
-
- AccessibleEvent_unref (aevent);
-}
-
-static guint listener_id = 0;
-static GList *device_listeners = NULL;
-
-static gboolean
-id_is_free (guint id)
-{
- GList *l;
-
- for (l = device_listeners; l; l = g_list_next (l))
- {
- CSpiDeviceListener *listener = l->data;
- if (listener->id == id) return FALSE;
- }
- return TRUE;
-}
-
-static void remove_listener (GObject *obj, gpointer data)
-{
- device_listeners = g_list_remove (device_listeners, obj);
-}
-
-static void
-cspi_event_listener_instance_init (CSpiEventListener *listener)
-{
-}
-
-static void
-cspi_event_listener_finalize (GObject *object)
-{
- CSpiEventListener *listener = (CSpiEventListener *) object;
- GList *l;
-
- for (l = listener->callbacks; l; l = l->next)
- {
- cspi_event_handler_free (l->data);
- }
-
- g_list_free (listener->callbacks);
-
- event_parent_class->finalize (object);
-}
-
-static void
-cspi_event_listener_class_init (CSpiEventListenerClass *klass)
-{
- GObjectClass *object_class = (GObjectClass *) klass;
-
- event_parent_class = g_type_class_peek_parent (klass);
- object_class->finalize = cspi_event_listener_finalize;
-
- klass->event = cspi_event;
-}
-
-gpointer
-cspi_event_listener_new (void)
-{
- CSpiEventListener *listener;
-
- listener = g_object_new (cspi_event_listener_get_type (), NULL);
-
- return listener;
-}
-
-static void
-cspi_event_listener_init (CSpiEventListener *listener)
-{
-}
-
-void
-cspi_event_listener_add_cb (AccessibleEventListener *al,
- AccessibleEventListenerCB callback,
- void *user_data)
-{
- CSpiEventListener *listener = al;
-
- g_return_if_fail (CSPI_IS_EVENT_LISTENER (listener));
-
- listener->callbacks = g_list_prepend (listener->callbacks,
- cspi_event_handler_new ((void *) callback, user_data));
-}
-
-void
-cspi_event_listener_remove_cb (AccessibleEventListener *al,
- AccessibleEventListenerCB callback)
-{
- CSpiEventListener *listener = al;
-
- g_return_if_fail (CSPI_IS_EVENT_LISTENER (listener));
-
- listener->callbacks = cspi_event_list_remove_by_cb (listener->callbacks, (void *) callback);
-}
-
-/*
- * Device event handler
- */
-static gboolean
-cspi_device_event (CSpiDeviceListener *listener,
- const Accessibility_DeviceEvent *event)
-{
- GList *l;
- CSpiDeviceListener *clistener = (CSpiDeviceListener *) listener;
- AccessibleDeviceEvent anevent;
- gboolean handled = FALSE;
-
- switch (event->type)
- {
- case Accessibility_KEY_PRESSED_EVENT:
- anevent.type = SPI_KEY_PRESSED;
- break;
- case Accessibility_KEY_RELEASED_EVENT:
- anevent.type = SPI_KEY_RELEASED;
- break;
- case Accessibility_BUTTON_PRESSED_EVENT:
- anevent.type = SPI_BUTTON_PRESSED;
- break;
- case Accessibility_BUTTON_RELEASED_EVENT:
- anevent.type = SPI_BUTTON_RELEASED;
- break;
- default:
- anevent.type = 0;
- break;
- }
- anevent.keyID = event->id;
- anevent.keycode = event->hw_code;
- anevent.timestamp = event->timestamp;
- anevent.keystring = g_strdup (event->event_string);
- anevent.modifiers = event->modifiers;
- anevent.is_text = event->is_text;
-
- /* FIXME: re-enterancy hazard on this list */
- for (l = clistener->callbacks; l; l = l->next)
- {
- EventHandler *eh = l->data;
-
- if ((handled = eh->cb.device_event (&anevent, eh->user_data)))
- {
- break;
- }
- }
- g_free (anevent.keystring);
-
- return handled;
-}
-
-static void
-cspi_device_listener_init (CSpiDeviceListener *listener)
-{
- GList *new_list;
-
- do
- {
- listener->id = listener_id++;
- } while (!id_is_free (listener->id));
- new_list = g_list_append (device_listeners, listener);
- if (new_list) device_listeners = new_list;
-}
-
-static void
-cspi_device_listener_finalize (GObject *object)
-{
- CSpiDeviceListener *listener = (CSpiDeviceListener *) object;
- GList *l;
-
- for (l = listener->callbacks; l; l = l->next)
- {
- cspi_event_handler_free (l->data);
- }
-
- g_list_free (listener->callbacks);
-
- device_parent_class->finalize (object);
-}
-
-static void
-cspi_device_listener_class_init (CSpiDeviceListenerClass *klass)
-{
- GObjectClass *object_class = (GObjectClass *) klass;
-
- device_parent_class = g_type_class_peek_parent (klass);
- object_class->finalize = cspi_device_listener_finalize;
-
- klass->device_event = cspi_device_event;
-}
-
-G_DEFINE_TYPE (CSpiDeviceListener, cspi_device_listener,
- G_TYPE_OBJECT)
-
-gpointer
-cspi_device_listener_new (void)
-{
- CSpiEventListener *listener = g_object_new (cspi_device_listener_get_type (), NULL);
-
- return listener;
-}
-
-void
-cspi_device_listener_add_cb (AccessibleDeviceListener *al,
- AccessibleDeviceListenerCB callback,
- void *user_data)
-{
- CSpiDeviceListener *listener = al;
-
- g_return_if_fail (CSPI_IS_DEVICE_LISTENER (listener));
-
- listener->callbacks = g_list_prepend (listener->callbacks,
- cspi_event_handler_new ((void *)callback, user_data));
-}
-
-void
-cspi_device_listener_remove_cb (AccessibleDeviceListener *al,
- AccessibleDeviceListenerCB callback)
-{
- CSpiDeviceListener *listener = al;
-
- g_return_if_fail (CSPI_IS_DEVICE_LISTENER (listener));
-
- listener->callbacks = cspi_event_list_remove_by_cb (listener->callbacks, (void *) callback);
-}
-
-void
-cspi_event_listener_unref (AccessibleEventListener *listener)
-{
- g_object_unref (G_OBJECT (listener));
-}
-
-void
-cspi_device_listener_unref (AccessibleDeviceListener *listener)
-{
- g_object_unref (G_OBJECT (listener));
-}
-
-static const char *deviceEvent_type = "(uinnisb)";
-
-DBusHandlerResult
-cspi_dbus_handle_deviceEvent (DBusConnection *bus, DBusMessage *message, void *data)
-{
- const char *path = dbus_message_get_path (message);
- int id;
- Accessibility_DeviceEvent event;
- CSpiDeviceListener *listener;
- DBusMessageIter iter;
- CSpiDeviceListenerClass *klass;
- dbus_bool_t retval = FALSE;
- GList *l;
- DBusMessage *reply;
- void *p = &event;
-
- if (sscanf (path, "/org/freedesktop/atspi/listeners/%d", &id) != 1)
- {
- g_warning ("Bad listener path: %s\n", path);
- goto done;
- }
- for (l = device_listeners; l; l = g_list_next (l))
- {
- listener = l->data;
- if (listener->id == id) break;
- }
- if (!l)
- {
- goto done;
- }
- dbus_message_iter_init (message, &iter);
- dbind_any_demarshal (&iter, (char **) &deviceEvent_type, &p);
- klass = CSPI_DEVICE_LISTENER_GET_CLASS (listener);
- if (klass->device_event)
- {
- retval = (*klass->device_event) (listener, &event);
- }
-done:
- reply = dbus_message_new_method_return (message);
- if (reply)
- {
- dbus_message_append_args (reply, DBUS_TYPE_BOOLEAN, &retval, DBUS_TYPE_INVALID);
- dbus_connection_send (SPI_bus(), reply, NULL);
- dbus_message_unref (reply);
- }
- return DBUS_HANDLER_RESULT_HANDLED;
-}
diff --git a/cspi/spi-listener.h b/cspi/spi-listener.h
deleted file mode 100644
index 862a646e..00000000
--- a/cspi/spi-listener.h
+++ /dev/null
@@ -1,220 +0,0 @@
-/*
- * AT-SPI - Assistive Technology Service Provider Interface
- * (Gnome Accessibility Project; http://developer.gnome.org/projects/gap)
- *
- * Copyright 2001, 2002 Sun Microsystems Inc.,
- * Copyright 2001, 2002 Ximian, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifndef _SPI_LISTENER_H_
-#define _SPI_LISTENER_H_
-
-#include <cspi/spi-impl.h>
-#include <glib-object.h>
-#include "spi-common/spi-types.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef enum
-{
- EVENT_DATA_STRING,
- EVENT_DATA_OBJECT,
- EVENT_DATA_RECT
-} EVENT_DATA_TYPE;
-
-/**
- * AccessibleEvent:
- * @type: a string representing the type of the event, with increasing specificity
- * from left to right, delimited by colons. Leftmost token represents event source type,
- * next token represents event category, and next token represents the subcategory
- * of the event, for instance the specific property, state, or attribute being notified.
- * @source: The #Accessible from which the event originated.
- * @detail1: an event-type-specific integer value.
- * @detail2: an event-type-specific integer value.
- *
- * A structure used to encapsulate event information.
- **/
-typedef struct {
- const char *type;
- Accessible *source;
- long detail1;
- long detail2;
- EVENT_DATA_TYPE v_type;
- union
- {
- char *text;
- Accessible *accessible;
- SPIRect rect;
- } v;
-} AccessibleEvent;
-
-/**
- *AccessibleDeviceEventType:
- *@SPI_KEY_PRESSED: A device key has been pressed.
- *@SPI_KEY_RELEASED: A device key has been released.
- *@SPI_BUTTON_PRESSED: A device button or switch (other than a keyboard key)
- * has been pressed.
- *@SPI_BUTTON_RELEASED: A device button or switch has been released.
- *
- *The type of an AccessibleDeviceEvent.
- **/
-typedef enum {
- SPI_KEY_PRESSED = 1<<0,
- SPI_KEY_RELEASED = 1<<1,
- SPI_BUTTON_PRESSED = 1<<2,
- SPI_BUTTON_RELEASED = 1<<3
-} AccessibleDeviceEventType;
-
-/**
- *AccessibleKeyEventType:
- *
- *This is a synonym for AccessibleDeviceEventType
- **/
-typedef AccessibleDeviceEventType AccessibleKeyEventType;
-
-/**
- * AccessibleDeviceEvent:
- * @keyID: Symbolic representation for the key or switch generating the event, e.g. keysym or button number.
- * @keystring: A symbolic name for the key or switch, or, if is_text is true, a string approximating the
- * inserted text characters which would result from this event, if a text entry field has keyboard focus.
- * @timestamp: A time in ms when this event occurred, relative to some unspecified starting point.
- * Timestamp values should therefore be used to compare events but should not be tested against a
- * fixed time.
- * @type: The #AccessibleDeviceEventType identifying the specific type of event.
- * @is_text: A boolean value indicating whether the event represents 'printable' text (i.e. whether it
- * changes the current insertion buffer of a focussed text entry component or not). Whitespace
- * is considered "printable" in this context, since it typically inserts characters into the buffer.
- *
- * A structure encapsulating information relevant to a device event notification.
- **/
-typedef struct {
- long keyID;
- short keycode;
- char * keystring;
- long timestamp;
- AccessibleDeviceEventType type;
- unsigned short modifiers;
- SPIBoolean is_text;
-} AccessibleDeviceEvent;
-
-typedef AccessibleDeviceEvent AccessibleKeystroke;
-
-/*
- * Function prototype typedefs for Event Listener Callbacks.
- * (see libspi/accessibleeventlistener.h for definition of SpiVoidEventListenerCB).
- *
- * usage: signatures should be
- * void (*AccessibleEventListenerCB) (AccessibleEvent *event);
- *
- * SPIBoolean (*AccessibleKeystrokeListenerCB) (AccessibleKeystrokeEvent *Event);
- * Note that AccessibleKeystrokeListeners may consume the event received
- * if one of their callbacks returns TRUE (see SPI_registerAccessibleKeystrokeListener)
- */
-
-/**
- * AccessibleEventListenerCB:
- * @event: The event for which notification is sent.
- * @user_data: User data which is passed to the callback each time a notification takes place.
- *
- * A function prototype for callbacks via which clients are notified of AT-SPI events.
- *
- **/
-typedef void (*AccessibleEventListenerCB) (const AccessibleEvent *event,
- void *user_data);
-/**
- * AccessibleKeystrokeListenerCB:
- * @stroke: the #AccessibleKeystroke event for which notification is taking place.
- * @user_data: data passed to the callback each time it is notified, according to the data
- * which was passed in when the listener/callback was registered.
- *
- * A function prototype for a callback function called when a key event notification takes place.
- *
- * Returns: %TRUE if the client wishes to consume the event and prevent its
- * dispatch to other listeners or the currently focussed application, if
- * the relevant callback was registered with the #SPI_KEYLISTENER_CANCONSUME flag.
- **/
-typedef SPIBoolean (*AccessibleKeystrokeListenerCB) (const AccessibleKeystroke *stroke,
- void *user_data);
-/**
- * AccessibleDeviceListenerCB:
- * @stroke: The #AccessibleDeviceEvent for which notification is being received.
- * @user_data: Data which is passed to the client each time this callback is notified.
- *
- * A callback function prototype via which clients receive device event notifications.
- *
- * Returns: %TRUE if the client wishes to consume/preempt the event, preventing it from being
- * relayed to the currently focussed application, %FALSE if the event delivery should proceed as normal.
- **/
-typedef SPIBoolean (*AccessibleDeviceListenerCB) (const AccessibleDeviceEvent *stroke,
- void *user_data);
-
-#define CSPI_EVENT_LISTENER_TYPE (cspi_event_listener_get_type ())
-#define CSPI_EVENT_LISTENER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), CSPI_EVENT_LISTENER_TYPE, CSpiEventListener))
-#define CSPI_EVENT_LISTENER_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), CSPI_EVENT_LISTENER_TYPE, CSpiEventListenerClass))
-#define CSPI_IS_EVENT_LISTENER(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), CSPI_EVENT_LISTENER_TYPE))
-#define CSPI_IS_EVENT_LISTENER_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), CSPI_EVENT_LISTENER_TYPE))
-#define CSPI_EVENT_LISTENER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CSPI_EVENT_LISTENER_TYPE, CSpiEventListenerClass))
-
-typedef struct {
- GObject parent;
- GList *callbacks;
-} CSpiEventListener;
-
-typedef struct {
- GObjectClass parent_class;
-
- /* signals */
- void (*event) (CSpiEventListener *listener,
- AccessibleEvent *e);
-} CSpiEventListenerClass;
-
-GType cspi_event_listener_get_type (void);
-
-#define CSPI_DEVICE_LISTENER_TYPE (cspi_device_listener_get_type ())
-#define CSPI_DEVICE_LISTENER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), CSPI_DEVICE_LISTENER_TYPE, CSpiDeviceListener))
-#define CSPI_DEVICE_LISTENER_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), CSPI_DEVICE_LISTENER_TYPE, CSpiDeviceListenerClass))
-#define CSPI_IS_DEVICE_LISTENER(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), CSPI_DEVICE_LISTENER_TYPE))
-#define CSPI_IS_DEVICE_LISTENER_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), CSPI_DEVICE_LISTENER_TYPE))
-#define CSPI_DEVICE_LISTENER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CSPI_DEVICE_LISTENER_TYPE, CSpiDeviceListenerClass))
-
-typedef struct {
- GObject parent;
- guint id;
- GList *callbacks;
-} CSpiDeviceListener;
-
-typedef struct {
- GObjectClass parent_class;
- gboolean (*device_event) (CSpiDeviceListener *listener, const Accessibility_DeviceEvent *key);
-} CSpiDeviceListenerClass;
-
-GType cspi_device_listener_get_type (void);
-gpointer cspi_device_listener_new (void);
-void cspi_device_listener_add_cb (AccessibleDeviceListener *al,
- AccessibleDeviceListenerCB callback,
- void *user_data);
-void cspi_device_listener_remove_cb (AccessibleDeviceListener *al,
- AccessibleDeviceListenerCB callback);
-void cspi_device_listener_unref (AccessibleDeviceListener *listener);
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/cspi/spi-main.c b/cspi/spi-main.c
deleted file mode 100644
index 26687522..00000000
--- a/cspi/spi-main.c
+++ /dev/null
@@ -1,1108 +0,0 @@
-/*
- * AT-SPI - Assistive Technology Service Provider Interface
- * (Gnome Accessibility Project; http://developer.gnome.org/projects/gap)
- *
- * Copyright 2001, 2002 Sun Microsystems Inc.,
- * Copyright 2001, 2002 Ximian, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-/*
- *
- * Basic SPI initialization and event loop function prototypes
- *
- */
-
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include <cspi/spi-private.h>
-#include "spi.h"
-
-#undef DEBUG_OBJECTS
-
-static DBusConnection *bus = NULL;
-static GHashTable *apps = NULL;
-static GHashTable *live_refs = NULL;
-static GQueue *exception_handlers = NULL;
-static DBusError exception;
-
-static void
-cspi_object_release (gpointer value)
-{
-}
-
-gboolean
-cspi_exception_throw (DBusError *error, const char *desc_prefix)
-{
- SPIExceptionHandler *handler = NULL;
- SPIException ex;
- if (exception_handlers) handler = g_queue_peek_head (exception_handlers);
-
- ex.type = SPI_EXCEPTION_SOURCE_UNSPECIFIED;
- ex.source = NULL;
- ex.code = SPI_EXCEPTION_UNSPECIFIED;
- ex.error = error;
- // TODO: Fill in description
-
- if (handler)
- return (*handler) (&ex, FALSE);
- else
- return FALSE; /* means exception was not handled */
-}
-
-const char *spi_path_dec = SPI_DBUS_PATH_DEC;
-const char *spi_path_registry = SPI_DBUS_PATH_REGISTRY;
-const char *spi_bus_registry = SPI_DBUS_NAME_REGISTRY;
-const char *spi_path_desktop = SPI_DBUS_PATH_DESKTOP;
-const char *spi_interface_accessible = SPI_DBUS_INTERFACE_ACCESSIBLE;
-const char *spi_interface_action = SPI_DBUS_INTERFACE_ACTION;
-const char *spi_interface_application = SPI_DBUS_INTERFACE_APPLICATION;
-const char *spi_interface_component = SPI_DBUS_INTERFACE_COMPONENT;
-const char *spi_interface_dec = SPI_DBUS_INTERFACE_DEC;
-const char *spi_interface_desktop = SPI_DBUS_INTERFACE_DESKTOP;
-const char *spi_interface_device_event_listener = SPI_DBUS_INTERFACE_DEVICE_EVENT_LISTENER;
-const char *spi_interface_document = SPI_DBUS_INTERFACE_DOCUMENT;
-const char *spi_interface_editable_text = SPI_DBUS_INTERFACE_EDITABLE_TEXT;
-const char *spi_interface_hyperlink = SPI_DBUS_INTERFACE_HYPERLINK;
-const char *spi_interface_hypertext = SPI_DBUS_INTERFACE_HYPERTEXT;
-const char *spi_interface_image = SPI_DBUS_INTERFACE_IMAGE;
-const char *spi_interface_registry = SPI_DBUS_INTERFACE_REGISTRY;
-const char *spi_interface_selection = SPI_DBUS_INTERFACE_SELECTION;
-const char *spi_interface_table = SPI_DBUS_INTERFACE_TABLE;
-const char *spi_interface_text = SPI_DBUS_INTERFACE_TEXT;
-const char *spi_interface_tree = SPI_DBUS_INTERFACE_TREE;
-const char *spi_interface_value = SPI_DBUS_INTERFACE_VALUE;
-
-static const char *interfaces[] =
-{
- SPI_DBUS_INTERFACE_ACCESSIBLE,
- SPI_DBUS_INTERFACE_ACTION,
- SPI_DBUS_INTERFACE_APPLICATION,
- SPI_DBUS_INTERFACE_COLLECTION,
- SPI_DBUS_INTERFACE_COMPONENT,
- SPI_DBUS_INTERFACE_DOCUMENT,
- SPI_DBUS_INTERFACE_EDITABLE_TEXT,
- SPI_DBUS_INTERFACE_HYPERLINK,
- SPI_DBUS_INTERFACE_HYPERTEXT,
- SPI_DBUS_INTERFACE_IMAGE,
- "org.freedesktop.atspi.LoginHelper",
- SPI_DBUS_INTERFACE_SELECTION,
- "org.freedesktop.atspi.Selector",
- SPI_DBUS_INTERFACE_TABLE,
- SPI_DBUS_INTERFACE_TEXT,
- SPI_DBUS_INTERFACE_VALUE,
- NULL
-};
-
-static gint get_iface_num (const char *iface)
-{
- // TODO: Use a binary search or hash to improve performance
- int i;
-
- for (i = 0; interfaces[i]; i++)
- {
- if (!strcmp(iface, interfaces[i])) return i;
- }
- return -1;
-}
-
-SPIBoolean
-cspi_accessible_is_a (Accessible *accessible,
- const char *interface_name)
-{
- int n;
-
- if (accessible == NULL)
- {
- return FALSE;
- }
-
- n = get_iface_num (interface_name);
- if (n == -1) return FALSE;
- return (SPIBoolean)((accessible->interfaces & (1 << n))? TRUE: FALSE);
-}
-
-static GHashTable *
-cspi_get_live_refs (void)
-{
- if (!live_refs)
- {
- live_refs = g_hash_table_new (g_direct_hash, g_direct_equal);
- }
- return live_refs;
-}
-
-DBusConnection *
-SPI_bus (void)
-{
- return bus;
-}
-
-SPIBoolean
-cspi_exception (void)
-{
- if (dbus_error_is_set (&exception))
- {
- dbus_error_free (&exception);
- return TRUE;
- }
- return FALSE;
-}
-
-SPIBoolean
-cspi_check_ev (const char *error_string)
-{
- if (dbus_error_is_set (&exception))
- {
- cspi_exception_throw (&exception, error_string);
- return FALSE;
- }
- return TRUE;
-}
-
-Accessible *
-cspi_object_add (Accessible *accessible)
-{
- if (accessible) cspi_object_ref (accessible);
- return accessible;
-}
-
-void
-cspi_object_ref (Accessible *accessible)
-{
- g_return_if_fail (accessible != NULL);
-
- accessible->ref_count++;
- g_hash_table_insert (live_refs, accessible, accessible);
-}
-
-#define APP_IS_REGISTRY(app) (!strcmp (app->bus_name, spi_bus_registry))
-
-static void
-cspi_object_unref_internal (Accessible *accessible, gboolean defunct)
-{
- gboolean cached;
-
- if (accessible == NULL)
- {
- return;
- }
-
- if (--accessible->ref_count == 0 || (accessible->ref_count == 1 && !defunct) && g_hash_table_lookup (live_refs, accessible))
- {
- AccessibleEvent e;
- memset (&e, 0, sizeof(e));
- e.type = "object:state-change:defunct";
- e.source = accessible;
- e.detail1 = 1;
- cspi_dispatch_event (&e);
- g_hash_table_remove (live_refs, accessible);
- }
- if (accessible->ref_count == 0)
- {
- if (APP_IS_REGISTRY (accessible->app))
- {
- g_free (accessible->v.path);
- }
- if (accessible->states)
- spi_state_set_cache_unref (accessible->states);
- g_free (accessible->description);
- g_free (accessible->name);
- g_free(accessible);
- }
-}
-
-void
-cspi_object_unref (Accessible *accessible)
-{
- cspi_object_unref_internal (accessible, FALSE);
-}
-
-static void
-cspi_cleanup (void)
-{
- GHashTable *refs;
-
- cspi_streams_close_all ();
-
- refs = live_refs;
- live_refs = NULL;
- if (refs)
- {
- g_hash_table_destroy (refs);
- }
-}
-
-static gboolean SPI_inited = FALSE;
-
-static GHashTable *app_hash = NULL;
-
-static Accessible *
-ref_accessible (CSpiApplication *app, const char *path)
-{
- int id;
- guint *id_val;
-
- if (sscanf (path, "/org/freedesktop/atspi/accessible/%d", &id) != 1)
- {
- return NULL;
- }
- Accessible *a = g_hash_table_lookup (app->hash, &id);
- if (a)
- {
- cspi_object_ref (a);
- return a;
- }
- id_val = g_new (guint, 1);
- if (!id_val) return NULL;
- *id_val = id;
- a = g_new0 (Accessible, 1);
- if (!a)
- {
- g_free (id_val);
- return NULL;
- }
- g_hash_table_insert (app->hash, id_val, a);
- a->app = app;
- a->v.id = id;
- a->ref_count = 2; /* one for the caller, one for the hash */
- return a;
-}
-
-static CSpiApplication *
-cspi_get_application (const char *bus_name)
-{
- CSpiApplication *app = NULL;
- char *bus_name_dup;
-
- if (!app_hash)
- {
- app_hash = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, (GDestroyNotify)g_hash_table_unref);
- if (!app_hash) return NULL;
- }
- app = g_hash_table_lookup (app_hash, bus_name);
- if (app) return app;
- bus_name_dup = g_strdup (bus_name);
- if (!bus_name_dup) return NULL;
- // TODO: change below to something that will send state-change:defunct notification if necessary */
- app = g_new (CSpiApplication, 1);
- if (!app) return NULL;
- app->bus_name = bus_name_dup;
- if (APP_IS_REGISTRY (app))
- {
- app->hash = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, cspi_object_unref);
- }
- else
- {
- app->hash = g_hash_table_new_full (g_int_hash, g_int_equal, g_free, cspi_object_unref);
- }
- g_hash_table_insert (app_hash, bus_name_dup, app);
- return app;
-}
-
-typedef struct
-{
- char *path;
- char *parent;
- GArray *children;
- GArray *interfaces;
- char *name;
- dbus_uint32_t role;
- char *description;
- GArray *state_bitflags;
-} CACHE_ADDITION;
-
-static void
-handle_addition (CSpiApplication*app, CACHE_ADDITION *ca)
-{
- gint i;
- GList *new_list;
-
- Accessible *a = ref_accessible (app, ca->path);
- /* Note: children don't hold refs for their parents or vice versa */
- a->parent = ref_accessible (app, ca->parent);
- if (a->parent) cspi_object_unref (a->parent);
- if (a->children)
- {
- g_list_free (a->children);
- a->children = NULL;
- }
- for (i = 0; i < ca->children->len; i++)
- {
- const char *child_path = g_array_index (ca->children, const char *, i);
- Accessible *child = ref_accessible (app, child_path);
- new_list = g_list_append (a->children, child);
- if (new_list) a->children = new_list;
- cspi_object_unref (child);
- }
- a->interfaces = 0;
- for (i = 0; i < ca->interfaces->len; i++)
- {
- const char *iface = g_array_index (ca->interfaces, const char *, i);
- if (!strcmp (iface, "org.freedesktop.DBus.Introspectable")) continue;
- gint n = get_iface_num (iface);
- if (n == -1)
- {
- g_warning ("Unknown interface %s", iface);
- }
- else a->interfaces |= (1 << n);
- g_free (iface);
- }
- if (a->name) g_free (a->name);
- a->name = ca->name;
- a->role = ca->role;
- if (a->description) g_free (a->description);
- a->description = ca->description;
- a->states = spi_state_set_cache_new (ca->state_bitflags);
- g_array_free (ca->interfaces, TRUE);
- g_array_free (ca->children, TRUE);
- /* spi_state_set_cache_new frees state_bitflags */
- /* This is a bit of a hack since ref_accessible sets ref_count to 2
- * for a new object, one of the refs being for the cache */
- cspi_object_unref (a);
-}
-
-/* Update the cache with added/modified objects and free the array */
-static void
-handle_additions (CSpiApplication*app, GArray *additions)
-{
- gint i;
-
- if (!additions)
- {
- return;
- }
- for (i = 0; i < additions->len; i++)
- {
- CACHE_ADDITION *ca = &g_array_index (additions, CACHE_ADDITION, i);
- handle_addition (app, ca);
- }
-}
-
-static DBusHandlerResult
-cspi_dbus_handle_remove_accessible (DBusConnection *bus, DBusMessage *message, void *user_data)
-{
- const char *sender = dbus_message_get_sender (message);
- CSpiApplication *app = cspi_get_application (sender);
- const char *path;
- Accessible *a;
-
- if (!dbus_message_get_args (message, NULL, DBUS_TYPE_STRING, &path, DBUS_TYPE_INVALID))
- {
- g_warning ("Received RemoveAccessible with invalid arguments");
- return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
- }
- a = ref_accessible (app, path);
- if (a->parent && g_list_find (a->parent->children, a))
- {
- a->parent->children = g_list_remove (a->parent->children, a);
- // TODO: Send children-changed:remove event
- /* Note: children don't hold refs for their parents or vice versa */
- }
- g_hash_table_remove (app->hash, &a->v.id);
- cspi_object_unref_internal (a, TRUE); /* unref our own ref */
- return DBUS_HANDLER_RESULT_HANDLED;
-}
-
-static gboolean
-add_app_to_desktop (Accessible *a, const char *bus_name)
-{
- DBusError error;
- char *root_path;
-
- dbus_error_init (&error);
- if (dbind_method_call_reentrant (bus, bus_name, "/org/freedesktop/atspi/tree", spi_interface_tree, "getRoot", &error, "=>o", &root_path))
- {
- Accessible *obj = cspi_ref_accessible (bus_name, root_path);
- if (obj)
- {
- GList *new_list = g_list_append (a->children, obj);
- if (new_list)
- {
- a->children = new_list;
- return TRUE;
- }
- }
- g_free (root_path);
- }
- else
- {
- g_warning ("Error calling getRoot for %s: %s", bus_name, error.message);
- }
- return FALSE;
-}
-
-static void
-send_children_changed (Accessible *parent, Accessible *child, gboolean add)
-{
- AccessibleEvent e;
-
- memset (&e, 0, sizeof(e));
- e.type = (add? "object:children-changed:add": "object:children-changed:remove");
- e.source = parent;
- e.detail1 = g_list_index (parent->children, child);
- cspi_dispatch_event (&e);
-}
-
-static void
-unref_object_and_children (Accessible *obj)
-{
- GList *l;
-
- for (l = obj->children; l; l = l->next)
- {
- unref_object_and_children (l->data);
- }
- cspi_object_unref_internal (obj, TRUE);
-}
-
-static gboolean
-remove_app_from_desktop (Accessible *a, const char *bus_name)
-{
- GList *l;
- Accessible *child;
-
- for (l = a->children; l; l = l->next)
- {
- child = l->data;
- if (!strcmp (bus_name, child->app->bus_name)) break;
- }
- if (!l)
- {
- g_warning ("Removing unregistered app %s; doing nothing\n", bus_name);
- return FALSE;
- }
- send_children_changed (a, child, FALSE);
- a->children = g_list_remove (a->children, child);
- unref_object_and_children (child);
- return TRUE;
-}
-
-static Accessible *desktop;
-
-static Accessible *
-ref_accessible_desktop (CSpiApplication *app)
-{
- DBusError error;
- GArray *apps = NULL;
- GArray *additions;
- gint i;
-
- if (desktop)
- {
- cspi_object_ref (desktop);
- return desktop;
- }
- desktop = g_new0 (Accessible, 1);
- if (!desktop)
- {
- return NULL;
- }
- g_hash_table_insert (app->hash, "", desktop);
- desktop->app = app;
- desktop->ref_count = 2; /* one for the caller, one for the hash */
- desktop->name = g_strdup ("");
- dbus_error_init (&error);
- if (!dbind_method_call_reentrant (bus, spi_bus_registry, spi_path_registry, spi_interface_registry, "getApplications", &error, "=>as", &apps))
- {
- g_error ("Couldn't get application list: %s", error.message);
- }
- for (i = 0; i < apps->len; i++)
- {
- const char *app_name = g_array_index (apps, char *, i);
- if (app_name[0] == '\0')
- {
- g_warning ("Got empty app name");
- continue;
- }
- CSpiApplication *app = cspi_get_application (app_name);
- additions = NULL;
- dbus_error_init (&error);
- dbind_method_call_reentrant (bus, app_name, "/org/freedesktop/atspi/tree", spi_interface_tree, "getTree", &error, "=>a(ooaoassusau)", &additions);
- if (error.message)
- {
- g_warning ("getTree (%s): %s", app_name, error.message);
- }
- handle_additions (app, additions);
- add_app_to_desktop (desktop, app_name);
- }
- g_array_free (apps, TRUE);
- return desktop;
-}
-
-Accessible *
-cspi_ref_accessible (const char *app, const char *path)
-{
- CSpiApplication *a = cspi_get_application (app);
- if (!a) return NULL;
- if ( APP_IS_REGISTRY(a))
- {
- return ref_accessible_desktop (a);
- }
- return ref_accessible (a, path);
-}
-
-Accessible *
-cspi_ref_related_accessible (Accessible *obj, const char *path)
-{
- return ref_accessible (obj->app, path);
-}
-
-static const char *cacheSignalType = "(ooaoassusau)";
-
-static DBusHandlerResult
-cspi_dbus_handle_update_accessible (DBusConnection *bus, DBusMessage *message, void *user_data)
-{
- DBusMessageIter iter;
- CACHE_ADDITION ca;
- void *p = &ca;
- const char *sender = dbus_message_get_sender (message);
- CSpiApplication *app = cspi_get_application (sender);
- const char *type = cacheSignalType;
-
- if (!app)
- {
- g_warning ("UpdateAccessible from unknown app. Should we add it?", sender);
- return DBUS_HANDLER_RESULT_HANDLED;
- }
- dbus_message_iter_init (message, &iter);
- // TODO: Check signature
- dbind_any_demarshal (&iter, &type, &p); /* additions */
- handle_addition (app, &ca);
- return DBUS_HANDLER_RESULT_HANDLED;
-}
-
-static DBusHandlerResult
-cspi_dbus_handle_register_application (DBusConnection *bus, DBusMessage *message, void *user_data)
-{
- DBusError error;
- dbus_uint32_t v;
- Accessible *a;
- char *bus_name;
-
- dbus_error_init (&error);
- a = cspi_ref_accessible (spi_bus_registry, spi_path_registry);
- if (add_app_to_desktop (a, dbus_message_get_sender (message)))
- {
- send_children_changed (a, g_list_last (a->children)->data, TRUE);
- }
- cspi_object_unref (a);
- return DBUS_HANDLER_RESULT_HANDLED;
-}
-
-static DBusHandlerResult
-cspi_dbus_handle_deregister_application (DBusConnection *bus, DBusMessage *message, void *user_data)
-{
- Accessible *a;
- DBusError error;
- char *bus_name;
-
- dbus_error_init (&error);
- if (!dbus_message_get_args (message, &error, DBUS_TYPE_STRING, &bus_name, DBUS_TYPE_INVALID))
- {
- g_warning ("Error processing %s: %s\n", dbus_message_get_member(message), error.message);
- dbus_error_free (&error);
- return DBUS_HANDLER_RESULT_HANDLED;
- }
-
- a = cspi_ref_accessible (spi_bus_registry, spi_path_registry);
- remove_app_from_desktop (a, bus_name);
- cspi_object_unref (a);
- return DBUS_HANDLER_RESULT_HANDLED;
-}
-
-
-static DBusHandlerResult
-cspi_dbus_filter (DBusConnection *bus, DBusMessage *message, void *data)
-{
- int type = dbus_message_get_type (message);
- const char *interface = dbus_message_get_interface (message);
- const char *member = dbus_message_get_member (message);
- dbus_uint32_t v;
- char *bus_name;
-
- if (type == DBUS_MESSAGE_TYPE_SIGNAL &&
- !strncmp (interface, "org.freedesktop.atspi.Event.", 28))
- {
- return cspi_dbus_handle_event (bus, message, data);
- }
- if (dbus_message_is_method_call (message, spi_interface_device_event_listener, "notifyEvent"))
- {
- return cspi_dbus_handle_deviceEvent (bus, message, data);
- }
- if (dbus_message_is_signal (message, spi_interface_tree, "updateAccessible"))
- {
- return cspi_dbus_handle_update_accessible (bus, message, data);
- }
- if (dbus_message_is_signal (message, spi_interface_tree, "removeAccessible"))
- {
- return cspi_dbus_handle_remove_accessible (bus, message, data);
- }
- if (dbus_message_is_method_call (message, spi_interface_registry, "registerApplication"))
- {
- return cspi_dbus_handle_register_application (bus, message, data);
- }
- if (dbus_message_is_method_call (message, spi_interface_registry, "deregisterApplication"))
- {
- return cspi_dbus_handle_deregister_application (bus, message, data);
- }
- return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
-}
-
-static const char *signal_interfaces[] =
-{
- "org.freedesktop.atspi.Event.Object",
- "org.freedesktop.atspi.Event.Window",
- "org.freedesktop.atspi.Event.Mouse",
- "org.freedesktop.atspi.Event.Terminal",
- "org.freedesktop.atspi.Event.Document",
- "org.freedesktop.atspi.Event.Focus",
- NULL
-};
-
-/**
- * SPI_init:
- *
- * Connects to the accessibility registry and initializes the SPI.
- *
- * Returns: 0 on success, otherwise an integer error code.
- **/
-int
-SPI_init (void)
-{
- DBusError error;
- char *match;
- int i;
-
- if (SPI_inited)
- {
- return 1;
- }
-
- SPI_inited = TRUE;
-
- g_type_init ();
-
- cspi_get_live_refs();
- g_atexit (cspi_cleanup);
-
- dbus_error_init (&error);
- bus = dbus_bus_get (DBUS_BUS_SESSION, &error);
- if (!bus)
- {
- g_error ("Couldn't get session bus");
- return 2;
- }
- dbus_bus_register (bus, &error);
- dbus_connection_setup_with_g_main(bus, g_main_context_default());
- dbus_connection_add_filter (bus, cspi_dbus_filter, NULL, NULL);
- match = g_strdup_printf ("type='signal',interface='%s',member='updateAccessible'", spi_interface_tree);
- dbus_error_init (&error);
- dbus_bus_add_match (bus, match, &error);
- g_free (match);
- match = g_strdup_printf ("type='signal',interface='%s',member='removeAccessible'", spi_interface_tree);
- dbus_error_init (&error);
- dbus_bus_add_match (bus, match, &error);
- g_free (match);
- match = g_strdup_printf ("type='method_call',interface='%s'", spi_interface_registry);
- dbus_bus_add_match (bus, match, &error);
- g_free (match);
- for (i = 0; signal_interfaces[i]; i++)
- {
- match = g_strdup_printf ("type='signal',interface='%s'", signal_interfaces[i]);
- dbus_bus_add_match (bus, match, &error);
- g_free (match);
- }
- return 0;
-}
-
- static GMainLoop *mainloop;
-
-/**
- * SPI_event_main:
- *
- * Starts/enters the main event loop for the SPI services.
- *
- * (NOTE: This method does not return control, it is exited via a call to
- * SPI_event_quit () from within an event handler).
- *
- **/
-void
-SPI_event_main (void)
-{
-
- mainloop = g_main_loop_new (NULL, FALSE);
- g_main_loop_run (mainloop);
-}
-
-/**
- * SPI_event_quit:
- *
- * Quits the last main event loop for the SPI services,
- * see SPI_event_main
- **/
-void
-SPI_event_quit (void)
-{
- g_main_loop_quit (mainloop);
-}
-
-/**
- * SPI_eventIsReady:
- *
- * Checks to see if an SPI event is waiting in the event queue.
- * Used by clients that don't wish to use SPI_event_main().
- *
- * Not Yet Implemented.
- *
- * Returns: #TRUE if an event is waiting, otherwise #FALSE.
- *
- **/
-SPIBoolean
-SPI_eventIsReady (void)
-{
- return FALSE;
-}
-
-/**
- * SPI_nextEvent:
- * @waitForEvent: a #SPIBoolean indicating whether to block or not.
- *
- * Gets the next event in the SPI event queue; blocks if no event
- * is pending and @waitForEvent is #TRUE.
- * Used by clients that don't wish to use SPI_event_main().
- *
- * Not Yet Implemented.
- *
- * Returns: the next #AccessibleEvent in the SPI event queue.
- **/
-AccessibleEvent *
-SPI_nextEvent (SPIBoolean waitForEvent)
-{
- return NULL;
-}
-
-#ifdef PRINT_LEAKS
-static void
-report_leaked_ref (gpointer key, gpointer val, gpointer user_data)
-{
- char *name, *role;
- Accessible *a = (Accessible *) val;
-
- name = Accessible_getName (a);
- if (cspi_exception ())
- {
- name = NULL;
- }
-
- role = Accessible_getRoleName (a);
- if (cspi_exception ())
- {
- role = NULL;
- }
-
- fprintf (stderr, "leaked %d references to object %s, role %s %p\n",
- a->ref_count, name ? name : "<?>", role ? role : "<?>", a);
-
- SPI_freeString (name);
-}
-#endif
-
-/**
- * SPI_exit:
- *
- * Disconnects from the Accessibility Registry and releases
- * any floating resources. Call only once at exit.
- *
- * Returns: 0 if there were no leaks, otherwise non zero.
- **/
-int
-SPI_exit (void)
-{
- int leaked;
-
- if (!SPI_inited)
- {
- return 0;
- }
-
- SPI_inited = FALSE;
-
- if (live_refs)
- {
- leaked = g_hash_table_size (live_refs);
-#ifdef DEBUG_OBJECTS
- fprintf (stderr, "Leaked %d SPI handles\n", leaked);
-
-#define PRINT_LEAKS
-#ifdef PRINT_LEAKS
- g_hash_table_foreach (live_refs, report_leaked_ref, NULL);
-#endif
-
-#endif
- }
- else
- {
- leaked = 0;
- }
-
- cspi_cleanup ();
-
- return leaked;
-}
-
-/**
- * SPI_freeString:
- * @s: a character string returned from another at-spi call.
- *
- * Free a character string returned from an at-spi call. Clients of
- * at-spi should use this function instead of free () or g_free().
- * A NULL string @s will be silently ignored.
- * This API should not be used to free strings
- * from other libraries or allocated by the client.
- **/
-void
-SPI_freeString (char *s)
-{
- if (s)
- {
- g_free (s);
- }
-}
-
-/**
- * SPI_freeRect:
- * @r: a pointer to an SPIRect returned from another at-spi call.
- *
- * Free a SPIRect structure returned from an at-spi call. Clients of
- * at-spi should use this function instead of free () or g_free().
- * A NULL rect @r will be silently ignored.
- * This API should not be used to free data
- * from other libraries or allocated by the client.
- *
- * @Since: AT-SPI 1.6
- **/
-void
-SPI_freeRect (SPIRect *r)
-{
- if (r)
- {
- /* err, okay, in this case the client _could_
- have called g_free, but we don't want to guarantee it */
- g_free (r);
- }
-}
-
-/**
- * SPI_dupString:
- * @s: a UTF-8 string to be duplicated
- *
- * @Since: AT-SPI 1.4
- *
- * Returns: a duplicate of the string passed as a parameter, which should
- * be freed via SPI_freeString after use.
- **/
-char *
-SPI_dupString (char *s)
-{
- if (s)
- {
- return g_strdup (s);
- }
- else
- return NULL;
-}
-
-/**
- * SPI_exceptionHandlerPush:
- * @handler: an #SPIExceptionHandler to install as the first code to deal with exceptions.
- *
- * Install a client-side handler for #SPIException instances, which can see and handle any
- * exceptions before chaining them to the next exception handler in the stack.
- *
- * @Since: AT-SPI 1.4
- *
- * Returns %TRUE if the result succeeded, %FALSE if @hander could not be registered.
- **/
-SPIBoolean SPI_exceptionHandlerPush (SPIExceptionHandler *handler)
-{
- if (!exception_handlers)
- exception_handlers = g_queue_new ();
- g_queue_push_head (exception_handlers, handler);
- return TRUE;
-}
-
-/**
- * SPI_exceptionHandlerPop:
- *
- * Remove/pop an #SPIExceptionHandler off the error handler stack and return the new handler.
- *
- * @Since: AT-SPI 1.4
- *
- * Returns the #SPIExceptionHandler which is now at the top of the error handler stack after the call.
- **/
-SPIExceptionHandler* SPI_exceptionHandlerPop (void)
-{
- return (SPIExceptionHandler *) g_queue_pop_head (exception_handlers);
-}
-
-/**
- * SPIException_getSourceType:
- * @err: the exception being queried
- *
- * Get the #SPIExceptionType of an exception which has been thrown.
- *
- * @Since: AT-SPI 1.4
- *
- * Returns: the #SPIExceptionType corresponding to exception @err.
- **/
-SPIExceptionType SPIException_getSourceType (SPIException *err)
-{
- if (err)
- return err->type;
- else
- return SPI_EXCEPTION_SOURCE_UNSPECIFIED;
-}
-
-/**
- * SPIException_getExceptionCode:
- * @err: the #SPIException being queried.
- *
- * Get the #SPIExceptionCode telling what type of exception condition has occurred.
- *
- * @Since: AT-SPI 1.4
- *
- * Returns: the #SPIExceptionCode corresponding to exception @err.
- **/
-SPIExceptionCode SPIException_getExceptionCode (SPIException *err)
-{
- return err->code;
-}
-
-/**
- * SPIAccessibleException_getSource:
- * @err: the #SPIException being queried.
- *
- * Get the identity of the object which threw an exception.
- *
- * @Since: AT-SPI 1.4
- *
- * Returns: a pointer to the #Accessible object which threw the exception.
- **/
-Accessible* SPIAccessibleException_getSource (SPIException *err)
-{
- if (err->type == SPI_EXCEPTION_SOURCE_ACCESSIBLE)
- cspi_object_ref (err->source);
- return err->source;
- return NULL;
-}
-
-/**
- * SPIException_getDescription:
- * @err: the #SPIException being queried.
- *
- * Get a text description of the exception that has been thrown.
- * Unfortunately these descriptions tend to be terse and limited in
- * the detail which they can provide.
- *
- * Returns: a brief character string describing the exception.
- **/
-char* SPIException_getDescription (SPIException *err)
-{
- /* TODO: friendlier error messages? */
- if (err->error)
- return err->error->message;
- return NULL;
-}
-
-static char *
-get_path (Accessible *obj)
-{
- if (APP_IS_REGISTRY (obj->app))
- {
- return g_strdup_printf (SPI_DBUS_PATH_REGISTRY);
- }
- return g_strdup_printf ("/org/freedesktop/atspi/accessible/%d", obj->v.id);
-}
-
-dbus_bool_t
-cspi_dbus_call (Accessible *obj, const char *interface, const char *method, DBusError *error, const char *type, ...)
-{
- va_list args;
- char *path = get_path (obj);
- dbus_bool_t retval;
- DBusError err;
-
- if (!error) error = &err;
- dbus_error_init (error);
- va_start (args, type);
- retval = dbind_method_call_reentrant_va (SPI_bus(), obj->app->bus_name, path, interface, method, error, type, args);
- va_end (args);
- g_free (path);
- if (dbus_error_is_set (error))
- {
- if (!dbus_error_is_set (&exception))
- {
- // TODO: Should we call cspi_exception_throw?
- dbus_move_error (error, &exception);
- }
- else if (error == &err) dbus_error_free (error);
- }
- return retval;
-}
-
-dbus_bool_t
-cspi_dbus_get_property (Accessible *obj, const char *interface, const char *name, DBusError *error, const char *type, void *data)
-{
- DBusMessage *message, *reply;
- char *path = get_path (obj);
- DBusMessageIter iter, iter_variant;
- DBusError err;
- dbus_bool_t retval = FALSE;
-
- message = dbus_message_new_method_call (obj->app->bus_name, path, "org.freedesktop.DBus.Properties", "Get");
- if (!message)
- {
- // TODO: throw exception
- goto done;
- }
- dbus_message_append_args (message, DBUS_TYPE_STRING, &interface, DBUS_TYPE_STRING, &name, DBUS_TYPE_INVALID);
- if (!error) error = &err;
- dbus_error_init (error);
- reply = dbus_connection_send_with_reply_and_block (SPI_bus(), message, 1000, error);
- dbus_message_unref (message);
- if (!reply)
- {
- // TODO: throw exception
- goto done;
- }
- dbus_message_iter_init (reply, &iter);
- dbus_message_iter_recurse (&iter, &iter_variant);
- if (dbus_message_iter_get_arg_type (&iter_variant) != type[0])
- {
- g_warning ("cspi_dbus_get_property: Wrong type: expected %s, got %c\n", type, dbus_message_iter_get_arg_type (&iter_variant));
- goto done;
- }
- dbus_message_iter_get_basic (&iter_variant, data);
- dbus_message_unref (reply);
- if (type[0] == 's') *(char **)data = g_strdup (*(char **)data);
- retval = TRUE;
-done:
- g_free (path);
- return retval;
-}
diff --git a/cspi/spi-private.h b/cspi/spi-private.h
deleted file mode 100644
index c7197cb6..00000000
--- a/cspi/spi-private.h
+++ /dev/null
@@ -1,119 +0,0 @@
-/*
- * AT-SPI - Assistive Technology Service Provider Interface
- * (Gnome Accessibility Project; http://developer.gnome.org/projects/gap)
- *
- * Copyright 2002 Ximian, Inc.
- * 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.
- */
-
-#ifndef _SPI_PRIVATE_H_
-#define _SPI_PRIVATE_H_
-
-/* Private internal implementation details of at-spi. */
-
-#include "spi-common/spi-dbus.h"
-#include "cspi/spi.h"
-#include "string.h"
-#include "cspi/cspi-lowlevel.h"
-#include "cspi/spi-listener.h"
-#include "dbind/dbind.h"
-#include <glib-object.h>
-#include "spi-common/spi-stateset.h"
-
-typedef struct _CSpiApplication CSpiApplication;
-struct _CSpiApplication
-{
- GHashTable *hash;
- char *bus_name;
-};
-
-struct _Accessible {
- gint ref_count;
- Accessible *parent;
- GList *children;
- CSpiApplication *app;
- union
- {
- gint id;
- char *path;
- } v;
- gint role : 8;
- gint interfaces : 24;
- char *name;
- char *description;
- AtkStateSet *states;
-};
-
-#define SPI_INTERNAL_EVENT_MAGIC 0xc3
-/*
- * For internal use by CSPI implementation only
- */
-typedef struct {
- AccessibleEvent event;
- guint id;
- guchar magic;
- guchar type;
- guint16 ref_count;
-} InternalEvent;
-
-struct _SPIException {
- SPIExceptionType type;
- Accessible *source;
- DBusError *error;
- SPIExceptionCode code;
- char * desc;
-};
-
-DBusConnection *SPI_bus (void);
-SPIBoolean cspi_exception (void);
-Accessible *cspi_object_add (Accessible *accessible);
-void cspi_object_ref (Accessible *accessible);
-void cspi_object_unref (Accessible *accessible);
-SPIBoolean cspi_accessible_is_a (Accessible *accessible,
- const char *interface_name);
-AccessibleRole cspi_role_from_spi_role (Accessibility_Role role);
-void cspi_streams_close_all (void);
-gboolean cspi_exception_throw (DBusError *error, const char *desc_prefix);
-
-AccessibleAttributeSet
- *_cspi_attribute_set_from_sequence (const GArray *seq);
-#define cspi_return_if_fail(val) \
- if (!(val)) \
- return
-#define cspi_return_val_if_fail(val, ret) \
- if (!(val)) \
- return (ret)
-
-#define cspi_return_if_ev(err) \
- if (cspi_exception ()) \
- return;
-#define cspi_return_val_if_ev(err, ret) \
- if (cspi_exception ()) \
- return (ret);
-
-typedef struct _Accessibility_BoundingBox Accessibility_BoundingBox;
-struct _Accessibility_BoundingBox
-{
- dbus_int32_t x;
- dbus_int32_t y;
- dbus_int32_t width;
- dbus_int32_t height;
-};
-
-#endif /* _SPI_PRIVATE_H_ */
diff --git a/cspi/spi-registry.c b/cspi/spi-registry.c
deleted file mode 100644
index 9629c4f6..00000000
--- a/cspi/spi-registry.c
+++ /dev/null
@@ -1,422 +0,0 @@
-/*
- * AT-SPI - Assistive Technology Service Provider Interface
- * (Gnome Accessibility Project; http://developer.gnome.org/projects/gap)
- *
- * Copyright 2001, 2002 Sun Microsystems Inc.,
- * Copyright 2001, 2002 Ximian, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-/* spi_registry.c: Global functions wrapping the registry */
-
-#include <cspi/spi-private.h>
-
-static GArray *desktops;
-
-/**
- * SPI_getDesktopCount:
- *
- * Get the number of virtual desktops.
- * NOTE: currently multiple virtual desktops are not implemented, this
- * function always returns '1'.
- *
- * Returns: an integer indicating the number of active virtual desktops.
- **/
-int
-SPI_getDesktopCount ()
-{
- return 1;
-}
-
-/**
- * SPI_getDesktop:
- * @i: an integer indicating which of the accessible desktops is to be returned.
- *
- * Get the virtual desktop indicated by index @i.
- * NOTE: currently multiple virtual desktops are not implemented, this
- * function always returns '1'.
- *
- * Returns: a pointer to the 'i-th' virtual desktop's #Accessible representation.
- **/
-Accessible*
-SPI_getDesktop (int i)
-{
- if (i != 0) return NULL;
- return cspi_ref_accessible (spi_bus_registry, NULL);
-}
-
-/**
- * SPI_getDesktopList:
- * @desktop_list: a pointer to an array of #Accessible references.
- *
- * Get the list of virtual desktops. On return, @list will point
- * to a newly-created, NULL terminated array of virtual desktop
- * pointers.
- * It is the responsibility of the caller to free this array when
- * it is no longer needed.
- *
- * Not Yet Implemented : this implementation always returns a single
- * #Accessible desktop.
- *
- * Returns: an integer indicating how many virtual desktops have been
- * placed in the list pointed to by parameter @list.
- **/
-int
-SPI_getDesktopList (Accessible ***desktop_list)
-{
- Accessible **list;
-
- list = g_new0 (Accessible *, 2);
-
- if (!desktop_list) return 1;
- list [0] = cspi_ref_accessible (spi_bus_registry, NULL);
-
- *desktop_list = list;
-
- return 1;
-}
-
-/**
- * SPI_freeDesktopList:
- * @desktop_list: a pointer to an array of #Accessible objects
- * as returned from @SPI_getDesktopList
- *
- * This routine frees the memory associated with the list.
- **/
-void
-SPI_freeDesktopList (Accessible **desktop_list)
-{
- Accessible **p;
-
- for (p = desktop_list; p && *p; p++)
- {
- cspi_object_unref (*p);
- }
- g_free (desktop_list);
-}
-
-/**
- * SPI_KEYSET_ALL_KEYS:
- * @SPI_KEYSET_ALL_KEYS: A special value for an AccessibleKeySet type, which tacitly
- * includes all keycodes and keyvals for the specified modifier set.
- **/
-
-/**
- * SPI_registerAccessibleKeystrokeListener:
- * @listener: a pointer to the #AccessibleKeystrokeListener for which
- * keystroke events are requested.
- * @keys: a pointer to the #AccessibleKeySet indicating which
- * keystroke events are requested, or #SPI_KEYSET_ALL_KEYS
- * to indicate that all keycodes and keyvals for the specified
- * modifier set are to be included.
- * @modmask: an #AccessibleKeyMaskType mask indicating which
- * key event modifiers must be set in combination with @keys,
- * events will only be reported for key events for which all
- * modifiers in @modmask are set. If you wish to listen for
- * events with multiple modifier combinations you must call
- * registerAccessibleKeystrokeListener() once for each combination.
- * @eventmask: an #AccessibleKeyMaskType mask indicating which
- * types of key events are requested (#SPI_KEY_PRESSED, etc.).
- * @sync_type: a #AccessibleKeyListenerSyncType parameter indicating
- * the behavior of the notification/listener transaction.
- *
- * Register a listener for keystroke events, either pre-emptively for
- * all windows (SPI_KEYLISTENER_ALL_WINDOWS),
- * non-preemptively (SPI_KEYLISTENER_NOSYNC), or
- * pre-emptively at the toolkit level (SPI_KEYLISTENER_CANCONSUME).
- * If ALL_WINDOWS or CANCONSUME are used, the event is consumed
- * upon receipt if one of @listener's callbacks returns #TRUE.
- * ( Other sync_type values may be available in the future )
- *
- * Returns: #TRUE if successful, otherwise #FALSE.
- **/
-SPIBoolean
-SPI_registerAccessibleKeystrokeListener (AccessibleKeystrokeListener *listener,
- AccessibleKeySet *keys,
- AccessibleKeyMaskType modmask,
- AccessibleKeyEventMask eventmask,
- AccessibleKeyListenerSyncType sync_type)
-{
- gchar *path = cspi_device_listener_get_path (listener);
- gint i;
- GArray *key_set;
- dbus_uint32_t key_events = 0;
- Accessibility_ControllerEventMask controller_event_mask;
- Accessibility_EventListenerMode listener_mode;
- DBusError error;
- SPIBoolean retval = FALSE;
-
- if (!listener)
- {
- return retval;
- }
-
- /* copy the keyval filter values from the C api into the DBind KeySet */
- if (keys)
- {
- key_set = g_array_sized_new (FALSE, TRUE, sizeof (Accessibility_KeyDefinition), keys->len);
- key_set->len = keys->len;
- for (i = 0; i < keys->len; ++i)
- {
- Accessibility_KeyDefinition *kd = ((Accessibility_KeyDefinition *) key_set->data) + i;
- kd->keycode = keys->keycodes[i];
- kd->keysym = keys->keysyms[i];
- if (keys->keystrings && keys->keystrings[i])
- {
- kd->keystring = keys->keystrings[i];
- }
- else
- {
- kd->keystring = "";
- }
- }
- }
- else
- {
- key_set = g_array_sized_new (FALSE, TRUE, sizeof (Accessibility_KeyDefinition), 0);
- }
-
- /* copy the event filter values from the C api into the DBus key_events */
- if (eventmask & SPI_KEY_PRESSED)
- {
- key_events |= (1 << Accessibility_KEY_PRESSED_EVENT);
- }
- if (eventmask & SPI_KEY_RELEASED)
- {
- key_events |= (1 << Accessibility_KEY_RELEASED_EVENT);
- }
-
- controller_event_mask = (dbus_uint32_t) modmask;
-
- listener_mode.synchronous =
- (dbus_bool_t) ((sync_type & SPI_KEYLISTENER_SYNCHRONOUS)!=0);
- listener_mode.preemptive =
- (dbus_bool_t) ((sync_type & SPI_KEYLISTENER_CANCONSUME)!=0);
- listener_mode.global =
- (dbus_bool_t) ((sync_type & SPI_KEYLISTENER_ALL_WINDOWS)!=0);
-
- dbus_error_init (&error);
- dbind_method_call_reentrant (SPI_bus(), spi_bus_registry, spi_path_dec, spi_interface_dec, "registerKeystrokeListener", &error, "oa(iisi)uu(bbb)=>b", path, key_set, controller_event_mask, key_events, &listener_mode, &retval);
-
- g_array_free (key_set, TRUE);
- g_free (path);
-
- return retval;
-}
-
-/**
- * SPI_deregisterAccessibleKeystrokeListener:
- * @listener: a pointer to the #AccessibleKeystrokeListener for which
- * keystroke events are requested.
- * @modmask: the key modifier mask for which this listener is to be
- * 'deregistered' (of type #AccessibleeyMaskType).
- *
- * Removes a keystroke event listener from the registry's listener queue,
- * ceasing notification of events with modifiers matching @modmask.
- *
- * Returns: #TRUE if successful, otherwise #FALSE.
- **/
-SPIBoolean
-SPI_deregisterAccessibleKeystrokeListener (AccessibleKeystrokeListener *listener,
- AccessibleKeyMaskType modmask)
-{
- gchar *path = cspi_device_listener_get_path (listener);
- Accessibility_ControllerEventMask controller_event_mask;
- GArray *key_set;
- dbus_uint32_t key_events = 0;
- DBusError error;
-
- if (!listener)
- {
- return FALSE;
- }
-
-
- controller_event_mask = (dbus_uint32_t) modmask;
-
- key_set = g_array_sized_new (FALSE, TRUE, sizeof (Accessibility_KeyDefinition), 0);
- dbind_method_call_reentrant (SPI_bus(), spi_bus_registry, spi_path_dec, spi_interface_dec, "deregisterKeystrokeListener", &error, "oa(iisi)uu", path, &key_set, key_events, controller_event_mask);
- g_free (path);
- return TRUE;
-}
-
-/**
- * SPI_registerDeviceEventListener:
- * @listener: a pointer to the #AccessibleDeviceListener which requests
- * the events.
- * @eventmask: an #AccessibleDeviceEventMask mask indicating which
- * types of key events are requested (#SPI_KEY_PRESSED, etc.).
- * @filter: Unused parameter.
- *
- * Register a listener for device events, for instance button events.
- *
- * Returns: #TRUE if successful, otherwise #FALSE.
- **/
-SPIBoolean
-SPI_registerDeviceEventListener (AccessibleDeviceListener *listener,
- AccessibleDeviceEventMask eventmask,
- void *filter)
-{
- SPIBoolean retval = FALSE;
- dbus_uint32_t event_types = 0;
- gint i;
- gchar *path = cspi_device_listener_get_path (listener);
- DBusError error;
-
- if (!listener)
- {
- return retval;
- }
-
- /* copy the event filter values from the C api into the CORBA KeyEventTypeSeq */
-
- if (eventmask & SPI_BUTTON_PRESSED)
- {
- event_types |= (1 << Accessibility_BUTTON_PRESSED_EVENT);
- }
- if (eventmask & SPI_BUTTON_RELEASED)
- {
- event_types |= (1 << Accessibility_BUTTON_RELEASED_EVENT);
- }
-
- dbus_error_init (&error);
- dbind_method_call_reentrant (SPI_bus(), spi_bus_registry, spi_path_dec, spi_interface_dec, "registerDeviceEventListener", &error, "ou=>b", path, event_types, &retval);
- g_free (path);
- return retval;
-}
-
-/**
- * SPI_deregisterDeviceEventListener:
- * @listener: a pointer to the #AccessibleDeviceListener for which
- * device events are requested.
- * @filter: Unused parameter.
- *
- * Removes a device event listener from the registry's listener queue,
- * ceasing notification of events of the specified type.
- *
- * Returns: #TRUE if successful, otherwise #FALSE.
- **/
-SPIBoolean
-SPI_deregisterDeviceEventListener (AccessibleDeviceListener *listener,
- void *filter)
-{
- dbus_uint32_t event_types = 0;
- gchar *path = cspi_device_listener_get_path (listener);
- DBusError error;
-
- if (!listener)
- {
- return FALSE;
- }
-
- event_types |= (1 << Accessibility_BUTTON_PRESSED_EVENT);
- event_types |= (1 << Accessibility_BUTTON_RELEASED_EVENT);
-
- dbus_error_init (&error);
- dbind_method_call_reentrant (SPI_bus(), spi_bus_registry, spi_path_dec, spi_interface_dec, "deregisterDeviceEventListener", &error, "ou", path, event_types);
- g_free (path);
- return TRUE;
-}
-
-/**
- * SPI_generateKeyboardEvent:
- * @keyval: a long integer indicating the keycode or keysym of the key event
- * being synthesized.
- * @keystring: an (optional) UTF-8 string which, if @keyval is NULL,
- * indicates a 'composed' keyboard input string which is
- * being synthesized; this type of keyboard event synthesis does
- * not emulate hardware keypresses but injects the string
- * as though a composing input method (such as XIM) were used.
- * @synth_type: a #AccessibleKeySynthType flag indicating whether @keyval
- * is to be interpreted as a keysym rather than a keycode
- * (CSPI_KEYSYM), or whether to synthesize
- * SPI_KEY_PRESS, SPI_KEY_RELEASE, or both (SPI_KEY_PRESSRELEASE).
- *
- * Synthesize a keyboard event (as if a hardware keyboard event occurred in the
- * current UI context).
- *
- * Returns: #TRUE if successful, otherwise #FALSE.
- **/
-SPIBoolean
-SPI_generateKeyboardEvent (long int keyval,
- char *keystring,
- AccessibleKeySynthType synth_type)
-{
- dbus_uint32_t keysynth_type;
- dbus_int32_t keycode = keyval;
- DBusError error;
-
- switch (synth_type)
- {
- case SPI_KEY_PRESS:
- keysynth_type = Accessibility_KEY_PRESS;
- break;
- case SPI_KEY_RELEASE:
- keysynth_type = Accessibility_KEY_RELEASE;
- break;
- case SPI_KEY_PRESSRELEASE:
- keysynth_type = Accessibility_KEY_PRESSRELEASE;
- break;
- case SPI_KEY_SYM:
- keysynth_type = Accessibility_KEY_SYM;
- break;
- case SPI_KEY_STRING:
- keysynth_type = Accessibility_KEY_STRING;
- break;
- default:
- return FALSE;
- }
-
- if (!keystring) keystring = "";
- dbus_error_init (&error);
- dbind_method_call_reentrant (SPI_bus(), spi_bus_registry, spi_path_dec, spi_interface_dec, "generateKeyboardEvent", &error, "isu", keycode, keystring, keysynth_type);
-
- return TRUE;
-}
-
-/**
- * SPI_generateMouseEvent:
- * @x: a #long indicating the screen x coordinate of the mouse event.
- * @y: a #long indicating the screen y coordinate of the mouse event.
- * @name: a string indicating which mouse event to be synthesized
- * (e.g. "b1p", "b1c", "b2r", "rel", "abs").
- *
- * Synthesize a mouse event at a specific screen coordinate.
- * Most AT clients should use the #AccessibleAction interface when
- * tempted to generate mouse events, rather than this method.
- * Event names: b1p = button 1 press; b2r = button 2 release;
- * b3c = button 3 click; b2d = button 2 double-click;
- * abs = absolute motion; rel = relative motion.
- *
- * Returns: #TRUE if successful, otherwise #FALSE.
- **/
-SPIBoolean
-SPI_generateMouseEvent (long x, long y, char *name)
-{
- dbus_int32_t dbus_x = x, dbus__y = y;
- DBusError error;
-
- dbus_error_init (&error);
- dbind_method_call_reentrant (SPI_bus(), spi_bus_registry, spi_path_dec, spi_interface_dec, "generateMouseEvent", &error, "iis", x, y, name);
- return TRUE;
-}
-
-char *
-cspi_device_listener_get_path (CSpiDeviceListener *listener)
-{
- return g_strdup_printf ("/org/freedesktop/atspi/listeners/%d", listener->id);
-}
diff --git a/cspi/spi-roletypes.h b/cspi/spi-roletypes.h
deleted file mode 100644
index 15b8bc0c..00000000
--- a/cspi/spi-roletypes.h
+++ /dev/null
@@ -1,273 +0,0 @@
-/*
- * AT-SPI - Assistive Technology Service Provider Interface
- * (Gnome Accessibility Project; http://developer.gnome.org/projects/gap)
- *
- * Copyright 2001, 2002 Sun Microsystems Inc.,
- * Copyright 2001, 2002 Ximian, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifndef _SPI_ROLETYPES_H_
-#define _SPI_ROLETYPES_H_
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * AccessibleRole:
- * @SPI_ROLE_INVALID: role is not legal, something is wrong with this object
- * @SPI_ROLE_ACCEL_LABEL: object is a label indicating keyboard
- * accelerators for the parent
- * @SPI_ROLE_ALERT: Object is used to alert the user about something
- * @SPI_ROLE_ANIMATION: Object contains a dynamic or moving image
- * @SPI_ROLE_ARROW: Object is a 2d directional indicator
- * @SPI_ROLE_CALENDAR: Object contains one or more dates, usually arranged into
- * a 2d list
- * @SPI_ROLE_CANVAS: Object that can be drawn into and is used to trap events
- * @SPI_ROLE_CHECK_BOX: Object representd a choice that can be checked or unchecked
- * and provides a separate indicator for the current state.
- * @SPI_ROLE_CHECK_MENU_ITEM: Object is a menu item that behaves like a CHECK_BOX
- * @SPI_ROLE_COLOR_CHOOSER: A specialized dialog that lets the user choose a color.
- * @SPI_ROLE_COLUMN_HEADER: The header for a column of data
- * @SPI_ROLE_COMBO_BOX: A list of choices the user can select from
- * @SPI_ROLE_DATE_EDITOR: Allows entry of a date
- * @SPI_ROLE_DESKTOP_ICON: An inconifed internal frame within a DESKTOP_PANE
- * @SPI_ROLE_DESKTOP_FRAME: A pane that supports internal frames and
- * iconified versions of those internal frames.
- * @SPI_ROLE_DIAL: A rotating/rotatable valuator
- * @SPI_ROLE_DIALOG: A top level window with title bar and a border
- * @SPI_ROLE_DIRECTORY_PANE: A pane that allows the user to navigate
- * through and select the contents of a directory.
- * @SPI_ROLE_DRAWING_AREA: An object used for drawing custom user interface elements
- * @SPI_ROLE_FILE_CHOOSER: A specialized dialog that displays the files in the
- * directory and lets the user select a file, browse a different
- * directory, or specify a filename.
- * @SPI_ROLE_FILLER: A object that fills up space in a user interface
- * @SPI_ROLE_FONT_CHOOSER: Allows selection of a display font
- * @SPI_ROLE_FRAME: A top level window with a title bar, border, menubar, etc.
- * @SPI_ROLE_GLASS_PANE: A pane that is guaranteed to be painted on top of all
- * panes beneath it
- * @SPI_ROLE_HTML_CONTAINER: A document container for HTML, whose children
- * represent the document content.
- * @SPI_ROLE_ICON: A small fixed size picture, typically used to decorate components.
- * @SPI_ROLE_IMAGE: An image, typically static
- * @SPI_ROLE_INTERNAL_FRAME: A frame-like object that is clipped by a desktop pane.
- * @SPI_ROLE_LABEL: An object used to present an icon or short string in an interface
- * @SPI_ROLE_LAYERED_PANE: A specialized pane that allows its children to be drawn in layers
- * providing a form of stacking order.
- * @SPI_ROLE_LIST: An object that presents a list of objects to the user and allows the
- * user to select one or more of them.
- * @SPI_ROLE_LIST_ITEM: An object that represents an element of a list.
- * @SPI_ROLE_MENU: An object usually found inside a menu bar that contains a list of
- * actions the user can choose from.
- * @SPI_ROLE_MENU_BAR: An object usually drawn at the top of the primary dialog box of an
- * application that contains a list of menus the user can choose from.
- * @SPI_ROLE_MENU_ITEM: An object usually contained in a menu that presents an
- * action the user can choose.
- * @SPI_ROLE_OPTION_PANE: A specialized pane whose primary use is inside a DIALOG
- * @SPI_ROLE_PAGE_TAB: An object that is a child of a page tab list
- * @SPI_ROLE_PAGE_TAB_LIST: An object that presents a series of panels (or page tabs),
- * one at a time, through some mechanism provided by the object.
- * @SPI_ROLE_PANEL: A generic container that is often used to group objects.
- * @SPI_ROLE_PASSWORD_TEXT: A text object uses for passwords, or other places where
- * the text content is not shown visibly to the user.
- * @SPI_ROLE_POPUP_MENU: A temporary window that is usually used to offer the user a
- * list of choices, and then hides when the user selects one of those choices.
- * @SPI_ROLE_PROGRESS_BAR: An object used to indicate how much of a task has been completed.
- * @SPI_ROLE_PUSH_BUTTON: A specialized object which the user can interact with to tell
- * the application to do something.
- * @SPI_ROLE_RADIO_BUTTON: A specialized check box that will cause other radio buttons in the
- * same group to become uncghecked when this one is checked.
- * @SPI_ROLE_RADIO_MENU_ITEM: A specialized menu item that behaves like a
- * radio button.
- * @SPI_ROLE_ROOT_PANE: A specialized pane that has a glass pane and a layered pane as its
- * children.
- * @SPI_ROLE_ROW_HEADER: The header for a row of data
- * @SPI_ROLE_SCROLL_BAR: An object usually used to allow a user to incrementally
- * view a large amount of data.
- * @SPI_ROLE_SCROLL_PANE: An object that allows a user to incrementally view a large amount
- * of information.
- * @SPI_ROLE_SEPARATOR: An object usually contained in a menu to provide a visible and
- * logical separation of the contents in a menu.
- * @SPI_ROLE_SLIDER: An object that allows the user to select from a bounded range.
- * @SPI_ROLE_SPIN_BUTTON: An object which allows selection from a set of choices and
- * displays the current choice.
- * @SPI_ROLE_SPLIT_PANE: A specialized panel that presents two other panels at the same time.
- * @SPI_ROLE_STATUS_BAR: An object the display qualitative status information. c.f. PROGRESS_BAR
- * @SPI_ROLE_TABLE: An object used to rpesent information in terms of rows and columns.
- * @SPI_ROLE_TABLE_CELL: An object which is a descendant of a table,
- * with a row/column location. A cell may span multiple rows and columns.
- * @SPI_ROLE_TABLE_COLUMN_HEADER: An object which serves to describe a column in a table.
- * @SPI_ROLE_TABLE_ROW_HEADER: An object which serves to label or describe a row in a table.
- * @SPI_ROLE_TEAROFF_MENU_ITEM: A menu item which allows the menu to be removed from
- * a menubar and placed in its own window
- * @SPI_ROLE_TERMINAL: An object that emulates a teletype or terminal
- * @SPI_ROLE_TEXT: An object that presents text to the user
- * @SPI_ROLE_TOGGLE_BUTTON: A specialized push button that can be checked or unchecked,
- * but does not provide a separate indicator for the current state.
- * @SPI_ROLE_TOOL_BAR: A bar or palette usually composed of push buttons or toggle buttons
- * @SPI_ROLE_TOOL_TIP: An object that provides information about another object
- * @SPI_ROLE_TREE: An object used to represent hierarchical information to the user
- * @SPI_ROLE_TREE_TABLE: An object which represents both hierarchical and tabular information
- * @SPI_ROLE_UNKNOWN: The object contains some SpiAccessible information, but its role is
- * not known.
- * @SPI_ROLE_VIEWPORT: An object usually used in a scroll pane, which restricts the visual
- * area into which its contents are presented.
- * @SPI_ROLE_WINDOW: A top level window with no title or border.
- * @SPI_ROLE_EXTENDED: This object's role is not included in the standard role list and
- * should be queried by name.
- * @SPI_ROLE_HEADER: An object that serves as a document header.
- * @SPI_ROLE_FOOTER: An object that serves as a document footer.
- * @SPI_ROLE_PARAGRAPH: An object which is contains a paragraph of text content.
- * @SPI_ROLE_RULER: An object which describes margins and tab stops, etc. for text objects
- * which it controls (should have CONTROLLER_FOR relation to such).
- * @SPI_ROLE_APPLICATION: An object which corresponds to a desktop application,
- * which may have children of @SPI_ROLE_FRAME or other type.
- * @SPI_ROLE_AUTOCOMPLETE: The object is a dialog or list containing items for
- * insertion into an entry widget, for instance a list
- * of words for completion of a text entry.
- * @SPI_ROLE_EDITBAR: The object is an editable text object in a toolbar
- * @SPI_ROLE_EMBEDDED: The object is an embedded component container.
- * This role is a "grouping" hint that the contained
- * objects share a context which is different from the
- * container in which this accessible is embedded.
- * Uses: document embedding, "panel applets", etc.
- * @SPI_ROLE_ENTRY: The object is a component whose textual content may be entered or modified by the user, provided @SPI_STATE_EDITABLE is present.
- * @SPI_ROLE_CHART: The object is a graphical depiction of quantitative data. It may contain multiple subelements whose attributes and/or description may be queried to obtain both the quantitative data and information about how the data is being presented. The LABELLED_BY relation is particularly important in interpreting objects of this type, as is the accessible-description property.
- * @SPI_ROLE_CAPTION: The object contains descriptive information, usually textual, about another user interface element such as a table, chart, or image.
- * @SPI_ROLE_DOCUMENT_FRAME: The object is a visual frame or container which contains a view of document content. Document frames may occur within another Document instance, in which case the second document may be said to be embedded in the containing instance. HTML frames are often ROLE_DOCUMENT_FRAME. Either this object, or a singleton descendant, should implement the Document interface.
- * @SPI_ROLE_HEADING: The object serves as a heading for content which follows it in a document. The 'heading level' of the heading, if availabe, may be obtained by querying the object's attributes.
- * @SPI_ROLE_PAGE: The object is a containing instance which encapsulates a page of information. @SPI_ROLE_PAGE is used in documents and content which support a paginated navigation model.
- * @SPI_ROLE_SECTION: The object is a containing instance of document content which constitutes a particular 'logical' section of the document. The type of content within a section, and the nature of the section division itself, may be obtained by querying the object's attributes. Sections may be nested.
- * @SPI_ROLE_REDUNDANT_OBJECT: The object is redundant with another object in the hierarchy, and is exposed for purely technical reasons. Objects of this role should normally be ignored by clients.
- * @SPI_ROLE_FORM: The object is a container for form controls, for instance as part of a
- * web form or user-input form within a document. This role is primarily a tag/convenience for
- * clients when navigating complex documents, it is not expected that ordinary GUI containers will
- * always have ATK_ROLE_FORM.
- * @SPI_ROLE_LINK: The object is a hypertext anchor.
- * @SPI_ROLE_INPUT_METHOD_WINDOW: The object is an input method window used
- * to input or compose a text character (typically a "complex text" character).
- * @SPI_ROLE_LAST_DEFINED: Used to determine the end of the role enumeration.
- *
- * Describes the role of an object
- *
- * These are the built-in enumerated roles that UI components can have.
- * Other roles may be added at runtime, so an AccessibleRole >=
- * SPI_ROLE_LAST_DEFINED is not necessarily an error.
- **/
-typedef enum
-{
- SPI_ROLE_INVALID,
- SPI_ROLE_ACCEL_LABEL,
- SPI_ROLE_ALERT,
- SPI_ROLE_ANIMATION,
- SPI_ROLE_ARROW,
- SPI_ROLE_CALENDAR,
- SPI_ROLE_CANVAS,
- SPI_ROLE_CHECK_BOX,
- SPI_ROLE_CHECK_MENU_ITEM,
- SPI_ROLE_COLOR_CHOOSER,
- SPI_ROLE_COLUMN_HEADER,
- SPI_ROLE_COMBO_BOX,
- SPI_ROLE_DATE_EDITOR,
- SPI_ROLE_DESKTOP_ICON,
- SPI_ROLE_DESKTOP_FRAME,
- SPI_ROLE_DIAL,
- SPI_ROLE_DIALOG,
- SPI_ROLE_DIRECTORY_PANE,
- SPI_ROLE_DRAWING_AREA,
- SPI_ROLE_FILE_CHOOSER,
- SPI_ROLE_FILLER,
- SPI_ROLE_FONT_CHOOSER,
- SPI_ROLE_FRAME,
- SPI_ROLE_GLASS_PANE,
- SPI_ROLE_HTML_CONTAINER,
- SPI_ROLE_ICON,
- SPI_ROLE_IMAGE,
- SPI_ROLE_INTERNAL_FRAME,
- SPI_ROLE_LABEL,
- SPI_ROLE_LAYERED_PANE,
- SPI_ROLE_LIST,
- SPI_ROLE_LIST_ITEM,
- SPI_ROLE_MENU,
- SPI_ROLE_MENU_BAR,
- SPI_ROLE_MENU_ITEM,
- SPI_ROLE_OPTION_PANE,
- SPI_ROLE_PAGE_TAB,
- SPI_ROLE_PAGE_TAB_LIST,
- SPI_ROLE_PANEL,
- SPI_ROLE_PASSWORD_TEXT,
- SPI_ROLE_POPUP_MENU,
- SPI_ROLE_PROGRESS_BAR,
- SPI_ROLE_PUSH_BUTTON,
- SPI_ROLE_RADIO_BUTTON,
- SPI_ROLE_RADIO_MENU_ITEM,
- SPI_ROLE_ROOT_PANE,
- SPI_ROLE_ROW_HEADER,
- SPI_ROLE_SCROLL_BAR,
- SPI_ROLE_SCROLL_PANE,
- SPI_ROLE_SEPARATOR,
- SPI_ROLE_SLIDER,
- SPI_ROLE_SPIN_BUTTON,
- SPI_ROLE_SPLIT_PANE,
- SPI_ROLE_STATUS_BAR,
- SPI_ROLE_TABLE,
- SPI_ROLE_TABLE_CELL,
- SPI_ROLE_TABLE_COLUMN_HEADER,
- SPI_ROLE_TABLE_ROW_HEADER,
- SPI_ROLE_TEAROFF_MENU_ITEM,
- SPI_ROLE_TERMINAL,
- SPI_ROLE_TEXT,
- SPI_ROLE_TOGGLE_BUTTON,
- SPI_ROLE_TOOL_BAR,
- SPI_ROLE_TOOL_TIP,
- SPI_ROLE_TREE,
- SPI_ROLE_TREE_TABLE,
- SPI_ROLE_UNKNOWN,
- SPI_ROLE_VIEWPORT,
- SPI_ROLE_WINDOW,
- SPI_ROLE_EXTENDED,
- SPI_ROLE_HEADER,
- SPI_ROLE_FOOTER,
- SPI_ROLE_PARAGRAPH,
- SPI_ROLE_RULER,
- SPI_ROLE_APPLICATION,
- SPI_ROLE_AUTOCOMPLETE,
- SPI_ROLE_EDITBAR,
- SPI_ROLE_EMBEDDED,
- SPI_ROLE_ENTRY,
- SPI_ROLE_CHART,
- SPI_ROLE_CAPTION,
- SPI_ROLE_DOCUMENT_FRAME,
- SPI_ROLE_HEADING,
- SPI_ROLE_PAGE,
- SPI_ROLE_SECTION,
- SPI_ROLE_FORM,
- SPI_ROLE_REDUNDANT_OBJECT,
- SPI_ROLE_LINK,
- SPI_ROLE_INPUT_METHOD_WINDOW,
- SPI_ROLE_LAST_DEFINED
-} AccessibleRole;
-
-char* AccessibleRole_getName (AccessibleRole role);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/cspi/spi-selection.c b/cspi/spi-selection.c
deleted file mode 100644
index d3690704..00000000
--- a/cspi/spi-selection.c
+++ /dev/null
@@ -1,274 +0,0 @@
-/*
- * AT-SPI - Assistive Technology Service Provider Interface
- * (Gnome Accessibility Project; http://developer.gnome.org/projects/gap)
- *
- * Copyright 2001, 2002 Sun Microsystems Inc.,
- * Copyright 2001, 2002 Ximian, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#include <cspi/spi-private.h>
-
-/**
- * AccessibleSelection_ref:
- * @obj: a pointer to the #AccessibleSelection implementor on which to operate.
- *
- * Increment the reference count for an #AccessibleSelection object.
- *
- **/
-void
-AccessibleSelection_ref (AccessibleSelection *obj)
-{
- cspi_object_ref (obj);
-}
-
-/**
- * AccessibleSelection_unref:
- * @obj: a pointer to the #AccessibleSelection implementor on which to operate.
- *
- * Decrement the reference count for an #Accessible object.
- *
- **/
-void
-AccessibleSelection_unref (AccessibleSelection *obj)
-{
- cspi_object_unref (obj);
-}
-
-/**
- * AccessibleSelection_getNSelectedChildren:
- * @obj: a pointer to the #AccessibleSelection implementor on which to operate.
- *
- * Get the number of children of an #AccessibleSelection implementor which are
- * currently selected.
- *
- * Returns: a #long indicating the number of #Accessible children
- * of the #AccessibleSelection implementor which are currently selected.
- *
- **/
-long
-AccessibleSelection_getNSelectedChildren (AccessibleSelection *obj)
-{
- dbus_int32_t retval;
-
- cspi_return_val_if_fail (obj != NULL, -1);
-
- cspi_dbus_get_property (obj, spi_interface_selection, "nSelectedChildren", NULL, "i", &retval);
-
- cspi_return_val_if_ev ("getNSelectedChildren", -1);
-
- return retval;
-}
-
-/**
- * AccessibleSelection_getSelectedChild:
- * @obj: a pointer to the #AccessibleSelection on which to operate.
- * @selectedChildIndex: a #long indicating which of the selected
- * children is specified.
- *
- * Get the i-th selected #Accessible child of an #AccessibleSelection.
- * Note that @childIndex refers to the index in the list of 'selected'
- * children and generally differs from that used in
- * #Accessible_getChildAtIndex() or returned by
- * #Accessible_getIndexInParent(). @selectedChildIndex must lie between 0
- * and #AccessibleSelection_getNSelectedChildren()-1, inclusive.
- *
- * Returns: a pointer to a selected #Accessible child object,
- * specified by @childIndex.
- *
- **/
-Accessible *
-AccessibleSelection_getSelectedChild (AccessibleSelection *obj,
- long int selectedChildIndex)
-{
- dbus_int32_t d_selectedChildIndex = selectedChildIndex;
- char *path;
- Accessible *child;
-
- cspi_return_val_if_fail (obj != NULL, NULL);
-
- cspi_dbus_call (obj, spi_interface_selection, "getSelectedChild", NULL, "i=>o", &d_selectedChildIndex, &path);
- child = cspi_ref_related_accessible (obj, path);
- g_free (path);
- return child;
-}
-
-/**
- * AccessibleSelection_selectChild:
- * @obj: a pointer to the #AccessibleSelection on which to operate.
- * @childIndex: a #long indicating which child of the #Accessible
- * is to be selected.
- *
- * Add a child to the selected children list of an #AccessibleSelection.
- * For #AccessibleSelection implementors that only allow
- * single selections, this may replace the (single) current
- * selection.
- *
- * Returns: #TRUE if the child was successfully selected, #FALSE otherwise.
- **/
-SPIBoolean
-AccessibleSelection_selectChild (AccessibleSelection *obj,
- long int childIndex)
-{
- dbus_int32_t d_childIndex = childIndex;
- dbus_bool_t retval;
-
- cspi_return_val_if_fail (obj != NULL, FALSE);
-
- cspi_dbus_call (obj, spi_interface_selection, "selectChild", NULL, "i=>b", &d_childIndex, &retval);
-
- cspi_return_val_if_ev ("selectChild", FALSE);
-
- return retval;
-}
-
-/**
- * AccessibleSelection_deselectSelectedChild:
- * @obj: a pointer to the #AccessibleSelection on which to operate.
- * @selectedChildIndex: a #long indicating which of the selected children
- * of the #Accessible is to be selected.
- *
- * Remove a child to the selected children list of an #AccessibleSelection.
- * Note that @childIndex is the index in the selected-children list,
- * not the index in the parent container. @selectedChildIndex in this
- * method, and @childIndex in #AccessibleSelection_selectChild
- * are asymmettric.
- *
- * Returns: #TRUE if the child was successfully deselected, #FALSE otherwise.
- **/
-SPIBoolean
-AccessibleSelection_deselectSelectedChild (AccessibleSelection *obj,
- long int selectedChildIndex)
-{
- dbus_int32_t d_selectedChildIndex = selectedChildIndex;
- dbus_bool_t retval;
-
- cspi_return_val_if_fail (obj != NULL, FALSE);
-
- cspi_dbus_call (obj, spi_interface_selection, "deselectSelectedChild", NULL, "i=>b", &d_selectedChildIndex, &retval);
-
- cspi_return_val_if_ev ("deselectSelectedChild", FALSE);
-
- return retval;
-}
-
-/**
- * AccessibleSelection_deselectChild:
- * @obj: a pointer to the #AccessibleSelection on which to operate.
- * @childIndex: a #long indicating which of the children
- * of the #Accessible is to be de-selected.
- *
- * Deselect a specific child of an #AccessibleSelection.
- * Note that @childIndex is the index of the child
- * in the parent container.
- *
- * See #AccessibleSelection_deselectSelectedChild
- *
- * Since AT-SPI 1.8.0
- *
- * Returns: #TRUE if the child was successfully deselected, #FALSE otherwise.
- **/
-SPIBoolean
-AccessibleSelection_deselectChild (AccessibleSelection *obj,
- long int childIndex)
-{
- dbus_int32_t d_childIndex = childIndex;
- dbus_bool_t retval;
-
- cspi_return_val_if_fail (obj != NULL, FALSE);
-
- cspi_dbus_call (obj, spi_interface_selection, "deselectChild", NULL, "i=>b", &d_childIndex, &retval);
-
- cspi_return_val_if_ev ("deselectChild", FALSE);
-
- return retval;
-}
-
-/**
- * AccessibleSelection_isChildSelected:
- * @obj: a pointer to the #AccessibleSelection implementor on which to operate.
- * @childIndex: an index into the #AccessibleSelection's list of children.
- *
- * Determine whether a particular child of an #AccessibleSelection implementor
- * is currently selected. Note that @childIndex is the index into the
- * standard #Accessible container's list of children.
- *
- * Returns: #TRUE if the specified child is currently selected,
- * #FALSE otherwise.
- **/
-SPIBoolean
-AccessibleSelection_isChildSelected (AccessibleSelection *obj,
- long int childIndex)
-{
- dbus_int32_t d_childIndex = childIndex;
- dbus_bool_t retval;
-
- cspi_return_val_if_fail (obj != NULL, FALSE);
-
- cspi_dbus_call (obj, spi_interface_selection, "isChildSelected", NULL, "i=>b", &d_childIndex, &retval);
-
- cspi_return_val_if_ev ("isChildSelected", FALSE);
-
- return retval;
-}
-
-/**
- * AccessibleSelection_selectAll:
- * @obj: a pointer to the #AccessibleSelection implementor on which to operate.
- *
- * Attempt to select all of the children of an #AccessibleSelection implementor.
- * Not all #AccessibleSelection implementors support this operation.
- *
- * Returns: #TRUE if successful, #FALSE otherwise.
- *
- **/
-SPIBoolean
-AccessibleSelection_selectAll (AccessibleSelection *obj)
-{
- dbus_bool_t retval;
-
- cspi_return_val_if_fail (obj != NULL, FALSE);
-
- cspi_dbus_call (obj, spi_interface_selection, "selectAll", NULL, "=>b", &retval);
-
- cspi_return_val_if_ev ("selectAll", FALSE);
-
- return retval;
-}
-
-/**
- * AccessibleSelection_clearSelection:
- * @obj: a pointer to the #AccessibleSelection implementor on which to operate.
- *
- * Clear the current selection, removing all selected children from the
- * specified #AccessibleSelection implementor's selection list.
- *
- * Returns: #TRUE if successful, #FALSE otherwise.
- *
- **/
-SPIBoolean
-AccessibleSelection_clearSelection (AccessibleSelection *obj)
-{
- dbus_bool_t retval;
-
- cspi_return_val_if_fail (obj != NULL, FALSE);
-
- cspi_dbus_call (obj, spi_interface_selection, "clearSelection", NULL, "=>b", &retval);
-
- return retval;
-}
-
diff --git a/cspi/spi-statetypes.h b/cspi/spi-statetypes.h
deleted file mode 100644
index 06f2155c..00000000
--- a/cspi/spi-statetypes.h
+++ /dev/null
@@ -1,127 +0,0 @@
-/*
- * AT-SPI - Assistive Technology Service Provider Interface
- * (Gnome Accessibility Project; http://developer.gnome.org/projects/gap)
- *
- * Copyright 2001, 2002 Sun Microsystems Inc.,
- * Copyright 2001, 2002 Ximian, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifndef _SPI_STATETYPES_H_
-#define _SPI_STATETYPES_H_
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- *AccessibleState:
- *@SPI_STATE_INVALID: Indicates an invalid state
- *@SPI_STATE_ACTIVE: Indicates a window is currently the active window
- *@SPI_STATE_ARMED: Indicates that the object is armed
- *@SPI_STATE_BUSY: Indicates the current object is busy
- *@SPI_STATE_CHECKED: Indicates this object is currently checked
- *@SPI_STATE_COLLAPSED: Indicates this object is collapsed
- *@SPI_STATE_DEFUNCT: Indicates the user interface object corresponding to this object no longer exists
- *@SPI_STATE_EDITABLE: Indicates the user can change the contents of this object
- *@SPI_STATE_ENABLED: Indicates that this object is enabled
- *@SPI_STATE_EXPANDABLE: Indicates this object allows progressive disclosure of its children
- *@SPI_STATE_EXPANDED: Indicates this object its expanded
- *@SPI_STATE_FOCUSABLE: Indicates this object can accept keyboard focus, which means all events resulting from typing on the keyboard will normally be passed to it when it has focus
- *@SPI_STATE_FOCUSED: Indicates this object currently has the keyboard focus
- *@SPI_STATE_HORIZONTAL: Indicates the orientation of thsi object is horizontal
- *@SPI_STATE_ICONIFIED: Indicates this object is minimized and is represented only by an icon
- *@SPI_STATE_MODAL: Indicates something must be done with this object before the user can interact with an object in a different window
- *@SPI_STATE_MULTI_LINE: Indicates this (text) object can contain multiple lines of text
- *@SPI_STATE_MULTISELECTABLE: Indicates this object allows more than one of its children to be selected at the same time
- *@SPI_STATE_OPAQUE: Indicates this object paints every pixel within its rectangular region
- *@SPI_STATE_PRESSED: Indicates this object is currently pressed
- *@SPI_STATE_RESIZABLE: Indicates the size of this object is not fixed
- *@SPI_STATE_SELECTABLE: Indicates this object is the child of an object that allows its children to be selected and that this child is one of those children that can be selected
- *@SPI_STATE_SELECTED: Indicates this object is the child of an object that allows its children to be selected and that this child is one of those children that has been selected
- *@SPI_STATE_SENSITIVE: Indicates this object is sensitive
- *@SPI_STATE_SHOWING: Indicates this object, the object's parent, the object's parent's parent, and so on, are all visible
- *@SPI_STATE_SINGLE_LINE: Indicates this (text) object can contain only a single line of text
- *@SPI_STATE_STALE: Indicates that the index associated with this object has changed since the user accessed the object
- *@SPI_STATE_TRANSIENT: Indicates this object is transient
- *@SPI_STATE_VERTICAL: Indicates the orientation of this object is vertical
- *@SPI_STATE_VISIBLE: Indicates this object is visible
- *@SPI_STATE_MANAGES_DESCENDANTS: Indicates that "active-descendant-changed"
- * event is sent when children become 'active' (i.e. are selected or navigated
- * to onscreen). Used to prevent need to enumerate all children in very large
- * containers, like tables.
- *@SPI_STATE_INDETERMINATE: Indicates that a check box is in a state other than checked or not checked.
- *@SPI_STATE_TRUNCATED: Indicates that an object is truncated, e.g. a text value in a speradsheet cell.
- *@SPI_STATE_REQUIRED: Indicates that explicit user interaction with an object is required by the user interface, e.g. a required field in a "web-form" interface.
- *@SPI_STATE_INVALID_ENTRY: Indicates that the object has encountered an error condition due to failure of input validation. For instance, a form control may acquire this state in response to invalid or malformed user input.
- *@SPI_STATE_SUPPORTS_AUTOCOMPLETION: Indicates that the object may exhibit "typeahead" behavior in response to user keystrokes, e.g. one keystroke may result in the insertion of several characters into an entry, or result in the auto-selection of an item in a list. This state supplants @SPI_ROLE_AUTOCOMPLETE.
- *@SPI_STATE_SELECTABLE_TEXT:Indicates that the object in question supports text selection. It should only be exposed on objects which implement the Text interface, in order to distinguish this state from @SPI_STATE_SELECTABLE, which infers that the object in question is a selectable child of an object which implements Selection. While similar, text selection and subelement selection are distinct operations.
- *@SPI_STATE_IS_DEFAULT: Indicates that the object is the "default" active component, i.e. the object which is activated by an end-user press of the "Enter" or "Return" key. Typically a "close" or "submit" button.
- *@SPI_STATE_VISITED: Indicates that the object (typically a hyperlink) has already been 'activated', and/or its backing data has already been downloaded, rendered, or otherwise "visited".
- *@SPI_STATE_LAST_DEFINED: Not a valid state, used for finding end of enumeration
- *
- *The possibles states of an object.
- **/
-typedef enum
-{
- SPI_STATE_INVALID,
- SPI_STATE_ACTIVE,
- SPI_STATE_ARMED,
- SPI_STATE_BUSY,
- SPI_STATE_CHECKED,
- SPI_STATE_COLLAPSED,
- SPI_STATE_DEFUNCT,
- SPI_STATE_EDITABLE,
- SPI_STATE_ENABLED,
- SPI_STATE_EXPANDABLE,
- SPI_STATE_EXPANDED,
- SPI_STATE_FOCUSABLE,
- SPI_STATE_FOCUSED,
- SPI_STATE_HORIZONTAL,
- SPI_STATE_ICONIFIED,
- SPI_STATE_MODAL,
- SPI_STATE_MULTI_LINE,
- SPI_STATE_MULTISELECTABLE,
- SPI_STATE_OPAQUE,
- SPI_STATE_PRESSED,
- SPI_STATE_RESIZABLE,
- SPI_STATE_SELECTABLE,
- SPI_STATE_SELECTED,
- SPI_STATE_SENSITIVE,
- SPI_STATE_SHOWING,
- SPI_STATE_SINGLE_LINE,
- SPI_STATE_STALE,
- SPI_STATE_TRANSIENT,
- SPI_STATE_VERTICAL,
- SPI_STATE_VISIBLE,
- SPI_STATE_MANAGES_DESCENDANTS,
- SPI_STATE_INDETERMINATE,
- SPI_STATE_TRUNCATED,
- SPI_STATE_REQUIRED,
- SPI_STATE_INVALID_ENTRY,
- SPI_STATE_SUPPORTS_AUTOCOMPLETION,
- SPI_STATE_SELECTABLE_TEXT,
- SPI_STATE_IS_DEFAULT,
- SPI_STATE_VISITED,
- SPI_STATE_LAST_DEFINED
-} AccessibleState;
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/cspi/spi-streamablecontent.c b/cspi/spi-streamablecontent.c
deleted file mode 100644
index 2bb16327..00000000
--- a/cspi/spi-streamablecontent.c
+++ /dev/null
@@ -1,429 +0,0 @@
-/*
- * AT-SPI - Assistive Technology Service Provider Interface
- * (Gnome Accessibility Project; http://developer.gnome.org/projects/gap)
- *
- * Copyright 2001, 2002 Sun Microsystems Inc.,
- * Copyright 2001, 2002 Ximian, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#include <string.h>
-#include <cspi/spi-private.h>
-
-#define CORBA_BLOCK_SIZE 65536 /* see libbonobo, dunno where this is officially dictated */
-
-#if 0 // TODO
-struct StreamCacheItem {
- Accessibility_ContentStream stream;
- gchar *mimetype;
-};
-
-static gboolean
-streams_equal_func (gconstpointer a, gconstpointer b)
-{
- const struct StreamCacheItem *c1 = a, *c2 = b;
- return CORBA_Object_is_equivalent (c1->stream, c2->stream, cspi_ev ());
-}
-
-static void
-stream_cache_item_free (gpointer a)
-{
- struct StreamCacheItem *cache_item = a;
-
- cspi_release_unref (cache_item->stream);
- SPI_freeString (cache_item->mimetype);
- g_free (cache_item);
-}
-
-static GHashTable *streams = NULL;
-
-static GHashTable *
-get_streams (void)
-{
- if (streams == NULL)
- streams = g_hash_table_new_full (g_direct_hash, streams_equal_func,
- NULL, stream_cache_item_free);
- return streams;
-}
-
-static CORBA_long
-accessible_content_stream_client_seek (const Accessibility_ContentStream stream,
- CORBA_long offset,
- Accessibility_ContentStream_SeekType seek_type,
- CORBA_Environment *opt_ev)
-{
- CORBA_Environment *ev, temp_ev;
- CORBA_long ret_offset;
-
- if (!opt_ev) {
- CORBA_exception_init (&temp_ev);
- ev = &temp_ev;
- } else
- ev = opt_ev;
-
- ret_offset = Accessibility_ContentStream_seek (stream, offset, seek_type, ev);
- if (BONOBO_EX (ev))
- ret_offset = -1;
-
- if (!opt_ev)
- CORBA_exception_free (&temp_ev);
-
- return ret_offset;
-}
-
-static guint8*
-accessible_content_stream_client_read (const Accessibility_ContentStream stream,
- const size_t size,
- CORBA_long *length_read,
- CORBA_Environment *ev)
-{
- size_t pos;
- guint8 *mem;
- size_t length;
-
- g_return_val_if_fail (ev != NULL, NULL);
-
- if (length_read)
- *length_read = size;
-
- length = size;
-
- if (length == 0)
- return NULL;
-
- mem = g_try_malloc (length);
- if (!mem) {
- CORBA_exception_set_system (ev, ex_CORBA_NO_MEMORY,
- CORBA_COMPLETED_NO);
- return NULL;
- }
-
- *length_read = 0;
-
- for (pos = 0; pos < length;) {
- Accessibility_ContentStream_iobuf *buf;
- CORBA_long len;
-
- len = (pos + CORBA_BLOCK_SIZE < length) ?
- CORBA_BLOCK_SIZE : length - pos;
-
- Accessibility_ContentStream_read (stream, len, &buf, ev);
-
- if (BONOBO_EX (ev) || !buf)
- goto io_error;
-
- if (buf->_length > 0) {
- memcpy (mem + pos, buf->_buffer, buf->_length);
- pos += buf->_length;
- *length_read += buf->_length;
- /* we assume a short read equals EOF ... is that right? */
- if (buf->_length < len || *length_read == size)
- return mem;
- } else {
- g_warning ("Buffer length %d", buf->_length);
- goto io_error;
- }
- *length_read += buf->_length;
-
- CORBA_free (buf);
- }
-
- return mem;
-
- io_error:
- return NULL;
-}
-#endif // TODO
-
-/* internal use only, declared in cspi-private.h */
-void
-cspi_streams_close_all (void)
-{
-#if 0 // TODO
- if (streams)
- {
- g_hash_table_destroy (streams);
- streams = NULL;
- }
-#else
- g_warning ("Streams not implemented yet");
-#endif // TODO
-}
-
-#if 0 // TODO
-/**
- * AccessibleStreamableContent_ref:
- * @obj: a pointer to the #AccessibleStreamableContent implementor on which to
- * operate.
- *
- * Increment the reference count for an #AccessibleStreamableContent object.
- *
- * @Since: AT-SPI 1.4
- **/
-void
-AccessibleStreamableContent_ref (AccessibleStreamableContent *obj)
-{
- cspi_object_ref (obj);
-}
-
-/**
- * AccessibleStreamableContent_unref:
- * @obj: a pointer to the #AccessibleStreamableContent implementor
- * on which to operate.
- *
- * Decrement the reference count for an #AccessibleStreamableContent object.
- *
- * @Since: AT-SPI 1.4
- **/
-void
-AccessibleStreamableContent_unref (AccessibleStreamableContent *obj)
-{
- cspi_object_unref (obj);
-}
-
-/**
- * AccessibleStreamableContent_getContentTypes:
- * @obj: a pointer to the #AccessibleStreamableContent implementor on which to operate.
- *
- * Get a list of strings containing the content mimetypes available from an
- * #AccessibleStreamableContent implementor.
- *
- * @Since: AT-SPI 1.4
- *
- * Returns: an array of strings, terminated by a NULL string, specifying the
- * mimetypes for which the streamed content is available.
- *
- **/
-
-char **
-AccessibleStreamableContent_getContentTypes (AccessibleStreamableContent *obj)
-{
- Accessibility_StringSeq *mimeseq;
- char **content_types;
- int i;
-
- g_return_val_if_fail (obj != NULL, NULL);
-
- mimeseq = Accessibility_StreamableContent_getContentTypes (CSPI_OBJREF (obj),
- cspi_ev ());
- cspi_return_val_if_ev ("getContentTypes", NULL);
- content_types = g_new0 (char *, mimeseq->_length + 1);
- for (i = 0; i < mimeseq->_length; ++i)
- content_types[i] = g_strdup (mimeseq->_buffer[i]);
- content_types [mimeseq->_length] = NULL;
- CORBA_free (mimeseq);
-
- return content_types;
-}
-/**
-* AccessibleStreamableContent_freeContentTypesList:
-* @obj: the AccessibleStreamableContent implementor on which to operate.
-* @content_types: a list of content types previously returned by
-* #AccessibleStreamableContent_getContentTypes.
-*
-* Free the memory associated with a call to #AccessibleStreamableContent_getContentTypes, once
-* the result has been used.
-*
-* Since: AT-SPI 1.4
-**/
-void
-AccessibleStreamableContent_freeContentTypesList (AccessibleStreamableContent *obj,
- char **content_types)
-{
- if (content_types)
- {
- gint i = 0;
- while (content_types[i])
- {
- g_free (content_types[i]);
- i++;
- }
- g_free (content_types);
- }
-}
-
-/**
- * AccessibleStreamableContent_open:
- * @obj: a pointer to the #AccessibleStreamableContent implementor on which to operate.
- * @content_type: a string specifying the content type to retrieve (should match one
- * of the return strings from #AccessibleStreamableContent_getContentTypes ()).
- *
- * Open a streaming connection to an AccessibleStreamableContent implementor,
- * of a particular content type. Note that a client may only have one
- * open stream per streamable interface instance in the current
- * implementation.
- *
- * @Since: AT-SPI 1.4
- *
- * Returns: #TRUE if successful, #FALSE if unsuccessful.
- *
- **/
-SPIBoolean
-AccessibleStreamableContent_open (AccessibleStreamableContent *obj,
- const char *content_type)
-{
- Accessibility_ContentStream stream;
- struct StreamCacheItem *cache;
- stream = Accessibility_StreamableContent_getStream (CSPI_OBJREF (obj),
- content_type,
- cspi_ev ());
- cspi_return_val_if_ev ("getContent", FALSE);
-
- if (stream != CORBA_OBJECT_NIL) {
- cache = g_new0 (struct StreamCacheItem, 1);
- cache->stream = stream;
- cache->mimetype = CORBA_string_dup (content_type);
-
- g_hash_table_replace (get_streams (), CSPI_OBJREF (obj), cache);
- /* FIXME
- * This limits us to one concurrent stream per streamable interface
- * for a given client.
- * It might be reasonable for a client to open more than one stream
- * to content, in different mime-types, at the same time.
- */
-
- return TRUE;
- }
- return FALSE;
-}
-
-/**
- * AccessibleStreamableContent_close:
- * @obj: a pointer to the #AccessibleStreamableContent implementor on which to operate.
- *
- * Close the current streaming connection to an AccessibleStreamableContent implementor.
- * This must be called before any subsequent AccessibleStreamableContent_open
- * calls on the same object.
- *
- * @Since: AT-SPI 1.4
- *
- * Returns: #TRUE if successful, #FALSE if unsuccessful.
- *
- **/
-SPIBoolean
-AccessibleStreamableContent_close (AccessibleStreamableContent *obj)
-{
- if (CSPI_OBJREF (obj) != CORBA_OBJECT_NIL) {
- if (g_hash_table_remove (get_streams (), CSPI_OBJREF (obj)))
- return TRUE;
- }
- return FALSE;
-}
-
-/**
- * AccessibleStreamableContent_seek:
- * @obj: a pointer to the #AccessibleStreamableContent implementor on which to operate.
- * @offset: a long int specifying the offset into the stream.
- * @seek_type: an enum indicating the seek offset type, may be SEEK_SET,
- * SEEK_CUR, SEEK_END (as in the lseek() libc command).
- *
- * Cause the current streamable content connection (obtained via
- * #AccessibleStreamableContent_open()) to seek to a particular offset in the
- * stream.
- *
- * @Since: AT-SPI 1.4
- *
- * Returns: #TRUE if successful, #FALSE if unsuccessful.
- *
- **/
-long int
-AccessibleStreamableContent_seek (AccessibleStreamableContent *obj,
- long int offset,
- AccessibleStreamableContentSeekType seek_type)
-{
- Accessibility_ContentStream stream;
- long int ret_offset = 0;
- struct StreamCacheItem *cached;
- Accessibility_ContentStream_SeekType content_seek_type;
-
- cached = g_hash_table_lookup (get_streams (), CSPI_OBJREF (obj));
- if (cached)
- {
- stream = cached->stream;
- if (stream != CORBA_OBJECT_NIL)
- {
- switch (seek_type) {
- case SPI_STREAM_SEEK_SET:
- content_seek_type = Accessibility_ContentStream_SEEK_SET;
- break;
- case SPI_STREAM_SEEK_END:
- content_seek_type = Accessibility_ContentStream_SEEK_END;
- break;
- case SPI_STREAM_SEEK_CUR:
- default:
- content_seek_type = Accessibility_ContentStream_SEEK_CURRENT;
- break;
- }
- ret_offset = accessible_content_stream_client_seek (stream, offset,
- content_seek_type, cspi_ev ());
- cspi_return_val_if_ev ("seek", FALSE);
- }
- }
- return ret_offset;
-}
-
-/**
- * AccessibleStreamableContent_read:
- * @obj: a pointer to the #AccessibleStreamableContent implementor on which to operate.
- * @buff: a pointer to a buffer into which the resulting bytes read from the stream
- * are to be written.
- * @nbytes: a long integer indicating the number of bytes to read/write.
- * @read_type: currently unused, specifies behavior of reads for streamed content
- * if blocking is not allowed, etc.
- *
- * Copy (read) bytes from the currently open streamable content connection
- * to a buffer. This is a blocking API, in the sense that it does not
- * return until the bytes have been read, or an error condition is
- * detected.
- *
- * @Since: AT-SPI 1.4
- *
- * Returns: an integer indicating the number of bytes read, or -1 on error.
- *
- **/
-SPIBoolean
-AccessibleStreamableContent_read (AccessibleStreamableContent *obj,
- void *buff,
- long int nbytes,
- unsigned int read_type)
-{
- Accessibility_ContentStream stream;
- struct StreamCacheItem *cached;
- cached = g_hash_table_lookup (get_streams (), CSPI_OBJREF (obj));
- if (cached)
- {
- CORBA_long len_read = 0;
- stream = cached->stream;
- if (stream != CORBA_OBJECT_NIL)
- {
- guint8 *mem;
-
- mem = accessible_content_stream_client_read (stream, (size_t) nbytes, &len_read, cspi_ev ());
- cspi_return_val_if_ev ("read", FALSE);
- if (mem)
- {
- memcpy (buff, mem, len_read);
- g_free (mem);
- if ((nbytes == -1) || (len_read == nbytes))
- return TRUE;
- }
- }
- }
- else g_message ("no matching stream was opened...");
- return FALSE;
-}
-#endif // TODO
diff --git a/cspi/spi-table.c b/cspi/spi-table.c
deleted file mode 100644
index e45408c9..00000000
--- a/cspi/spi-table.c
+++ /dev/null
@@ -1,815 +0,0 @@
-/*
- * AT-SPI - Assistive Technology Service Provider Interface
- * (Gnome Accessibility Project; http://developer.gnome.org/projects/gap)
- *
- * Copyright 2001, 2002 Sun Microsystems Inc.,
- * Copyright 2001, 2002 Ximian, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#include <stdlib.h> /* for malloc */
-#include <cspi/spi-private.h>
-
-/**
- * AccessibleTable_ref:
- * @obj: a pointer to the #AccessibleTable implementor on which to operate.
- *
- * Increment the reference count for an #AccessibleTable object.
- **/
-void
-AccessibleTable_ref (AccessibleTable *obj)
-{
- cspi_object_ref (obj);
-}
-
-/**
- * AccessibleTable_unref:
- * @obj: a pointer to the #AccessibleTable implementor on which to operate.
- *
- * Decrement the reference count for an #AccessibleTable object.
- **/
-void
-AccessibleTable_unref (AccessibleTable *obj)
-{
- cspi_object_unref (obj);
-}
-
-/**
- * AccessibleTable_getCaption:
- * @obj: a pointer to the #AccessibleTable implementor on which to operate.
- *
- * Get an accessible representation of the caption for an #AccessibleTable.
- *
- * Returns: an #Accessible object that serves as the table's caption.
- **/
-Accessible *
-AccessibleTable_getCaption (AccessibleTable *obj)
-{
- char *path;
- Accessible *retval;
-
- cspi_return_val_if_fail (obj != NULL, NULL);
-
- cspi_dbus_get_property (obj, spi_interface_table, "caption", NULL, "o", &path);
- cspi_return_val_if_ev ("getCaption", NULL);
- retval = cspi_ref_related_accessible (obj, path);
- g_free (path);
- return retval;
-}
-
-/**
- * AccessibleTable_getSummary:
- * @obj: a pointer to the #AccessibleTable implementor on which to operate.
- *
- * Get an accessible object which summarizes the contents of an #AccessibleTable.
- *
- * Returns: an #Accessible object that serves as the table's summary (often a
- * reduced #AccessibleTable).
- **/
-Accessible *
-AccessibleTable_getSummary (AccessibleTable *obj)
-{
- char *path;
- Accessible *retval;
-
- cspi_return_val_if_fail (obj != NULL, NULL);
-
- cspi_dbus_get_property (obj, spi_interface_table, "summary", NULL, "o", &path);
- cspi_return_val_if_ev ("getSummary", NULL);
- retval = cspi_ref_related_accessible (obj, path);
- g_free (path);
- return retval;
-}
-
-/**
- * AccessibleTable_getNRows:
- * @obj: a pointer to the #AccessibleTable implementor on which to operate.
- *
- * Get the number of rows in an #AccessibleTable,
- * exclusive of any rows that are programmatically hidden, but inclusive
- * of rows that may be outside of the current scrolling window or viewport.
- *
- * Returns: a #long integer indicating the number of rows in the table.
- **/
-long
-AccessibleTable_getNRows (AccessibleTable *obj)
-{
- dbus_int32_t retval;
-
- cspi_return_val_if_fail (obj != NULL, -1);
-
- cspi_dbus_get_property (obj, spi_interface_table, "nRows", NULL, "i", &retval);
-
- cspi_return_val_if_ev ("getNRows", -1);
-
- return retval;
-
-}
-
-/**
- * AccessibleTable_getNColumns:
- * @obj: a pointer to the #AccessibleTable implementor on which to operate.
- *
- * Get the number of columns in an #AccessibleTable,
- * exclusive of any columns that are programmatically hidden, but inclusive
- * of columns that may be outside of the current scrolling window or viewport.
- *
- * Returns: a #long integer indicating the number of columns in the table.
- **/
-long
-AccessibleTable_getNColumns (AccessibleTable *obj)
-{
- dbus_int32_t retval;
-
- cspi_return_val_if_fail (obj != NULL, -1);
-
- cspi_dbus_get_property (obj, spi_interface_table, "nColumns", NULL, "i", &retval);
-
- cspi_return_val_if_ev ("getNColumns", -1);
-
- return retval;
-}
-
-/**
- * AccessibleTable_getAccessibleAt:
- * @obj: a pointer to the #AccessibleTable implementor on which to operate.
- * @row: the specified table row, zero-indexed.
- * @column: the specified table column, zero-indexed.
- *
- * Get the table cell at the specified row and column indices.
- * To get the accessible object at a particular (x, y) screen coordinate,
- * use #Accessible_getAccessibleAtPoint ().
- *
- * Returns: an #Accessible object representing the specified table cell.
- **/
-Accessible *
-AccessibleTable_getAccessibleAt (AccessibleTable *obj,
- long int row,
- long int column)
-{
- dbus_int32_t d_row = row, d_column = column;
- char *path;
- Accessible *retval;
-
- cspi_return_val_if_fail (obj != NULL, NULL);
-
- cspi_dbus_call (obj, spi_interface_table, "getAccessibleAt", NULL, "ii=>o", &d_row, &d_column, &path);
- cspi_return_val_if_ev ("getAccessibleAt", NULL);
- retval = cspi_ref_related_accessible (obj, path);
- g_free (path);
- return retval;
-}
-
-/**
- * AccessibleTable_getIndexAt:
- * @obj: a pointer to the #AccessibleTable implementor on which to operate.
- * @row: the specified table row, zero-indexed.
- * @column: the specified table column, zero-indexed.
- *
- * Get the 1-D child index corresponding to the specified 2-D row and column indices.
- * To get the accessible object at a particular (x, y) screen coordinate,
- * use #Accessible_getAccessibleAtPoint ().
- * @see #AccessibleTable_getRowAtIndex(), #AccessibleTable_getColumnAtIndex()
- *
- * Returns: a long integer which serves as the index of a specified cell in the
- * table, in a form usable by #Accessible_getChildAtIndex().
- **/
-long
-AccessibleTable_getIndexAt (AccessibleTable *obj,
- long int row,
- long int column)
-{
- dbus_int32_t d_row = row, d_column = column;
- dbus_int32_t retval;
-
- cspi_return_val_if_fail (obj != NULL, -1);
-
- cspi_dbus_call (obj, spi_interface_table, "getIndexAt", NULL, "ii=>i", d_row, d_column, &retval);
-
- cspi_return_val_if_ev ("getIndexAt", -1);
-
- return retval;
-}
-
-/**
- * AccessibleTable_getRowAtIndex:
- * @obj: a pointer to the #AccessibleTable implementor on which to operate.
- * @index: the specified child index, zero-indexed.
- *
- * Get the table row index occupied by the child at a particular 1-D child index.
- *
- * @see #AccessibleTable_getIndexAt(), #AccessibleTable_getColumnAtIndex()
- *
- * Returns: a long integer indicating the first row spanned by the child of a
- * table, at the specified 1-D (zero-offset) @index.
- **/
-long
-AccessibleTable_getRowAtIndex (AccessibleTable *obj,
- long index)
-{
- dbus_int32_t d_index = index;
- dbus_int32_t retval;
-
- cspi_return_val_if_fail (obj != NULL, -1);
-
- cspi_dbus_call (obj, spi_interface_table, "getRowAtIndex", NULL, "i=>i", d_index, &retval);
-
- cspi_return_val_if_ev ("getRowAtIndex", -1);
-
- return retval;
-}
-
-/**
- * AccessibleTable_getColumnAtIndex:
- * @obj: a pointer to the #AccessibleTable implementor on which to operate.
- * @index: the specified child index, zero-indexed.
- *
- * Get the table column index occupied by the child at a particular 1-D child index.
- *
- * @see #AccessibleTable_getIndexAt(), #AccessibleTable_getRowAtIndex()
- *
- * Returns: a long integer indicating the first column spanned by the child of a
- * table, at the specified 1-D (zero-offset) @index.
- **/
-long
-AccessibleTable_getColumnAtIndex (AccessibleTable *obj,
- long index)
-{
- dbus_int32_t d_index = index;
- dbus_int32_t retval;
-
- cspi_return_val_if_fail (obj != NULL, -1);
-
- cspi_dbus_call (obj, spi_interface_table, "getColumnAtIndex", NULL, "i=>i", d_index, &retval);
-
- cspi_return_val_if_ev ("getColumnAtIndex", -1);
-
- return retval;
-}
-
-/**
- * AccessibleTable_getRowDescription:
- * @obj: a pointer to the #AccessibleTable implementor on which to operate.
- * @row: the specified table row, zero-indexed.
- *
- * Get a text description of a particular table row. This differs from
- * AccessibleTable_getRowHeader, which returns an #Accessible.
- *
- * Returns: a UTF-8 string describing the specified table row, if available.
- **/
-char *
-AccessibleTable_getRowDescription (AccessibleTable *obj,
- long int row)
-{
- dbus_int32_t d_row = row;
- char *retval;
-
- cspi_return_val_if_fail (obj != NULL, NULL);
-
- cspi_dbus_call (obj, spi_interface_table, "getRowDescription", NULL, "i=>s", d_row, &retval);
-
- cspi_return_val_if_ev ("getRowDescription", NULL);
-
- return retval;
-}
-
-/**
- * AccessibleTable_getColumnDescription:
- * @obj: a pointer to the #AccessibleTable implementor on which to operate.
- * @column: the specified table column, zero-indexed.
- *
- * Get a text description of a particular table column. This differs from
- * AccessibleTable_getColumnHeader, which returns an #Accessible.
- *
- * Returns: a UTF-8 string describing the specified table column, if available.
- **/
-char *
-AccessibleTable_getColumnDescription (AccessibleTable *obj,
- long int column)
-{
- dbus_int32_t d_column = column;
- char *retval;
-
- cspi_return_val_if_fail (obj != NULL, NULL);
-
- cspi_dbus_call (obj, spi_interface_table, "getColumnDescription", NULL, "i=>s", d_column, &retval);
-
- cspi_return_val_if_ev ("getColumnDescription", NULL);
-
- return retval;
-}
-
-/**
- * AccessibleTable_getRowExtentAt:
- * @obj: a pointer to the #AccessibleTable implementor on which to operate.
- * @row: the specified table row, zero-indexed.
- * @column: the specified table column, zero-indexed.
- *
- * 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).
- *
- * Returns: a long integer indicating the number of rows spanned by the specified cell.
- **/
-long
-AccessibleTable_getRowExtentAt (AccessibleTable *obj,
- long int row,
- long int column)
-{
- dbus_int32_t d_row = row, d_column = column;
- dbus_int32_t retval;
-
- cspi_return_val_if_fail (obj != NULL, -1);
-
- cspi_dbus_call (obj, spi_interface_table, "getRowExtentAt", NULL, "ii=>i", d_row, d_column, &retval);
-
- cspi_return_val_if_ev ("getRowExtentAt", -1);
-
- return retval;
-}
-
-/**
- * AccessibleTable_getColumnExtentAt:
- * @obj: a pointer to the #AccessibleTable implementor on which to operate.
- * @row: the specified table row, zero-indexed.
- * @column: the specified table column, zero-indexed.
- *
- * 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).
- *
- * Returns: a long integer indicating the number of columns spanned by the specified cell.
- **/
-long
-AccessibleTable_getColumnExtentAt (AccessibleTable *obj,
- long int row,
- long int column)
-{
- dbus_int32_t d_row = row, d_column = column;
- dbus_int32_t retval;
-
- cspi_return_val_if_fail (obj != NULL, -1);
-
- cspi_dbus_call (obj, spi_interface_table, "getColumnExtentAt", NULL, "ii=>i", d_row, d_column, &retval);
-
- cspi_return_val_if_ev ("getColumnExtentAt", -1);
-
- return retval;
-}
-
-/**
- * AccessibleTable_getRowHeader:
- * @obj: a pointer to the #AccessibleTable implementor on which to operate.
- * @row: the specified table row, zero-indexed.
- *
- * Get the header associated with a table row, if available. This differs from
- * AccessibleTable_getRowDescription, which returns a string.
- *
- * Returns: a #Accessible representatin of the specified table row, if available.
- **/
-Accessible *
-AccessibleTable_getRowHeader (AccessibleTable *obj,
- long int row)
-{
- dbus_int32_t d_row = row;
- char *path;
- Accessible *retval;
-
- cspi_return_val_if_fail (obj != NULL, NULL);
-
- cspi_dbus_call (obj, spi_interface_table, "getRowHeader", NULL, "i=>o", d_row, &path);
- cspi_return_val_if_ev ("getRowHeader", NULL);
- retval = cspi_ref_related_accessible (obj, path);
- g_free (path);
-
- return retval;
-}
-
-/**
- * AccessibleTable_getColumnHeader:
- * @obj: a pointer to the #AccessibleTable implementor on which to operate.
- * @column: the specified table column, zero-indexed.
- *
- * Get the header associated with a table column, if available. This differs from
- * AccessibleTable_getColumnDescription, which returns a string.
- *
- * Returns: a #Accessible representatin of the specified table column, if available.
- **/
-Accessible *
-AccessibleTable_getColumnHeader (AccessibleTable *obj,
- long int column)
-{
- dbus_int32_t d_column = column;
- char *path;
- Accessible *retval;
-
- cspi_return_val_if_fail (obj != NULL, NULL);
-
- cspi_dbus_call (obj, spi_interface_table, "getColumnHeader", NULL, "i=>o", d_column, &path);
- cspi_return_val_if_ev ("getColumnHeader", NULL);
- retval = cspi_ref_related_accessible (obj, path);
- g_free (path);
-
- return retval;
-}
-
-/**
- * AccessibleTable_getNSelectedRows:
- * @obj: a pointer to the #AccessibleTable implementor on which to operate.
- *
- * Query a table to find out how many rows are currently selected. Not all tables
- * support row selection.
- *
- * Returns: a long integer indicating the number of rows currently selected.
- **/
-long
-AccessibleTable_getNSelectedRows (AccessibleTable *obj)
-{
- dbus_int32_t retval;
-
- cspi_return_val_if_fail (obj != NULL, -1);
-
- cspi_dbus_get_property (obj, spi_interface_table, "nSelectedRows", NULL, "i", &retval);
-
- cspi_return_val_if_ev ("getNSelectedRows", -1);
-
- return retval;
-}
-
-static long
-cspi_long_seq_to_array (GArray *seq, long int **array)
-{
- long *j;
- long length, i;
-
- if (!cspi_check_ev ("getSelectionItems"))
- {
- *array = NULL;
- return 0;
- }
-
- length = seq->len;
-
- j = *array = malloc (sizeof (long) * length);
-
- for (i = 0; i < length; i++)
- {
- j[i] = g_array_index (seq, long, i);
- }
-
- g_array_free (seq, TRUE);
-
- return length;
-}
-
-/**
- * AccessibleTable_getSelectedRows:
- * @obj: a pointer to the #AccessibleTable implementor on which to operate.
- * @selectedRows: a doubly indirected pointer which will be set to the address
- * of an array of long integers, specifying which rows are currently selected.
- *
- * Query a table for a list of indices of rows which are currently selected.
- *
- * Returns: a long integer indicating the length of the array returned in @selectedRows.
- **/
-long
-AccessibleTable_getSelectedRows (AccessibleTable *obj,
- long int **selectedRows)
-{
- GArray *rows;
-
- *selectedRows = NULL;
-
- cspi_return_val_if_fail (obj != NULL, 0);
-
- cspi_dbus_call (obj, spi_interface_table, "getSelectedRows", NULL, "=>ai", &rows);
-
- cspi_return_val_if_ev ("getSelectedRows", -1);
-
- return cspi_long_seq_to_array (rows, selectedRows);
-}
-
-/**
- * AccessibleTable_getNSelectedColumns:
- * @obj: a pointer to the #AccessibleTable implementor on which to operate.
- *
- * Query a table to find out how many columns are currently selected. Not all tables
- * support column selection.
- *
- * Returns: a long integer indicating the number of columns currently selected.
- **/
-long
-AccessibleTable_getNSelectedColumns (AccessibleTable *obj)
-{
- dbus_int32_t retval;
-
- cspi_return_val_if_fail (obj != NULL, -1);
-
- cspi_dbus_get_property (obj, spi_interface_table, "nSelectedColumns", NULL, "i", &retval);
-
- cspi_return_val_if_ev ("getNSelectedColumns", -1);
-
- return retval;
-}
-
-/**
- * AccessibleTable_getSelectedColumns:
- * @obj: a pointer to the #AccessibleTable implementor on which to operate.
- * @selectedColumns: a doubly indirected pointer which will be set to the address
- * of an array of long integers, specifying which columns are currently selected.
- *
- * Query a table for a list of indices of columns which are currently selected.
- * Not all tables support column selection.
- *
- * Returns: a long integer indicating the length of the array returned in @selectedColumns.
- **/
-long
-AccessibleTable_getSelectedColumns (AccessibleTable *obj,
- long int **selectedColumns)
-{
- GArray *columns;
-
- *selectedColumns = NULL;
-
- cspi_return_val_if_fail (obj != NULL, 0);
-
- cspi_dbus_call (obj, spi_interface_table, "getSelectedColumns", NULL, "=>ai", &columns);
-
- cspi_return_val_if_ev ("getSelectedColumns", -1);
- return cspi_long_seq_to_array (columns, selectedColumns);
-}
-
-/**
- * AccessibleTable_isRowSelected:
- * @obj: a pointer to the #AccessibleTable implementor on which to operate.
- * @row: the zero-indexed row number of the row being queried.
- *
- * Determine whether a table row is selected. Not all tables support row selection.
- *
- * Returns: #TRUE if the specified row is currently selected, #FALSE if not.
- **/
-SPIBoolean
-AccessibleTable_isRowSelected (AccessibleTable *obj,
- long int row)
-{
- dbus_int32_t d_row = row;
- dbus_bool_t retval;
-
- cspi_return_val_if_fail (obj != NULL, FALSE);
-
- cspi_dbus_call (obj, spi_interface_table, "isRowSelected", NULL, "i=>b", d_row, &retval);
-
- cspi_return_val_if_ev ("isRowSelected", FALSE);
-
- return retval;
-}
-
-/**
- * AccessibleTable_isColumnSelected:
- * @obj: a pointer to the #AccessibleTable implementor on which to operate.
- * @column: the zero-indexed column number of the column being queried.
- *
- * Determine whether specified table column is selected.
- * Not all tables support column selection.
- *
- * Returns: #TRUE if the specified column is currently selected, #FALSE if not.
- **/
-SPIBoolean
-AccessibleTable_isColumnSelected (AccessibleTable *obj,
- long int column)
-{
- dbus_int32_t d_column = column;
- dbus_bool_t retval;
-
- cspi_return_val_if_fail (obj != NULL, FALSE);
-
- cspi_dbus_call (obj, spi_interface_table, "isColumnSelected", NULL, "i=>b", d_column, &retval);
-
- cspi_return_val_if_ev ("isColumnSelected", FALSE);
-
- return retval;
-}
-
-/**
- * AccessibleTable_addRowSelection:
- * @obj: a pointer to the #AccessibleTable implementor on which to operate.
- * @row: the zero-indexed row number of the row being selected.
- *
- * Select the specified row, adding it to the current row selection.
- * Not all tables support row selection.
- *
- * Returns: #TRUE if the specified row was successfully selected, #FALSE if not.
- **/
-SPIBoolean
-AccessibleTable_addRowSelection (AccessibleTable *obj,
- long int row)
-{
- dbus_int32_t d_row = row;
- dbus_bool_t retval;
-
- cspi_return_val_if_fail (obj != NULL, FALSE);
-
- cspi_dbus_call (obj, spi_interface_table, "addRowSelection", NULL, "i=>b", d_row, &retval);
-
- cspi_return_val_if_ev ("addRowSelection", FALSE);
-
- return retval;
-}
-
-/**
- * AccessibleTable_addColumnSelection:
- * @obj: a pointer to the #AccessibleTable implementor on which to operate.
- * @column: the zero-indexed column number of the column being selected.
- *
- * Select the specified column, adding it to the current column selection.
- * Not all tables support column selection.
- *
- * Returns: #TRUE if the specified column was successfully selected, #FALSE if not.
- **/
-SPIBoolean
-AccessibleTable_addColumnSelection (AccessibleTable *obj,
- long int column)
-{
- dbus_int32_t d_column = column;
- dbus_bool_t retval;
-
- cspi_return_val_if_fail (obj != NULL, FALSE);
-
- cspi_dbus_call (obj, spi_interface_table, "addColumnSelection", NULL, "i=>b", d_column, &retval);
-
- cspi_return_val_if_ev ("addColumnSelection", FALSE);
-
- return retval;
-}
-
-/**
- * AccessibleTable_removeRowSelection:
- * @obj: a pointer to the #AccessibleTable implementor on which to operate.
- * @row: the zero-indexed number of the row being deselected.
- *
- * De-select the specified row, removing it to the current row selection.
- * Not all tables support row selection.
- *
- * Returns: #TRUE if the specified row was successfully de-selected, #FALSE if not.
- **/
-SPIBoolean
-AccessibleTable_removeRowSelection (AccessibleTable *obj,
- long int row)
-{
- dbus_int32_t d_row = row;
- dbus_bool_t retval;
-
- cspi_return_val_if_fail (obj != NULL, FALSE);
-
- cspi_dbus_call (obj, spi_interface_table, "removeRowSelection", NULL, "i=>b", d_row, &retval);
-
- cspi_return_val_if_ev ("removeRowSelection", FALSE);
-
- return retval;
-}
-
-/**
- * AccessibleTable_removeColumnSelection:
- * @obj: a pointer to the #AccessibleTable implementor on which to operate.
- * @column: the zero-indexed column number of the column being de-selected.
- *
- * De-select the specified column, removing it to the current column selection.
- * Not all tables support column selection.
- *
- * Returns: #TRUE if the specified column was successfully de-selected, #FALSE if not.
- **/
-SPIBoolean
-AccessibleTable_removeColumnSelection (AccessibleTable *obj,
- long int column)
-{
- dbus_int32_t d_column = column;
- dbus_bool_t retval;
-
- cspi_return_val_if_fail (obj != NULL, FALSE);
-
- cspi_dbus_call (obj, spi_interface_table, "removeColumnSelection", NULL, "i=>b", d_column, &retval);
-
- cspi_return_val_if_ev ("removeColumnSelection", FALSE);
-
- return retval;
-}
-
-/**
- * AccessibleTable_getRowColumnExtentsAtIndex:
- * @obj: a pointer to the #AccessibleTable implementor on which to operate.
- * @index: the index of the Table child whose row/column
- * extents are requested.
- * @row: back-filled with the first table row associated with
- * the cell with child index \c index.
- * @col: back-filled with the first table column associated
- * with the cell with child index \c index.
- * @row_extents: back-filled with the number of table rows
- * across which child \c i extends.
- * @col_extents: back-filled with the number of table columns
- * across which child \c i extends.
- * @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.
- *
- * 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.
- *
- * 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
- *
- * retval = table::getRowColumnExtentsAtIndex (6, row, col,
- * row_extents,
- * col_extents,
- * is_selected);
- *
- * will return True, and after the call
- * row, col, row_extents, col_extents,
- * and \c is_selected will contain 2, 5, 1, 2, and
- * True, respectively.
- *
- * Returns: \c True if the index is associated with a valid table
- * cell, \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
- **/
-SPIBoolean
-AccessibleTable_getRowColumnExtentsAtIndex (AccessibleTable *obj,
- long int index, long int *row, long int *col,
- long int *row_extents, long int *col_extents,
- long int *is_selected)
-{
- dbus_int32_t d_index = index;
- dbus_bool_t retval;
- dbus_int32_t d_row, d_col, d_row_extents, d_col_extents;
- dbus_bool_t d_is_selected;
-
- cspi_return_val_if_fail (obj != NULL, FALSE);
-
- cspi_dbus_call (obj, spi_interface_table, "getRowColumnExtentsAtIndex", NULL, "i=>iiiibb", d_index, &d_row, &d_col, &d_row_extents, &d_col_extents, &d_is_selected, &retval);
-
- if (!cspi_check_ev ("getRowColumnExtentsAtIndex")){
-
- *row = 0;
- *col = 0;
- *row_extents = 0;
- *col_extents = 0;
- *is_selected = FALSE;
- retval = FALSE;
- }
-
- else {
- *row = d_row;
- *col = d_col;
- *row_extents = d_row_extents;;
- *col_extents = d_col_extents;
- *is_selected = d_is_selected;;
- }
-
- return retval;
-}
-
-
-/**
- * AccessibleTable_isSelected:
- * @obj: a pointer to the #AccessibleTable implementor on which to operate.
- * @row: the zero-indexed row of the cell being queried.
- * @column: the zero-indexed column of the cell being queried.
- *
- * Determine whether the cell at a specific row and column is selected.
- *
- * Returns: #TRUE if the specified cell is currently selected, #FALSE if not.
- **/
-SPIBoolean
-AccessibleTable_isSelected (AccessibleTable *obj,
- long int row,
- long int column)
-{
- dbus_int32_t d_row = row, d_column = column;
- dbus_bool_t retval;
-
- cspi_return_val_if_fail (obj != NULL, FALSE);
-
- cspi_dbus_call (obj, spi_interface_table, "isSelected", NULL, "ii=>b", d_row, d_column, &retval);
-
- cspi_return_val_if_ev ("isSelected", FALSE);
-
- return retval;
-}
-
diff --git a/cspi/spi-text.c b/cspi/spi-text.c
deleted file mode 100644
index 6c5786dd..00000000
--- a/cspi/spi-text.c
+++ /dev/null
@@ -1,967 +0,0 @@
-/*
- * AT-SPI - Assistive Technology Service Provider Interface
- * (Gnome Accessibility Project; http://developer.gnome.org/projects/gap)
- *
- * Copyright 2001, 2002 Sun Microsystems Inc.,
- * Copyright 2001, 2002 Ximian, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#include <cspi/spi-private.h>
-
-static Accessibility_TEXT_BOUNDARY_TYPE
-get_accessible_text_boundary_type (AccessibleTextBoundaryType type)
-{
- switch (type)
- {
- case SPI_TEXT_BOUNDARY_CHAR:
- return Accessibility_TEXT_BOUNDARY_CHAR;
- break;
- case SPI_TEXT_BOUNDARY_CURSOR_POS:
- /* FixME */
- return Accessibility_TEXT_BOUNDARY_CHAR;
- break;
- case SPI_TEXT_BOUNDARY_WORD_START:
- return Accessibility_TEXT_BOUNDARY_WORD_START;
- break;
- case SPI_TEXT_BOUNDARY_WORD_END:
- return Accessibility_TEXT_BOUNDARY_WORD_END;
- break;
- case SPI_TEXT_BOUNDARY_SENTENCE_START:
- return Accessibility_TEXT_BOUNDARY_SENTENCE_START;
- break;
- case SPI_TEXT_BOUNDARY_SENTENCE_END:
- return Accessibility_TEXT_BOUNDARY_SENTENCE_END;
- break;
- case SPI_TEXT_BOUNDARY_LINE_START:
- return Accessibility_TEXT_BOUNDARY_LINE_START;
- break;
- case SPI_TEXT_BOUNDARY_LINE_END:
- return Accessibility_TEXT_BOUNDARY_LINE_END;
- break;
- case SPI_TEXT_BOUNDARY_ATTRIBUTE_RANGE:
- /* Fixme */
- return Accessibility_TEXT_BOUNDARY_CHAR;
- break;
- default:
- /* FIXME */
- return Accessibility_TEXT_BOUNDARY_CHAR;
- }
-}
-
-static Accessibility_TEXT_CLIP_TYPE
-get_accessible_text_clip_type (AccessibleTextClipType type)
-{
- switch (type)
- {
- case SPI_TEXT_CLIP_NONE:
- return Accessibility_TEXT_CLIP_NONE;
- break;
- case SPI_TEXT_CLIP_MIN:
- return Accessibility_TEXT_CLIP_MIN;
- break;
- case SPI_TEXT_CLIP_MAX:
- return Accessibility_TEXT_CLIP_MAX;
- break;
- default:
- return Accessibility_TEXT_CLIP_BOTH;
- }
-}
-
-typedef struct
-{
- dbus_int32_t startOffset;
- dbus_int32_t endOffset;
- char *content;
-} Accessibility_Range;
-
-static AccessibleTextRange **
-get_accessible_text_ranges_from_range_seq (GArray *range_seq)
-{
- AccessibleTextRange **ranges = NULL;
- AccessibleTextRange *array = NULL;
- int i;
- if (range_seq && range_seq->len > 0)
- {
- ranges = g_new0 (AccessibleTextRange *, range_seq->len + 1);
- }
- array = g_new0 (AccessibleTextRange, range_seq->len);
- for (i = 0; i < range_seq->len; i++)
- {
- Accessibility_Range *r = g_array_index (range_seq, Accessibility_Range *, i);
- AccessibleTextRange *range;
- range = &array[i];
- range->start = r->startOffset;
- range->end = r->endOffset;
- range->contents = g_strdup (r->content);
- ranges[i] = range;
- }
- ranges[i] = NULL; /* null-terminated list! */
- // TODO: Figure out whether we're leaking strings
- g_array_free (range_seq, TRUE);
-
- return ranges;
-}
-
-
-/**
- * AccessibleText_ref:
- * @obj: a pointer to the #AccessibleText object on which to operate.
- *
- * Increment the reference count for an #AccessibleText object.
- **/
-void
-AccessibleText_ref (AccessibleText *obj)
-{
- cspi_object_ref (obj);
-}
-
-/**
- * AccessibleText_unref:
- * @obj: a pointer to the #Accessible object on which to operate.
- *
- * Decrement the reference count for an #AccessibleText object.
- **/
-void
-AccessibleText_unref (AccessibleText *obj)
-{
- cspi_object_unref (obj);
-}
-
-/**
- * AccessibleText_getCharacterCount:
- * @obj: a pointer to the #AccessibleText object to query.
- *
- * Get the character count of an #AccessibleText object.
- *
- * Returns: a long integer indicating the total number of
- * characters in the #AccessibleText object.
- **/
-long
-AccessibleText_getCharacterCount (AccessibleText *obj)
-{
- dbus_int32_t retval;
-
- cspi_return_val_if_fail (obj != NULL, -1);
-
- cspi_dbus_get_property (obj, spi_interface_text, "characterCount", NULL, "i", &retval);
-
- cspi_return_val_if_ev ("getCharacterCount", -1);
-
- return retval;
-}
-
-/**
- * AccessibleText_getText:
- * @obj: a pointer to the #AccessibleText object to query.
- * @startOffset: a #long indicating the start of the desired text range.
- * @endOffset: a #long indicating the first character past the desired range.
- *
- * Get a range of text from an #AccessibleText object. The number of bytes
- * in the returned string may exceed endOffset-startOffset, since
- * UTF-8 is a variable-width encoding.
- *
- * Returns: a text string containing characters from @startOffset
- * to @endOffset-1, inclusive, encoded as UTF-8.
- **/
-char *
-AccessibleText_getText (AccessibleText *obj,
- long int startOffset,
- long int endOffset)
-{
- char *retval;
- dbus_int32_t d_startOffset = startOffset, d_endOffset = endOffset;
-
- cspi_return_val_if_fail (obj != NULL, NULL);
-
- cspi_dbus_call (obj, spi_interface_text, "getText", NULL, "ii=>s", startOffset, endOffset, &retval);
-
- cspi_return_val_if_ev ("getText", NULL);
-
- return retval;
-}
-
-/**
- * AccessibleText_getCaretOffset:
- * @obj: a pointer to the #AccessibleText object to query.
- *
- * Get the current offset of the text caret in an #AccessibleText object.
- *
- * Returns: a long integer indicating the current position of the text caret.
- **/
-long
-AccessibleText_getCaretOffset (AccessibleText *obj)
-{
- dbus_int32_t retval;
-
- cspi_return_val_if_fail (obj != NULL, -1);
-
- cspi_dbus_get_property (obj, spi_interface_text, "caretOffset", NULL, "i", &retval);
-
- cspi_return_val_if_ev ("getCaretOffset", -1);
-
- return retval;
-}
-
-/**
- * AccessibleText_getAttributes:
- * @obj: a pointer to the #AccessibleText object to query.
- * @offset: a long integer indicating the offset from which the attribute
- * search is based.
- * @startOffset: a #long indicating the start of the desired text range.
- * @endOffset: a #long indicating the first character past the desired range.
- *
- * Get the attributes applied to a range of text from an #AccessibleText
- * object, and the bounds of the range.
- * The text attributes correspond to CSS attributes where possible,
- * keys and values are delimited from one another via ":", and
- * the delimiter between key/value pairs is ";". Thus
- * "font-size:10;foreground-color:0,0,0" would be a valid
- * return string.
- *
- * Returns: a text string describing the attributes occurring within the
- * attribute run containing @offset, encoded as UTF-8.
- **/
-char *
-AccessibleText_getAttributes (AccessibleText *obj,
- long int offset,
- long int *startOffset,
- long int *endOffset)
-{
- dbus_int32_t d_offset = offset;
- dbus_int32_t retStartOffset, retEndOffset;
- char *retval;
-
- if (obj == NULL)
- {
- *startOffset = *endOffset = -1;
- return NULL;
- }
-
- cspi_dbus_call (obj, spi_interface_text, "getAttributes", NULL, "i=>sii", d_offset, &retval, &retStartOffset, &retEndOffset);
-
- if (!cspi_check_ev ("getAttributes"))
- {
- *startOffset = *endOffset = -1;
- retval = NULL;
- }
- else
- {
- *startOffset = retStartOffset;
- *endOffset = retEndOffset;
- }
-
- return retval;
-}
-
-/**
- * AccessibleText_getDefaultAttributes:
- * @obj: a pointer to the #AccessibleText object to query.
- *
- * Get the default attributes applied to an #AccessibleText
- * object.
- * The text attributes correspond to CSS attributes where possible,
- * keys and values are delimited from one another via ":", and
- * the delimiter between key/value pairs is ";". Thus
- * "font-size:10;foreground-color:0,0,0" would be a valid
- * return string. The combination of this attribute set and
- * the attributes reported by #AccessibleText_getAttributes
- * describes the entire set of text attributes over a range.
- *
- * @Since: AT-SPI 1.4
- *
- * Returns: a text string describing the default attributes
- * applied to a text object, (exclusive of explicitly-set
- * attributes), encoded as UTF-8.
- **/
-char *
-AccessibleText_getDefaultAttributes (AccessibleText *obj)
-{
- char *retval;
-
- if (obj == NULL)
- {
- return NULL;
- }
-
- cspi_dbus_call (obj, spi_interface_text, "getAttributes", NULL, "=>s", &retval);
-
- if (!cspi_check_ev ("getAttributes"))
- {
- retval = NULL;
- }
-
- return retval;
-}
-
-/**
- * AccessibleText_setCaretOffset:
- * @obj: a pointer to the #AccessibleText object on which to operate.
- * @newOffset: the offset to which the text caret is to be moved.
- *
- * Set the text caret position for an #AccessibleText object.
- *
- * Returns: #TRUE if successful, #FALSE otherwise.
- **/
-SPIBoolean
-AccessibleText_setCaretOffset (AccessibleText *obj,
- long int newOffset)
-{
- dbus_int32_t d_newOffset = newOffset;
- dbus_bool_t retval;
-
- cspi_return_val_if_fail (obj != NULL, FALSE);
-
- cspi_dbus_call (obj, spi_interface_text, "setCaretOffset", NULL, "i=>b", d_newOffset, &retval);
-
- cspi_return_val_if_ev ("setCaretOffset", FALSE);
-
- return retval;
-}
-
-/**
- * AccessibleText_getTextBeforeOffset:
- * @obj: a pointer to the #AccessibleText object on which to operate.
- * @offset: a long integer indicating the offset from which the delimiter
- * search is based.
- * @type: an #AccessibleTextBoundaryType indicating whether the desired
- * text string is a word, sentence, line, or attribute run.
- * @startOffset: a pointer to a long integer which is assigned the
- * starting offset of the returned string, relative to the
- * original #AccessibleText.
- * @endOffset: a pointer to a long integer which is assigned the
- * ending offset of the returned string, relative to the original
- * #AccessibleText.
- *
- * Get delimited text from an #AccessibleText object which precedes a given
- * text offset.
- *
- * Returns: a UTF-8 string representing the delimited text, both of whose
- * delimiting boundaries are before the current offset, or
- * an empty string if no such text exists.
- **/
-char *
-AccessibleText_getTextBeforeOffset (AccessibleText *obj,
- long int offset,
- AccessibleTextBoundaryType type,
- long int *startOffset,
- long int *endOffset)
-{
- dbus_int32_t d_offset = offset;
- dbus_uint32_t d_type = type;
- dbus_int32_t retStartOffset, retEndOffset;
- char *retval;
-
- if (obj == NULL)
- {
- *startOffset = *endOffset = -1;
- return NULL;
- }
-
- cspi_dbus_call (obj, spi_interface_text, "getTextBeforeOffset", NULL, "iu=>sii", d_offset, d_type, &retval, &retStartOffset, &retEndOffset);
- if (!cspi_check_ev ("getTextBeforeOffset"))
- {
- *startOffset = *endOffset = -1;
- retval = NULL;
- }
- else
- {
- *startOffset = retStartOffset;
- *endOffset = retEndOffset;
- }
- return retval;
-}
-
-/**
- * AccessibleText_getTextAtOffset:
- * @obj: a pointer to the #AccessibleText object on which to operate.
- * @offset: a long integer indicating the offset from which the delimiter
- * search is based.
- * @type: an #AccessibleTextBoundaryType indicating whether the desired
- * text string is a word, sentence, line, or attribute run.
- * @startOffset: a pointer to a long integer which is assigned the
- * starting offset of the returned string, relative to the
- * original #AccessibleText.
- * @endOffset: a pointer to a long integer which is assigned the
- * ending offset of the returned string, relative to the original
- * #AccessibleText.
- *
- * Get delimited text from an #AccessibleText object which includes a given
- * text offset.
- *
- * Returns: a UTF-8 string representing the delimited text, whose
- * delimiting boundaries bracket the current offset, or
- * an empty string if no such text exists.
- **/
-char *
-AccessibleText_getTextAtOffset (AccessibleText *obj,
- long int offset,
- AccessibleTextBoundaryType type,
- long int *startOffset, long int *endOffset)
-{
- dbus_int32_t d_offset = offset;
- dbus_uint32_t d_type = type;
- dbus_int32_t retStartOffset, retEndOffset;
- char *retval;
-
- if (obj == NULL)
- {
- *startOffset = *endOffset = -1;
- return NULL;
- }
-
- cspi_dbus_call (obj, spi_interface_text, "getTextAtOffset", NULL, "iu=>sii", d_offset, d_type, &retval, &retStartOffset, &retEndOffset);
-
- if (!cspi_check_ev ("getTextAtOffset"))
- {
- *startOffset = *endOffset = -1;
- retval = NULL;
- }
- else
- {
- *startOffset = retStartOffset;
- *endOffset = retEndOffset;
- }
- return retval;
-}
-
-/**
- * AccessibleText_getTextAfterOffset:
- * @obj: a pointer to the #AccessibleText object on which to operate.
- * @offset: a long integer indicating the offset from which the delimiter
- * search is based.
- * @type: an #AccessibleTextBoundaryType indicating whether the desired
- * text string is a word, sentence, line, or attribute run.
- * @startOffset: a pointer to a long integer which is assigned the
- * starting offset of the returned string, relative to the
- * original #AccessibleText.
- * @endOffset: a pointer to a long integer which is assigned the
- * ending offset of the returned string, relative to the original
- * #AccessibleText.
- *
- * Get delimited text from an #AccessibleText object which follows a given
- * text offset.
- *
- * Returns: a UTF-8 string representing the delimited text, both of whose
- * delimiting boundaries are after or inclusive of the current
- * offset, or an empty string if no such text exists.
- **/
-char *
-AccessibleText_getTextAfterOffset (AccessibleText *obj,
- long int offset,
- AccessibleTextBoundaryType type,
- long int *startOffset, long int *endOffset)
-{
- dbus_int32_t d_offset = offset;
- dbus_uint32_t d_type = type;
- dbus_int32_t retStartOffset, retEndOffset;
- char *retval;
-
- if (obj == NULL)
- {
- *startOffset = *endOffset = -1;
- return NULL;
- }
-
- cspi_dbus_call (obj, spi_interface_text, "getTextAfterOffset", NULL, "iu=>sii", d_offset, d_type, &retval, &retStartOffset, &retEndOffset);
-
- if (!cspi_check_ev ("getTextAfterOffset"))
- {
- *startOffset = *endOffset = -1;
- retval = NULL;
- }
- else
- {
- *startOffset = retStartOffset;
- *endOffset = retEndOffset;
- }
- return retval;
-}
-
-/**
- * AccessibleText_getCharacterAtOffset:
- * @obj: a pointer to the #AccessibleText object on which to operate.
- * @offset: a long integer indicating the text offset where the desired
- * character is located.
- *
- * Get the character at a given offset for an #AccessibleText object.
- *
- * Returns: an #unsigned long integer which represents the
- * UCS-4 unicode code point of the given character, or
- * 0xFFFFFFFF if the character in question cannot be represented
- * in the UCS-4 encoding.
- **/
-unsigned long
-AccessibleText_getCharacterAtOffset (AccessibleText *obj,
- long int offset)
-{
- dbus_int32_t d_offset = offset;
- dbus_int32_t retval;
-
- cspi_return_val_if_fail (obj != NULL, -1);
-
- cspi_dbus_call (obj, spi_interface_text, "getCharacterAtOffset", NULL, "i=>i", d_offset, &retval);
-
- cspi_return_val_if_ev ("getCharacterAtOffset", -1);
-
- return retval;
-}
-
-/**
- * AccessibleText_getCharacterExtents:
- * @obj: a pointer to the #AccessibleText object on which to operate.
- * @offset: an integer indicating the offset of the text character for
- * whom boundary information is requested.
- * @x: a pointer to a long integer into which the nominal x coordinate
- * of the corresponding glyph will be returned.
- * @y:a pointer to a long integer into which the nominal y coordinate
- * of the corresponding glyph will be returned.
- * @width:a pointer to a long integer into which the width
- * of the corresponding glyph will be returned.
- * @height: a pointer to a long integer into which the height
- * of the corresponding glyph will be returned.
- * @type: an #AccessibleCoordType indicating the coordinate system to use
- * for the returned values.
- *
- * Get the bounding box containing the glyph representing
- * the character at a particular text offset.
- **/
-void
-AccessibleText_getCharacterExtents (AccessibleText *obj,
- long int offset,
- long int *x,
- long int *y,
- long int *width,
- long int *height,
- AccessibleCoordType type)
-{
- dbus_int32_t d_offset = offset;
- dbus_uint16_t d_type = type;
- dbus_int32_t retX, retY, retWidth, retHeight;
-
- if (obj == NULL)
- {
- *x = *y = -1;
- *width = *height = -1;
- return;
- }
-
- cspi_dbus_call (obj, spi_interface_text, "getCharacterExtents", NULL, "in=>iiii", d_offset, d_type, &retX, &retY, &retWidth, &retHeight);
-
- if (!cspi_check_ev ("getCharacterExtents"))
- {
- *x = *y = -1;
- *width = *height = -1;
- }
- else
- {
- *x = retX;
- *y = retY;
- *width = retWidth;
- *height = retHeight;
- }
-}
-
-/**
- * AccessibleText_getOffsetAtPoint:
- * @obj: a pointer to the #AccessibleText object on which to operate.
- * @x: the x coordinate of the point to be queried.
- * @y: the y coordinate of the point to be queried.
- * @type: an #AccessibleCoordType indicating the coordinate system in which
- * the values should be returned.
- *
- * Get the bounding box for a glyph at a certain #AccessibleText offset.
- *
- * Returns: the offset (as a long integer) at the point (@x, @y)
- * in the specified coordinate system.
- *
- **/
-long
-AccessibleText_getOffsetAtPoint (AccessibleText *obj,
- long int x,
- long int y,
- AccessibleCoordType type)
-{
- dbus_int32_t d_x = x, d_y = y;
- dbus_uint16_t d_type = type;
- dbus_int32_t retval;
-
- cspi_return_val_if_fail (obj != NULL, -1);
-
- cspi_dbus_call (obj, spi_interface_text, "getOffsetAtPoint", NULL, "iin=>i", d_x, d_y, d_type, &retval);
-
- cspi_return_val_if_ev ("getOffsetAtPoint", -1);
-
- return retval;
-}
-
-/**
- * AccessibleText_getRangeExtents:
- * @obj: a pointer to the #AccessibleText object on which to operate.
- * @startOffset: an integer indicating the offset of the first text character for
- * whom boundary information is requested.
- * @endOffset: an integer indicating the offset of the text character
- * after the last character for whom boundary information is requested.
- * @x: a pointer to a long integer into which the nominal x coordinate
- * of the corresponding bounding box will be returned.
- * @y:a pointer to a long integer into which the nominal y coordinate
- * of the corresponding bounding box will be returned.
- * @width:a pointer to a long integer into which the width
- * of the corresponding bounding box will be returned.
- * @height: a pointer to a long integer into which the height
- * of the corresponding bounding box will be returned.
- * @type: an #AccessibleCoordType indicating the coordinate system to use
- * for the returned values.
- *
- * Get the bounding box for text within a range in an #AccessibleText object.
- *
- * @Since: AT-SPI 1.2
- **/
-void
-AccessibleText_getRangeExtents (AccessibleText *obj,
- long int startOffset,
- long int endOffset,
- long int *x,
- long int *y,
- long int *width,
- long int *height,
- AccessibleCoordType type)
-{
- dbus_int32_t d_startOffset = startOffset, d_endOffset = endOffset;
- dbus_int16_t d_type = type;
- dbus_int32_t retX, retY, retWidth, retHeight;
-
- if (obj == NULL)
- {
- *x = *y = -1;
- *width = *height = -1;
- return;
- }
-
- cspi_dbus_call (obj, spi_interface_text, "getRangeExtents", NULL, "iin=>iiii", d_startOffset, d_endOffset, d_type, &retX, &retY, &retWidth, &retHeight);
-
- if (!cspi_check_ev ("getRangeExtents"))
- {
- *x = *y = -1;
- *width = *height = -1;
- }
- else
- {
- *x = retX;
- *y = retY;
- *width = retWidth;
- *height = retHeight;
- }
-}
-
-/**
- * AccessibleText_getBoundedRanges:
- * @obj: a pointer to the #AccessibleText object on which to operate.
- * @x: the 'starting' x coordinate of the bounding box.
- * @y: the 'starting' y coordinate of the bounding box.
- * @width: the x extent of the bounding box.
- * @height: the y extent of the bounding box.
- * @type: an #AccessibleCoordType indicating the coordinate system to use
- * for the returned values.
- * @clipTypeX: an #AccessibleTextClipType indicating how to treat characters that
- * intersect the bounding box's x extents.
- * @clipTypeY: an #AccessibleTextClipType indicating how to treat characters that
- * intersect the bounding box's y extents.
- *
- * Get the ranges of text from an #AccessibleText object which lie within the
- * bounds defined by (@x, @y) and (@x+@width, @y+@height).
- *
- * @Since: AT-SPI 1.2
- *
- * Returns: a null-terminated list of pointers to AccessibleTextRange structs
- * detailing the bounded text.
- **/
-AccessibleTextRange **
-AccessibleText_getBoundedRanges (AccessibleText *obj,
- long int x,
- long int y,
- long int width,
- long int height,
- AccessibleCoordType type,
- AccessibleTextClipType clipTypeX,
- AccessibleTextClipType clipTypeY)
-{
- dbus_int32_t d_x = x, d_y = y, d_width = width, d_height = height;
- dbus_uint16_t d_type = type;
- dbus_uint32_t d_clipTypeX = clipTypeX, d_clipTypeY = clipTypeY;
- GArray *range_seq;
-
- cspi_return_val_if_fail (obj != NULL, NULL);
-
- cspi_dbus_call (obj, spi_interface_text, "getBoundedRanges", NULL, "iiiinuu=>a(iisv)", d_x, d_y, d_width, d_height, d_type, d_clipTypeX, d_clipTypeY, &range_seq);
-
- cspi_return_val_if_ev ("getBoundedRanges", NULL);
-
- return get_accessible_text_ranges_from_range_seq (range_seq);
-}
-
-/**
- * AccessibleTextRange_freeRanges:
- * @ranges: a pointer to an array of AccessibleTextRange structs.
- *
- * Free the memory used by a list of AccessibleTextRange structs.
- * The argument passed in should be an array of pointers
- * AccessibleTextRange structs.
- *
- * @Since: AT-SPI 1.2
- **/
-void
-AccessibleTextRange_freeRanges (AccessibleTextRange **ranges)
-{
- /* this was a contiguously allocated block, only free the first element */
- g_free (ranges[0]);
- g_free (ranges);
-}
-
-/**
- * AccessibleText_getNSelections:
- * @obj: a pointer to the #AccessibleText object on which to operate.
- *
- * Get the number of active non-contiguous selections for an
- * #AccessibleText object.
- *
- * Returns: a long integer indicating the current
- * number of non-contiguous text selections active
- * within an #AccessibleText object.
- **/
-long
-AccessibleText_getNSelections (AccessibleText *obj)
-{
- dbus_int32_t retval;
-
- cspi_return_val_if_fail (obj != NULL, -1);
-
- cspi_dbus_call (obj, spi_interface_text, "getNSelections", NULL, "i", &retval);
-
- cspi_return_val_if_ev ("getNSelections", -1);
-
- return retval;
-}
-
-/**
- * AccessibleText_getSelection:
- * @obj: a pointer to the #AccessibleText object on which to operate.
- * @selectionNum: an integer indicating which selection to query.
- * @startOffset: a pointer to a long integer into which the start offset
- * of the selection will be returned.
- * @endOffset: a pointer to a long integer into which the start offset
- * of the selection will be returned.
- *
- * Get the bounds of the @selectionNum-th active text selection for an
- * #AccessibleText object.
- **/
-void
-AccessibleText_getSelection (AccessibleText *obj,
- long int selectionNum,
- long int *startOffset,
- long int *endOffset)
-{
- dbus_int32_t d_selectionNum = selectionNum;
- dbus_int32_t retStartOffset, retEndOffset;
-
- if (obj == NULL)
- {
- *endOffset = *startOffset = -1;
- return;
- }
-
- cspi_dbus_call (obj, spi_interface_text, "getSelection", NULL, "i=>ii", d_selectionNum, &retStartOffset, &retEndOffset);
-
- if (!cspi_check_ev ("getSelection"))
- {
- *startOffset = *endOffset = -1;
- }
- else
- {
- *startOffset = retStartOffset;
- *endOffset = retEndOffset;
- }
-}
-
-/**
- * AccessibleText_addSelection:
- * @obj: a pointer to the #AccessibleText object on which to operate.
- * @startOffset: the starting offset of the desired new selection.
- * @endOffset: the offset of the first character after the new selection.
- *
- * Select some text (add a text selection) in an #AccessibleText object.
- *
- * Returns: #TRUE if successful, #FALSE otherwise.
- **/
-SPIBoolean
-AccessibleText_addSelection (AccessibleText *obj,
- long int startOffset, long int endOffset)
-{
- dbus_int32_t d_startOffset = startOffset, d_endOffset = endOffset;
- dbus_bool_t retval;
-
- cspi_return_val_if_fail (obj != NULL, FALSE);
-
- cspi_dbus_call (obj, spi_interface_text, "addSelection", NULL, "ii=>b", d_startOffset, d_endOffset, &retval);
-
- cspi_return_val_if_ev ("addSelection", FALSE);
-
- return retval;
-}
-
-/**
- * AccessibleText_removeSelection:
- * @obj: a pointer to the #AccessibleText object on which to operate.
- * @selectionNum: an integer indicating which (possibly of several)
- * text selection to remove.
- *
- * De-select a text selection.
- *
- * Returns: #TRUE if successful, #FALSE otherwise.
- **/
-SPIBoolean
-AccessibleText_removeSelection (AccessibleText *obj,
- long int selectionNum)
-{
- dbus_int32_t d_selectionNum = selectionNum;
- dbus_bool_t retval;
-
- cspi_return_val_if_fail (obj != NULL, FALSE);
-
- cspi_dbus_call (obj, spi_interface_text, "removeSelection", NULL, "i=>b", d_selectionNum, &retval);
-
- cspi_return_val_if_ev ("removeSelection", FALSE);
-
- return retval;
-}
-
-/**
- * AccessibleText_setSelection:
- * @obj: a pointer to the #AccessibleText object on which to operate.
- * @selectionNum: a zero-offset index indicating which text selection to modify.
- * @startOffset: a long int, the new starting offset for the selection.
- * @endOffset: a long int, the desired new offset of the first character
- * after the selection.
- *
- * Change the bounds of an existing #AccessibleText text selection.
- *
- * Returns: #TRUE if successful, #FALSE otherwise.
- **/
-SPIBoolean
-AccessibleText_setSelection (AccessibleText *obj,
- long int selectionNum,
- long int startOffset,
- long int endOffset)
-{
- dbus_int32_t d_selectionNum = selectionNum, d_startOffset = startOffset, d_endOffset = endOffset;
- dbus_bool_t retval;
-
- cspi_return_val_if_fail (obj != NULL, FALSE);
-
- cspi_dbus_call (obj, spi_interface_text, "setSelection", NULL, "iii=>b", d_selectionNum, d_startOffset, d_endOffset, &retval);
-
- cspi_return_val_if_ev ("setSelection", FALSE);
-
- return retval;
-}
-
-
-/**
- * AccessibleText_getAttributeRun:
- * @obj: a pointer to the #AccessibleText object to query.
- * @offset: a long integer indicating the offset from which the attribute
- * search is based.
- * @startOffset: a #long indicating the start of the desired text range.
- * @endOffset: a #long indicating the first character past the desired range.
- * @includeDefaults: a #bool 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.
- *
- * @Since: AT-SPI 1.7
- *
- * Returns: the AttributeSet defined at offset, optionally including the 'default' attributes.
- **/
-
-AccessibleAttributeSet *
-AccessibleText_getAttributeRun (AccessibleText *obj,
- long int offset,
- long int *startOffset,
- long int *endOffset,
- long int includeDefaults){
-
- dbus_int32_t d_offset = offset;
- dbus_bool_t d_includeDefaults = includeDefaults;
- dbus_int32_t retStartOffset, retEndOffset;
- AccessibleAttributeSet *retval;
- GArray *attributes;
-
- if (obj == NULL)
- {
- *startOffset = *endOffset = -1;
- return NULL;
- }
-
- cspi_dbus_call (obj, spi_interface_text, "getAttributeRun", NULL, "ib=>asii", d_offset, d_includeDefaults, &attributes, &retStartOffset, &retEndOffset);
-
- if (!cspi_check_ev ("getAttributeRun"))
- {
- *startOffset = *endOffset = -1;
- retval = NULL;
- }
- else
- {
- *startOffset = retStartOffset;
- *endOffset = retEndOffset;
- retval = _cspi_attribute_set_from_sequence (attributes);
- }
-
- return retval;
-
-}
-
-/**
- * AccessibleText_getDefaultAttributeSet:
- * @obj: a pointer to the #AccessibleText object to query.
- *
- *
- * @Since: AT-SPI 1.7
- *
- * Returns: 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.
- *
- **/
-
-AccessibleAttributeSet *
-AccessibleText_getDefaultAttributeSet (AccessibleText *obj){
- AccessibleAttributeSet *retval;
- GArray *attributes;
-
- cspi_return_val_if_fail (obj != NULL, NULL);
-
- cspi_dbus_call (obj, spi_interface_text, "getDefaultAttributes", NULL, "as", &attributes);
-
- retval = _cspi_attribute_set_from_sequence (attributes);
- return retval;
-}
diff --git a/cspi/spi-value.c b/cspi/spi-value.c
deleted file mode 100644
index 576eb063..00000000
--- a/cspi/spi-value.c
+++ /dev/null
@@ -1,162 +0,0 @@
-/*
- * AT-SPI - Assistive Technology Service Provider Interface
- * (Gnome Accessibility Project; http://developer.gnome.org/projects/gap)
- *
- * Copyright 2001, 2002 Sun Microsystems Inc.,
- * Copyright 2001, 2002 Ximian, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#include <cspi/spi-private.h>
-
-/**
- * AccessibleValue_ref:
- * @obj: a pointer to the #AccessibleValue implementor on which to operate.
- *
- * Increment the reference count for an #AccessibleValue object.
- **/
-void
-AccessibleValue_ref (AccessibleValue *obj)
-{
- cspi_object_ref (obj);
-}
-
-/**
- * AccessibleValue_unref:
- * @obj: a pointer to the #AccessibleValue implementor on which to operate.
- *
- * Decrement the reference count for an #AccessibleValue object.
- **/
-void
-AccessibleValue_unref (AccessibleValue *obj)
-{
- cspi_object_unref (obj);
-}
-
-/**
- * AccessibleValue_getMinimumValue:
- * @obj: a pointer to the #AccessibleValue implementor on which to operate.
- *
- * Get the minimum allowed value for an #AccessibleValue.
- *
- * Returns: the minimum allowed value for this object.
- *
- **/
-double
-AccessibleValue_getMinimumValue (AccessibleValue *obj)
-{
- double retval;
-
- cspi_return_val_if_fail (obj != NULL, 0.0);
-
- cspi_dbus_get_property (obj, spi_interface_value, "minimumValue", NULL, "d", &retval);
-
- cspi_return_val_if_ev ("getMinimumValue", 0.0);
-
- return retval;
-}
-
-/**
- * AccessibleValue_getCurrentValue:
- * @obj: a pointer to the #AccessibleValue implementor on which to operate.
- *
- * Get the current value for an #AccessibleValue.
- *
- * Returns: the current value for this object.
- **/
-double
-AccessibleValue_getCurrentValue (AccessibleValue *obj)
-{
- double retval;
-
- cspi_return_val_if_fail (obj != NULL, 0.0);
-
- cspi_dbus_get_property (obj, spi_interface_value, "currentValue", NULL, "d", &retval);
-
- cspi_return_val_if_ev ("getCurrentValue", 0.0);
-
- return retval;
-}
-
-/**
- * AccessibleValue_getMaximumValue:
- * @obj: a pointer to the #AccessibleValue implementor on which to operate.
- *
- * Get the maximum allowed value for an #AccessibleValue.
- *
- * Returns: the maximum allowed value for this object.
- **/
-double
-AccessibleValue_getMaximumValue (AccessibleValue *obj)
-{
- double retval;
- cspi_return_val_if_fail (obj != NULL, 0.0);
-
- cspi_dbus_get_property (obj, spi_interface_value, "maximumValue", NULL, "d", &retval);
-
- cspi_return_val_if_ev ("getMaximumValue", 0.0);
-
- return retval;
-}
-
-/**
- * AccessibleValue_setCurrentValue:
- * @obj: a pointer to the #AccessibleValue implementor on which to operate.
- * @newValue: a #float value which is the desired new value of the object.
- *
- * Set the current value of an #AccessibleValue.
- *
- * Returns: #TRUE if the value could be assigned the specified value,
- * #FALSE otherwise.
- **/
-SPIBoolean
-AccessibleValue_setCurrentValue (AccessibleValue *obj,
- double newValue)
-{
- cspi_return_val_if_fail (obj != NULL, FALSE);
-
- cspi_dbus_call (obj, spi_interface_value, "setCurrentValue", NULL, "d", &newValue);
-
- cspi_return_val_if_ev ("setCurrentValue", FALSE);
-
- return TRUE;
-}
-
-/**
- * AccessibleValue_getMinimumIncrement:
- * @obj: a pointer to the #AccessibleValue implementor on which to operate.
- *
- * Get the minimum increment by which an #AccessibleValue can be adjusted.
- *
- * Returns: the minimum increment by which the value may be changed, or
- * zero if the minimum increment cannot be determined.
- *
- **/
-double
-AccessibleValue_getMinimumIncrement (AccessibleValue *obj)
-{
- double retval;
-
- cspi_return_val_if_fail (obj != NULL, 0.0);
-
- cspi_dbus_get_property (obj, spi_interface_value, "minimumIncrement", NULL, "d", &retval);
-
- cspi_return_val_if_ev ("getMinimumIncrement", 0.0);
-
- return retval;
-}
-
diff --git a/cspi/spi.h b/cspi/spi.h
deleted file mode 100644
index 4441e95a..00000000
--- a/cspi/spi.h
+++ /dev/null
@@ -1,1232 +0,0 @@
-/*
- * AT-SPI - Assistive Technology Service Provider Interface
- * (Gnome Accessibility Project; http://developer.gnome.org/projects/gap)
- *
- * Copyright 2001, 2002 Sun Microsystems Inc.,
- * Copyright 2001, 2002 Ximian, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifndef _SPI_H
-#define _SPI_H
-
-#include <glib.h>
-#include <spi-common/spi-types.h>
-#include <cspi/spi-impl.h>
-/*
- * Definitions for AccessibleRole, AccessibleState,
- * and event listeners.
- */
-#include <cspi/spi-roletypes.h>
-#include <cspi/spi-statetypes.h>
-#include <cspi/spi-listener.h>
-
-
-/*
- * Auxiliary typedefs and mask definitions
- */
-#include <spi-common/keymasks.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- *AccessibleCollectionMatchType:
- *
- *@SPI_COLLECTION_MATCH_INVALID
- *@SPI_COLLECTION_MATCH_ALL TRUE if all of the criteria are met
- *@SPI_COLLECTION_MATCH_ANY TRUE if any of the criteria are met
- *@SPI_COLLECTION_MATCH_NONE TRUE if none of the criteria are met
- *@SPI_COLLECTION_MATCH_EMPTY Same as MATCH_ALL if the criteria is non-empty;
- * for empty criteria this rule requires returned value to also have empty set.
- *@SPI_COLLECTION_MATCH_LAST_DEFINED
- *
- **/
-typedef enum
-{
- SPI_COLLECTION_MATCH_INVALID,
- SPI_COLLECTION_MATCH_ALL,
- SPI_COLLECTION_MATCH_ANY,
- SPI_COLLECTION_MATCH_NONE,
- SPI_COLLECTION_MATCH_EMPTY,
- SPI_COLLECTION_MATCH_LAST_DEFINED
-}AccessibleCollectionMatchType;
-
-
-/**
- *AccessibleTextBoundaryType:
- *@SPI_TEXT_BOUNDARY_CHAR: Delimiter is the current character's bounds.
- *@SPI_TEXT_BOUNDARY_CURSOR_POS: Delimiter is the current text caret position.
- *@SPI_TEXT_BOUNDARY_WORD_START: Bounds run from the first character of a word to the first
- * character of the following word (i.e. including trailing whitespace, if any) within the text object.
- *@SPI_TEXT_BOUNDARY_WORD_END: Bounds run from the last character of a word to the last
- * character of the following word (i.e. including leading whitespace) within the text object.
- *@SPI_TEXT_BOUNDARY_SENTENCE_START: Bounds run from the first character of a sentence to the first
- * character of the next sentence in the text object.
- *@SPI_TEXT_BOUNDARY_SENTENCE_END: Bounds run from the last character of a sentence to the last
- * character of the next sentence in the text object.
- *@SPI_TEXT_BOUNDARY_LINE_START: Bounds span one line of text, with the line delimiter at the end of the
- * bounds, if present, within the current text object.
- *@SPI_TEXT_BOUNDARY_LINE_END: Bounds span one line of text, including a preceding line delimiter
- * if present within the current text object.
- *@SPI_TEXT_BOUNDARY_ATTRIBUTE_RANGE: Bounds span the run, relative to the specified offset and
- * text accessor API rules, over which the attributes of the text object are invariant.
- *
- *Text boundary types used for specifying boundaries for regions of text.
- **/
-typedef enum
-{
- SPI_TEXT_BOUNDARY_CHAR,
- SPI_TEXT_BOUNDARY_CURSOR_POS,
- SPI_TEXT_BOUNDARY_WORD_START,
- SPI_TEXT_BOUNDARY_WORD_END,
- SPI_TEXT_BOUNDARY_SENTENCE_START,
- SPI_TEXT_BOUNDARY_SENTENCE_END,
- SPI_TEXT_BOUNDARY_LINE_START,
- SPI_TEXT_BOUNDARY_LINE_END,
- SPI_TEXT_BOUNDARY_ATTRIBUTE_RANGE
-} AccessibleTextBoundaryType;
-
-/**
- *AccessibleTextClipType
- *@SPI_TEXT_CLIP_NONE: No clipping to be done
- *@SPI_TEXT_CLIP_MIN: Text clipped by min coordinate is omitted
- *@SPI_TEXT_CLIP_MAX: Text clipped by max coordinate is omitted
- *@SPI_TEXT_CLIP_BOTH: Only text fully within mix/max bound is retained
- *
- *Describes the type of clipping required.
- **/
-typedef enum
-{
- SPI_TEXT_CLIP_NONE,
- SPI_TEXT_CLIP_MIN,
- SPI_TEXT_CLIP_MAX,
- SPI_TEXT_CLIP_BOTH
-} AccessibleTextClipType;
-
-/**
- *AccessibleRelationType:
- *@SPI_RELATION_NULL: Not used, this is an invalid value for this enumeration.
- *@SPI_RELATION_LABEL_FOR: Indicates an object is a label for one or more target objects.
- *@SPI_RELATION_LABELED_BY: Indicates an object is labelled by one or more target objects.
- *@SPI_RELATION_CONTROLLED_BY: Indicates an object controlled by one or more target objects.
- *@SPI_RELATION_CONTROLLER_FOR: Indicates an object is an controller for one or more target objects.
- *@SPI_RELATION_MEMBER_OF: Indicates an object is a member of a group of one or
-more target objects.
- *@SPI_RELATION_NODE_CHILD_OF: Indicates an object is a cell in a treetable which is displayed because a cell in the same column is expanded and identifies that cell.
- *@SPI_RELATION_EXTENDED: This value indicates that a relation other than those pre-specified by this version of AT-SPI
- * is present.
- *@SPI_RELATION_FLOWS_TO: Indicates that the object has content that flows logically to another
- * AtkObject in a sequential way, (for instance text-flow).
- *@SPI_RELATION_FLOWS_FROM: Indicates that the object has content that flows logically from
- * another AtkObject in a sequential way, (for instance text-flow).
- *@SPI_RELATION_SUBWINDOW_OF: Indicates a subwindow attached to a component but otherwise has no connection in the UI heirarchy to that component.
- *@SPI_RELATION_EMBEDS: Indicates that the object visually embeds
- * another object's content, i.e. this object's content flows around
- * another's content.
- *@SPI_RELATION_EMBEDDED_BY: Inverse of %SPI_RELATION_EMBEDS, indicates that
- * this object's content is visualy embedded in another object.
- *@SPI_RELATION_POPUP_FOR: Indicates that an object is a popup for another object.
- *@SPI_RELATION_PARENT_WINDOW_OF: Indicates that an object is a parent window of another object.
- *@SPI_RELATION_DESCRIBED_BY: Indicates that another object provides descriptive information about this object; more verbose than %SPI_RELATION_LABELLED_BY.
- *@SPI_RELATION_DESCRIPTION_FOR: Indicates that an object provides descriptive information about another object; more verbose than %SPI_RELATION_LABEL_FOR.
- *@SPI_RELATION_LAST_DEFINED: Do not use, this is an implementation detail used
- * to identify the size of this enumeration.
- *
- *Describes the type of the relation
- **/
-typedef enum
-{
- SPI_RELATION_NULL,
- SPI_RELATION_LABEL_FOR,
- SPI_RELATION_LABELED_BY,
- SPI_RELATION_CONTROLLER_FOR,
- SPI_RELATION_CONTROLLED_BY,
- SPI_RELATION_MEMBER_OF,
- SPI_RELATION_NODE_CHILD_OF,
- SPI_RELATION_EXTENDED,
- SPI_RELATION_FLOWS_TO,
- SPI_RELATION_FLOWS_FROM,
- SPI_RELATION_SUBWINDOW_OF,
- SPI_RELATION_EMBEDS,
- SPI_RELATION_EMBEDDED_BY,
- SPI_RELATION_POPUP_FOR,
- SPI_RELATION_PARENT_WINDOW_OF,
- SPI_RELATION_DESCRIPTION_FOR,
- SPI_RELATION_DESCRIBED_BY,
- SPI_RELATION_LAST_DEFINED
-} AccessibleRelationType;
-
-
-/* don't change the order of these ! */
-/**
- *AccessibleCoordType:
- *@SPI_COORD_TYPE_SCREEN: specifies xy coordinates relative to the screen
- *@SPI_COORD_TYPE_WINDOW: specifies xy coordinates relative to an object's
- * top-level window
- *
- *Specifies how xy coordinates are to be interpreted. Used by functions such
- *as AccessibleComponent_getPosition() and AccessibleText_getCharacterExtents()
- **/
-typedef enum {
- SPI_COORD_TYPE_SCREEN,
- SPI_COORD_TYPE_WINDOW
-} AccessibleCoordType;
-
-/**
- *AccessibleKeySynthType:
- *@SPI_KEY_PRESS: Generates a keypress event (requires a subsequent #SPI_KEY_RELEASE event)
- *@SPI_KEY_RELEASE: Generates a key-release event
- *@SPI_KEY_PRESSRELEASE: Generates a key press/release event pair.
- *@SPI_KEY_SYM: Injects a "keysym" event into the stream, as if a press/release pair occurred; allows
- * the user to specify the key via its symbolic name, as opposed to simulating a hardware press of a
- * specific key.
- *@SPI_KEY_STRING: Injects one or more keysym events into the keyboard buffer, or directly inserts
- * a string value into the currently focussed text widget, if the widgets supports this.
- * #SPI_KEY_STRING synthesis provides a shortcut for text substring insertion, and also allows the
- * insertion of text which is not currently available via the current keyboard's keymap.
- *
- * Specifies the type of a generated event.
- **/
-typedef enum {
- SPI_KEY_PRESS,
- SPI_KEY_RELEASE,
- SPI_KEY_PRESSRELEASE,
- SPI_KEY_SYM,
- SPI_KEY_STRING
-} AccessibleKeySynthType;
-
-/**
- *AccessibleKeyListenerSyncType:
- *@SPI_KEYLISTENER_NOSYNC: Events may be delivered asynchronously,
- * which means in some cases they may already have been delivered to the
- * application before the AT client receives the notification.
- *@SPI_KEYLISTENER_SYNCHRONOUS: Events are delivered synchronously, before the
- * currently focussed application sees them.
- *@SPI_KEYLISTENER_CANCONSUME: Events may be consumed by the AT client. Presumes and
- * requires #SPI_KEYLISTENER_SYNCHRONOUS, incompatible with #SPI_KEYLISTENER_NOSYNC.
- *@SPI_KEYLISTENER_ALL_WINDOWS: Events are received not from the application toolkit layer, but
- * from the device driver or windowing system subsystem; such notifications are 'global' in the
- * sense that they are not broken or defeated by applications that participate poorly
- * in the accessibility APIs, or not at all; however because of the intrusive nature of
- * such snooping, it can have side-effects on certain older platforms. If unconditional
- * event notifications, even when inaccessible or "broken" applications have focus, are not
- * required, it may be best to avoid this enum value/flag.
- *
- *Specified the tyupe of a key listener event.
- * Certain of the values above can and should be bitwise-'OR'ed
- * together, observing the compatibility limitations specified in the description of
- * each value. For instance, #SPI_KEYLISTENER_ALL_WINDOWS | #SPI_KEYLISTENER_CANCONSUME is
- * a commonly used combination which gives the AT complete control over the delivery of matching
- * events. However, such filters should be used sparingly as they may have a negative impact on
- * system performance.
- **/
-typedef enum {
- SPI_KEYLISTENER_NOSYNC = 0,
- SPI_KEYLISTENER_SYNCHRONOUS = 1,
- SPI_KEYLISTENER_CANCONSUME = 2,
- SPI_KEYLISTENER_ALL_WINDOWS = 4
-} AccessibleKeyListenerSyncType;
-
-
-/**
- *AccessibleStreamableContentSeekType
- *@SPI_STREAM_SEEK_SET: seek from the 'top' of the streamable
- *@SPI_STREAM_SEEK_CUR: seek from the current position in the stream
- *@SPI_STREAM_SEEK_END: seek from the end of the stream (if known)
- *
- *The seek type for a specified offset in AccessibleStreamableContent_seek.
- **/
-typedef enum
-{
- SPI_STREAM_SEEK_SET,
- SPI_STREAM_SEEK_CUR,
- SPI_STREAM_SEEK_END
-} AccessibleStreamableContentSeekType;
-
-/**
- * SPIException:
- * @type: private
- * @source: private
- * @ev: private
- * @code: private
- * @desc: private
- *
- * An opaque object encapsulating information about thrown exceptions.
- **/
-typedef struct _SPIException SPIException;
-
-/**
- * SPIExceptionHandler:
- * @err: points to the SPIException opaque object.
- * @is_fatal: indicates whether the exception is a fatal error or not.
- *
- * A function type for functions to be called when exceptions occur.
- *
- * Returns
- **/
-typedef SPIBoolean (*SPIExceptionHandler) (SPIException *err, SPIBoolean is_fatal);
-
-/**
- * SPIExceptionCode:
- * @SPI_EXCEPTION_UNSPECIFIED: An exception of unknown type, or which doesn't fit the other types.
- * @SPI_EXCEPTION_DISCONNECT: Communication with the object or service has been disconnected;
- * this usually means that the object or service has died or exited.
- * @SPI_EXCEPTION_NO_IMPL: The object or service is missing the implementation for a request.
- * @SPI_EXCEPTION_IO: The communications channel has become corrupted, blocked, or is otherwise in a bad state.
- * @SPI_EXCEPTION_BAD_DATA: The data received or sent over the interface has been identified as
- * improperly formatted or otherwise fails to match the expectations.
- *
- * Exception codes indicating what's gone wrong in an AT-SPI call.
- **/
-typedef enum {
- SPI_EXCEPTION_UNSPECIFIED,
- SPI_EXCEPTION_DISCONNECT,
- SPI_EXCEPTION_NO_IMPL,
- SPI_EXCEPTION_IO,
- SPI_EXCEPTION_BAD_DATA
-} SPIExceptionCode;
-
-/**
- * SPIExceptionType:
- * @SPI_EXCEPTION_SOURCE_UNSPECIFIED: Don't know or can't tell where the problem is
- * @SPI_EXCEPTION_SOURCE_ACCESSIBLE: The source of an event or query (i.e. an app) has thrown the exception.
- * @SPI_EXCEPTION_SOURCE_REGISTRY: The AT-SPI registry has thrown the exception or cannot be reached.
- * @SPI_EXCEPTION_SOURCE_DEVICE: The device event subsystem has encountered an error condition.
- *
- * The general source of the failure, i.e. whether the app, registry, or device system has encountered trouble.
- **/
-typedef enum {
- SPI_EXCEPTION_SOURCE_UNSPECIFIED,
- SPI_EXCEPTION_SOURCE_ACCESSIBLE,
- SPI_EXCEPTION_SOURCE_REGISTRY,
- SPI_EXCEPTION_SOURCE_DEVICE
-} SPIExceptionType;
-
-typedef unsigned long AccessibleKeyEventMask;
-typedef unsigned long AccessibleDeviceEventMask;
-
-/**
- *AccessibleComponentLayer:
- *@SPI_LAYER_INVALID: The layer cannot be determined or is somehow undefined.
- *@SPI_LAYER_BACKGROUND: Component belongs to the destop background.
- *@SPI_LAYER_CANVAS: Component is a canvas backdrop or drawing area.
- *@SPI_LAYER_WIDGET: Component is a 'normal' widget.
- *@SPI_LAYER_MDI: Component is drawn in the MDI layer and may have valid
- * Z-information relative to other MDI-layer components.
- *@SPI_LAYER_POPUP: Component is in the popup layer, above other widgets and
- * MDI components.
- *@SPI_LAYER_OVERLAY: Component is in the overlay plane - this value is reserved
- * for future use.
- *@SPI_LAYER_WINDOW: Component is in the window layer and have valid Z-information
- * relative to other window-layer components.
- *@SPI_LAYER_LAST_DEFINED: Used to determine the last valid value in the enum,
- * should not be encountered.
- *
- * Describes the layer of a component.
- *
- * These enumerated "layer values" are used when determining which UI
- * rendering layer a component is drawn into, which can help in making
- * determinations of when components occlude one another.
- **/
-typedef enum {
- SPI_LAYER_INVALID,
- SPI_LAYER_BACKGROUND,
- SPI_LAYER_CANVAS,
- SPI_LAYER_WIDGET,
- SPI_LAYER_MDI,
- SPI_LAYER_POPUP,
- SPI_LAYER_OVERLAY,
- SPI_LAYER_WINDOW,
- SPI_LAYER_LAST_DEFINED
-} AccessibleComponentLayer;
-
-
-/**
- * AccessibleTextRange:
- * @start: the first nominal character position within the range.
- * @end: the first nominal character position following the range.
- * @content: The actual text content between @start and @end, as a UTF-8 string.
- *
- * Structure which encapsulates a text range - must be associated with an
- * AccessibleText-implementing object.
- **/
-typedef struct _AccessibleTextRange
-{
- long int start;
- long int end;
- char *contents;
-} AccessibleTextRange;
-
-/**
- * AccessibleKeySet:
- * @keysyms:
- * @keycodes:
- * @len:
- *
- * Structure containing identifying information about a set of keycode or
- * keysyms.
- **/
-typedef struct _AccessibleKeySet
-{
- unsigned long *keysyms;
- unsigned short *keycodes;
- char **keystrings;
- short len;
-} AccessibleKeySet;
-
-/*
- * A special value for an AccessibleKeySet type, which tacitly
- * includes all keycodes and keyvals for the specified modifier set.
- */
-#define SPI_KEYSET_ALL_KEYS NULL
-
-typedef unsigned long AccessibleModifierMaskType;
-/**
- *AccessibleKeyMaskType:
- *
- *AccessibleKeyMaskType is a mask which is a set of key event modifiers
- *which is specified in SPI_registerAccessibleKeystrokeListener.
- **/
-
-typedef AccessibleModifierMaskType AccessibleKeyMaskType;
-
-typedef struct _AccessibleAttributeSet
-{
- int len;
- char **attributes;
-} AccessibleAttributeSet;
-
-typedef struct _AccessibleRoleSet
-{
- int len;
- AccessibleRole *roles;
-} AccessibleRoleSet;
-
-
-
-/* Basic SPI initialization and event loop function prototypes */
-
-int SPI_init (void);
-void SPI_event_main (void);
-void SPI_event_quit (void);
-SPIBoolean SPI_eventIsReady (void);
-AccessibleEvent *SPI_nextEvent (SPIBoolean waitForEvent);
-int SPI_exit (void);
-
-/* Event Listener creation and support. */
-
-void SPI_freeAccessibleKeySet (
- AccessibleKeySet *keyset);
-AccessibleKeySet * SPI_createAccessibleKeySet (
- int len,
- const char *keysyms,
- short *keycodes,
- const char **keystrings);
-AccessibleEventListener * SPI_createAccessibleEventListener (
- AccessibleEventListenerCB callback,
- void *user_data);
-SPIBoolean AccessibleEventListener_addCallback (
- AccessibleEventListener *listener,
- AccessibleEventListenerCB callback,
- void *user_data);
-SPIBoolean AccessibleEventListener_removeCallback (
- AccessibleEventListener *listener,
- AccessibleEventListenerCB callback);
-void AccessibleEventListener_unref (
- AccessibleEventListener *listener);
-
-/* Device Event Listener creation and support. */
-
-/* First four are deprecated in favor of the last four; really just a re-name */
-
-AccessibleKeystrokeListener * SPI_createAccessibleKeystrokeListener (
- AccessibleKeystrokeListenerCB callback,
- void *user_data);
-SPIBoolean AccessibleKeystrokeListener_addCallback (
- AccessibleKeystrokeListener *listener,
- AccessibleKeystrokeListenerCB callback,
- void *user_data);
-SPIBoolean AccessibleKeystrokeListener_removeCallback (
- AccessibleKeystrokeListener *listener,
- AccessibleKeystrokeListenerCB callback);
-void AccessibleKeystrokeListener_unref (
- AccessibleKeystrokeListener *listener);
-
-AccessibleDeviceListener * SPI_createAccessibleDeviceListener (
- AccessibleDeviceListenerCB callback,
- void *user_data);
-SPIBoolean AccessibleDeviceListener_addCallback (
- AccessibleDeviceListener *listener,
- AccessibleDeviceListenerCB callback,
- void *user_data);
-SPIBoolean AccessibleDeviceListener_removeCallback (
- AccessibleDeviceListener *listener,
- AccessibleDeviceListenerCB callback);
-void AccessibleDeviceListener_unref (
- AccessibleDeviceListener *listener);
-
-/* Global functions serviced by the registry */
-
-SPIBoolean SPI_registerGlobalEventListener (
- AccessibleEventListener *listener,
- const char *eventType);
-SPIBoolean SPI_deregisterGlobalEventListener (
- AccessibleEventListener *listener,
- const char *eventType);
-SPIBoolean SPI_deregisterGlobalEventListenerAll (
- AccessibleEventListener *listener);
-SPIBoolean SPI_registerAccessibleKeystrokeListener (
- AccessibleKeystrokeListener *listener,
- AccessibleKeySet *keys,
- AccessibleKeyMaskType modmask,
- AccessibleKeyEventMask eventmask,
- AccessibleKeyListenerSyncType sync_type);
-SPIBoolean SPI_deregisterAccessibleKeystrokeListener (
- AccessibleKeystrokeListener *listener,
- AccessibleKeyMaskType modmask);
-
-SPIBoolean SPI_registerDeviceEventListener (
- AccessibleDeviceListener *listener,
- AccessibleDeviceEventMask eventmask,
- void *filter);
-SPIBoolean SPI_deregisterDeviceEventListener (
- AccessibleDeviceListener *listener,
- void *filter);
-
-int SPI_getDesktopCount (void);
-Accessible *SPI_getDesktop (int i);
-int SPI_getDesktopList (Accessible ***desktop_list);
-void SPI_freeDesktopList (Accessible **desktop_list);
-
-SPIBoolean SPI_generateKeyboardEvent (long int keyval,
- char *keystring,
- AccessibleKeySynthType synth_type);
-
-SPIBoolean SPI_generateMouseEvent (long int x, long int y, char *name);
-
-/* Accessible function prototypes */
-
-void Accessible_ref (Accessible *obj);
-void Accessible_unref (Accessible *obj);
-char * Accessible_getName (Accessible *obj);
-char * Accessible_getDescription (Accessible *obj);
-Accessible * Accessible_getParent (Accessible *obj);
-long Accessible_getChildCount (Accessible *obj);
-Accessible * Accessible_getChildAtIndex (Accessible *obj,
- long int childIndex);
-long Accessible_getIndexInParent (Accessible *obj);
-AccessibleRelation **Accessible_getRelationSet (Accessible *obj);
-AccessibleRole Accessible_getRole (Accessible *obj);
-char * Accessible_getRoleName (Accessible *obj);
-char * Accessible_getLocalizedRoleName (Accessible *obj);
-AccessibleStateSet * Accessible_getStateSet (Accessible *obj);
-AccessibleAttributeSet *Accessible_getAttributes (Accessible *obj);
-AccessibleApplication *Accessible_getHostApplication (Accessible *obj);
-
-/* Interface query methods */
-
-SPIBoolean Accessible_isAction (Accessible *obj);
-SPIBoolean Accessible_isApplication (Accessible *obj);
-SPIBoolean Accessible_isCollection (Accessible *obj);
-SPIBoolean Accessible_isComponent (Accessible *obj);
-SPIBoolean Accessible_isDocument (Accessible *obj);
-SPIBoolean Accessible_isEditableText (Accessible *obj);
-SPIBoolean Accessible_isHypertext (Accessible *obj);
-SPIBoolean Accessible_isImage (Accessible *obj);
-SPIBoolean Accessible_isMatchRule (Accessible *obj);
-SPIBoolean Accessible_isSelection (Accessible *obj);
-SPIBoolean Accessible_isStreamableContent (Accessible *obj);
-SPIBoolean Accessible_isTable (Accessible *obj);
-SPIBoolean Accessible_isText (Accessible *obj);
-SPIBoolean Accessible_isValue (Accessible *obj);
-
-AccessibleAction * Accessible_getAction (Accessible *obj);
-AccessibleApplication * Accessible_getApplication (Accessible *obj);
-AccessibleCollection * Accessible_getCollection (Accessible *obj);
-AccessibleComponent * Accessible_getComponent (Accessible *obj);
-AccessibleDocument * Accessible_getDocument (Accessible *obj);
-AccessibleEditableText * Accessible_getEditableText (Accessible *obj);
-AccessibleHypertext * Accessible_getHypertext (Accessible *obj);
-AccessibleImage * Accessible_getImage (Accessible *obj);
-AccessibleMatchRule * Accessible_getMatchRule (Accessible *obj);
-AccessibleSelection * Accessible_getSelection (Accessible *obj);
-AccessibleStreamableContent * Accessible_getStreamableContent (Accessible *obj);
-AccessibleTable * Accessible_getTable (Accessible *obj);
-AccessibleText * Accessible_getText (Accessible *obj);
-AccessibleValue * Accessible_getValue (Accessible *obj);
-AccessibleUnknown * Accessible_queryInterface (Accessible *obj,
- const char *interface_name);
-
-/* AccessibleAction function prototypes */
-
-void AccessibleAction_ref (AccessibleAction *obj);
-void AccessibleAction_unref (AccessibleAction *obj);
-long AccessibleAction_getNActions (AccessibleAction *obj);
-char *AccessibleAction_getName (AccessibleAction *obj,
- long int i);
-char *AccessibleAction_getDescription (AccessibleAction *obj,
- long int i);
-SPIBoolean AccessibleAction_doAction (AccessibleAction *obj,
- long int i);
-char *AccessibleAction_getKeyBinding (AccessibleAction *obj,
- long int i);
-
-/* AccessibleApplication function prototypes */
-
-void AccessibleApplication_ref (AccessibleApplication *obj);
-void AccessibleApplication_unref (AccessibleApplication *obj);
-char *AccessibleApplication_getToolkitName (AccessibleApplication *obj);
-char *AccessibleApplication_getVersion (AccessibleApplication *obj);
-long AccessibleApplication_getID (AccessibleApplication *obj);
-char *AccessibleApplication_getLocale (AccessibleApplication *obj, int lc_category);
-SPIBoolean AccessibleApplication_pause (AccessibleApplication *obj);
-SPIBoolean AccessibleApplication_resume (AccessibleApplication *obj);
-
-/* AccessibleCollection function prototypes */
-void AccessibleCollection_ref (AccessibleCollection *obj);
-void AccessibleCollection_unref (AccessibleCollection *obj);
-AccessibleMatchRule *
-AccessibleCollection_createMatchRule (AccessibleCollection *obj,
- AccessibleStateSet *states,
- AccessibleCollectionMatchType statematchtype,
- AccessibleAttributeSet *attributes,
- AccessibleCollectionMatchType attributematchtype,
- AccessibleRoleSet *roles,
- AccessibleCollectionMatchType rolematchtype,
- char *interfaces,
- AccessibleCollectionMatchType interfacematchtype,
- long int invert);
-void
-AccessibleCollection_freeMatchRule (AccessibleCollection *obj,
- AccessibleMatchRule *matchrule);
-/* AccessibleComponent function prototypes */
-
-void AccessibleComponent_ref (AccessibleComponent *obj);
-void AccessibleComponent_unref (AccessibleComponent *obj);
-SPIBoolean AccessibleComponent_contains (AccessibleComponent *obj,
- long int x,
- long int y,
- AccessibleCoordType ctype);
-Accessible *AccessibleComponent_getAccessibleAtPoint (
- AccessibleComponent *obj,
- long int x,
- long int y,
- AccessibleCoordType ctype);
-void AccessibleComponent_getExtents (AccessibleComponent *obj,
- long int *x,
- long int *y,
- long int *width,
- long int *height,
- AccessibleCoordType ctype);
-void AccessibleComponent_getPosition (AccessibleComponent *obj,
- long int *x,
- long int *y,
- AccessibleCoordType ctype);
-void AccessibleComponent_getSize (AccessibleComponent *obj,
- long int *width,
- long int *height);
-AccessibleComponentLayer
- AccessibleComponent_getLayer (AccessibleComponent *obj);
-SPIBoolean AccessibleComponent_grabFocus (AccessibleComponent *obj);
-short AccessibleComponent_getMDIZOrder(AccessibleComponent *obj);
-double AccessibleComponent_getAlpha (AccessibleComponent *obj);
-
-/* AccessibleDocument function prototypes */
-
-void AccessibleDocument_ref (AccessibleDocument *obj);
-void AccessibleDocument_unref (AccessibleDocument *obj);
-char *AccessibleDocument_getLocale (AccessibleDocument *obj);
-char *AccessibleDocument_getAttributeValue (AccessibleDocument *obj,
- char *attribute);
-AccessibleAttributeSet *AccessibleDocument_getAttributes (AccessibleDocument *obj);
-
-/* AccessibleEditableText function prototypes */
-
-void
-AccessibleEditableText_ref (AccessibleEditableText *obj);
-
-void
-AccessibleEditableText_unref (AccessibleEditableText *obj);
-
-SPIBoolean
-AccessibleEditableText_setAttributes (AccessibleEditableText *obj,
- const char *attributes,
- long int startOffset,
- long int endOffset);
-
-SPIBoolean
-AccessibleEditableText_setTextContents (AccessibleEditableText *obj,
- const char *newContents);
-
-SPIBoolean
-AccessibleEditableText_insertText (AccessibleEditableText *obj,
- long int position,
- const char *text,
- long int length);
-
-SPIBoolean
-AccessibleEditableText_copyText (AccessibleText *obj,
- long int startPos,
- long int endPos);
-
-SPIBoolean
-AccessibleEditableText_cutText (AccessibleEditableText *obj,
- long int startPos,
- long int endPos);
-
-SPIBoolean
-AccessibleEditableText_deleteText (AccessibleEditableText *obj,
- long int startPos,
- long int endPos);
-
-SPIBoolean
-AccessibleEditableText_pasteText (AccessibleEditableText *obj,
- long int position);
-
-/*
- *
- * AccessibleHyperlink function prototypes
- *
- */
-void
-AccessibleHyperlink_ref (AccessibleHyperlink *obj);
-void
-AccessibleHyperlink_unref (AccessibleHyperlink *obj);
-
-long
-AccessibleHyperlink_getNAnchors (AccessibleHyperlink *obj);
-
-char *
-AccessibleHyperlink_getURI (AccessibleHyperlink *obj,
- long int i);
-
-Accessible *
-AccessibleHyperlink_getObject (AccessibleHyperlink *obj,
- long int i);
-
-void
-AccessibleHyperlink_getIndexRange (AccessibleHyperlink *obj,
- long int *startIndex,
- long int *endIndex);
-
-SPIBoolean
-AccessibleHyperlink_isValid (AccessibleHyperlink *obj);
-
-/*
- *
- * AccessibleHypertext function prototypes
- *
- */
-
-void
-AccessibleHypertext_ref (AccessibleHypertext *obj);
-
-void
-AccessibleHypertext_unref (AccessibleHypertext *obj);
-
-long
-AccessibleHypertext_getNLinks (AccessibleHypertext *obj);
-
-AccessibleHyperlink *
-AccessibleHypertext_getLink (AccessibleHypertext *obj,
- long int linkIndex);
-
-long
-AccessibleHypertext_getLinkIndex (AccessibleHypertext *obj,
- long int characterOffset);
-
-/*
- *
- * AccessibleImage function prototypes
- *
- */
-
-void
-AccessibleImage_ref (AccessibleImage *obj);
-
-void
-AccessibleImage_unref (AccessibleImage *obj);
-
-char *
-AccessibleImage_getImageDescription (AccessibleImage *obj);
-
-void
-AccessibleImage_getImageSize (AccessibleImage *obj,
- long int *width,
- long int *height);
-
-void
-AccessibleImage_getImagePosition (AccessibleImage *obj,
- long int *x,
- long int *y,
- AccessibleCoordType ctype);
-
-void
-AccessibleImage_getImageExtents (AccessibleImage *obj,
- long int *x,
- long int *y,
- long int *width,
- long int *height,
- AccessibleCoordType ctype);
-char *
-AccessibleImage_getImageLocale (AccessibleImage *obj);
-
-/*
- *
- * AccessibleMatchRule function prototypes
- *
- */
-void AccessibleMatchRule_ref (AccessibleMatchRule *obj);
-void AccessibleMatchRule_unref (AccessibleMatchRule *obj);
-
-/*
- *
- * AccessibleRelation function prototypes
- *
- */
-
-void AccessibleRelation_ref (AccessibleRelation *obj);
-void AccessibleRelation_unref (AccessibleRelation *obj);
-
-AccessibleRelationType
-AccessibleRelation_getRelationType (AccessibleRelation *obj);
-
-int
-AccessibleRelation_getNTargets (AccessibleRelation *obj);
-
-Accessible *
-AccessibleRelation_getTarget (AccessibleRelation *obj, int i);
-
-
-/*
- *
- * AccessibleSelection function prototypes
- *
- */
-
-void AccessibleSelection_ref (AccessibleSelection *obj);
-void AccessibleSelection_unref (AccessibleSelection *obj);
-
-long
-AccessibleSelection_getNSelectedChildren (AccessibleSelection *obj);
-
-Accessible *
-AccessibleSelection_getSelectedChild (AccessibleSelection *obj,
- long int selectedChildIndex);
-
-SPIBoolean
-AccessibleSelection_selectChild (AccessibleSelection *obj,
- long int childIndex);
-
-SPIBoolean
-AccessibleSelection_deselectSelectedChild (AccessibleSelection *obj,
- long int selectedChildIndex);
-
-SPIBoolean
-AccessibleSelection_deselectChild (AccessibleSelection *obj,
- long int childIndex);
-
-SPIBoolean
-AccessibleSelection_isChildSelected (AccessibleSelection *obj,
- long int childIndex);
-
-SPIBoolean
-AccessibleSelection_selectAll (AccessibleSelection *obj);
-
-SPIBoolean
-AccessibleSelection_clearSelection (AccessibleSelection *obj);
-
-
-/*
- *
- * AccessibleStateSet function prototypes
- *
- */
-
-void AccessibleStateSet_ref (AccessibleStateSet *obj);
-void AccessibleStateSet_unref (AccessibleStateSet *obj);
-
-SPIBoolean
-AccessibleStateSet_contains (AccessibleStateSet *obj,
- AccessibleState state);
-
-void
-AccessibleStateSet_add (AccessibleStateSet *obj,
- AccessibleState state);
-
-void
-AccessibleStateSet_remove (AccessibleStateSet *obj,
- AccessibleState state);
-
-SPIBoolean
-AccessibleStateSet_equals (AccessibleStateSet *obj,
- AccessibleStateSet *obj2);
-
-AccessibleStateSet *
-AccessibleStateSet_compare (AccessibleStateSet *obj,
- AccessibleStateSet *obj2);
-
-SPIBoolean
-AccessibleStateSet_isEmpty (AccessibleStateSet *obj);
-
-void
-AccessibleStreamableContent_ref (AccessibleStreamableContent *obj);
-void
-AccessibleStreamableContent_unref (AccessibleStreamableContent *obj);
-char **
-AccessibleStreamableContent_getContentTypes (AccessibleStreamableContent *obj);
-
-void
-AccessibleStreamableContent_freeContentTypesList (AccessibleStreamableContent *obj,
- char **content_types);
-#define AccessibleStreamableContent_freeContentTypeList(a, b) AccessibleStreamableContent_freeContentTypesList(a,b)
-
-SPIBoolean
-AccessibleStreamableContent_open (AccessibleStreamableContent *obj,
- const char *content_type);
-SPIBoolean
-AccessibleStreamableContent_close (AccessibleStreamableContent *obj);
-
-long
-AccessibleStreamableContent_seek (AccessibleStreamableContent *obj,
- long int offset,
- AccessibleStreamableContentSeekType seek_type);
-SPIBoolean
-AccessibleStreamableContent_read (AccessibleStreamableContent *obj,
- void *buff,
- long int nbytes,
- unsigned int read_type);
-/*
- *
- * AccessibleTable function prototypes
- *
- */
-
-void AccessibleTable_ref (AccessibleTable *obj);
-void AccessibleTable_unref (AccessibleTable *obj);
-
-Accessible *
-AccessibleTable_getCaption (AccessibleTable *obj);
-
-Accessible *
-AccessibleTable_getSummary (AccessibleTable *obj);
-
-long
-AccessibleTable_getNRows (AccessibleTable *obj);
-
-long
-AccessibleTable_getNColumns (AccessibleTable *obj);
-
-Accessible *
-AccessibleTable_getAccessibleAt (AccessibleTable *obj,
- long int row,
- long int column);
-
-long
-AccessibleTable_getIndexAt (AccessibleTable *obj,
- long int row,
- long int column);
-
-long
-AccessibleTable_getRowAtIndex (AccessibleTable *obj,
- long int index);
-
-long
-AccessibleTable_getColumnAtIndex (AccessibleTable *obj,
- long int index);
-
-char *
-AccessibleTable_getRowDescription (AccessibleTable *obj,
- long int row);
-
-char *
-AccessibleTable_getColumnDescription (AccessibleTable *obj,
- long int column);
-
-long
-AccessibleTable_getRowExtentAt (AccessibleTable *obj,
- long int row,
- long int column);
-
-long
-AccessibleTable_getColumnExtentAt (AccessibleTable *obj,
- long int row,
- long int column);
-
-SPIBoolean
-AccessibleTable_getRowColumnExtentsAtIndex (AccessibleTable *obj,
- long int index, long int *row, long int *col,
- long int *row_extents, long int *col_extents,
- long int *is_selected);
-
-Accessible *
-AccessibleTable_getRowHeader (AccessibleTable *obj,
- long int row);
-
-Accessible *
-AccessibleTable_getColumnHeader (AccessibleTable *obj,
- long int column);
-
-long
-AccessibleTable_getNSelectedRows (AccessibleTable *obj);
-
-long
-AccessibleTable_getSelectedRows (AccessibleTable *obj,
- long int **selectedRows);
-
-long
-AccessibleTable_getNSelectedColumns (AccessibleTable *obj);
-
-long
-AccessibleTable_getSelectedColumns (AccessibleTable *obj,
- long int **selectedColumns);
-
-SPIBoolean
-AccessibleTable_isRowSelected (AccessibleTable *obj,
- long int row);
-
-SPIBoolean
-AccessibleTable_isColumnSelected (AccessibleTable *obj,
- long int column);
-
-SPIBoolean
-AccessibleTable_isSelected (AccessibleTable *obj,
- long int row,
- long int column);
-
-SPIBoolean
-AccessibleTable_addRowSelection (AccessibleTable *obj,
- long int row);
-SPIBoolean
-AccessibleTable_addColumnSelection (AccessibleTable *obj,
- long int column);
-
-SPIBoolean
-AccessibleTable_removeRowSelection (AccessibleTable *obj,
- long int row);
-SPIBoolean
-AccessibleTable_removeColumnSelection (AccessibleTable *obj,
- long int column);
-
-/*
- *
- * AccessibleText function prototypes
- *
- */
-
-void AccessibleText_ref (AccessibleText *obj);
-void AccessibleText_unref (AccessibleText *obj);
-
-long
-AccessibleText_getCharacterCount (AccessibleText *obj);
-
-char *
-AccessibleText_getText (AccessibleText *obj,
- long int startOffset,
- long int endOffset);
-
-long
-AccessibleText_getCaretOffset (AccessibleText *obj);
-
-char *
-AccessibleText_getAttributes (AccessibleText *obj,
- long int offset,
- long int *startOffset,
- long int *endOffset);
-
-char *
-AccessibleText_getDefaultAttributes (AccessibleText *obj);
-
-SPIBoolean
-AccessibleText_setCaretOffset (AccessibleText *obj,
- long int newOffset);
-
-char *
-AccessibleText_getTextBeforeOffset (AccessibleText *obj,
- long int offset,
- AccessibleTextBoundaryType type,
- long int *startOffset,
- long int *endOffset);
-
-char *
-AccessibleText_getTextAtOffset (AccessibleText *obj,
- long int offset,
- AccessibleTextBoundaryType type,
- long int *startOffset,
- long int *endOffset);
-
-char *
-AccessibleText_getTextAfterOffset (AccessibleText *obj,
- long int offset,
- AccessibleTextBoundaryType type,
- long int *startOffset,
- long int *endOffset);
-
-unsigned long
-AccessibleText_getCharacterAtOffset (AccessibleText *obj,
- long int offset);
-
-void
-AccessibleText_getCharacterExtents (AccessibleText *obj,
- long int offset,
- long int *x,
- long int *y,
- long int *width,
- long int *height,
- AccessibleCoordType type);
-
-void
-AccessibleText_getRangeExtents (AccessibleText *obj,
- long int startOffset,
- long int endOffset,
- long int *x,
- long int *y,
- long int *width,
- long int *height,
- AccessibleCoordType type);
-
-AccessibleTextRange **
-AccessibleText_getBoundedRanges (AccessibleText *obj,
- long int x,
- long int y,
- long int width,
- long int height,
- AccessibleCoordType type,
- AccessibleTextClipType clipTypeX,
- AccessibleTextClipType clipTypeY);
-
-void
-AccessibleTextRange_freeRanges (AccessibleTextRange **ranges);
-
-long
-AccessibleText_getOffsetAtPoint (AccessibleText *obj,
- long int x,
- long int y,
- AccessibleCoordType type);
-
-long
-AccessibleText_getNSelections (AccessibleText *obj);
-
-void
-AccessibleText_getSelection (AccessibleText *obj,
- long int selectionNum,
- long int *startOffset,
- long int *endOffset);
-
-
-SPIBoolean
-AccessibleText_addSelection (AccessibleText *obj,
- long int startOffset,
- long int endOffset);
-
-SPIBoolean
-AccessibleText_removeSelection (AccessibleText *obj,
- long int selectionNum);
-
-SPIBoolean
-AccessibleText_setSelection (AccessibleText *obj,
- long int selectionNum,
- long int startOffset,
- long int endOffset);
-AccessibleAttributeSet *
-AccessibleText_getAttributeRun (AccessibleText *obj,
- long int offset,
- long int *startOffset,
- long int *endOffset,
- long int includeDefaults);
-AccessibleAttributeSet *
-AccessibleText_getDefaultAttributeSet (AccessibleText *obj);
-
-/* AccessibleValue Function Prototypes: */
-
-void AccessibleValue_ref (AccessibleValue *obj);
-void AccessibleValue_unref (AccessibleValue *obj);
-double AccessibleValue_getMinimumValue (AccessibleValue *obj);
-double AccessibleValue_getCurrentValue (AccessibleValue *obj);
-double AccessibleValue_getMaximumValue (AccessibleValue *obj);
-SPIBoolean AccessibleValue_setCurrentValue (AccessibleValue *obj,
- double newValue);
-double AccessibleValue_getMinimumIncrement (AccessibleValue *obj);
-
-/* Persistance and lifecycle control for AccessibleEvents. */
-SPIBoolean AccessibleEvent_ref (const AccessibleEvent *e);
-void AccessibleEvent_unref (const AccessibleEvent *e);
-
-/*
- * Prototypes for accessor functions, to obtain context
- * information for accessible events.
- */
-
-char* AccessibleEvent_getSourceName (const AccessibleEvent *e);
-AccessibleRole AccessibleEvent_getSourceRole (const AccessibleEvent *e);
-AccessibleApplication* AccessibleEvent_getSourceApplication (const AccessibleEvent *e);
-SPIBoolean AccessibleEvent_getSourceDetails (const AccessibleEvent *e, char **name,
- AccessibleRole *role,
- AccessibleApplication **app);
-
-char* AccessibleTextChangedEvent_getChangeString (const AccessibleEvent *e);
-Accessible * AccessibleChildChangedEvent_getChildAccessible (const AccessibleEvent *e);
-
-Accessible * AccessibleParentChangedEvent_getParentAccessible (const AccessibleEvent *e);
-
-char* AccessibleTextSelectionChangedEvent_getSelectionString (const AccessibleEvent *e);
-
-char* AccessibleWindowEvent_getTitleString (const AccessibleEvent *e);
-
-Accessible * AccessibleActiveDescendantChangedEvent_getActiveDescendant (const AccessibleEvent *e);
-
-Accessible * AccessibleTableSummaryChangedEvent_getSummaryAccessible (const AccessibleEvent *e);
-
-Accessible * AccessibleTableHeaderChangedEvent_getHeaderAccessible (const AccessibleEvent *e);
-
-char * AccessibleTableCaptionChangedEvent_getCaptionString (const AccessibleEvent *e);
-
-char * AccessibleTableRowDescriptionChangedEvent_getDescriptionString (const AccessibleEvent *e);
-
-char * AccessibleTableColumnDescriptionChangedEvent_getDescriptionString (const AccessibleEvent *e);
-
-char * AccessibleDescriptionChangedEvent_getDescriptionString (const AccessibleEvent *e);
-
-char * AccessibleNameChangedEvent_getNameString (const AccessibleEvent *e);
-SPIRect * AccessibleBoundsChangedEvent_getNewBounds (const AccessibleEvent *e);
-
-/* Misc methods and error handling */
-void SPI_freeString (char *s);
-
-char* SPI_dupString (char *s);
-
-void SPI_freeRect (SPIRect *r);
-
-SPIBoolean SPI_exceptionHandlerPush (SPIExceptionHandler *handler);
-
-SPIExceptionHandler* SPI_exceptionHandlerPop (void);
-
-SPIExceptionType SPIException_getSourceType (SPIException *err);
-
-SPIExceptionCode SPIException_getExceptionCode (SPIException *err);
-
-Accessible* SPIAccessibleException_getSource (SPIException *err);
-
-char* SPIException_getDescription (SPIException *err);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/dbind-config.h.in b/dbind/dbind-config.h.in
index 3da421e1..3da421e1 100644
--- a/dbind-config.h.in
+++ b/dbind/dbind-config.h.in
diff --git a/libloginhelper-1.0.pc.in b/libloginhelper-1.0.pc.in
deleted file mode 100644
index 70124d98..00000000
--- a/libloginhelper-1.0.pc.in
+++ /dev/null
@@ -1,11 +0,0 @@
-prefix=@prefix@
-exec_prefix=@exec_prefix@
-libdir=@libdir@
-includedir=@includedir@
-
-Name: liblogin-helper
-Description: Login-Helper library for assistive technologies
-Requires: libbonobo-2.0 atk libspi-1.0
-Version: @VERSION@
-Libs: -L${libdir} -lloginhelper
-Cflags: -I${includedir}/at-spi-1.0
diff --git a/login-helper/Makefile.am b/login-helper/Makefile.am
deleted file mode 100644
index d314072f..00000000
--- a/login-helper/Makefile.am
+++ /dev/null
@@ -1,22 +0,0 @@
-lib_LTLIBRARIES = libloginhelper.la
-
-LDADD = $(X_LIBS) $(LOGIN_HELPER_LIBS)
-
-INCLUDES = -I$(top_srcdir) \
- -I$(top_builddir) \
- $(WARN_CFLAGS) \
- $(DBUS_GLIB_CFLAGS)
-
-libloginhelperincludedir = $(includedir)/at-spi-1.0/login-helper
-
-libloginhelper_la_LDFLAGS = -no-undefined
-libloginhelper_la_LIBADD = \
- $(top_builddir)/spi-common/libspicommon.la \
- $(top_builddir)/droute/libdroute.la \
- $(X_LIBS)
-
-libloginhelperinclude_HEADERS = \
- login-helper.h
-
-libloginhelper_la_SOURCES = \
- login-helper.c
diff --git a/login-helper/login-helper.c b/login-helper/login-helper.c
deleted file mode 100644
index 68e50173..00000000
--- a/login-helper/login-helper.c
+++ /dev/null
@@ -1,159 +0,0 @@
-/*
- * AT-SPI - Assistive Technology Service Provider Interface
- * (Gnome Accessibility Project; http://developer.gnome.org/projects/gap)
- *
- * LoginHelper interface
- * Copyright 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.
- */
-
-/* login-helper.c: minimal implementation of Accessibility_LoginHelper.idl */
-#include <config.h>
-#include "login-helper.h"
-#include "spi-common/spi-dbus.h"
-#include "droute/droute.h"
-
-/* Our parent Gtk object type */
-#define PARENT_TYPE G_TYPE_OBJECT
-
-/* A pointer to our parent object class */
-static GObjectClass *g_object_parent_class;
-
-static void
-login_helper_finalize (GObject *object)
-{
- (G_OBJECT_CLASS (g_object_parent_class))->finalize (object);
-}
-
-static gboolean
-login_helper_set_safe (LoginHelper *helper, gboolean safe)
-{
- LoginHelperClass *klass = LOGIN_HELPER_GET_CLASS (helper);
-
- if (klass->set_safe)
- return (* klass->set_safe)(helper, safe);
- else
- return FALSE;
-}
-
-static DBusMessage *
-impl_set_safe (DBusConnection *bus, DBusMessage *message, void *user_data)
-{
- LoginHelper *helper = user_data;
-
- DBusError error;
- dbus_bool_t safe;
- dbus_bool_t rv;
- DBusMessage *reply;
-
- dbus_error_init (&error);
- if (!dbus_message_get_args
- (message, &error, DBUS_TYPE_BOOLEAN, &safe, DBUS_TYPE_INVALID))
- {
- return droute_invalid_arguments_error (message);
- }
- rv = login_helper_set_safe (helper, safe);
- reply = dbus_message_new_method_return (message);
- if (reply)
- {
- dbus_message_append_args (reply, DBUS_TYPE_BOOLEAN, &rv, DBUS_TYPE_INVALID);
- }
- return reply;
-}
-
-static LoginHelperDeviceReqFlags
-login_helper_get_device_reqs (LoginHelper *helper)
-{
- LoginHelperClass *klass = LOGIN_HELPER_GET_CLASS (helper);
-
- if (klass->get_device_reqs)
- return (* klass->get_device_reqs)(helper);
- else
- return 0;
-}
-
-static DBusMessage *
-impl_get_device_reqs (DBusConnection *bus, DBusMessage *message, void *user_data)
-{
- LoginHelper *helper = user_data;
- dbus_uint32_t flags = 0;
- DBusMessage *reply;
-
- flags = login_helper_get_device_reqs (helper);
-
- reply = dbus_message_new_method_return (message);
- if (reply)
- {
- dbus_message_append_args (reply, DBUS_TYPE_UINT32, &flags, DBUS_TYPE_INVALID);
- }
- return reply;
-}
-
-static Window*
-login_helper_get_raise_windows (LoginHelper *helper)
-{
- LoginHelperClass *klass = LOGIN_HELPER_GET_CLASS (helper);
-
- if (klass->get_raise_windows)
- return (* klass->get_raise_windows)(helper);
- else
- return NULL;
-}
-
-static DBusMessage *
-impl_get_raise_windows (DBusConnection *bus, DBusMessage *message, void *user_data)
-{
- LoginHelper *helper = user_data;
- unsigned long *wids;
- gint count = 0;
- DBusMessage *reply;
- DBusMessageIter iter, iter_array;
-
- wids = login_helper_get_raise_windows (helper);
- reply = dbus_message_new_method_return (message);
- if (!reply) return NULL;
- dbus_message_iter_init_append (message, &iter);
- if (dbus_message_iter_open_container (&iter, DBUS_TYPE_ARRAY, "i", &iter_array) && wids)
- {
- while (*wids)
- {
- // TODO: figure out if this will break on 64-bit systems
- dbus_int32_t id = *wids++;
- dbus_message_iter_append_basic (&iter_array, DBUS_TYPE_INT32, &id);
- }
- dbus_message_iter_close_container (&iter, &iter_array);
- }
- if (wids) g_free (wids);
- return reply;
-}
-
-static void
-login_helper_class_init (LoginHelperClass *klass)
-{
- GObjectClass * object_class = (GObjectClass *) klass;
-
- g_object_parent_class = g_type_class_peek_parent (klass);
-
- object_class->finalize = login_helper_finalize;
-}
-
-static void
-login_helper_init (LoginHelper *object)
-{
-}
-
-G_DEFINE_TYPE (LoginHelper, login_helper, PARENT_TYPE)
diff --git a/login-helper/login-helper.h b/login-helper/login-helper.h
deleted file mode 100644
index a81c3780..00000000
--- a/login-helper/login-helper.h
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * AT-SPI - Assistive Technology Service Provider Interface
- * (Gnome Accessibility Project; http://developer.gnome.org/projects/gap)
- *
- * LoginHelper
- *
- * Copyright 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.
- */
-
-#ifndef LOGIN_HELPER_H_
-#define LOGIN_HELPER_H_
-
-#include <glib.h>
-#include <glib-object.h>
-//#include <login-helper/Accessibility_LoginHelper.h>
-#include <X11/X.h>
-
-G_BEGIN_DECLS
-
-typedef struct _LoginHelper LoginHelper;
-typedef struct _LoginHelperClass LoginHelperClass;
-
-#define LOGIN_HELPER_TYPE (login_helper_get_type ())
-#define LOGIN_HELPER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), LOGIN_HELPER_TYPE, LoginHelper))
-#define LOGIN_HELPER_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), LOGIN_HELPER_TYPE, LoginHelperClass))
-#define LOGIN_HELPER_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS((o), LOGIN_HELPER_TYPE, LoginHelperClass))
-#define IS_LOGIN_HELPER(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), LOGIN_HELPER_TYPE))
-#define IS_LOGIN_HELPER_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), LOGIN_HELPER_TYPE))
-
-struct _LoginHelper {
- GObject parent;
-
-};
-
-typedef unsigned long LoginHelperDeviceReqFlags;
-
-#define LOGIN_HELPER_GUI_EVENTS 1
-#define LOGIN_HELPER_CORE_KEYBOARD 2
-#define LOGIN_HELPER_CORE_POINTER 4
-#define LOGIN_HELPER_EXT_INPUT 8
-#define LOGIN_HELPER_POST_WINDOWS 16
-#define LOGIN_HELPER_AUDIO_OUT 32
-#define LOGIN_HELPER_AUDIO_IN 64
-#define LOGIN_HELPER_NETWORK 128
-#define LOGIN_HELPER_LOCALHOST 256
-#define LOGIN_HELPER_SERIAL_OUT 512
-#define LOGIN_HELPER_SERIAL_IN 1024
-#define LOGIN_HELPER_LAST_DEFINED 2048
-
-struct _LoginHelperClass {
- GObjectClass parent_class;
-
- gboolean (*set_safe) (LoginHelper *helper, gboolean safe);
- LoginHelperDeviceReqFlags (*get_device_reqs) (LoginHelper *helper);
- Window* (*get_raise_windows) (LoginHelper *helper);
-};
-
-GType login_helper_get_type (void) G_GNUC_CONST;
-LoginHelper *login_helper_new (void);
-
-G_END_DECLS
-
-#endif /* LOGIN_HELPER_H */
diff --git a/pyatspi/Accessibility.py b/pyatspi/Accessibility.py
deleted file mode 100644
index cf4df5b3..00000000
--- a/pyatspi/Accessibility.py
+++ /dev/null
@@ -1,41 +0,0 @@
-#Copyright (C) 2008 Codethink Ltd
-
-#This library is free software; you can redistribute it and/or
-#modify it under the terms of the GNU Lesser General Public
-#License version 2 as published by the Free Software Foundation.
-
-#This program 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 General Public License for more details.
-#You should have received a copy of the GNU Lesser General Public License
-#along with this program; if not, write to the Free Software
-#Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-from constants import *
-
-from registry import*
-from accessible import *
-from action import *
-from application import *
-from collection import *
-from component import *
-from constants import *
-from desktop import *
-from deviceevent import *
-from document import *
-from editabletext import *
-from event import *
-from hyperlink import *
-from hypertext import *
-from image import *
-from interfaces import *
-from loginhelper import *
-from relation import *
-from role import *
-from selection import *
-from state import *
-from table import *
-from text import *
-from utils import *
-from value import *
diff --git a/pyatspi/Makefile.am b/pyatspi/Makefile.am
deleted file mode 100644
index cd4e6f86..00000000
--- a/pyatspi/Makefile.am
+++ /dev/null
@@ -1,35 +0,0 @@
-pyatspidir = $(pythondir)/pyatspi
-pyatspi_PYTHON = \
- Accessibility.py \
- accessible.py \
- accessiblecache.py \
- action.py \
- application.py \
- applicationcache.py \
- base.py \
- collection.py \
- component.py \
- constants.py \
- desktop.py \
- deviceevent.py \
- document.py \
- editabletext.py \
- event.py \
- factory.py \
- hyperlink.py \
- hypertext.py \
- image.py \
- __init__.py \
- interfaces.py \
- loginhelper.py \
- registry.py \
- relation.py \
- role.py \
- selection.py \
- state.py \
- table.py \
- text.py \
- utils.py \
- value.py
-
-CLEANFILES = *.pyc
diff --git a/pyatspi/__init__.py b/pyatspi/__init__.py
deleted file mode 100644
index 3ad8476f..00000000
--- a/pyatspi/__init__.py
+++ /dev/null
@@ -1,30 +0,0 @@
-#Copyright (C) 2008 Codethink Ltd
-
-#This library is free software; you can redistribute it and/or
-#modify it under the terms of the GNU Lesser General Public
-#License version 2 as published by the Free Software Foundation.
-
-#This program 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 General Public License for more details.
-#You should have received a copy of the GNU Lesser General Public License
-#along with this program; if not, write to the Free Software
-#Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-__version__ = (1, 9, 0)
-
-import registry
-Registry = registry._Registry()
-registry._Registry = Registry
-del registry
-
-import constants
-from Accessibility import *
-
-#This is a re-creation of the namespace pollution implemented
-#by PyORBit.
-import sys
-import Accessibility
-sys.modules['Accessibility'] = Accessibility
-del sys
diff --git a/pyatspi/accessible.py b/pyatspi/accessible.py
deleted file mode 100644
index 8bbe9b29..00000000
--- a/pyatspi/accessible.py
+++ /dev/null
@@ -1,283 +0,0 @@
-#Copyright (C) 2008 Codethink Ltd
-
-#This library is free software; you can redistribute it and/or
-#modify it under the terms of the GNU Lesser General Public
-#License version 2 as published by the Free Software Foundation.
-
-#This program 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 General Public License for more details.
-#You should have received a copy of the GNU Lesser General Public License
-#along with this program; if not, write to the Free Software
-#Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-from interfaces import ATSPI_ACCESSIBLE, ATSPI_APPLICATION
-from base import BaseProxy, Enum
-from factory import accessible_factory
-from state import StateSet, _marshal_state_set
-from relation import _marshal_relation_set
-from role import Role, ROLE_NAMES
-
-__all__ = [
- "LOCALE_TYPE",
- "LOCALE_TYPE_COLLATE",
- "LOCALE_TYPE_CTYPE",
- "LOCALE_TYPE_MESSAGES",
- "LOCALE_TYPE_MONETARY",
- "LOCALE_TYPE_NUMERIC",
- "LOCALE_TYPE_TIME",
- "BoundingBox",
- "Accessible",
- ]
-
-#------------------------------------------------------------------------------
-
-class LOCALE_TYPE(Enum):
- _enum_lookup = {
- 0:'LOCALE_TYPE_MESSAGES',
- 1:'LOCALE_TYPE_COLLATE',
- 2:'LOCALE_TYPE_CTYPE',
- 3:'LOCALE_TYPE_MONETARY',
- 4:'LOCALE_TYPE_NUMERIC',
- 5:'LOCALE_TYPE_TIME',
- }
-
-LOCALE_TYPE_COLLATE = LOCALE_TYPE(1)
-LOCALE_TYPE_CTYPE = LOCALE_TYPE(2)
-LOCALE_TYPE_MESSAGES = LOCALE_TYPE(0)
-LOCALE_TYPE_MONETARY = LOCALE_TYPE(3)
-LOCALE_TYPE_NUMERIC = LOCALE_TYPE(4)
-LOCALE_TYPE_TIME = LOCALE_TYPE(5)
-
-#------------------------------------------------------------------------------
-
-class BoundingBox(list):
- def __new__(cls, x, y, width, height):
- return list.__new__(cls, (x, y, width, height))
- def __init__(self, x, y, width, height):
- list.__init__(self, (x, y, width, height))
-
- def __str__(self):
- return ("(%d, %d, %d, %d)" % (self.x, self.y, self.width, self.height))
-
- def _get_x(self):
- return self[0]
- def _set_x(self, val):
- self[0] = val
- x = property(fget=_get_x, fset=_set_x)
- def _get_y(self):
- return self[1]
- def _set_y(self, val):
- self[1] = val
- y = property(fget=_get_y, fset=_set_y)
- def _get_width(self):
- return self[2]
- def _set_width(self, val):
- self[2] = val
- width = property(fget=_get_width, fset=_set_width)
- def _get_height(self):
- return self[3]
- def _set_height(self, val):
- self[3] = val
- height = property(fget=_get_height, fset=_set_height)
-
-#------------------------------------------------------------------------------
-
-class Accessible(BaseProxy):
- """
- 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.
- """
-
- _relation_set = None
-
- def __nonzero__(self):
- return True
-
- def __len__(self):
- return self.getChildCount()
-
- def __getitem__(self, index):
- return self.getChildAtIndex(index)
-
- def getApplication(self):
- """
- Get the containing Application for this object.
- @return the Application instance to which this object belongs.
- """
- return self._cache.create_application(self._app_name)
-
- def getAttributes(self):
- """
- 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/).
-
- @return : An AttributeSet encapsulating any "attribute values"
- currently defined for the object. An attribute set is a list of strings
- with each string comprising an name-value pair format 'name:value'.
- """
- func = self.get_dbus_method("getAttributes", dbus_interface=ATSPI_ACCESSIBLE)
- return [key + ':' + value for key, value in func().iteritems()]
-
- def getChildAtIndex(self, index):
- """
- Get the accessible child of this object at index.
- @param : index
- an in parameter indicating which child is requested (zero-indexed).
- @return : the 'nth' Accessible child of this object.
- """
- path = self.cached_data.children[index]
- return self._cache.create_accessible(self._app_name, path, ATSPI_ACCESSIBLE)
-
- def getIndexInParent(self):
- """
- Get the index of this object in its parent's child list.
- @return : a long integer indicating this object's index in the
- parent's list.
- """
- if self.parent == None:
- return -1
- for i in range(0, self.parent.childCount):
- child = self.parent.getChildAtIndex(i)
- if self.isEqual(child):
- return i
- raise AccessibleObjectNoLongerExists("Child not found within parent")
-
- def getLocalizedRoleName(self):
- """
- Get a string indicating the type of UI role played by this object,
- translated to the current locale.
- @return : a UTF-8 string indicating the type of UI role played
- by this object.
- """
- func = self.get_dbus_method("getLocalizedRoleName", dbus_interface=ATSPI_ACCESSIBLE)
- return func()
-
- def getRelationSet(self):
- """
- Get a set defining this object's relationship to other accessible
- objects.
- @return : a RelationSet defining this object's relationships.
- """
- if self._relation_set:
- return self._relation_set
- else:
- func = self.get_dbus_method("getRelationSet", dbus_interface=ATSPI_ACCESSIBLE)
- relation_set = func()
- self._relation_set = _marshal_relation_set(self._cache, self._app_name, relation_set)
- return self._relation_set
-
- def getRole(self):
- """
- Get the Role indicating the type of UI role played by this object.
- @return : a Role indicating the type of UI role played by this
- object.
- """
- return Role(self.cached_data.role)
-
- def getRoleName(self):
- """
- Get a string indicating the type of UI role played by this object.
- @return : a UTF-8 string indicating the type of UI role played
- by this object.
- """
- """
- func = self.get_dbus_method("getRoleName", dbus_interface=ATSPI_ACCESSIBLE)
- return func()
- """
- return ROLE_NAMES[self.cached_data.role]
-
- def getState(self):
- """
- Get the current state of the object as a StateSet.
- @return : a StateSet encapsulating the currently true states
- of the object.
- """
- return _marshal_state_set(self.cached_data.state)
-
- def isEqual(self, accessible):
- """
- 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.
- @param : obj
- an Accessible object reference to compare to
- @return : a boolean indicating whether the two object references
- point to the same object.
- """
- return (self._app_name == accessible._app_name) and \
- (self._acc_path == accessible._acc_path)
-
-
- def get_childCount(self):
- return len(self.cached_data.children)
- _childCountDoc = \
- """
- childCount: the number of children contained by this object.
- """
- childCount = property(fget=get_childCount, doc=_childCountDoc)
-
- getChildCount = get_childCount
-
- def get_description(self):
- return self.cached_data.description
- _descriptionDoc = \
- """
- a string describing the object in more detail than name.
- """
- description = property(fget=get_description, doc=_descriptionDoc)
-
- def get_name(self):
- return self.cached_data.name
- _nameDoc = \
- """
- a (short) string representing the object's name.
- """
- name = property(fget=get_name, doc=_nameDoc)
-
- def get_parent(self):
- return self._cache.create_accessible(self._app_name,
- self.cached_data.parent,
- ATSPI_ACCESSIBLE)
-
- _parentDoc = \
- """
- an Accessible object which is this object's containing object.
- """
- parent = property(fget=get_parent, doc=_parentDoc)
-
- def refresh(self):
- self._relation_set = None
- self._cache.application_cache[self._app_name]._refresh()
-
-# Register the accessible class with the factory.
-accessible_factory.register_accessible_class(ATSPI_ACCESSIBLE, Accessible)
-
-#END----------------------------------------------------------------------------
diff --git a/pyatspi/accessiblecache.py b/pyatspi/accessiblecache.py
deleted file mode 100644
index b1907931..00000000
--- a/pyatspi/accessiblecache.py
+++ /dev/null
@@ -1,196 +0,0 @@
-#Copyright (C) 2008 Codethink Ltd
-
-#This library is free software; you can redistribute it and/or
-#modify it under the terms of the GNU Lesser General Public
-#License version 2 as published by the Free Software Foundation.
-
-#This program 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 General Public License for more details.
-#You should have received a copy of the GNU Lesser General Public License
-#along with this program; if not, write to the Free Software
-#Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-import dbus as _dbus
-
-from event import Event as _Event
-
-#------------------------------------------------------------------------------
-
-class _CacheData(object):
- __slots__ = [
- 'path',
- 'parent',
- 'interfaces',
- 'children',
- 'role',
- 'name',
- 'description',
- 'state',
- ]
-
- def __init__(self, data):
- self._update(data)
-
- def _update(self, data):
- (self.path,
- self.parent,
- self.children,
- self.interfaces,
- self.name,
- self.role,
- self.description,
- self.state) = data
-
-#------------------------------------------------------------------------------
-
-def _list_items_added_removed (l1, l2):
- """
- Returns a tuple (boolean, boolean).
- The first value indicates if, when
- moving from l1 to l2, any items have been added.
- The second value indicates whether any items have
- been removed.
- """
- l1notl2 = [item for item in l1 if item not in l2]
- l2notl1 = [item for item in l2 if item not in l1]
- return ((len(l1notl2) > 0), (len(l2notl1) > 0))
-
-#------------------------------------------------------------------------------
-
-class AccessibleCache(object):
- """
- There is one accessible cache per application.
- For each application the accessible cache stores
- data on every accessible object within the app.
-
- It also acts as the factory for creating client
- side proxies for these accessible objects.
-
- connection - DBus connection.
- busName - Name of DBus connection where cache interface resides.
- """
-
- _PATH = '/org/freedesktop/atspi/tree'
- _INTERFACE = 'org.freedesktop.atspi.Tree'
- _GET_METHOD = 'getTree'
- _UPDATE_SIGNAL = 'updateAccessible'
- _REMOVE_SIGNAL = 'removeAccessible'
-
- def __init__(self, registry, connection, bus_name):
- """
- Creates a cache.
-
- connection - DBus connection.
- busName - Name of DBus connection where cache interface resides.
- """
- self._registry = registry
- self._connection = connection
- self._bus_name = bus_name
-
- obj = connection.get_object(bus_name, self._PATH, introspect=False)
- self._tree_itf = _dbus.Interface(obj, self._INTERFACE)
-
- self._objects = {}
-
- get_method = self._tree_itf.get_dbus_method(self._GET_METHOD)
- self._update_objects(get_method())
-
- self._updateMatch = self._tree_itf.connect_to_signal(self._UPDATE_SIGNAL, self._update_single)
- self._removeMatch = self._tree_itf.connect_to_signal(self._REMOVE_SIGNAL, self._remove_object)
-
- self._root = self._tree_itf.getRoot()
-
- def __getitem__(self, key):
- return self._objects[key]
-
- def __contains__(self, key):
- return key in self._objects
-
- def _dispatch_event(self, olddata, newdata):
- if olddata.name != newdata.name:
- event = _Event(self._registry.cache,
- newdata.path,
- self._bus_name,
- "org.freedesktop.atspi.Event.Object",
- "property-change",
- ("accessible-name", 0, 0, newdata.name))
- self._registry._notifyNameChange(event)
-
- if olddata.description != newdata.description:
- event = _Event(self._registry.cache,
- newdata.path,
- self._bus_name,
- "org.freedesktop.atspi.Event.Object",
- "property-change",
- ("accessible-description", 0, 0, newdata.description))
- self._registry._notifyDescriptionChange(event)
-
- if olddata.parent != newdata.parent:
- event = _Event(self._registry.cache,
- newdata.path,
- self._bus_name,
- "org.freedesktop.atspi.Event.Object",
- "property-change",
- ("accessible-parent", 0, 0, ""))
- self._registry._notifyParentChange(event)
-
- removed, added = _list_items_added_removed (olddata.children, newdata.children)
-
- if added:
- event = _Event(self._registry.cache,
- newdata.path,
- self._bus_name,
- "org.freedesktop.atspi.Event.Object",
- "children-changed",
- ("add", 0, 0, ""))
- self._registry._notifyChildrenChange(event)
-
- if removed:
- event = _Event(self._registry.cache,
- newdata.path,
- self._bus_name,
- "org.freedesktop.atspi.Event.Object",
- "children-changed",
- ("remove", 0, 0, ""))
- self._registry._notifyChildrenChange(event)
-
- # TODO This should be the other way around. Single is more common than many.
- def _update_single(self, object):
- self._update_objects ([object])
-
- def _update_objects(self, objects):
- cache_update_objects = []
- for data in objects:
- #First element is the object path.
- path = data[0]
- if path in self._objects:
- olddata = self._objects[path]
- newdata = _CacheData(data)
- cache_update_objects.append((olddata, newdata))
- self._objects[path] = newdata
- else:
- self._objects[path] = _CacheData(data)
- for old, new in cache_update_objects:
- self._dispatch_event(old, new)
-
- def _remove_object(self, path):
- # TODO I'm squashing a possible error here
- # I've seen things appear to be deleted twice
- # which needs investigation
- try:
- del(self._objects[path])
- except KeyError:
- pass
-
- def _get_root(self):
- return self._root
-
- def _refresh(self):
- get_method = self._tree_itf.get_dbus_method(self._GET_METHOD)
- self._update_objects(get_method())
-
- root = property(fget=_get_root)
-
-#END---------------------------------------------------------------------------
diff --git a/pyatspi/action.py b/pyatspi/action.py
deleted file mode 100644
index 5ac22622..00000000
--- a/pyatspi/action.py
+++ /dev/null
@@ -1,111 +0,0 @@
-#Copyright (C) 2008 Codethink Ltd
-
-#This library is free software; you can redistribute it and/or
-#modify it under the terms of the GNU Lesser General Public
-#License version 2 as published by the Free Software Foundation.
-
-#This program 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 General Public License for more details.
-#You should have received a copy of the GNU Lesser General Public License
-#along with this program; if not, write to the Free Software
-#Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-from interfaces import *
-from accessible import Accessible
-from factory import accessible_factory
-
-import dbus
-
-__all__ = [
- "Action",
- ]
-
-#------------------------------------------------------------------------------
-
-class Action(Accessible):
- """
- 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.
- """
-
- def getActions(self):
- """
- getActions:
- Retrieves all the actions at once.
- @return : an array of an array of strings in the form
- [[name, description, keybinding], ...]
- """
- func = self.get_dbus_method("getActions", dbus_interface=ATSPI_ACTION)
- return func()
-
- def doAction(self, index):
- """
- doAction:
- @param : index
- the 0-based index of the action to perform.
- Causes the object to perform the specified action.
- @return : a boolean indicating success or failure.
- """
- func = self.get_dbus_method("doAction", dbus_interface=ATSPI_ACTION)
- return func(index)
-
- def getDescription(self, index):
- """
- getDescription:
- @param : index
- the index of the action for which a description is desired.
- Get the description of the specified action. The description
- of an action may provide information about the result of action
- invocation, unlike the action name.
- @return : a string containing the description of the specified
- action.
- """
- func = self.get_dbus_method("getDescription", dbus_interface=ATSPI_ACTION)
- return func(index)
-
- def getKeyBinding(self, index):
- """
- getKeyBinding:
- @param : index
- the 0-based index of the action for which a key binding is requested.
- Get the key binding associated with a specific action.
- @return : a string containing the key binding for the specified
- action, or an empty string ("") if none exists.
- """
- func = self.get_dbus_method("getKeyBinding", dbus_interface=ATSPI_ACTION)
- return func(index)
-
- def getName(self, index):
- """
- getName:
- @param : index
- the index of the action whose name is requested.
- Get the name of the specified action. Action names generally
- describe the user action, i.e. "click" or "press", rather then
- the result of invoking the action.
- @return : a string containing the name of the specified action.
- """
- func = self.get_dbus_method("getName", dbus_interface=ATSPI_ACTION)
- return func(index)
-
- def get_nActions(self):
- return dbus.Int32(self._pgetter(self._dbus_interface, "nActions"))
- _nActionsDoc = \
- """
- nActions: a long containing the number of actions this object
- supports.
- """
- nActions = property(fget=get_nActions, doc=_nActionsDoc)
-
-# Register the accessible class with the factory.
-accessible_factory.register_accessible_class(ATSPI_ACTION, Action)
-
-#END----------------------------------------------------------------------------
diff --git a/pyatspi/application.py b/pyatspi/application.py
deleted file mode 100644
index ca126fe9..00000000
--- a/pyatspi/application.py
+++ /dev/null
@@ -1,68 +0,0 @@
-#Copyright (C) 2008 Codethink Ltd
-
-#This library is free software; you can redistribute it and/or
-#modify it under the terms of the GNU Lesser General Public
-#License version 2 as published by the Free Software Foundation.
-
-#This program 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 General Public License for more details.
-#You should have received a copy of the GNU Lesser General Public License
-#along with this program; if not, write to the Free Software
-#Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-from interfaces import *
-from factory import accessible_factory
-from accessible import Accessible
-
-import dbus
-
-__all__ = [
- "Application",
- ]
-
-#------------------------------------------------------------------------------
-
-class Application(Accessible):
- """
- 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.
- """
-
- def getLocale(self, locale_type):
- """
- Gets the locale in which the application is currently operating.
- For the current message locale, use lctype LOCALE_TYPE_MESSAGES.
- @param : lctype
- The LocaleType for which the locale is queried.
- @return a string compliant with the POSIX standard for locale
- description.
- """
- func = self.get_dbus_method("getLocale", dbus_interface=ATSPI_APPLICATION)
- return func(local_type)
-
- def get_toolkitName(self):
- return dbus.String(self._pgetter(self._dbus_interface, "toolkitName"))
- _toolkitNameDoc = \
- """
- A string indicating the type of user interface toolkit which
- is used by the application.
- """
- toolkitName = property(fget=get_toolkitName, doc=_toolkitNameDoc)
-
- def get_version(self):
- return dbus.String(self._pgetter(self._dbus_interface, "version"))
- _versionDoc = \
- """
- A string indicating the version number of the application's accessibility
- bridge implementation.
- """
- version = property(fget=get_version, doc=_versionDoc)
-
-# Register the accessible class with the factory.
-accessible_factory.register_accessible_class(ATSPI_APPLICATION, Application)
-
-#END----------------------------------------------------------------------------
diff --git a/pyatspi/applicationcache.py b/pyatspi/applicationcache.py
deleted file mode 100644
index 68fa65ab..00000000
--- a/pyatspi/applicationcache.py
+++ /dev/null
@@ -1,248 +0,0 @@
-#Copyright (C) 2008 Codethink Ltd
-
-#This library is free software; you can redistribute it and/or
-#modify it under the terms of the GNU Lesser General Public
-#License version 2 as published by the Free Software Foundation.
-
-#This program 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 General Public License for more details.
-#You should have received a copy of the GNU Lesser General Public License
-#along with this program; if not, write to the Free Software
-#Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-import dbus
-
-from accessiblecache import AccessibleCache
-from desktop import Desktop, DESKTOP_PATH
-from factory import accessible_factory
-from event import Event as _Event
-from base import AccessibleObjectNotAvailable
-
-from interfaces import *
-
-__all__ = [
- "ApplicationCache",
- "TestApplicationCache",
- ]
-
-#------------------------------------------------------------------------------
-
-ROOT_PATH = '/org/freedesktop/atspi/accessible/root'
-
-#------------------------------------------------------------------------------
-
-class TestApplicationCache(object):
-
- """
- Test application store, accesses a single application.
-
- The store object acts as a central class for creating accessible objects.
- It interfaces with the ATSPI registry to keep account of all accessible
- applications. It contains the accessible cache objects from each application.
-
- @registry: Each accessible cache object must have a reference to the registry
- object to send update events.
-
- @connection: D-Bus connection used to access applications.
-
- @bus_name: The test store only accesses one accessible application, this is its
- D-Bus path.
- """
-
- def __init__(self, registry, connection, bus_name):
- self._connection = connection
-
- self.application_list = [bus_name]
- self.application_cache = {bus_name:AccessibleCache(registry, connection, bus_name)}
-
- def get_cache_data(self, app_name, acc_path):
- """
- Returns the cache tuple for the given application and accessible
- object path. Throws an IndexError if the cache data is not found.
- """
- return self.application_cache[app_name][acc_path]
-
- def create_application(self, app_name):
- """
- Creates an accessible object for the root of the application
- available at the given D-Bus name.
- """
- cls = accessible_factory.get_accessible_class(ATSPI_APPLICATION)
- try:
- return cls(app_name, self.application_cache[app_name].root, self, ATSPI_APPLICATION)
- except KeyError:
- raise AccessibleObjectNotAvailable ()
-
- def create_accessible(self, app_name, acc_path, interface, dbus_object=None):
- """
- Creates an accessible object.
-
- @app_name: D-Bus name of the application where the accessible object resides.
-
- @acc_path: D-Bus path of the object within the application.
-
- @interface: D-Bus interface of the requested object. A different accessible object
- class will be created depending on this. Making the function much like
- an accessible object factory.
-
- @dbus_object: If a D-Bus object already exists for the accessible object it can be
- provided here so that another one is not created.
- """
- # An acc_path of '/' implies the desktop object, whatever the app_name.
- if acc_path == DESKTOP_PATH:
- return Desktop(self)
- if acc_path == ROOT_PATH:
- return None
- else:
- cls = accessible_factory.get_accessible_class(interface)
- try:
- return cls(app_name, acc_path, self, interface, dbus_object=dbus_object)
- except KeyError:
- raise AccessibleObjectNotAvailable ()
-
- @property
- def connection(self):
- """
- D-Bus connection used by the store.
- """
- return self._connection
-
-#------------------------------------------------------------------------------
-
-class ApplicationCache(object):
- """
- Test application store, accesses a single application.
-
- The store object acts as a central class for creating accessible objects.
- It interfaces with the ATSPI registry to keep account of all accessible
- applications. It contains the accessible cache objects from each application.
-
- @registry: Each accessible cache object must have a reference to the registry
- object to send update events.
-
- @connection: D-Bus connection used to access applications.
-
- @bus_name: The test store only accesses one accessible application, this is its
- D-Bus path.
- """
-
- _APPLICATIONS_ADD = 1
- _APPLICATIONS_REMOVE = 0
-
- def __init__(self, registry, connection):
- self._connection = connection
- self._registry = registry
-
- self.application_list = []
- self.application_cache = {}
-
- self._regsig = connection.add_signal_receiver(self.update_handler,
- dbus_interface=ATSPI_REGISTRY_INTERFACE,
- signal_name="updateApplications")
-
- obj = connection.get_object(ATSPI_REGISTRY_NAME,
- ATSPI_REGISTRY_PATH,
- introspect=False)
- self._app_register = dbus.Interface(obj, ATSPI_REGISTRY_INTERFACE)
-
- self.application_list.extend(self._app_register.getApplications())
- for bus_name in self.application_list:
- self.application_cache[bus_name] = AccessibleCache(self._registry, self._connection, bus_name)
-
- def update_handler (self, update_type, bus_name):
- if update_type == ApplicationCache._APPLICATIONS_ADD:
- #TODO Check that app does not already exist
- #TODO Excuding this app is a hack, need to have re-entrant method calls.
- if bus_name != self._connection.get_unique_name ():
- self.application_list.append(bus_name)
- self.application_cache[bus_name] = AccessibleCache(self._registry,
- self._connection,
- bus_name)
- event = _Event(self,
- DESKTOP_PATH,
- ATSPI_REGISTRY_NAME,
- "org.freedesktop.atspi.Event.Object",
- "children-changed",
- ("add", 0, 0, ""))
- elif update_type == ApplicationCache._APPLICATIONS_REMOVE:
- #TODO Fail safely if app does not exist
- self.application_list.remove(bus_name)
- del(self.application_cache[bus_name])
- event = _Event(self,
- DESKTOP_PATH,
- ATSPI_REGISTRY_NAME,
- "org.freedesktop.atspi.Event.Object",
- "children-changed",
- ("remove", 0, 0, ""))
-
- self._registry._notifyChildrenChange(event)
-
- def get_cache_data(self, app_name, acc_path):
- """
- Returns the cache tuple for the given application and accessible
- object path. Throws an IndexError if the cache data is not found.
- """
- return self.application_cache[app_name][acc_path]
-
- def create_application(self, app_name):
- """
- Creates an accessible object for the root of the application
- available at the given D-Bus name.
- """
- if app_name == ATSPI_REGISTRY_NAME:
- return Desktop(self)
- else:
- cls = accessible_factory.get_accessible_class(ATSPI_APPLICATION)
- try:
- return cls(app_name, self.application_cache[app_name].root, self, ATSPI_APPLICATION)
- except KeyError:
- raise AccessibleObjectNotAvailable ()
-
- def create_accessible(self, app_name, acc_path, interface, dbus_object=None):
- """
- Creates an accessible object.
-
- @app_name: D-Bus name of the application where the accessible object resides.
-
- @acc_path: D-Bus path of the object within the application.
-
- @interface: D-Bus interface of the requested object. A different accessible object
- class will be created depending on this. Making the function much like
- an accessible object factory.
-
- @dbus_object: If a D-Bus object already exists for the accessible object it can be
- provided here so that another one is not created.
- """
- if acc_path == DESKTOP_PATH:
- return Desktop(self)
- if acc_path == ROOT_PATH:
- return None
- else:
- cls = accessible_factory.get_accessible_class(interface)
- try:
- return cls(app_name, acc_path, self, interface, dbus_object=dbus_object)
- except KeyError:
- raise AccessibleObjectNotAvailable ()
-
- @property
- def connection(self):
- """
- D-Bus connection used by the store.
- """
- return self._connection
-
- def _refresh(self):
- new = self._app_register.getApplications()
- removed = [item for item in self.application_list if item not in new]
- added = [item for item in new if item not in self.application_list]
- for item in added:
- self.update_handler (self._APPLICATIONS_ADD, item)
- for item in removed:
- self.update_handler (self._APPLICATIONS_REMOVE, item)
-
- for item in self.application_cache.values():
- item._refresh()
-
-#END----------------------------------------------------------------------------
diff --git a/pyatspi/base.py b/pyatspi/base.py
deleted file mode 100644
index 7096d1ba..00000000
--- a/pyatspi/base.py
+++ /dev/null
@@ -1,203 +0,0 @@
-#Copyright (C) 2008 Codethink Ltd
-
-#This library is free software; you can redistribute it and/or
-#modify it under the terms of the GNU Lesser General Public
-#License version 2 as published by the Free Software Foundation.
-
-#This program 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 General Public License for more details.
-#You should have received a copy of the GNU Lesser General Public License
-#along with this program; if not, write to the Free Software
-#Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-import dbus
-from dbus.proxies import Interface
-from dbus.exceptions import *
-
-import interfaces
-
-__all__ = [
- "AccessibleObjectNoLongerExists",
- "AccessibleObjectNotAvailable",
- "Enum",
- "BaseProxy",
- "_repack_tuple",
- ]
-
-class AccessibleObjectNoLongerExists(Exception):
- pass
-
-class AccessibleObjectNotAvailable(Exception):
- pass
-
-#------------------------------------------------------------------------------
-
-def _repack_tuple (tup):
- """
- Re-packs a tuple moving the last element to the beginning.
- """
- return (tup[-1] ,) + tup[:-1]
-
-#------------------------------------------------------------------------------
-
-class Enum(dbus.UInt32):
- def __str__(self):
- return self._enum_lookup[int(self)]
-
- def __eq__(self, other):
- if other is None:
- return False
- if int(self) == int(other):
- return True
- else:
- return False
-
- def __hash__(self):
- return int(self)
-
-#------------------------------------------------------------------------------
-
-
-class BaseProxyMeta(type):
- def __new__(meta, *args, **kwargs):
- cls = type.__new__(meta, *args, **kwargs)
-
- queryable_interfaces = {
- 'Accessible':interfaces.ATSPI_ACCESSIBLE,
- 'Action':interfaces.ATSPI_ACTION,
- 'Application':interfaces.ATSPI_APPLICATION,
- 'Collection':interfaces.ATSPI_COLLECTION,
- 'Component':interfaces.ATSPI_COMPONENT,
- 'Desktop':interfaces.ATSPI_DESKTOP,
- 'Document':interfaces.ATSPI_DOCUMENT,
- 'EditableText':interfaces.ATSPI_EDITABLE_TEXT,
- 'Hypertext':interfaces.ATSPI_HYPERTEXT,
- 'Hyperlink':interfaces.ATSPI_HYPERLINK,
- 'Image':interfaces.ATSPI_IMAGE,
- 'Selection':interfaces.ATSPI_SELECTION,
- 'StreamableContent':interfaces.ATSPI_STREAMABLE_CONTENT,
- 'Table':interfaces.ATSPI_TABLE,
- 'Text':interfaces.ATSPI_TEXT,
- 'Value':interfaces.ATSPI_VALUE,
- }
-
- def return_query(interface):
- def new_query(self):
- return self.queryInterface(interface)
- return new_query
-
- for interface in queryable_interfaces.keys():
- name = 'query%s' % interface
- setattr(cls, name, return_query(queryable_interfaces[interface]))
-
- return cls
-
-#------------------------------------------------------------------------------
-
-class BaseProxy(object):
- """
- The base D-Bus proxy for a remote object that implements one or more
- of the AT-SPI interfaces.
- """
-
- __metaclass__ = BaseProxyMeta
-
- def __init__(self, app_name, acc_path, cache, interface, dbus_object=None):
- """
- Create a D-Bus Proxy for an ATSPI interface.
-
- cache - ApplicationCache, where the cached data for the accessible can be obtained.
- app_name - D-Bus bus name of the application this accessible belongs to.
- acc_path - D-Bus object path of the server side accessible object.
- parent - Parent accessible.
- dbus_object(kwarg) - The D-Bus proxy object used by the accessible for D-Bus method calls.
- """
- self._cache = cache
- self._app_name = app_name
- self._acc_path = acc_path
- self._dbus_interface = interface
-
- if not dbus_object:
- dbus_object = cache.connection.get_object(self._app_name,
- self._acc_path,
- introspect=False)
- self._dbus_object = dbus_object
-
- self._pgetter = self.get_dbus_method("Get",
- dbus_interface="org.freedesktop.DBus.Properties")
- self._psetter = self.get_dbus_method("Set",
- dbus_interface="org.freedesktop.DBus.Properties")
-
- def __str__(self):
- try:
- return '[%s | %s]' % (self.getRoleName(), self.name)
- except Exception:
- return '[DEAD]'
-
- def __eq__(self, other):
- if other is None:
- return False
- try:
- if self._app_name == other._app_name and \
- self._acc_path == other._acc_path:
- return True
- else:
- return False
- except AttributeError:
- return False
-
- def __ne__(self, other):
- return not self.__eq__(other)
-
- def __hash__(self):
- return hash(self._app_name + self._acc_path)
-
- def get_dbus_method(self, *args, **kwargs):
- method = self._dbus_object.get_dbus_method(*args, **kwargs)
-
- def dbus_method_func(*iargs, **ikwargs):
- # TODO Need to throw an AccessibleObjectNoLongerExists exception
- # on D-Bus error of the same type.
- try:
- return method(*iargs, **ikwargs)
- except UnknownMethodException, e:
- raise NotImplementedError(e)
- except DBusException, e:
- raise LookupError(e)
-
- return dbus_method_func
-
- @property
- def cached_data(self):
- try:
- return self._cache.get_cache_data(self._app_name, self._acc_path)
- except KeyError:
- raise AccessibleObjectNoLongerExists, \
- 'Cache data cannot be found for path %s in app %s' % (self._acc_path, self._app_name)
-
- @property
- def interfaces(self):
- return self.cached_data.interfaces
-
- def queryInterface(self, interface):
- """
- Gets a different accessible interface for this object
- or raises a NotImplemented error if the given interface
- is not supported.
- """
- if interface in self.interfaces:
- return self._cache.create_accessible(self._app_name,
- self._acc_path,
- interface,
- dbus_object=self._dbus_object)
- else:
- raise NotImplementedError(
- "%s not supported by accessible object at path %s"
- % (interface, self._acc_path))
-
- def flushCache(self):
- pass
-
-#END----------------------------------------------------------------------------
diff --git a/pyatspi/collection.py b/pyatspi/collection.py
deleted file mode 100644
index a5be8209..00000000
--- a/pyatspi/collection.py
+++ /dev/null
@@ -1,110 +0,0 @@
-#Copyright (C) 2008 Codethink Ltd
-
-#This library is free software; you can redistribute it and/or
-#modify it under the terms of the GNU Lesser General Public
-#License version 2 as published by the Free Software Foundation.
-
-#This program 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 General Public License for more details.
-#You should have received a copy of the GNU Lesser General Public License
-#along with this program; if not, write to the Free Software
-#Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-from interfaces import *
-from base import Enum
-from accessible import Accessible
-from factory import accessible_factory
-
-__all__ = [
- "Collection",
- ]
-
-#------------------------------------------------------------------------------
-
-class Collection(Accessible):
-
- def createMatchRule(self, *args, **kwargs):
- func = self.get_dbus_method("createMatchRule", dbus_interface=ATSPI_COLLECTION)
- return func(*args, **kwargs)
-
- def freeMatchRule(self, *args, **kwargs):
- func = self.get_dbus_method("freeMatchRule", dbus_interface=ATSPI_COLLECTION)
- return func(*args, **kwargs)
-
- def getActiveDescendant(self, *args, **kwargs):
- func = self.get_dbus_method("getActiveDescendant", dbus_interface=ATSPI_COLLECTION)
- return func(*args, **kwargs)
-
- def getMatches(self, *args, **kwargs):
- func = self.get_dbus_method("getMatches", dbus_interface=ATSPI_COLLECTION)
- return func(*args, **kwargs)
-
- def getMatchesFrom(self, *args, **kwargs):
- func = self.get_dbus_method("getMatchesFrom", dbus_interface=ATSPI_COLLECTION)
- return func(*args, **kwargs)
-
- def getMatchesTo(self, *args, **kwargs):
- func = self.get_dbus_method("getMatchesTo", dbus_interface=ATSPI_COLLECTION)
- return func(*args, **kwargs)
-
- def isAncestorOf(self, *args, **kwargs):
- func = self.get_dbus_method("isAncestorOf", dbus_interface=ATSPI_COLLECTION)
- return func(*args, **kwargs)
-
- class MatchType(Enum):
- _enum_lookup = {
- 0:'MATCH_INVALID',
- 1:'MATCH_ALL',
- 2:'MATCH_ANY',
- 3:'MATCH_NONE',
- 4:'MATCH_EMPTY',
- 5:'MATCH_LAST_DEFINED',
- }
-
- MATCH_ALL = MatchType(1)
- MATCH_ANY = MatchType(2)
- MATCH_EMPTY = MatchType(4)
- MATCH_INVALID = MatchType(0)
- MATCH_LAST_DEFINED = MatchType(5)
- MATCH_NONE = MatchType(3)
-
- class SortOrder(Enum):
- _enum_lookup = {
- 0:'SORT_ORDER_INVALID',
- 1:'SORT_ORDER_CANONICAL',
- 2:'SORT_ORDER_FLOW',
- 3:'SORT_ORDER_TAB',
- 4:'SORT_ORDER_REVERSE_CANONICAL',
- 5:'SORT_ORDER_REVERSE_FLOW',
- 6:'SORT_ORDER_REVERSE_TAB',
- 7:'SORT_ORDER_LAST_DEFINED',
- }
-
- SORT_ORDER_CANONICAL = SortOrder(1)
- SORT_ORDER_FLOW = SortOrder(2)
- SORT_ORDER_INVALID = SortOrder(0)
- SORT_ORDER_LAST_DEFINED = SortOrder(7)
- SORT_ORDER_REVERSE_CANONICAL = SortOrder(4)
- SORT_ORDER_REVERSE_FLOW = SortOrder(5)
- SORT_ORDER_REVERSE_TAB = SortOrder(6)
- SORT_ORDER_TAB = SortOrder(3)
-
- class TreeTraversalType(Enum):
- _enum_lookup = {
- 0:'TREE_RESTRICT_CHILDREN',
- 1:'TREE_RESTRICT_SIBLING',
- 2:'TREE_INORDER',
- 3:'TREE_LAST_DEFINED',
- }
-
- TREE_INORDER = TreeTraversalType(2)
- TREE_LAST_DEFINED = TreeTraversalType(3)
- TREE_RESTRICT_CHILDREN = TreeTraversalType(0)
- TREE_RESTRICT_SIBLING = TreeTraversalType(1)
-
-# Register the accessible class with the factory.
-accessible_factory.register_accessible_class(ATSPI_COLLECTION, Collection)
-
-#END----------------------------------------------------------------------------
diff --git a/pyatspi/component.py b/pyatspi/component.py
deleted file mode 100644
index 9e7b36f0..00000000
--- a/pyatspi/component.py
+++ /dev/null
@@ -1,189 +0,0 @@
-#Copyright (C) 2008 Codethink Ltd
-
-#This library is free software; you can redistribute it and/or
-#modify it under the terms of the GNU Lesser General Public
-#License version 2 as published by the Free Software Foundation.
-
-#This program 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 General Public License for more details.
-#You should have received a copy of the GNU Lesser General Public License
-#along with this program; if not, write to the Free Software
-#Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-from interfaces import *
-from base import Enum
-from factory import accessible_factory
-from accessible import BoundingBox, Accessible
-
-from dbus.types import UInt32
-
-__all__ = [
- "CoordType",
- "XY_SCREEN",
- "XY_WINDOW",
- "ComponentLayer",
- "Component",
- "LAYER_BACKGROUND",
- "LAYER_CANVAS",
- "LAYER_INVALID",
- "LAYER_LAST_DEFINED",
- "LAYER_MDI",
- "LAYER_OVERLAY",
- "LAYER_POPUP",
- "LAYER_WIDGET",
- "LAYER_WINDOW",
- ]
-
-#------------------------------------------------------------------------------
-
-class CoordType(Enum):
- _enum_lookup = {
- 0:'XY_SCREEN',
- 1:'XY_WINDOW',
- }
-
-XY_SCREEN = CoordType(0)
-XY_WINDOW = CoordType(1)
-
-#------------------------------------------------------------------------------
-
-class ComponentLayer(Enum):
- _enum_lookup = {
- 0:'LAYER_INVALID',
- 1:'LAYER_BACKGROUND',
- 2:'LAYER_CANVAS',
- 3:'LAYER_WIDGET',
- 4:'LAYER_MDI',
- 5:'LAYER_POPUP',
- 6:'LAYER_OVERLAY',
- 7:'LAYER_WINDOW',
- 8:'LAYER_LAST_DEFINED',
- }
-
-LAYER_BACKGROUND = ComponentLayer(1)
-LAYER_CANVAS = ComponentLayer(2)
-LAYER_INVALID = ComponentLayer(0)
-LAYER_LAST_DEFINED = ComponentLayer(8)
-LAYER_MDI = ComponentLayer(4)
-LAYER_OVERLAY = ComponentLayer(6)
-LAYER_POPUP = ComponentLayer(5)
-LAYER_WIDGET = ComponentLayer(3)
-LAYER_WINDOW = ComponentLayer(7)
-
-#------------------------------------------------------------------------------
-
-class Component(Accessible):
- """
- 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.
- """
-
- def contains(self, x, y, coord_type):
- """
- @return True if the specified point lies within the Component's
- bounding box, False otherwise.
- """
- func = self.get_dbus_method("contains", dbus_interface=ATSPI_COMPONENT)
- return func(x, y, UInt32(coord_type))
-
- def getAccessibleAtPoint(self, x, y, coord_type):
- """
- @return the Accessible child whose bounding box contains the
- specified point.
- """
- func = self.get_dbus_method("getAccessibleAtPoint", dbus_interface=ATSPI_COMPONENT)
- return self._cache.create_accessible(self._app_name,
- func(x, y, UInt32(coord_type)),
- interfaces.ATSPI_COMPONENT)
-
- def getAlpha(self):
- """
- 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.
- """
- func = self.get_dbus_method("getAlpha", dbus_interface=ATSPI_COMPONENT)
- return func()
-
- def getExtents(self, coord_type):
- """
- Obtain the Component's bounding box, in pixels, relative to the
- specified coordinate system.
- @param coord_type
- @return a BoundingBox which entirely contains the object's onscreen
- visual representation.
- """
- func = self.get_dbus_method("getExtents", dbus_interface=ATSPI_COMPONENT)
- extents = func(UInt32(coord_type))
- return BoundingBox(*extents)
-
- def getLayer(self):
- """
- @return the ComponentLayer in which this object resides.
- """
- func = self.get_dbus_method("getLayer", dbus_interface=ATSPI_COMPONENT)
- return ComponentLayer(func())
-
- def getMDIZOrder(self):
- """
- 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.
- @return an integer indicating the object's place in the stacking
- order.
- """
- func = self.get_dbus_method("getMDIZOrder", dbus_interface=ATSPI_COMPONENT)
- return func()
-
- def getPosition(self, coord_type):
- """
- Obtain the position of the current component in the coordinate
- system specified by 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.
- """
- func = self.get_dbus_method("getPosition", dbus_interface=ATSPI_COMPONENT)
- return func(UInt32(coord_type))
-
- def getSize(self):
- """
- Obtain the size, in the coordinate system specified by 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.
- """
- func = self.get_dbus_method("getSize", dbus_interface=ATSPI_COMPONENT)
- return func()
-
- def grabFocus(self):
- """
- Request that the object obtain keyboard focus.
- @return True if keyboard focus was successfully transferred to
- the Component.
- """
- func = self.get_dbus_method("grabFocus", dbus_interface=ATSPI_COMPONENT)
- return func()
-
-# Register the accessible class with the factory.
-accessible_factory.register_accessible_class(ATSPI_COMPONENT, Component)
-
-#END----------------------------------------------------------------------------
diff --git a/pyatspi/constants.py b/pyatspi/constants.py
deleted file mode 100644
index b6c694ac..00000000
--- a/pyatspi/constants.py
+++ /dev/null
@@ -1,144 +0,0 @@
-#Copyright (C) 2008 Codethink Ltd
-#copyright: Copyright (c) 2005, 2007 IBM Corporation
-
-#This library is free software; you can redistribute it and/or
-#modify it under the terms of the GNU Lesser General Public
-#License version 2 as published by the Free Software Foundation.
-
-#This program 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 General Public License for more details.
-#You should have received a copy of the GNU Lesser General Public License
-#along with this program; if not, write to the Free Software
-#Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#Portions of this code originally licensed and copyright (c) 2005, 2007
-#IBM Corporation under the BSD license, available at
-#U{http://www.opensource.org/licenses/bsd-license.php}
-
-#authors: Peter Parente, Mark Doffman
-
-# Constants used in the Component interface to get screen coordinates
-DESKTOP_COORDS = 0
-WINDOW_COORDS = 1
-
-# Constants used to synthesize mouse events
-MOUSE_B1P = 'b1p'
-MOUSE_B1R = 'b1r'
-MOUSE_B1C = 'b1c'
-MOUSE_B1D = 'b1d'
-MOUSE_B2P = 'b2p'
-MOUSE_B2R = 'b2r'
-MOUSE_B2C = 'b2c'
-MOUSE_B2D = 'b2d'
-MOUSE_B3P = 'b3p'
-MOUSE_B3R = 'b3r'
-MOUSE_B3C = 'b3c'
-MOUSE_B3D = 'b3d'
-MOUSE_ABS = 'abs'
-MOUSE_REL = 'rel'
-
-# events that clear cached properties
-CACHE_EVENTS = ['object:property-change:accessible-name',
- 'object:property-change:accessible-description',
- 'object:property-change:accessible-role',
- 'object:property-change:accessible-parent']
-
-CACHE_PROPERTIES = ''
-
-# Dictionary used to correct the bug of not being able to register for all the
-# subevents given only an AT-SPI event class (i.e. first part of the event
-# name) keys are event names having subevents and values are the subevents
-# under the key event; handlers *can* be registered for events not in this tree
-EVENT_TREE = {
- 'terminal':
- ['terminal:line-changed',
- 'terminal:columncount-changed',
- 'terminal:linecount-changed',
- 'terminal:application-changed',
- 'terminal:charwidth-changed'
- ],
- 'document':
- ['document:load-complete',
- 'document:reload',
- 'document:load-stopped',
- 'document:content-changed',
- 'document:attributes-changed'
- ],
- 'object':
- ['object:property-change',
- 'object:bounds-changed',
- 'object:link-selected',
- 'object:state-changed',
- 'object:children-changed',
- 'object:visible-data-changed',
- 'object:selection-changed',
- 'object:model-changed',
- 'object:active-descendant-changed',
- 'object:row-inserted',
- 'object:row-reordered',
- 'object:row-deleted',
- 'object:column-inserted',
- 'object:column-reordered',
- 'object:column-deleted',
- 'object:text-bounds-changed',
- 'object:text-selection-changed',
- 'object:text-changed',
- 'object:text-attributes-changed',
- 'object:text-caret-moved',
- 'object:attributes-changed'],
- 'object:text-changed' :
- ['object:text-changed:insert',
- 'object:text-changed:delete'],
- 'object:property-change' :
- ['object:property-change:accessible-parent',
- 'object:property-change:accessible-name',
- 'object:property-change:accessible-description',
- 'object:property-change:accessible-value',
- 'object:property-change:accessible-role',
- 'object:property-change:accessible-table-caption',
- 'object:property-change:accessible-table-column-description',
- 'object:property-change:accessible-table-column-header',
- 'object:property-change:accessible-table-row-description',
- 'object:property-change:accessible-table-row-header',
- 'object:property-change:accessible-table-summary'],
- 'object:children-changed' :
- ['object:children-changed:add',
- 'object:children-changed:remove'],
- 'object:state-changed' :
- ['object:state-changed:'],
- 'mouse' :
- ['mouse:abs',
- 'mouse:rel',
- 'mouse:button'],
- 'mouse:button' :
- ['mouse:button:1p',
- 'mouse:button:1r',
- 'mouse:button:2p',
- 'mouse:button:2r',
- 'mouse:button:3p',
- 'mouse:button:3r'],
- 'window' :
- ['window:minimize',
- 'window:maximize',
- 'window:restore',
- 'window:close',
- 'window:create',
- 'window:reparent',
- 'window:desktop-create',
- 'window:desktop-destroy',
- 'window:activate',
- 'window:deactivate',
- 'window:raise',
- 'window:lower',
- 'window:move',
- 'window:resize',
- 'window:shade',
- 'window:unshade',
- 'window:restyle'],
- 'focus' :
- ['focus:']
-}
-
-from Accessibility import *
diff --git a/pyatspi/desktop.py b/pyatspi/desktop.py
deleted file mode 100644
index ed6a9ee1..00000000
--- a/pyatspi/desktop.py
+++ /dev/null
@@ -1,364 +0,0 @@
-#Copyright (C) 2008 Codethink Ltd
-
-#This library is free software; you can redistribute it and/or
-#modify it under the terms of the GNU Lesser General Public
-#License version 2 as published by the Free Software Foundation.
-
-#This program 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 General Public License for more details.
-#You should have received a copy of the GNU Lesser General Public License
-#along with this program; if not, write to the Free Software
-#Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-from interfaces import *
-from base import BaseProxyMeta
-from accessible import BoundingBox
-from state import StateSet
-
-from role import ROLE_UNKNOWN
-from component import LAYER_WIDGET
-
-__all__ = [
- "Desktop",
- "DESKTOP_PATH",
- ]
-
-#------------------------------------------------------------------------------
-
-DESKTOP_PATH = '/org/freedesktop/atspi/accessible/desktop'
-
-#------------------------------------------------------------------------------
-
-class DesktopComponent(object):
- """
- 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.
- """
-
- def contains(self, *args, **kwargs):
- """
- @return True if the specified point lies within the Component's
- bounding box, False otherwise.
- """
- return False
-
- def getAccessibleAtPoint(self, *args, **kwargs):
- """
- @return the Accessible child whose bounding box contains the
- specified point.
- """
- return None
-
- def getAlpha(self, *args, **kwargs):
- """
- 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.
- """
- return 1.0
-
- def getExtents(self, coord_type):
- """
- Obtain the Component's bounding box, in pixels, relative to the
- specified coordinate system.
- @param coord_type
- @return a BoundingBox which entirely contains the object's onscreen
- visual representation.
- """
- #TODO This needs to return the window size
- return BoundingBox(*(0,0,1024,768))
-
- def getLayer(self, *args, **kwargs):
- """
- @return the ComponentLayer in which this object resides.
- """
- return LAYER_WIDGET
-
- def getMDIZOrder(self):
- """
- 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.
- @return an integer indicating the object's place in the stacking
- order.
- """
- return 0
-
- def getPosition(self, coord_type):
- """
- Obtain the position of the current component in the coordinate
- system specified by 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.
- """
- return (0,0)
-
- def getSize(self, *args, **kwargs):
- """
- Obtain the size, in the coordinate system specified by 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.
- """
- #TODO Need to return window size
- return (1024, 768)
-
- def grabFocus(self, *args, **kwargs):
- """
- Request that the object obtain keyboard focus.
- @return True if keyboard focus was successfully transferred to
- the Component.
- """
- return False
-
-#------------------------------------------------------------------------------
-
-class Desktop(object):
- """
- 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.
- """
-
- __metaclass__ = BaseProxyMeta
-
- def __init__(self, cache):
- """
- Creates a desktop object. There should be one single desktop
- object for the Registry object.
-
- @param cache - The application cache.
- @kwarf application - The application D-Bus name
-
- If the application name is provided the Desktop is being used for
- test and will only report the application provided as its single child.
- """
- self._appcache = cache
- self._app_name = ':'
- self._acc_path = DESKTOP_PATH
-
- def __str__(self):
- try:
- return '[%s | %s]' % (self.getRoleName(), self.name)
- except Exception:
- return '[DEAD]'
-
- def __nonzero__(self):
- return True
-
- def __len__(self):
- return self.getChildCount()
-
- def __getitem__(self, index):
- # IndexError thrown by getChildAtIndex
- return self.getChildAtIndex(index)
-
- def __eq__(self, other):
- if other is None:
- return False
- try:
- if self._app_name == other._app_name and \
- self._acc_path == other._acc_path:
- return True
- else:
- return False
- except AttributeError:
- return False
-
- def __ne__(self, other):
- return not self.__eq__(other)
-
- def __hash__(self):
- return hash(self._app_name + self._acc_path)
-
- def getApplication(self):
- """
- Get the containing Application for this object.
- @return the Application instance to which this object belongs.
- """
- return None
-
- def getAttributes(self):
- """
- 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/).
-
- @return : An AttributeSet encapsulating any "attribute values"
- currently defined for the object. An attribute set is a list of strings
- with each string comprising an name-value pair format 'name:value'.
- """
- return []
-
- def getChildAtIndex(self, index):
- """
- Get the accessible child of this object at index.
- @param : index
- an in parameter indicating which child is requested (zero-indexed).
- @return : the 'nth' Accessible child of this object.
- """
- return self._appcache.create_application(self._appcache.application_list[index])
-
- def getIndexInParent(self):
- """
- Get the index of this object in its parent's child list.
- @return : a long integer indicating this object's index in the
- parent's list.
- """
- return -1
-
- def getLocalizedRoleName(self):
- """
- Get a string indicating the type of UI role played by this object,
- translated to the current locale.
- @return : a UTF-8 string indicating the type of UI role played
- by this object.
- """
- #TODO Need to localize this somehow. Hmmmmm
- return 'unknown'
-
- def getRelationSet(self):
- """
- Get a set defining this object's relationship to other accessible
- objects.
- @return : a RelationSet defining this object's relationships.
- """
- return []
-
- def getRole(self):
- """
- Get the Role indicating the type of UI role played by this object.
- @return : a Role indicating the type of UI role played by this
- object.
- """
- return ROLE_UNKNOWN
-
- def getRoleName(self):
- """
- Get a string indicating the type of UI role played by this object.
- @return : a UTF-8 string indicating the type of UI role played
- by this object.
- """
- return 'unknown'
-
- def getState(self):
- """
- Get the current state of the object as a StateSet.
- @return : a StateSet encapsulating the currently true states
- of the object.
- """
- return StateSet()
-
- def isEqual(self, accessible):
- """
- 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.
- @param : obj
- an Accessible object reference to compare to
- @return : a boolean indicating whether the two object references
- point to the same object.
- """
- #TODO Fix this method
- return self == accessible
-
- def get_childCount(self):
- return len(self._appcache.application_list)
- _childCountDoc = \
- """
- childCount: the number of children contained by this object.
- """
- childCount = property(fget=get_childCount, doc=_childCountDoc)
-
- getChildCount = get_childCount
-
- def get_description(self):
- return ''
- _descriptionDoc = \
- """
- a string describing the object in more detail than name.
- """
- description = property(fget=get_description, doc=_descriptionDoc)
-
- def get_name(self):
- return 'main'
- _nameDoc = \
- """
- a (short) string representing the object's name.
- """
- name = property(fget=get_name, doc=_nameDoc)
-
- def get_parent(self):
- return None
- _parentDoc = \
- """
- An Accessible object which is this object's containing object.
- """
- parent = property(fget=get_parent, doc=_parentDoc)
-
- @property
- def interfaces(self):
- return [ATSPI_ACCESSIBLE, ATSPI_COMPONENT]
-
- def queryInterface(self, interface):
- """
- Gets a different accessible interface for this object
- or raises a NotImplemented error if the given interface
- is not supported.
- """
- if interface == ATSPI_ACCESSIBLE:
- return self
- elif interface == ATSPI_COMPONENT:
- return DesktopComponent()
- else:
- raise NotImplementedError(
- "%s not supported by accessible object at path %s"
- % (interface, self._acc_path))
-
- def refresh(self):
- self._appcache._refresh()
-
-#END----------------------------------------------------------------------------
diff --git a/pyatspi/deviceevent.py b/pyatspi/deviceevent.py
deleted file mode 100644
index e61d70b7..00000000
--- a/pyatspi/deviceevent.py
+++ /dev/null
@@ -1,549 +0,0 @@
-#Copyright (C) 2008 Codethink Ltd
-
-#This library is free software; you can redistribute it and/or
-#modify it under the terms of the GNU Lesser General Public
-#License version 2 as published by the Free Software Foundation.
-
-#This program 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 General Public License for more details.
-#You should have received a copy of the GNU Lesser General Public License
-#along with this program; if not, write to the Free Software
-#Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-import dbus as _dbus
-import dbus.service as _service
-import interfaces
-
-from base import Enum as _Enum
-
-#------------------------------------------------------------------------------
-
-class PressedEventType(_Enum):
- _enum_lookup = {
- 0:'KEY_PRESSED_EVENT',
- 1:'KEY_RELEASED_EVENT',
- 2:'BUTTON_PRESSED_EVENT',
- 3:'BUTTON_RELEASED_EVENT',
- }
-
-KEY_PRESSED_EVENT = PressedEventType(0)
-KEY_RELEASED_EVENT = PressedEventType(1)
-BUTTON_PRESSED_EVENT = PressedEventType(2)
-BUTTON_RELEASED_EVENT = PressedEventType(3)
-
-#------------------------------------------------------------------------------
-
-class ControllerEventMask(_Enum):
- _enum_lookup = {
- 1:'KEY_PRESSED_EVENT_MASK',
- 2:'KEY_RELEASED_EVENT_MASK',
- 4:'BUTTON_PRESSED_EVENT_MASK',
- 8:'BUTTON_RELEASED_EVENT_MASK',
- }
-
-KEY_PRESSED_EVENT_MASK = ControllerEventMask(1)
-KEY_RELEASED_EVENT_MASK = ControllerEventMask(2)
-BUTTON_PRESSED_EVENT_MASK = ControllerEventMask(4)
-BUTTON_RELEASED_EVENT_MASK = ControllerEventMask(8)
-
-#------------------------------------------------------------------------------
-
-class KeyEventType(_Enum):
- _enum_lookup = {
- 0:'KEY_PRESSED',
- 1:'KEY_RELEASED',
- }
-KEY_PRESSED = KeyEventType(0)
-KEY_RELEASED = KeyEventType(1)
-
-#------------------------------------------------------------------------------
-
-class KeySynthType(_Enum):
- _enum_lookup = {
- 0:'KEY_PRESS',
- 1:'KEY_RELEASE',
- 2:'KEY_PRESSRELEASE',
- 3:'KEY_SYM',
- 4:'KEY_STRING',
- }
-
-KEY_PRESS = KeySynthType(0)
-KEY_PRESSRELEASE = KeySynthType(2)
-KEY_RELEASE = KeySynthType(1)
-KEY_STRING = KeySynthType(4)
-KEY_SYM = KeySynthType(3)
-
-#------------------------------------------------------------------------------
-
-class ModifierType(_Enum):
- _enum_lookup = {
- 0:'MODIFIER_SHIFT',
- 1:'MODIFIER_SHIFTLOCK',
- 2:'MODIFIER_CONTROL',
- 3:'MODIFIER_ALT',
- 4:'MODIFIER_META',
- 5:'MODIFIER_META2',
- 6:'MODIFIER_META3',
- 7:'MODIFIER_NUMLOCK',
- }
-
-MODIFIER_ALT = ModifierType(3)
-MODIFIER_CONTROL = ModifierType(2)
-MODIFIER_META = ModifierType(4)
-MODIFIER_META2 = ModifierType(5)
-MODIFIER_META3 = ModifierType(6)
-MODIFIER_NUMLOCK = ModifierType(7)
-MODIFIER_SHIFT = ModifierType(0)
-MODIFIER_SHIFTLOCK = ModifierType(1)
-
-#------------------------------------------------------------------------------
-
-class DeviceEvent(list):
- """
- Wraps an AT-SPI device event with a more Pythonic interface. Primarily adds
- a consume attribute which can be used to cease propagation of a device event.
-
- @ivar consume: Should this event be consumed and not allowed to pass on to
- observers further down the dispatch chain in this process or possibly
- system wide?
- @type consume: boolean
- @ivar type: Kind of event, KEY_PRESSED_EVENT or KEY_RELEASED_EVENT
- @type type: Accessibility.EventType
- @ivar id: Serial identifier for this key event
- @type id: integer
- @ivar hw_code: Hardware scan code for the key
- @type hw_code: integer
- @ivar modifiers: Modifiers held at the time of the key event
- @type modifiers: integer
- @ivar timestamp: Time at which the event occurred relative to some platform
- dependent starting point (e.g. XWindows start time)
- @type timestamp: integer
- @ivar event_string: String describing the key pressed (e.g. keysym)
- @type event_string: string
- @ivar is_text: Is the event representative of text to be inserted (True), or
- of a control key (False)?
- @type is_text: boolean
- """
- def __new__(cls, type, id, hw_code, modifiers, timestamp, event_string, is_text):
- return list.__new__(cls, (type, id, hw_code, modifiers, timestamp, event_string, is_text))
- def __init__(self, type, id, hw_code, modifiers, timestamp, event_string, is_text):
- list.__init__(self, (type, id, hw_code, modifiers, timestamp, event_string, is_text))
- self.consume = False
- def _get_type(self):
- return self[0]
- def _set_type(self, val):
- self[0] = val
- type = property(fget=_get_type, fset=_set_type)
- def _get_id(self):
- return self[1]
- def _set_id(self, val):
- self[1] = val
- id = property(fget=_get_id, fset=_set_id)
- def _get_hw_code(self):
- return self[2]
- def _set_hw_code(self, val):
- self[2] = val
- hw_code = property(fget=_get_hw_code, fset=_set_hw_code)
- def _get_modifiers(self):
- return self[3]
- def _set_modifiers(self, val):
- self[3] = val
- modifiers = property(fget=_get_modifiers, fset=_set_modifiers)
- def _get_timestamp(self):
- return self[4]
- def _set_timestamp(self, val):
- self[4] = val
- timestamp = property(fget=_get_timestamp, fset=_set_timestamp)
- def _get_event_string(self):
- return self[5]
- def _set_event_string(self, val):
- self[5] = val
- event_string = property(fget=_get_event_string, fset=_set_event_string)
- def _get_is_text(self):
- return self[6]
- def _set_is_text(self, val):
- self[6] = val
- is_text = property(fget=_get_is_text, fset=_set_is_text)
-
- def __str__(self):
- """
- Builds a human readable representation of the event.
-
- @return: Event description
- @rtype: string
- """
- import constants
- if self.type == constants.KEY_PRESSED_EVENT:
- kind = 'pressed'
- elif self.type == constants.KEY_RELEASED_EVENT:
- kind = 'released'
- return """\
-%s
-\thw_code: %d
-\tevent_string: %s
-\tmodifiers: %d
-\tid: %d
-\ttimestamp: %d
-\tis_text: %s""" % (kind, self.hw_code, self.event_string, self.modifiers,
- self.id, self.timestamp, self.is_text)
-
-#------------------------------------------------------------------------------
-
-class EventListenerMode(list):
- def __new__(cls, synchronous, preemptive, global_):
- return list.__new__(cls, (synchronous, preemptive, global_))
- def __init__(self, synchronous, preemptive, global_):
- list.__init__(self, (synchronous, preemptive, global_))
- def _get_synchronous(self):
- return self[0]
- def _set_synchronous(self, val):
- self[0] = val
- synchronous = property(fget=_get_synchronous, fset=_set_synchronous)
- def _get_preemptive(self):
- return self[1]
- def _set_preemptive(self, val):
- self[1] = val
- preemptive = property(fget=_get_preemptive, fset=_set_preemptive)
- def _get_global_(self):
- return self[2]
- def _set_global_(self, val):
- self[2] = val
- global_ = property(fget=_get_global_, fset=_set_global_)
-
-#------------------------------------------------------------------------------
-
-class KeyDefinition(list):
- def __new__(cls, keycode, keysym, keystring, unused):
- return list.__new__(cls, (keycode, keysym, keystring, unused))
- def __init__(self, keycode, keysym, keystring, unused):
- list.__init__(self, (keycode, keysym, keystring, unused))
- def _get_keycode(self):
- return self[0]
- def _set_keycode(self, val):
- self[0] = val
- keycode = property(fget=_get_keycode, fset=_set_keycode)
- def _get_keysym(self):
- return self[1]
- def _set_keysym(self, val):
- self[1] = val
- keysym = property(fget=_get_keysym, fset=_set_keysym)
- def _get_keystring(self):
- return self[2]
- def _set_keystring(self, val):
- self[2] = val
- keystring = property(fget=_get_keystring, fset=_set_keystring)
- def _get_unused(self):
- return self[3]
- def _set_unused(self, val):
- self[3] = val
- unused = property(fget=_get_unused, fset=_set_unused)
-
-#------------------------------------------------------------------------------
-
-class DeviceEventController(object):
- """
- The interface via which clients request notification of device
- events, and through which device events may be simulated.
- """
-
- def __init__ (self, connection):
- dec_object = connection.get_object(interfaces.ATSPI_REGISTRY_NAME,
- interfaces.ATSPI_DEVICE_EVENT_CONTROLLER_PATH,
- introspect=True)
- self._dec = _dbus.Interface(dec_object, interfaces.ATSPI_DEVICE_EVENT_CONTROLLER_INTERFACE)
-
- def registerKeystrokeListener(self,
- event_listener,
- keys,
- event_mask,
- key_event_types,
- event_listener_mode):
- """
- Register to intercept keyboard events, and either pass them on
- or consume them.
- @param : listener
- A DeviceEventListener which will intercept key events.
- @param : keys
- A list of KeyDefinition indicating which keys to intercept, or KEYSET_ALL_KEYS.
- @param : mask
- A ControllerEventMask bitmask for filtering the intercepted key events.
- @param : type
- A list of KeyEventType
- @param : mode
- An EventListenerMode indicating whether the listener should receive
- the events synchronously, potentially consuming them, or just
- be notified asynchronously of those events that have been generated.
-
- @return True if the DeviceEventListener was successfully registered
- for the requested KeySet, ControllerEventMask, event types, and
- EventListenerMode; otherwise returns False.
- """
- func = self._dec.get_dbus_method("registerKeystrokeListener")
- return func(event_listener,
- keys,
- event_mask,
- key_event_types,
- event_listener_mode)
-
- def deregisterKeystrokeListener(self,
- event_listener,
- keys,
- event_mask,
- key_event_types):
- """
- De-register a previously registered keyboard eventlistener.
- @param : listener
- A DeviceEventListener which will intercept key events.
- @param : keys
- A list of KeyDefinition indicating which keys to intercept, or KEYSET_ALL_KEYS.
- @param : mask
- A ControllerEventMask filtering the intercepted key events.
- @param : type
- A list of KeyEventType
- """
- func = self._dec.get_dbus_method("deregisterKeystrokeListener")
- return func(event_listener,
- keys,
- event_mask,
- key_event_types)
-
- def registerDeviceEventListener(self,
- event_listener,
- event_types):
- """
- Register to intercept events, and either pass them on or consume
- them. To listen to keyboard events use registerKeystrokeListener
- instead.
- @param : listener
- A DeviceEventListener which will intercept events.
- @param : typeseq
- A list of EventType indicating which event types to listen for.
- @return True if successful, False if not
- """
- func = self._dec.get_dbus_method("registerDeviceEventListener")
- return func(event_listener, event_types)
-
- def deregisterDeviceEventListener(self,
- event_listener,
- event_types):
- """
- De-register a previously registered keyboard eventlistener.
- @param : listener
- A DeviceEventListener which will intercept events.
- @param : typeseq
- A List of EventType indicating which event types to stop listening
- for.
- """
- func = self._dec.get_dbus_method("deregisterDeviceEventListener")
- return func(event_listener, event_types)
-
- def notifyListenersSync(self, event):
- """
- 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.
- @return True if the event was consumed by a (pre-emptive) listener,
- False if not (in which case the device event will be forwarded
- as normal to any application which would normally receive it,
- e.g. the currently active application in the case of mouse or
- keyboard events).
- """
- func = self._dec.get_dbus_method("notifyListenersSync")
- return func(event)
-
- def notifyListenersAsync(self, event):
- """
- 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.
- """
- func = self._dec.get_dbus_method("notifyListenersAsync")
- return func(event)
-
- def generateKeyboardEvent(self, keycode, keystring, type):
- """
- Synthesize a keyboard event.
- @param : keycode
- A long integer indicating the keycode of the keypress to be synthesized.
- @param : keystring
- an optional UTF-8 string indicating a complex keyboard input
- event.
- @param : type
- 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 an internationalized or complex text
- input method, or a composed character).
- """
- func = self._dec.get_dbus_method("generateKeyboardEvent")
- return func(keycode, keystring, type)
-
- def generateMouseEvent(self, x, y, name):
- """
- Synthesize a mouse event.
- @param : x
- A long integer indicating the screen x coord for the mouse event.
- @param : y
- A long integer indicating the screen y coord for the mouse event.
- @param : name
- A string indicating the type of mouse event, e.g. "button1up"
- """
- func = self._dec.get_dbus_method("generateMouseEvent")
- return func(x, y, name)
-
-#------------------------------------------------------------------------------
-
-class _TestDeviceEventController(object):
- """
- Used for testing when no Registry daemon is present.
- """
-
- def registerKeystrokeListener(self, event_listener, keys, event_mask, key_event_types, event_listener_mode):
- return True
-
- def deregisterKeystrokeListener(self, event_listener, keys, event_mask, key_event_types):
- pass
-
- def registerDeviceEventListener(self, event_listener, event_types):
- return True
-
- def deregisterDeviceEventListener(self, event_listener, event_types):
- pass
-
- def notifyListenersSync(self, event):
- return False
-
- def notifyListenersAsync(self, event):
- pass
-
- def generateKeyboardEvent(self, keycode, keystring, type):
- pass
-
- def generateMouseEvent(self, x, y, name):
- pass
-
-#------------------------------------------------------------------------------
-
-class KeyboardDeviceEventListener(_service.Object):
- """
- Observes keyboard press and release events.
-
- @ivar registry: The L{Registry} that created this observer
- @type registry: L{Registry}
- @ivar key_set: Set of keys to monitor
- @type key_set: list of integer
- @ivar mask: Watch for key events while these modifiers are held
- @type mask: integer
- @ivar kind: Kind of events to monitor
- @type kind: integer
- @ivar mode: Keyboard event mode
- @type mode: Accessibility.EventListenerMode
- """
-
- _next_listener_id = 0
-
- def _get_unique_path (self):
- KeyboardDeviceEventListener._next_listener_id += 1
- return "/org/freedesktop/atspi/keyeventlistener/%d" % (KeyboardDeviceEventListener._next_listener_id,)
-
- def __init__(self, registry, synchronous, preemptive, global_):
- """
- Creates a mode object that defines when key events will be received from
- the system. Stores all other information for later registration.
-
- @param registry: The L{Registry} that created this observer
- @type registry: L{Registry}
- @param synchronous: Handle the key event synchronously?
- @type synchronous: boolean
- @param preemptive: Allow event to be consumed?
- @type preemptive: boolean
- @param global_: Watch for events on inaccessible applications too?
- @type global_: boolean
- """
- self._upath = self._get_unique_path()
- _service.Object.__init__(self, registry._bus, self._upath)
- self.mode = EventListenerMode(synchronous, preemptive, global_)
- self._registry = registry
-
- def register(self, dc, key_set, mask, kind):
- """
- Starts keyboard event monitoring.
-
- @param dc: Reference to a device controller
- @type dc: Accessibility.DeviceEventController
- @param key_set: Set of keys to monitor
- @type key_set: list of integer
- @param mask: Integer modifier mask or an iterable over multiple masks to
- unapply all at once
- @type mask: integer, iterable, or None
- @param kind: Kind of events to monitor
- @type kind: integer
- """
- try:
- # check if the mask is iterable
- iter(mask)
- except TypeError:
- # register a single integer if not
- dc.registerKeystrokeListener(self._upath, key_set, mask, kind, self.mode)
- else:
- for m in mask:
- dc.registerKeystrokeListener(self._upath, key_set, m, kind, self.mode)
-
- def unregister(self, dc, key_set, mask, kind):
- """
- Stops keyboard event monitoring.
-
- @param dc: Reference to a device controller
- @type dc: Accessibility.DeviceEventController
- @param key_set: Set of keys to monitor
- @type key_set: list of integer
- @param mask: Integer modifier mask or an iterable over multiple masks to
- unapply all at once
- @type mask: integer, iterable, or None
- @param kind: Kind of events to monitor
- @type kind: integer
- """
- try:
- # check if the mask is iterable
- iter(mask)
- except TypeError:
- # unregister a single integer if not
- dc.deregisterKeystrokeListener(self._upath, key_set, mask, kind)
- else:
- for m in mask:
- dc.deregisterKeystrokeListener(self._upath, key_set, m, kind)
-
- @_service.method(dbus_interface=interfaces.ATSPI_DEVICE_EVENT_LISTENER_INTERFACE,
- in_signature="(uinnisb)",
- out_signature="b")
- def notifyEvent(self, ev):
- """
- Notifies the L{Registry} that an event has occurred. Wraps the raw event
- object in our L{Event} class to support automatic ref and unref calls. An
- observer can return True to indicate this event should not be allowed to pass
- to other AT-SPI observers or the underlying application.
-
- @param ev: Keyboard event
- @type ev: Accessibility.DeviceEvent
- @return: Should the event be consumed (True) or allowed to pass on to other
- AT-SPI observers (False)?
- @rtype: boolean
- """
- # TODO Find out where the exceptions are falling in to.
- try:
- # wrap the device event
- event = DeviceEvent(*ev)
- return self._registry.handleDeviceEvent(event, self)
- except Exception, e:
- import traceback
- traceback.print_exc()
- return False
-
-#END---------------------------------------------------------------------------
diff --git a/pyatspi/document.py b/pyatspi/document.py
deleted file mode 100644
index 038b1fda..00000000
--- a/pyatspi/document.py
+++ /dev/null
@@ -1,74 +0,0 @@
-#Copyright (C) 2008 Codethink Ltd
-
-#This library is free software; you can redistribute it and/or
-#modify it under the terms of the GNU Lesser General Public
-#License version 2 as published by the Free Software Foundation.
-
-#This program 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 General Public License for more details.
-#You should have received a copy of the GNU Lesser General Public License
-#along with this program; if not, write to the Free Software
-#Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-from interfaces import *
-from accessible import Accessible
-from factory import accessible_factory
-
-__all__ = [
- "Document",
- ]
-
-#------------------------------------------------------------------------------
-
-class Document(Accessible):
- """
- 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.
- """
-
- def getAttributeValue(self, key):
- """
- Gets the value of a single attribute, if specified for the document
- as a whole.
- @param : attributename
- a string indicating the name of a specific attribute (name-value
- pair) being queried.
- @return a string corresponding to the value of the specified
- attribute, or an empty string if the attribute is unspecified
- for the object.
- """
- func = self.get_dbus_method("getAttributeValue", dbus_interface=ATSPI_DOCUMENT)
- return func(key)
-
- def getAttributes(self):
- """
- Gets all attributes specified for a document as a whole. For
- attributes which change within the document content, see Accessibility::Text::getAttributes
- instead.
- @return an AttributeSet containing the attributes of the document,
- as name-value pairs.
- """
- func = self.get_dbus_method("getAttributes", dbus_interface=ATSPI_DOCUMENT)
- return [key + ':' + value for key, value in func().values()]
-
- def getLocale(self):
- """
- Gets the locale associated with the document's content. e.g.
- the locale for LOCALE_TYPE_MESSAGES.
- @return a string compliant with the POSIX standard for locale
- description.
- """
- func = self.get_dbus_method("getLocale", dbus_interface=ATSPI_DOCUMENT)
- return func()
-
-# Register the accessible class with the factory.
-accessible_factory.register_accessible_class(ATSPI_DOCUMENT, Document)
-
-#END----------------------------------------------------------------------------
diff --git a/pyatspi/editabletext.py b/pyatspi/editabletext.py
deleted file mode 100644
index 23cdf485..00000000
--- a/pyatspi/editabletext.py
+++ /dev/null
@@ -1,124 +0,0 @@
-#Copyright (C) 2008 Codethink Ltd
-
-#This library is free software; you can redistribute it and/or
-#modify it under the terms of the GNU Lesser General Public
-#License version 2 as published by the Free Software Foundation.
-
-#This program 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 General Public License for more details.
-#You should have received a copy of the GNU Lesser General Public License
-#along with this program; if not, write to the Free Software
-#Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-from interfaces import *
-from factory import accessible_factory
-from text import *
-
-__all__ = [
- "EditableText",
- ]
-
-#------------------------------------------------------------------------------
-
-class EditableText(Text):
- """
- 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.
- """
-
- def copyText(self, start, end):
- """
- 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.
- """
- func = self.get_dbus_method("copyText", dbus_interface=ATSPI_EDITABLE_TEXT)
- return func(start, end)
-
- def cutText(self, start, end):
- """
- 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.
- @return True if the text was successfully cut, False otherwise.
- """
- func = self.get_dbus_method("cutText", dbus_interface=ATSPI_EDITABLE_TEXT)
- return func(start, end)
-
- def deleteText(self, start, end):
- """
- 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.
- @return True if the text was successfully deleted, False otherwise.
- """
- func = self.get_dbus_method("deleteText", dbus_interface=ATSPI_EDITABLE_TEXT)
- return func(start, end)
-
- def insertText(self, position, text, length):
- """
- 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 length characters will be inserted into
- the text object's text buffer.
- @param : length
- the number of characters of text to insert. If the character
- count of text is less than or equal to length, the entire contents
- of text will be inserted.
- @return True if the text content was successfully inserted, False
- otherwise.
- """
- func = self.get_dbus_method("insertText", dbus_interface=ATSPI_EDITABLE_TEXT)
- return func(position, text, length)
-
- def pasteText(self, position):
- """
- 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.
- @return True if the text was successfully pasted into the Text
- object, False otherwise.
- """
- func = self.get_dbus_method("pasteText", dbus_interface=ATSPI_EDITABLE_TEXT)
- return func(position)
-
- def setTextContents(self, contents):
- """
- 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.
- @return True if the text content was successfully changed, False
- otherwise.
- """
- func = self.get_dbus_method("setTextContents", dbus_interface=ATSPI_EDITABLE_TEXT)
- return func(contents)
-
-# Register the accessible class with the factory.
-accessible_factory.register_accessible_class(ATSPI_EDITABLE_TEXT, EditableText)
-
-#END----------------------------------------------------------------------------
diff --git a/pyatspi/event.py b/pyatspi/event.py
deleted file mode 100644
index 948535f9..00000000
--- a/pyatspi/event.py
+++ /dev/null
@@ -1,262 +0,0 @@
-#Copyright (C) 2008 Codethink Ltd
-
-#This library is free software; you can redistribute it and/or
-#modify it under the terms of the GNU Lesser General Public
-#License version 2 as published by the Free Software Foundation.
-
-#This program 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 General Public License for more details.
-#You should have received a copy of the GNU Lesser General Public License
-#along with this program; if not, write to the Free Software
-#Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-import interfaces
-from accessible import BoundingBox
-from base import AccessibleObjectNotAvailable
-
-__all__ = [
- "Event",
- "EventType",
- "event_type_to_signal_reciever",
- ]
-
-#------------------------------------------------------------------------------
-
-_interface_to_klass = {
- "org.freedesktop.atspi.Event.Object":"object",
- "org.freedesktop.atspi.Event.Window":"window",
- "org.freedesktop.atspi.Event.Mouse":"mouse",
- "org.freedesktop.atspi.Event.Keyboard":"keyboard",
- "org.freedesktop.atspi.Event.Terminal":"terminal",
- "org.freedesktop.atspi.Event.Document":"document",
- "org.freedesktop.atspi.Event.Focus":"focus",
- }
-
-_klass_to_interface = {
- "object":"org.freedesktop.atspi.Event.Object",
- "window":"org.freedesktop.atspi.Event.Window",
- "mouse":"org.freedesktop.atspi.Event.Mouse",
- "keyboard":"org.freedesktop.atspi.Event.Keyboard",
- "terminal":"org.freedesktop.atspi.Event.Terminal",
- "document":"org.freedesktop.atspi.Event.Document",
- "focus":"org.freedesktop.atspi.Event.Focus",
- }
-
-#------------------------------------------------------------------------------
-
-class _ELessList(list):
- def __getitem__(self, index):
- try:
- return list.__getitem__(self, index)
- except IndexError:
- return None
-
-class EventType(str):
- """
- Wraps the AT-SPI event type string so its components can be accessed
- individually as klass (can't use the keyword class), major, minor, and detail
- (klass_major_minor_detail).
-
- @note: All attributes of an instance of this class should be considered
- public readable as it is acting a a struct.
- @ivar klass: Most general event type identifier (object, window, mouse, etc.)
- @type klass: string
- @ivar major: Second level event type description
- @type major: string
- @ivar minor: Third level event type description
- @type minor: string
- @ivar detail: Lowest level event type description
- @type detail: string
- @ivar name: Full, unparsed event name as received from AT-SPI
- @type name: string
- @cvar format: Names of the event string components
- @type format: 4-tuple of string
- """
-
- _SEPARATOR = ':'
-
- def __init__(self, name):
- """
- Parses the full AT-SPI event name into its components
- (klass:major:minor:detail). If the provided event name is an integer
- instead of a string, then the event is really a device event.
-
- @param name: Full AT-SPI event name
- @type name: string
- @raise AttributeError: When the given event name is not a valid string
- """
- stripped = name.strip(self._SEPARATOR)
- separated = stripped.split(self._SEPARATOR, 3)
- self._separated = _ELessList(separated)
-
- self.klass = self._separated[0]
- self.major = self._separated[1]
- self.minor = self._separated[2]
- self.detail = self._separated[3]
-
- def is_subtype(self, event_type):
- """
- Determines if the passed event type is a subtype
- of this event.
- """
- if event_type.klass and event_type.klass != self.klass:
- return False
- else:
- if event_type.major and event_type.major != self.major:
- return False
- else:
- if event_type.minor and event_type.minor != self.minor:
- return False
- return True
-
- @property
- def name(self):
- return str(self)
-
- @property
- def value(self):
- return str(self)
-
-#------------------------------------------------------------------------------
-
-def event_type_to_signal_reciever(bus, cache, event_handler, event_type):
- kwargs = {
- 'sender_keyword':'sender',
- 'interface_keyword':'interface',
- 'member_keyword':'member',
- 'path_keyword':'path',
- }
- if event_type.major:
- major = event_type.major.replace('-', '_')
- if event_type.klass:
- kwargs['dbus_interface'] = _klass_to_interface[event_type.klass]
- if event_type.major:
- kwargs['signal_name'] = major
- if event_type.minor:
- kwargs['arg0'] = event_type.minor
-
- def handler_wrapper(minor, detail1, detail2, any_data,
- sender=None, interface=None, member=None, path=None):
- event = Event(cache, path, sender, interface, member, (minor, detail1, detail2, any_data))
- return event_handler(event)
-
- return bus.add_signal_receiver(handler_wrapper, **kwargs)
-
-#------------------------------------------------------------------------------
-
-def signal_spec_to_event_string (interface, name, minor):
- interface = _interface_to_klass[interface]
- name = name.replace('_', '-')
-
- if interface == "focus":
- return "focus:"
-
- result = interface + ':'
- if name:
- result += name + ':'
- if minor:
- result += minor
- return result
-
-#------------------------------------------------------------------------------
-
-class Event(object):
- """
- Wraps an AT-SPI event with a more Pythonic interface managing exceptions,
- the differences in any_data across versions, and the reference counting of
- accessibles provided with the event.
-
- @note: All unmarked attributes of this class should be considered public
- readable and writable as the class is acting as a record object.
-
- @ivar type: The type of the AT-SPI event
- @type type: L{EventType}
- @ivar detail1: First AT-SPI event parameter
- @type detail1: integer
- @ivar detail2: Second AT-SPI event parameter
- @type detail2: integer
- @ivar any_data: Extra AT-SPI data payload
- @type any_data: object
- @ivar host_application: Application owning the event source
- @type host_application: Accessibility.Application
- @ivar source_name: Name of the event source at the time of event dispatch
- @type source_name: string
- @ivar source_role: Role of the event source at the time of event dispatch
- @type source_role: Accessibility.Role
- @ivar source: Source of the event
- @type source: Accessibility.Accessible
- """
- def __init__(self, cache, source_path, source_application, interface, name, event):
- """
- Extracts information from the provided event. If the event is a "normal"
- event, pulls the detail1, detail2, any_data, and source values out of the
- given object and stores it in this object. If the event is a device event,
- key ID is stored in detail1, scan code is stored in detail2, key name,
- key modifiers (e.g. ALT, CTRL, etc.), is text flag, and timestamp are
- stored as a 4-tuple in any_data, and source is None (since key events are
- global).
-
- @param event: Event from an AT-SPI callback
- @type event: Accessibility.Event or Accessibility.DeviceEvent
- """
- self._cache = cache
- self._source_path = source_path
- self._source_application = source_application
-
- self._source = None
- self._application = None
-
- self.type = EventType(signal_spec_to_event_string(interface, name, event[0]))
-
- self.detail1 = event[1]
- self.detail2 = event[2]
-
- data = event[3]
- if name == "object_bounds_changed":
- self.any_data = BoundingBox(*data)
- else:
- self.any_data = data
-
- @property
- def host_application(self):
- if not self._application:
- try:
- return self._cache.create_application(self._source_application)
- except AccessibleObjectNotAvailable:
- pass
- return self._application
-
- @property
- def source(self):
- if not self._source:
- try:
- self._source = self._cache.create_accessible(self._source_application,
- self._source_path,
- interfaces.ATSPI_ACCESSIBLE)
- except AccessibleObjectNotAvailable:
- pass
- return self._source
-
- @property
- def source_name(self):
- return source.name
-
- @property
- def source_role(self):
- return source.getRole()
-
- def __str__(self):
- """
- Builds a human readable representation of the event including event type,
- parameters, and source info.
-
- @return: Event description
- @rtype: string
- """
- return '%s(%s, %s, %s)\n\tsource: %s\n\thost_application: %s' % \
- (self.type, self.detail1, self.detail2, self.any_data,
- self.source, self.host_application)
-
-#END----------------------------------------------------------------------------
diff --git a/pyatspi/factory.py b/pyatspi/factory.py
deleted file mode 100644
index 4b023200..00000000
--- a/pyatspi/factory.py
+++ /dev/null
@@ -1,28 +0,0 @@
-#Copyright (C) 2008 Codethink Ltd
-
-#This library is free software; you can redistribute it and/or
-#modify it under the terms of the GNU Lesser General Public
-#License version 2 as published by the Free Software Foundation.
-
-#This program 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 General Public License for more details.
-#You should have received a copy of the GNU Lesser General Public License
-#along with this program; if not, write to the Free Software
-#Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#------------------------------------------------------------------------------
-
-class AccessibleFactory(object):
- __accessible_interfaces = {}
-
- def register_accessible_class(self, name, cls):
- self.__accessible_interfaces[name] = cls
-
- def get_accessible_class(self, name):
- return self.__accessible_interfaces[name]
-
-accessible_factory = AccessibleFactory()
-
-#END----------------------------------------------------------------------------
diff --git a/pyatspi/hyperlink.py b/pyatspi/hyperlink.py
deleted file mode 100644
index de7a6db7..00000000
--- a/pyatspi/hyperlink.py
+++ /dev/null
@@ -1,109 +0,0 @@
-#Copyright (C) 2008 Codethink Ltd
-
-#This library is free software; you can redistribute it and/or
-#modify it under the terms of the GNU Lesser General Public
-#License version 2 as published by the Free Software Foundation.
-
-#This program 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 General Public License for more details.
-#You should have received a copy of the GNU Lesser General Public License
-#along with this program; if not, write to the Free Software
-#Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-from interfaces import *
-from accessible import Accessible
-from factory import accessible_factory
-
-import dbus
-
-__all__ = [
- "Hyperlink",
- ]
-
-#------------------------------------------------------------------------------
-
-class Hyperlink(Accessible):
- """
- 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.
- """
-
- def getObject(self, index):
- """
- 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.
- @return an Accessible object instance representing the Hyperlink's
- ith anchor, or through which the content associated with the
- ith anchor can be accessed.
- """
- func = self.get_dbus_method("getObject", dbus_interface=ATSPI_HYPERLINK)
- return self._cache.create_accessible(self._app_name, func(index),
- interfaces.ATSPI_HYPERLINK)
-
- def getURI(self, index):
- """
- Obtain a resource locator ('URI') which can be used to access
- the content to which this link "points" or is connected.
- @return a string corresponding to the URI of the Hyperlink's
- 'ith' anchor, if one exists, or a NIL string otherwise.
- """
- func = self.get_dbus_method("getURI", dbus_interface=ATSPI_HYPERLINK)
- return func(index)
-
- def isValid(self):
- """
- Check the hyperlink to see if a connection to its backing content
- can be established, or if its URI is valid.
- @return True if the object's content is available, or False if
- the hyperlink's URI is invalid, or a connection to the resource
- can not be established.
- """
- func = self.get_dbus_method("isValid", dbus_interface=ATSPI_HYPERLINK)
- return func()
-
- def get_endIndex(self):
- return dbus.Int32(self._pgetter(self._dbus_interface, "endIndex"))
- _endIndexDoc = \
- """
- 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.
- """
- endIndex = property(fget=get_endIndex, doc=_endIndexDoc)
-
- def get_nAnchors(self):
- return dbus.Int16(self._pgetter(self._dbus_interface, "nAnchors"))
- _nAnchorsDoc = \
- """
- the number of separate anchors associated with this Hyperlink
- """
- nAnchors = property(fget=get_nAnchors, doc=_nAnchorsDoc)
-
- def get_startIndex(self):
- return dbus.Int32(self._pgetter(self._dbus_interface, "startIndex"))
- _startIndexDoc = \
- """
- the starting offset within the containing Hypertext content with
- which this Hyperlink is associated
- """
- startIndex = property(fget=get_startIndex, doc=_startIndexDoc)
-
-# Register the accessible class with the factory.
-accessible_factory.register_accessible_class(ATSPI_HYPERLINK, Hyperlink)
-
-#END----------------------------------------------------------------------------
diff --git a/pyatspi/hypertext.py b/pyatspi/hypertext.py
deleted file mode 100644
index 6e7332f6..00000000
--- a/pyatspi/hypertext.py
+++ /dev/null
@@ -1,71 +0,0 @@
-#Copyright (C) 2008 Codethink Ltd
-
-#This library is free software; you can redistribute it and/or
-#modify it under the terms of the GNU Lesser General Public
-#License version 2 as published by the Free Software Foundation.
-
-#This program 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 General Public License for more details.
-#You should have received a copy of the GNU Lesser General Public License
-#along with this program; if not, write to the Free Software
-#Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-from interfaces import *
-from accessible import Accessible
-from factory import accessible_factory
-
-__all__ = [
- "Hypertext",
- ]
-
-#------------------------------------------------------------------------------
-
-class Hypertext(Accessible):
- """
- 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.
- """
-
- def getLink(self, index):
- """
- Get one of the Hyperlinks associated with this Hypertext object,
- by index.
- @param : linkIndex
- an integer from 0 to getNLinks() - 1.
- @return the Hyperlink in this Hypertext object.
- """
- func = self.get_dbus_method("getLink", dbus_interface=ATSPI_HYPERTEXT)
- return self._cache.create_accessible(self._app_name, func(index),
- interfaces.ATSPI_HYPERTEXT)
-
- def getLinkIndex(self, character_index):
- """
- 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 characterIndex, or -1 if no Hyperlink is associated with
- that character offset.
- """
- func = self.get_dbus_method("getLinkIndex", dbus_interface=ATSPI_HYPERTEXT)
- return func(character_index)
-
- def getNLinks(self):
- """
- Query the hypertext object for the number of Hyperlinks it contains.
- @return the number of Hyperlinks associated with this Hypertext
- object, as a long integer.
- """
- func = self.get_dbus_method("getNLinks", dbus_interface=ATSPI_HYPERTEXT)
- return func()
-
-# Register the accessible class with the factory.
-accessible_factory.register_accessible_class(ATSPI_HYPERTEXT, Hypertext)
-
-#END----------------------------------------------------------------------------
diff --git a/pyatspi/image.py b/pyatspi/image.py
deleted file mode 100644
index b2b595a4..00000000
--- a/pyatspi/image.py
+++ /dev/null
@@ -1,110 +0,0 @@
-#Copyright (C) 2008 Codethink Ltd
-
-#This library is free software; you can redistribute it and/or
-#modify it under the terms of the GNU Lesser General Public
-#License version 2 as published by the Free Software Foundation.
-
-#This program 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 General Public License for more details.
-#You should have received a copy of the GNU Lesser General Public License
-#along with this program; if not, write to the Free Software
-#Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-import dbus
-from interfaces import *
-from accessible import Accessible
-from factory import accessible_factory
-from accessible import BoundingBox
-
-from dbus.types import UInt32
-
-__all__ = [
- "Image",
- ]
-
-#------------------------------------------------------------------------------
-
-class Image(Accessible):
- """
- 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.
- """
-
- def getImageExtents(self, coordType):
- """
- 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.
- @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.
- @return a BoundingBox enclosing the image's onscreen representation.
- """
- func = self.get_dbus_method("getImageExtents", dbus_interface=ATSPI_IMAGE)
- return BoundingBox(*func(UInt32(coordType)))
-
- def getImagePosition(self, coord_type):
- """
- 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.
- """
- func = self.get_dbus_method("getImagePosition", dbus_interface=ATSPI_IMAGE)
- return func(UInt32(coord_type))
-
- def getImageSize(self):
- """
- 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.
- @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)
- """
- func = self.get_dbus_method("getImageSize", dbus_interface=ATSPI_IMAGE)
- return func()
-
- def get_imageDescription(self):
- return dbus.String(self._pgetter(self._dbus_interface, "imageDescription"))
- _imageDescriptionDoc = \
- """
- A UTF-8 string providing a textual description of what is visually
- depicted in the image.
- """
- imageDescription = property(fget=get_imageDescription, doc=_imageDescriptionDoc)
-
- def get_imageLocale(self):
- return dbus.String(self._pgetter(self._dbus_interface, "imageLocale"))
- _imageLocaleDoc = \
- """
- A string corresponding to the POSIX LC_MESSAGES locale used by
- the imageDescription.
- """
- imageLocale = property(fget=get_imageLocale, doc=_imageLocaleDoc)
-
-# Register the accessible class with the factory.
-accessible_factory.register_accessible_class(ATSPI_IMAGE, Image)
-
-#END----------------------------------------------------------------------------
diff --git a/pyatspi/interfaces.py b/pyatspi/interfaces.py
deleted file mode 100644
index 0883fb93..00000000
--- a/pyatspi/interfaces.py
+++ /dev/null
@@ -1,40 +0,0 @@
-#Copyright (C) 2008 Codethink Ltd
-
-#This library is free software; you can redistribute it and/or
-#modify it under the terms of the GNU Lesser General Public
-#License version 2 as published by the Free Software Foundation.
-
-#This program 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 General Public License for more details.
-#You should have received a copy of the GNU Lesser General Public License
-#along with this program; if not, write to the Free Software
-#Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-ATSPI_ACCESSIBLE = 'org.freedesktop.atspi.Accessible'
-ATSPI_ACTION = 'org.freedesktop.atspi.Action'
-ATSPI_APPLICATION = 'org.freedesktop.atspi.Application'
-ATSPI_COMPONENT = 'org.freedesktop.atspi.Component'
-ATSPI_COLLECTION = 'org.freedesktop.atspi.Collection'
-ATSPI_DESKTOP = 'org.freedesktop.atspi.Desktop'
-ATSPI_DOCUMENT = 'org.freedesktop.atspi.Document'
-ATSPI_EDITABLE_TEXT = 'org.freedesktop.atspi.EditableText'
-ATSPI_HYPERLINK = 'org.freedesktop.atspi.Hyperlink'
-ATSPI_HYPERTEXT = 'org.freedesktop.atspi.Hypertext'
-ATSPI_IMAGE = 'org.freedesktop.atspi.Image'
-ATSPI_LOGIN_HELPER = 'org.freedesktop.atspi.LoginHelper'
-ATSPI_SELECTION = 'org.freedesktop.atspi.Selection'
-ATSPI_SELECTOR = 'org.freedesktop.atspi.Selector'
-ATSPI_STREAMABLE_CONTENT = 'org.freedesktop.atspi.Content'
-ATSPI_TABLE = 'org.freedesktop.atspi.Table'
-ATSPI_TEXT = 'org.freedesktop.atspi.Text'
-ATSPI_VALUE = 'org.freedesktop.atspi.Value'
-
-ATSPI_REGISTRY_INTERFACE = 'org.freedesktop.atspi.Registry'
-ATSPI_REGISTRY_PATH = '/org/freedesktop/atspi/registry'
-ATSPI_REGISTRY_NAME = 'org.freedesktop.atspi.Registry'
-
-ATSPI_DEVICE_EVENT_CONTROLLER_INTERFACE = 'org.freedesktop.atspi.DeviceEventController'
-ATSPI_DEVICE_EVENT_CONTROLLER_PATH = '/org/freedesktop/atspi/registry/deviceeventcontroller'
-ATSPI_DEVICE_EVENT_LISTENER_INTERFACE = 'org.freedesktop.atspi.DeviceEventListener'
diff --git a/pyatspi/loginhelper.py b/pyatspi/loginhelper.py
deleted file mode 100644
index a8b5183c..00000000
--- a/pyatspi/loginhelper.py
+++ /dev/null
@@ -1,147 +0,0 @@
-#Copyright (C) 2008 Codethink Ltd
-
-#This library is free software; you can redistribute it and/or
-#modify it under the terms of the GNU Lesser General Public
-#License version 2 as published by the Free Software Foundation.
-
-#This program 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 General Public License for more details.
-#You should have received a copy of the GNU Lesser General Public License
-#along with this program; if not, write to the Free Software
-#Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-from interfaces import *
-from base import Enum
-from accessible import Accessible
-from factory import accessible_factory
-
-__all__ = [
- "LoginHelper",
- ]
-
-#------------------------------------------------------------------------------
-
-class LoginHelper(Accessible):
- """
- 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.
- """
-
- def getDeviceReqs(self, *args, **kwargs):
- """
- 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.
- @return : A sequence of LoginHelper_DeviceReq indicating the
- device I/O required in order to facilitate end-user access to
- the system.
- """
- func = self.get_dbus_method("getDeviceReqs", dbus_interface=ATSPI_LOGIN_HELPER)
- return func(*args, **kwargs)
-
- def getRaiseWindows(self, *args, **kwargs):
- """
- getRaiseWindows:
- Get a list of window IDs that need raising on login.
- @return : a sequence containing window IDS for toplevels which
- need to be raised/made visible during user authentication, in
- order for the LoginHelper to facilitate end-user access to the
- system.
- """
- func = self.get_dbus_method("getRaiseWindows", dbus_interface=ATSPI_LOGIN_HELPER)
- return func(*args, **kwargs)
-
- def setSafe(self, *args, **kwargs):
- """
- setSafe:
- @param : safe_mode
- TRUE if the client is requesting that 'safe mode' be initiated,
- FALSE if the client is advising that 'safe mode' may be exited,
- i.e. normal operation may be resumed.
- Request a LoginHelper to enter "safe" mode, or inform LoginHelper
- that "safe" mode may be exited. If safe_mode is TRUE, but the
- return value is 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.
- @return : whether the LoginHelper is now "safe" or not.
- """
- func = self.get_dbus_method("setSafe", dbus_interface=ATSPI_LOGIN_HELPER)
- return func(*args, **kwargs)
-
- class DeviceReq(Enum):
- _enum_lookup = {
- 0:'GUI_EVENTS',
- 1:'CORE_KEYBOARD',
- 2:'CORE_POINTER',
- 3:'EXT_INPUT',
- 4:'POST_WINDOWS',
- 5:'AUDIO_OUT',
- 6:'AUDIO_IN',
- 7:'NETWORK',
- 8:'LOCALHOST',
- 9:'SERIAL_OUT',
- 10:'SERIAL_IN',
- }
-
- AUDIO_IN = DeviceReq(6)
- AUDIO_OUT = DeviceReq(5)
- CORE_KEYBOARD = DeviceReq(1)
- CORE_POINTER = DeviceReq(2)
- EXT_INPUT = DeviceReq(3)
- GUI_EVENTS = DeviceReq(0)
- LOCALHOST = DeviceReq(8)
- NETWORK = DeviceReq(7)
- POST_WINDOWS = DeviceReq(4)
- SERIAL_IN = DeviceReq(10)
- SERIAL_OUT = DeviceReq(9)
-
- class WindowInfo(list):
- def __new__(cls, winID):
- list.__new__(cls, (winID))
- def __init__(self, winID):
- list.__init__(self, (winID))
-
- def _get_winID(self):
- return self[0]
- def _set_winID(self, val):
- self[0] = val
- winID = property(fget=_get_winID, fset=_set_winID)
-
-# Register the accessible class with the factory.
-accessible_factory.register_accessible_class(ATSPI_LOGIN_HELPER, LoginHelper)
-
-#END----------------------------------------------------------------------------
diff --git a/pyatspi/registry.py b/pyatspi/registry.py
deleted file mode 100644
index ab22053c..00000000
--- a/pyatspi/registry.py
+++ /dev/null
@@ -1,482 +0,0 @@
-#Copyright (C) 2008 Codethink Ltd
-#copyright: Copyright (c) 2005, 2007 IBM Corporation
-
-#This library is free software; you can redistribute it and/or
-#modify it under the terms of the GNU Lesser General Public
-#License version 2 as published by the Free Software Foundation.
-
-#This program 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 General Public License for more details.
-#You should have received a copy of the GNU Lesser General Public License
-#along with this program; if not, write to the Free Software
-#Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#Portions of this code originally licensed and copyright (c) 2005, 2007
-#IBM Corporation under the BSD license, available at
-#U{http://www.opensource.org/licenses/bsd-license.php}
-
-#authors: Peter Parente, Mark Doffman
-
-import os as _os
-import dbus as _dbus
-import gobject as _gobject
-
-from desktop import Desktop as _Desktop
-
-from event import EventType as _EventType
-from event import event_type_to_signal_reciever as _event_type_to_signal_reciever
-
-from applicationcache import TestApplicationCache, ApplicationCache
-
-from dbus.mainloop.glib import DBusGMainLoop as _DBusGMainLoop
-
-from Queue import Queue
-from deviceevent import *
-from deviceevent import _TestDeviceEventController
-
-_DBusGMainLoop(set_as_default=True)
-
-#------------------------------------------------------------------------------
-
-class _Registry(object):
- """
- Wraps the Accessibility.Registry to provide more Pythonic registration for
- events.
-
- This object should be treated as a singleton, but such treatment is not
- enforced. You can construct another instance of this object and give it a
- reference to the Accessibility.Registry singleton. Doing so is harmless and
- has no point.
-
- @ivar async: Should event dispatch to local listeners be decoupled from event
- receiving from the registry?
- @type async: boolean
- @ivar reg: Reference to the real, wrapped registry object
- @type reg: Accessibility.Registry
- @ivar dev: Reference to the device controller
- @type dev: Accessibility.DeviceEventController
- @ivar queue: Queue of events awaiting local dispatch
- @type queue: Queue.Queue
- @ivar clients: Map of event names to client listeners
- @type clients: dictionary
- @ivar observers: Map of event names to AT-SPI L{_Observer} objects
- @type observers: dictionary
- """
-
- def __init__(self):
- """
- Stores a reference to the AT-SPI registry. Gets and stores a reference
- to the DeviceEventController.
-
- @param reg: Reference to the AT-SPI registry daemon
- @type reg: Accessibility.Registry
- """
- self._bus = _dbus.SessionBus()
-
- app_name = None
- if "ATSPI_TEST_APP_NAME" in _os.environ.keys():
- app_name = _os.environ["ATSPI_TEST_APP_NAME"]
-
- if app_name:
- self._app_cache = TestApplicationCache(self, self._bus, app_name)
- self.dev = _TestDeviceEventController()
- else:
- self._app_cache = ApplicationCache(self, self._bus)
- self.dev = DeviceEventController(self._bus)
-
- self._event_listeners = {}
-
- # All of this special casing is for the 'faked'
- # events caused by cache updates.
-
- self._name_type = _EventType("object:property-change:name")
- self._name_listeners = {}
- self._description_type = _EventType("object:property-change:description")
- self._description_listeners = {}
- self._parent_type = _EventType("object:property-change:parent")
- self._parent_listeners = {}
- self._children_changed_type = _EventType("object:children-changed")
- self._children_changed_listeners = {}
-
- self.clients = {}
- self.deviceClients = {}
-
- def __call__(self):
- """
- @return: This instance of the registry
- @rtype: L{Registry}
- """
- return self
-
- @property
- def cache (self):
- """
- This is the accessible application cache through which
- all accessible objects are accessed.
- """
- return self._app_cache
-
- def start(self, async=False, gil=True):
- """
- Enter the main loop to start receiving and dispatching events.
-
- @param async: Should event dispatch be asynchronous (decoupled) from
- event receiving from the AT-SPI registry?
- @type async: boolean
- @param gil: Add an idle callback which releases the Python GIL for a few
- milliseconds to allow other threads to run? Necessary if other threads
- will be used in this process.
- Note - No Longer used.
- @type gil: boolean
- """
- self._loop = _gobject.MainLoop()
- try:
- self._loop.run()
- except KeyboardInterrupt:
- pass
-
- def stop(self, *args):
- """Quits the main loop."""
- self._loop.quit()
- self.flushEvents()
-
- def getDesktopCount(self):
- """
- Gets the number of available desktops.
-
- @return: Number of desktops
- @rtype: integer
- """
- return 1
-
- def getDesktop(self, i):
- """
- Gets a reference to the i-th desktop.
-
- @param i: Which desktop to get
- @type i: integer
- @return: Desktop reference
- @rtype: Accessibility.Desktop
- """
- return _Desktop(self._app_cache)
-
- # -------------------------------------------------------------------------------
-
- def _callClients(self, register, event):
- for client in register.keys():
- client(event)
-
- def _notifyNameChange(self, event):
- self._callClients(self._name_listeners, event)
-
- def _notifyDescriptionChange(self, event):
- self._callClients(self._description_listeners, event)
-
- def _notifyParentChange(self, event):
- self._callClients(self._parent_listeners, event)
-
- def _notifyChildrenChange(self, event):
- self._callClients(self._children_changed_listeners, event)
-
- def _registerFake(self, type, register, client, *names):
- """
- Registers a client from a register of clients
- for 'Fake' events emitted by the cache.
- """
- try:
- registered = register[client]
- except KeyError:
- registered = []
- register[client] = registered
-
- for name in names:
- new_type = _EventType(name)
- if new_type.is_subtype(type):
- registered.append(new_type.name)
-
- if registered == []:
- del(register[client])
-
- def _deregisterFake(self, type, register, client, *names):
- """
- Deregisters a client from a register of clients
- for 'Fake' events emitted by the cache.
- """
- try:
- registered = register[client]
- except KeyError:
- return True
-
- for name in names:
- remove_type = _EventType(name)
-
- copy = registered[:]
- for i in range(0, len(copy)):
- type_name = copy[i]
- registered_type = _EventType(type_name)
-
- if remove_type.is_subtype(registered_type):
- del(registered[i])
-
- if registered == []:
- del(register[client])
-
- # -------------------------------------------------------------------------------
-
- def registerEventListener(self, client, *names):
- """
- Registers a new client callback for the given event names. Supports
- registration for all subevents if only partial event name is specified.
- Do not include a trailing colon.
-
- For example, 'object' will register for all object events,
- 'object:property-change' will register for all property change events,
- and 'object:property-change:accessible-parent' will register only for the
- parent property change event.
-
- Registered clients will not be automatically removed when the client dies.
- To ensure the client is properly garbage collected, call
- L{deregisterEventListener}.
-
- @param client: Callable to be invoked when the event occurs
- @type client: callable
- @param names: List of full or partial event names
- @type names: list of string
- """
- try:
- registered = self._event_listeners[client]
- except KeyError:
- registered = []
- self._event_listeners[client] = registered
-
- for name in names:
- new_type = _EventType(name)
- registered.append((new_type.name,
- _event_type_to_signal_reciever(self._bus, self._app_cache, client, new_type)))
-
- self._registerFake(self._name_type, self._name_listeners, client, *names)
- self._registerFake(self._description_type, self._description_listeners, client, *names)
- self._registerFake(self._parent_type, self._parent_listeners, client, *names)
- self._registerFake(self._children_changed_type, self._children_changed_listeners, client, *names)
-
- def deregisterEventListener(self, client, *names):
- """
- Unregisters an existing client callback for the given event names. Supports
- unregistration for all subevents if only partial event name is specified.
- Do not include a trailing colon.
-
- This method must be called to ensure a client registered by
- L{registerEventListener} is properly garbage collected.
-
- @param client: Client callback to remove
- @type client: callable
- @param names: List of full or partial event names
- @type names: list of string
- @return: Were event names specified for which the given client was not
- registered?
- @rtype: boolean
- """
- try:
- registered = self._event_listeners[client]
- except KeyError:
- # Presumably if were trying to deregister a client with
- # no names then the return type is always true.
- return True
-
- missing = False
-
- for name in names:
- remove_type = _EventType(name)
- copy = registered[:]
- for i in range (0, len(copy)):
- type_name, signal_match = copy[i]
- registered_type = _EventType(type_name)
-
- if remove_type.is_subtype(registered_type):
- signal_match.remove()
- del(registered[i])
- else:
- missing = True
-
- if registered == []:
- del(self._event_listeners[client])
-
- #TODO Do these account for missing also?
- self._deregisterFake(self._name_type, self._name_listeners, client, *names)
- self._deregisterFake(self._description_type, self._description_listeners, client, *names)
- self._deregisterFake(self._parent_type, self._parent_listeners, client, *names)
- self._deregisterFake(self._children_changed_type, self._children_changed_listeners, client, *names)
-
- return missing
-
- # -------------------------------------------------------------------------------
-
- def registerKeystrokeListener(self,
- client,
- key_set=[],
- mask=0,
- kind=(KEY_PRESSED_EVENT, KEY_RELEASED_EVENT),
- synchronous=True,
- preemptive=True,
- global_=False):
- """
- Registers a listener for key stroke events.
-
- @param client: Callable to be invoked when the event occurs
- @type client: callable
- @param key_set: Set of hardware key codes to stop monitoring. Leave empty
- to indicate all keys.
- @type key_set: list of integer
- @param mask: When the mask is None, the codes in the key_set will be
- monitored only when no modifier is held. When the mask is an
- integer, keys in the key_set will be monitored only when the modifiers in
- the mask are held. When the mask is an iterable over more than one
- integer, keys in the key_set will be monitored when any of the modifier
- combinations in the set are held.
- @type mask: integer, iterable, None
- @param kind: Kind of events to watch, KEY_PRESSED_EVENT or
- KEY_RELEASED_EVENT.
- @type kind: list
- @param synchronous: Should the callback notification be synchronous, giving
- the client the chance to consume the event?
- @type synchronous: boolean
- @param preemptive: Should the callback be allowed to preempt / consume the
- event?
- @type preemptive: boolean
- @param global_: Should callback occur even if an application not supporting
- AT-SPI is in the foreground? (requires xevie)
- @type global_: boolean
- """
- try:
- # see if we already have an observer for this client
- ob = self.deviceClients[client]
- except KeyError:
- # create a new device observer for this client
- ob = KeyboardDeviceEventListener(self, synchronous, preemptive, global_)
- # store the observer to client mapping, and the inverse
- self.deviceClients[ob] = client
- self.deviceClients[client] = ob
- if mask is None:
- # None means all modifier combinations
- mask = utils.allModifiers()
- # register for new keystrokes on the observer
- ob.register(self.dev, key_set, mask, kind)
-
- def deregisterKeystrokeListener(self,
- client,
- key_set=[],
- mask=0,
- kind=(KEY_PRESSED_EVENT, KEY_RELEASED_EVENT)):
- """
- Deregisters a listener for key stroke events.
-
- @param client: Callable to be invoked when the event occurs
- @type client: callable
- @param key_set: Set of hardware key codes to stop monitoring. Leave empty
- to indicate all keys.
- @type key_set: list of integer
- @param mask: When the mask is None, the codes in the key_set will be
- monitored only when no modifier is held. When the mask is an
- integer, keys in the key_set will be monitored only when the modifiers in
- the mask are held. When the mask is an iterable over more than one
- integer, keys in the key_set will be monitored when any of the modifier
- combinations in the set are held.
- @type mask: integer, iterable, None
- @param kind: Kind of events to stop watching, KEY_PRESSED_EVENT or
- KEY_RELEASED_EVENT.
- @type kind: list
- @raise KeyError: When the client isn't already registered for events
- """
- # see if we already have an observer for this client
- ob = self.deviceClients[client]
- if mask is None:
- # None means all modifier combinations
- mask = utils.allModifiers()
- # register for new keystrokes on the observer
- ob.unregister(self.dev, key_set, mask, kind)
-
- def handleDeviceEvent(self, event, ob):
- """
- Dispatches L{event.DeviceEvent}s to registered clients. Clients are called
- in the order they were registered for the given AT-SPI event. If any
- client returns True, callbacks cease for the event for clients of this registry
- instance. Clients of other registry instances and clients in other processes may
- be affected depending on the values of synchronous and preemptive used when invoking
- L{registerKeystrokeListener}.
-
- @note: Asynchronous dispatch of device events is not supported.
-
- @param event: AT-SPI device event
- @type event: L{event.DeviceEvent}
- @param ob: Observer that received the event
- @type ob: L{KeyboardDeviceEventListener}
-
- @return: Should the event be consumed (True) or allowed to pass on to other
- AT-SPI observers (False)?
- @rtype: boolean
- """
- try:
- # try to get the client registered for this event type
- client = self.deviceClients[ob]
- except KeyError:
- # client may have unregistered recently, ignore event
- return False
- # make the call to the client
- try:
- return client(event) or event.consume
- except Exception:
- # print the exception, but don't let it stop notification
- traceback.print_exc()
-
- # -------------------------------------------------------------------------------
-
- def pumpQueuedEvents (self):
- """
- No Longer needed all application events are asyncronous.
- """
- pass
-
- def flushEvents (self):
- """
- No Longer needed all application events are asyncronous.
- """
- pass
-
- # -------------------------------------------------------------------------------
-
- def generateKeyboardEvent(self, keycode, keysym, kind):
- """
- Generates a keyboard event. One of the keycode or the keysym parameters
- should be specified and the other should be None. The kind parameter is
- required and should be one of the KEY_PRESS, KEY_RELEASE, KEY_PRESSRELEASE,
- KEY_SYM, or KEY_STRING.
-
- @param keycode: Hardware keycode or None
- @type keycode: integer
- @param keysym: Symbolic key string or None
- @type keysym: string
- @param kind: Kind of event to synthesize
- @type kind: integer
- """
- if keysym is None:
- self.dev.generateKeyboardEvent(keycode, '', kind)
- else:
- self.dev.generateKeyboardEvent(None, keysym, kind)
-
- def generateMouseEvent(self, x, y, name):
- """
- Generates a mouse event at the given absolute x and y coordinate. The kind
- of event generated is specified by the name. For example, MOUSE_B1P
- (button 1 press), MOUSE_REL (relative motion), MOUSE_B3D (butten 3
- double-click).
-
- @param x: Horizontal coordinate, usually left-hand oriented
- @type x: integer
- @param y: Vertical coordinate, usually left-hand oriented
- @type y: integer
- @param name: Name of the event to generate
- @type name: string
- """
- self.dev.generateMouseEvent(_dbus.Int32(x), _dbus.Int32(y), name)
diff --git a/pyatspi/relation.py b/pyatspi/relation.py
deleted file mode 100644
index ef952c22..00000000
--- a/pyatspi/relation.py
+++ /dev/null
@@ -1,137 +0,0 @@
-#Copyright (C) 2008 Codethink Ltd
-#copyright: Copyright (c) 2005, 2007 IBM Corporation
-
-#This library is free software; you can redistribute it and/or
-#modify it under the terms of the GNU Lesser General Public
-#License version 2 as published by the Free Software Foundation.
-
-#This program 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 General Public License for more details.
-#You should have received a copy of the GNU Lesser General Public License
-#along with this program; if not, write to the Free Software
-#Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#Portions of this code originally licensed and copyright (c) 2005, 2007
-#IBM Corporation under the BSD license, available at
-#U{http://www.opensource.org/licenses/bsd-license.php}
-
-#authors: Peter Parente, Mark Doffman
-
-import interfaces
-from base import Enum as _Enum
-
-#------------------------------------------------------------------------------
-
-class RelationType(_Enum):
- _enum_lookup = {
- 0:'RELATION_NULL',
- 1:'RELATION_LABEL_FOR',
- 2:'RELATION_LABELLED_BY',
- 3:'RELATION_CONTROLLER_FOR',
- 4:'RELATION_CONTROLLED_BY',
- 5:'RELATION_MEMBER_OF',
- 6:'RELATION_TOOLTIP_FOR',
- 7:'RELATION_NODE_CHILD_OF',
- 8:'RELATION_EXTENDED',
- 9:'RELATION_FLOWS_TO',
- 10:'RELATION_FLOWS_FROM',
- 11:'RELATION_SUBWINDOW_OF',
- 12:'RELATION_EMBEDS',
- 13:'RELATION_EMBEDDED_BY',
- 14:'RELATION_POPUP_FOR',
- 15:'RELATION_PARENT_WINDOW_OF',
- 16:'RELATION_DESCRIPTION_FOR',
- 17:'RELATION_DESCRIBED_BY',
- 18:'RELATION_LAST_DEFINED',
- }
-
-#------------------------------------------------------------------------------
-
-RELATION_CONTROLLED_BY = RelationType(4)
-RELATION_CONTROLLER_FOR = RelationType(3)
-RELATION_DESCRIBED_BY = RelationType(17)
-RELATION_DESCRIPTION_FOR = RelationType(16)
-RELATION_EMBEDDED_BY = RelationType(13)
-RELATION_EMBEDS = RelationType(12)
-RELATION_EXTENDED = RelationType(8)
-RELATION_FLOWS_FROM = RelationType(10)
-RELATION_FLOWS_TO = RelationType(9)
-RELATION_LABELLED_BY = RelationType(2)
-RELATION_LABEL_FOR = RelationType(1)
-RELATION_LAST_DEFINED = RelationType(18)
-RELATION_MEMBER_OF = RelationType(5)
-RELATION_NODE_CHILD_OF = RelationType(7)
-RELATION_NULL = RelationType(0)
-RELATION_PARENT_WINDOW_OF = RelationType(15)
-RELATION_POPUP_FOR = RelationType(14)
-RELATION_SUBWINDOW_OF = RelationType(11)
-RELATION_TOOLTIP_FOR = RelationType(6)
-
-#------------------------------------------------------------------------------
-
-# Build a dictionary mapping relation values to names based on the prefix of the enum constants.
-
-RELATION_VALUE_TO_NAME = dict(((value, name[9:].lower().replace('_', ' '))
- for name, value
- in globals().items()
- if name.startswith('RELATION_')))
-
-#------------------------------------------------------------------------------
-
-def _marshal_relation_set(cache, app_name, relation_set):
- """
- The D-Bus protocol has a relation set passed as an array of
- relation types and object arrays.
-
- This function marshals the D-Bus message into a list of relation
- objects.
- """
- return [Relation(cache, app_name, *relation) for relation in relation_set]
-
-#------------------------------------------------------------------------------
-
-class Relation(object):
- """
- An interface via which objects' non-hierarchical relationships
- to one another are indicated. An instance of Relations represents
- a "one-to-many" correspondance.
- """
-
- def __init__(self, cache, app_name, type, objects):
- self._type = type
- self._objects = objects
-
- self._cache = cache
- self._app_name = app_name
-
- def getNTargets(self):
- """
- @return the number of objects to which this relationship applies.
- """
- return len(self._objects)
-
- def getRelationType(self):
- """
- @return the RelationType of this Relation.
- """
- return RelationType(self._type)
-
- def getRelationTypeName(self):
- """
- @return an unlocalized string representing the relation type.
- """
- return RELATION_VALUE_TO_NAME[self._type]
-
- def getTarget(self, index):
- """
- @return an Object which is the 'nth'target of this Relation,
- e.g. the Object at index i in the list of Objects having the
- specified relationship to this Accessible.
- """
- return self._cache.create_accessible(self._app_name,
- self._objects[index],
- interfaces.ATSPI_ACCESSIBLE)
-
-#END----------------------------------------------------------------------------
diff --git a/pyatspi/role.py b/pyatspi/role.py
deleted file mode 100644
index a7dac275..00000000
--- a/pyatspi/role.py
+++ /dev/null
@@ -1,297 +0,0 @@
-#Copyright (C) 2008 Codethink Ltd
-
-#This library is free software; you can redistribute it and/or
-#modify it under the terms of the GNU Lesser General Public
-#License version 2 as published by the Free Software Foundation.
-
-#This program 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 General Public License for more details.
-#You should have received a copy of the GNU Lesser General Public License
-#along with this program; if not, write to the Free Software
-#Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-from base import Enum as _Enum
-
-#------------------------------------------------------------------------------
-
-class Role(_Enum):
- _enum_lookup = {
- 0:'ROLE_INVALID',
- 1:'ROLE_ACCELERATOR_LABEL',
- 2:'ROLE_ALERT',
- 3:'ROLE_ANIMATION',
- 4:'ROLE_ARROW',
- 5:'ROLE_CALENDAR',
- 6:'ROLE_CANVAS',
- 7:'ROLE_CHECK_BOX',
- 8:'ROLE_CHECK_MENU_ITEM',
- 9:'ROLE_COLOR_CHOOSER',
- 10:'ROLE_COLUMN_HEADER',
- 11:'ROLE_COMBO_BOX',
- 12:'ROLE_DATE_EDITOR',
- 13:'ROLE_DESKTOP_ICON',
- 14:'ROLE_DESKTOP_FRAME',
- 15:'ROLE_DIAL',
- 16:'ROLE_DIALOG',
- 17:'ROLE_DIRECTORY_PANE',
- 18:'ROLE_DRAWING_AREA',
- 19:'ROLE_FILE_CHOOSER',
- 20:'ROLE_FILLER',
- 21:'ROLE_FOCUS_TRAVERSABLE',
- 22:'ROLE_FONT_CHOOSER',
- 23:'ROLE_FRAME',
- 24:'ROLE_GLASS_PANE',
- 25:'ROLE_HTML_CONTAINER',
- 26:'ROLE_ICON',
- 27:'ROLE_IMAGE',
- 28:'ROLE_INTERNAL_FRAME',
- 29:'ROLE_LABEL',
- 30:'ROLE_LAYERED_PANE',
- 31:'ROLE_LIST',
- 32:'ROLE_LIST_ITEM',
- 33:'ROLE_MENU',
- 34:'ROLE_MENU_BAR',
- 35:'ROLE_MENU_ITEM',
- 36:'ROLE_OPTION_PANE',
- 37:'ROLE_PAGE_TAB',
- 38:'ROLE_PAGE_TAB_LIST',
- 39:'ROLE_PANEL',
- 40:'ROLE_PASSWORD_TEXT',
- 41:'ROLE_POPUP_MENU',
- 42:'ROLE_PROGRESS_BAR',
- 43:'ROLE_PUSH_BUTTON',
- 44:'ROLE_RADIO_BUTTON',
- 45:'ROLE_RADIO_MENU_ITEM',
- 46:'ROLE_ROOT_PANE',
- 47:'ROLE_ROW_HEADER',
- 48:'ROLE_SCROLL_BAR',
- 49:'ROLE_SCROLL_PANE',
- 50:'ROLE_SEPARATOR',
- 51:'ROLE_SLIDER',
- 52:'ROLE_SPIN_BUTTON',
- 53:'ROLE_SPLIT_PANE',
- 54:'ROLE_STATUS_BAR',
- 55:'ROLE_TABLE',
- 56:'ROLE_TABLE_CELL',
- 57:'ROLE_TABLE_COLUMN_HEADER',
- 58:'ROLE_TABLE_ROW_HEADER',
- 59:'ROLE_TEAROFF_MENU_ITEM',
- 60:'ROLE_TERMINAL',
- 61:'ROLE_TEXT',
- 62:'ROLE_TOGGLE_BUTTON',
- 63:'ROLE_TOOL_BAR',
- 64:'ROLE_TOOL_TIP',
- 65:'ROLE_TREE',
- 66:'ROLE_TREE_TABLE',
- 67:'ROLE_UNKNOWN',
- 68:'ROLE_VIEWPORT',
- 69:'ROLE_WINDOW',
- 70:'ROLE_EXTENDED',
- 71:'ROLE_HEADER',
- 72:'ROLE_FOOTER',
- 73:'ROLE_PARAGRAPH',
- 74:'ROLE_RULER',
- 75:'ROLE_APPLICATION',
- 76:'ROLE_AUTOCOMPLETE',
- 77:'ROLE_EDITBAR',
- 78:'ROLE_EMBEDDED',
- 79:'ROLE_ENTRY',
- 80:'ROLE_CHART',
- 81:'ROLE_CAPTION',
- 82:'ROLE_DOCUMENT_FRAME',
- 83:'ROLE_HEADING',
- 84:'ROLE_PAGE',
- 85:'ROLE_SECTION',
- 86:'ROLE_REDUNDANT_OBJECT',
- 87:'ROLE_FORM',
- 88:'ROLE_LINK',
- 89:'ROLE_INPUT_METHOD_WINDOW',
- 90:'ROLE_LAST_DEFINED',
- }
-
-ROLE_ACCELERATOR_LABEL = Role(1)
-ROLE_ALERT = Role(2)
-ROLE_ANIMATION = Role(3)
-ROLE_APPLICATION = Role(75)
-ROLE_ARROW = Role(4)
-ROLE_AUTOCOMPLETE = Role(76)
-ROLE_CALENDAR = Role(5)
-ROLE_CANVAS = Role(6)
-ROLE_CAPTION = Role(81)
-ROLE_CHART = Role(80)
-ROLE_CHECK_BOX = Role(7)
-ROLE_CHECK_MENU_ITEM = Role(8)
-ROLE_COLOR_CHOOSER = Role(9)
-ROLE_COLUMN_HEADER = Role(10)
-ROLE_COMBO_BOX = Role(11)
-ROLE_DATE_EDITOR = Role(12)
-ROLE_DESKTOP_FRAME = Role(14)
-ROLE_DESKTOP_ICON = Role(13)
-ROLE_DIAL = Role(15)
-ROLE_DIALOG = Role(16)
-ROLE_DIRECTORY_PANE = Role(17)
-ROLE_DOCUMENT_FRAME = Role(82)
-ROLE_DRAWING_AREA = Role(18)
-ROLE_EDITBAR = Role(77)
-ROLE_EMBEDDED = Role(78)
-ROLE_ENTRY = Role(79)
-ROLE_EXTENDED = Role(70)
-ROLE_FILE_CHOOSER = Role(19)
-ROLE_FILLER = Role(20)
-ROLE_FOCUS_TRAVERSABLE = Role(21)
-ROLE_FONT_CHOOSER = Role(22)
-ROLE_FOOTER = Role(72)
-ROLE_FORM = Role(87)
-ROLE_FRAME = Role(23)
-ROLE_GLASS_PANE = Role(24)
-ROLE_HEADER = Role(71)
-ROLE_HEADING = Role(83)
-ROLE_HTML_CONTAINER = Role(25)
-ROLE_ICON = Role(26)
-ROLE_IMAGE = Role(27)
-ROLE_INPUT_METHOD_WINDOW = Role(89)
-ROLE_INTERNAL_FRAME = Role(28)
-ROLE_INVALID = Role(0)
-ROLE_LABEL = Role(29)
-ROLE_LAST_DEFINED = Role(90)
-ROLE_LAYERED_PANE = Role(30)
-ROLE_LINK = Role(88)
-ROLE_LIST = Role(31)
-ROLE_LIST_ITEM = Role(32)
-ROLE_MENU = Role(33)
-ROLE_MENU_BAR = Role(34)
-ROLE_MENU_ITEM = Role(35)
-ROLE_OPTION_PANE = Role(36)
-ROLE_PAGE = Role(84)
-ROLE_PAGE_TAB = Role(37)
-ROLE_PAGE_TAB_LIST = Role(38)
-ROLE_PANEL = Role(39)
-ROLE_PARAGRAPH = Role(73)
-ROLE_PASSWORD_TEXT = Role(40)
-ROLE_POPUP_MENU = Role(41)
-ROLE_PROGRESS_BAR = Role(42)
-ROLE_PUSH_BUTTON = Role(43)
-ROLE_RADIO_BUTTON = Role(44)
-ROLE_RADIO_MENU_ITEM = Role(45)
-ROLE_REDUNDANT_OBJECT = Role(86)
-ROLE_ROOT_PANE = Role(46)
-ROLE_ROW_HEADER = Role(47)
-ROLE_RULER = Role(74)
-ROLE_SCROLL_BAR = Role(48)
-ROLE_SCROLL_PANE = Role(49)
-ROLE_SECTION = Role(85)
-ROLE_SEPARATOR = Role(50)
-ROLE_SLIDER = Role(51)
-ROLE_SPIN_BUTTON = Role(52)
-ROLE_SPLIT_PANE = Role(53)
-ROLE_STATUS_BAR = Role(54)
-ROLE_TABLE = Role(55)
-ROLE_TABLE_CELL = Role(56)
-ROLE_TABLE_COLUMN_HEADER = Role(57)
-ROLE_TABLE_ROW_HEADER = Role(58)
-ROLE_TEAROFF_MENU_ITEM = Role(59)
-ROLE_TERMINAL = Role(60)
-ROLE_TEXT = Role(61)
-ROLE_TOGGLE_BUTTON = Role(62)
-ROLE_TOOL_BAR = Role(63)
-ROLE_TOOL_TIP = Role(64)
-ROLE_TREE = Role(65)
-ROLE_TREE_TABLE = Role(66)
-ROLE_UNKNOWN = Role(67)
-ROLE_VIEWPORT = Role(68)
-ROLE_WINDOW = Role(69)
-
-ROLE_NAMES = {
- ROLE_INVALID:'invalid',
- ROLE_ACCELERATOR_LABEL:'accelerator label',
- ROLE_ALERT:'alert',
- ROLE_ANIMATION:'animation',
- ROLE_ARROW:'arrow',
- ROLE_CALENDAR:'calendar',
- ROLE_CANVAS:'canvas',
- ROLE_CHECK_BOX:'check box',
- ROLE_CHECK_MENU_ITEM:'check menu item',
- ROLE_COLOR_CHOOSER:'color chooser',
- ROLE_COLUMN_HEADER:'column header',
- ROLE_COMBO_BOX:'combo box',
- ROLE_DATE_EDITOR:'dateeditor',
- ROLE_DESKTOP_ICON:'desktop icon',
- ROLE_DESKTOP_FRAME:'desktop frame',
- ROLE_DIAL:'dial',
- ROLE_DIALOG:'dialog',
- ROLE_DIRECTORY_PANE:'directory pane',
- ROLE_DRAWING_AREA:'drawing area',
- ROLE_FILE_CHOOSER:'file chooser',
- ROLE_FILLER:'filler',
- ROLE_FONT_CHOOSER:'font chooser',
- ROLE_FRAME:'frame',
- ROLE_GLASS_PANE:'glass pane',
- ROLE_HTML_CONTAINER:'html container',
- ROLE_ICON:'icon',
- ROLE_IMAGE:'image',
- ROLE_INTERNAL_FRAME:'internal frame',
- ROLE_LABEL:'label',
- ROLE_LAYERED_PANE:'layered pane',
- ROLE_LIST:'list',
- ROLE_LIST_ITEM:'list item',
- ROLE_MENU:'menu',
- ROLE_MENU_BAR:'menu bar',
- ROLE_MENU_ITEM:'menu item',
- ROLE_OPTION_PANE:'option pane',
- ROLE_PAGE_TAB:'page tab',
- ROLE_PAGE_TAB_LIST:'page tab list',
- ROLE_PANEL:'panel',
- ROLE_PASSWORD_TEXT:'password text',
- ROLE_POPUP_MENU:'popup menu',
- ROLE_PROGRESS_BAR:'progress bar',
- ROLE_PUSH_BUTTON:'push button',
- ROLE_RADIO_BUTTON:'radio button',
- ROLE_RADIO_MENU_ITEM:'radio menu item',
- ROLE_ROOT_PANE:'root pane',
- ROLE_ROW_HEADER:'row header',
- ROLE_SCROLL_BAR:'scroll bar',
- ROLE_SCROLL_PANE:'scroll pane',
- ROLE_SEPARATOR:'separator',
- ROLE_SLIDER:'slider',
- ROLE_SPLIT_PANE:'split pane',
- ROLE_SPIN_BUTTON:'spin button',
- ROLE_STATUS_BAR:'status bar',
- ROLE_TABLE:'table',
- ROLE_TABLE_CELL:'table cell',
- ROLE_TABLE_COLUMN_HEADER:'table column header',
- ROLE_TABLE_ROW_HEADER:'table row header',
- ROLE_TEAROFF_MENU_ITEM:'tear off menu item',
- ROLE_TERMINAL:'terminal',
- ROLE_TEXT:'text',
- ROLE_TOGGLE_BUTTON:'toggle button',
- ROLE_TOOL_BAR:'tool bar',
- ROLE_TOOL_TIP:'tool tip',
- ROLE_TREE:'tree',
- ROLE_TREE_TABLE:'tree table',
- ROLE_UNKNOWN:'unknown',
- ROLE_VIEWPORT:'viewport',
- ROLE_WINDOW:'window',
- ROLE_HEADER:'header',
- ROLE_FOOTER:'footer',
- ROLE_PARAGRAPH:'paragraph',
- ROLE_RULER:'ruler',
- ROLE_APPLICATION:'application',
- ROLE_AUTOCOMPLETE:'autocomplete',
- ROLE_EDITBAR:'edit bar',
- ROLE_EMBEDDED:'embedded component',
- ROLE_ENTRY:'entry',
- ROLE_CHART:'chart',
- ROLE_CAPTION:'caption',
- ROLE_DOCUMENT_FRAME:'document frame',
- ROLE_HEADING:'heading',
- ROLE_PAGE:'page',
- ROLE_SECTION:'section',
- ROLE_REDUNDANT_OBJECT:'redundant object',
- ROLE_FORM:'form',
- ROLE_LINK:'link',
- ROLE_INPUT_METHOD_WINDOW:'input method window',
-}
-
-#END----------------------------------------------------------------------------
diff --git a/pyatspi/selection.py b/pyatspi/selection.py
deleted file mode 100644
index 4751ba52..00000000
--- a/pyatspi/selection.py
+++ /dev/null
@@ -1,136 +0,0 @@
-#Copyright (C) 2008 Codethink Ltd
-
-#This library is free software; you can redistribute it and/or
-#modify it under the terms of the GNU Lesser General Public
-#License version 2 as published by the Free Software Foundation.
-
-#This program 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 General Public License for more details.
-#You should have received a copy of the GNU Lesser General Public License
-#along with this program; if not, write to the Free Software
-#Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-from interfaces import *
-from accessible import Accessible
-from factory import accessible_factory
-
-import dbus
-
-__all__ = [
- "Selection",
- ]
-
-#------------------------------------------------------------------------------
-
-class Selection(Accessible):
- """
- 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.
- """
-
- def clearSelection(self):
- """
- Attempt to clear all selections (i.e. deselect all children)
- of a Selection. Not all Selection implementations allow the removal
- of all selections.
- @return True if the selections were successfully cleared, False
- otherwise.
- """
- func = self.get_dbus_method("clearSelection", dbus_interface=ATSPI_SELECTION)
- return func()
-
- def deselectChild(self, childIndex):
- """
- Remove a child from the selected children list of a Selection,
- if the child is currently selected.
- @param : childIndex
- a long integer (the zero offset index into the Accessible object's
- list of children) indicating which child of the Selection is
- to be selected.
- @return True if the child was successfully selected, False otherwise.
- """
- func = self.get_dbus_method("deselectChild", dbus_interface=ATSPI_SELECTION)
- return func(childIndex)
-
- def deselectSelectedChild(self, index):
- """
- Remove a child to the selected children list of a Selection.
- @param : selectedChildIndex
- a long integer indicating which of the selected children of the
- Selection is to be deselected. The index is a zero-offset index
- into the 'selected child list', not a zero-offset index into
- the list of all children of the Selection.
- @return True if the child was successfully deselected, False
- otherwise.
- """
- func = self.get_dbus_method("deselectSelectedChild", dbus_interface=ATSPI_SELECTION)
- return func(index)
-
- def getSelectedChild(self, index):
- """
- Get the i-th selected Accessible child of a Selection.
- @param : selectedChildIndex
- a long integer indicating which of the selected children of an
- object is being requested.
- @return a pointer to a selected Accessible child object, specified
- by selectedChildIndex.
- """
- func = self.get_dbus_method("getSelectedChild", dbus_interface=ATSPI_SELECTION)
- return self._cache.create_accessible(self._app_name, func(index),
- interfaces.ATSPI_ACCESSIBLE)
-
- def isChildSelected(self, index):
- """
- Determine whether a particular child of an Selection implementor
- is currently selected. Note that childIndex is the zero-offset
- index into the standard Accessible container's list of children.
- @param : childIndex
- an index into the Selection's list of children.
- @return True if the specified child is currently selected, False
- otherwise.
- """
- func = self.get_dbus_method("isChildSelected", dbus_interface=ATSPI_SELECTION)
- return func(index)
-
- def selectAll(self):
- """
- 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).
- @return True if successful, False otherwise.
- """
- func = self.get_dbus_method("selectAll", dbus_interface=ATSPI_SELECTION)
- return func()
-
- def selectChild(self, index):
- """
- Add a child to the selected children list of a Selection.
- @param : childIndex
- a long integer indicating which child of the Selection is to
- be selected.
- @return True if the child was successfully selected, False otherwise.
- """
- func = self.get_dbus_method("selectChild", dbus_interface=ATSPI_SELECTION)
- return func(index)
-
- def get_nSelectedChildren(self):
- return dbus.Int32(self._pgetter(self._dbus_interface, "nSelectedChildren"))
- _nSelectedChildrenDoc = \
- """
- The number of children of a Selection implementor which are currently
- selected.
- """
- nSelectedChildren = property(fget=get_nSelectedChildren, doc=_nSelectedChildrenDoc)
-
-# Register the accessible class with the factory.
-accessible_factory.register_accessible_class(ATSPI_SELECTION, Selection)
-
-#END----------------------------------------------------------------------------
diff --git a/pyatspi/state.py b/pyatspi/state.py
deleted file mode 100644
index fdfb2848..00000000
--- a/pyatspi/state.py
+++ /dev/null
@@ -1,256 +0,0 @@
-#Copyright (C) 2008 Codethink Ltd
-#copyright: Copyright (c) 2005, 2007 IBM Corporation
-
-#This library is free software; you can redistribute it and/or
-#modify it under the terms of the GNU Lesser General Public
-#License version 2 as published by the Free Software Foundation.
-
-#This program 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 General Public License for more details.
-#You should have received a copy of the GNU Lesser General Public License
-#along with this program; if not, write to the Free Software
-#Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#Portions of this code originally licensed and copyright (c) 2005, 2007
-#IBM Corporation under the BSD license, available at
-#U{http://www.opensource.org/licenses/bsd-license.php}
-
-#authors: Peter Parente, Mark Doffman
-
-from base import Enum as _Enum
-
-#------------------------------------------------------------------------------
-
-class StateType(_Enum):
- _enum_lookup = {
- 0:'STATE_INVALID',
- 1:'STATE_ACTIVE',
- 2:'STATE_ARMED',
- 3:'STATE_BUSY',
- 4:'STATE_CHECKED',
- 5:'STATE_COLLAPSED',
- 6:'STATE_DEFUNCT',
- 7:'STATE_EDITABLE',
- 8:'STATE_ENABLED',
- 9:'STATE_EXPANDABLE',
- 10:'STATE_EXPANDED',
- 11:'STATE_FOCUSABLE',
- 12:'STATE_FOCUSED',
- 13:'STATE_HAS_TOOLTIP',
- 14:'STATE_HORIZONTAL',
- 15:'STATE_ICONIFIED',
- 16:'STATE_MODAL',
- 17:'STATE_MULTI_LINE',
- 18:'STATE_MULTISELECTABLE',
- 19:'STATE_OPAQUE',
- 20:'STATE_PRESSED',
- 21:'STATE_RESIZABLE',
- 22:'STATE_SELECTABLE',
- 23:'STATE_SELECTED',
- 24:'STATE_SENSITIVE',
- 25:'STATE_SHOWING',
- 26:'STATE_SINGLE_LINE',
- 27:'STATE_STALE',
- 28:'STATE_TRANSIENT',
- 29:'STATE_VERTICAL',
- 30:'STATE_VISIBLE',
- 31:'STATE_MANAGES_DESCENDANTS',
- 32:'STATE_INDETERMINATE',
- 33:'STATE_REQUIRED',
- 34:'STATE_TRUNCATED',
- 35:'STATE_ANIMATED',
- 36:'STATE_INVALID_ENTRY',
- 37:'STATE_SUPPORTS_AUTOCOMPLETION',
- 38:'STATE_SELECTABLE_TEXT',
- 39:'STATE_IS_DEFAULT',
- 40:'STATE_VISITED',
- 41:'STATE_LAST_DEFINED',
- }
-
-#------------------------------------------------------------------------------
-
-STATE_ACTIVE = StateType(1)
-STATE_ANIMATED = StateType(35)
-STATE_ARMED = StateType(2)
-STATE_BUSY = StateType(3)
-STATE_CHECKED = StateType(4)
-STATE_COLLAPSED = StateType(5)
-STATE_DEFUNCT = StateType(6)
-STATE_EDITABLE = StateType(7)
-STATE_ENABLED = StateType(8)
-STATE_EXPANDABLE = StateType(9)
-STATE_EXPANDED = StateType(10)
-STATE_FOCUSABLE = StateType(11)
-STATE_FOCUSED = StateType(12)
-STATE_HAS_TOOLTIP = StateType(13)
-STATE_HORIZONTAL = StateType(14)
-STATE_ICONIFIED = StateType(15)
-STATE_INDETERMINATE = StateType(32)
-STATE_INVALID = StateType(0)
-STATE_INVALID_ENTRY = StateType(36)
-STATE_IS_DEFAULT = StateType(39)
-STATE_LAST_DEFINED = StateType(41)
-STATE_MANAGES_DESCENDANTS = StateType(31)
-STATE_MODAL = StateType(16)
-STATE_MULTISELECTABLE = StateType(18)
-STATE_MULTI_LINE = StateType(17)
-STATE_OPAQUE = StateType(19)
-STATE_PRESSED = StateType(20)
-STATE_REQUIRED = StateType(33)
-STATE_RESIZABLE = StateType(21)
-STATE_SELECTABLE = StateType(22)
-STATE_SELECTABLE_TEXT = StateType(38)
-STATE_SELECTED = StateType(23)
-STATE_SENSITIVE = StateType(24)
-STATE_SHOWING = StateType(25)
-STATE_SINGLE_LINE = StateType(26)
-STATE_STALE = StateType(27)
-STATE_SUPPORTS_AUTOCOMPLETION = StateType(37)
-STATE_TRANSIENT = StateType(28)
-STATE_TRUNCATED = StateType(34)
-STATE_VERTICAL = StateType(29)
-STATE_VISIBLE = StateType(30)
-STATE_VISITED = StateType(40)
-
-#------------------------------------------------------------------------------
-
-# Build a dictionary mapping state values to names based on the prefix of the enum constants.
-
-STATE_VALUE_TO_NAME = dict(((value, name[6:].lower().replace('_', ' '))
- for name, value
- in globals().items()
- if name.startswith('STATE_')))
-
-#------------------------------------------------------------------------------
-
-def _marshal_state_set(bitfield):
- """
- The D-Bus protocol has a stateset object passed
- as a 64bit bitfield. The Bits are passed as two 32bit
- integers.
-
- This function marshals the D-Bus message into a
- StateSet object that corresponds to these states.
- """
- (lower, upper) = bitfield
-
- states = []
-
- pos = 0
- while (lower):
- if (1L)&lower:
- states.append(StateType(pos))
- pos+=1
- lower >>= 1
-
- pos = 32
- while (upper):
- if (1L)&upper:
- states.append(StateType(pos))
- pos+=1
- upper >>= 1
-
- return StateSet(*states)
-
-#------------------------------------------------------------------------------
-
-class StateSet(object):
- """
- The StateSet object implements a wrapper around a
- bitmap of Accessible states.
-
- The StateSet object is the instantaneous state of
- the Accessible object and is not updated with its
- container Accessible. This behaviour is different
- to the CORBA version of AT-SPI
- """
- def __init__(self, *states):
- """
- Initializes the state set with the given states.
-
- @param states: States to add immediately
- @type states: list
- """
- self.states = set()
- map(self.add, states)
-
- def contains(self, state):
- """
- Checks if this StateSet contains the given state.
-
- @param state: State to check
- @type state: Accessibility.StateType
- @return: True if the set contains the given state
- @rtype: boolean
- """
- return state in self.states
-
- def add(self, *states):
- """
- Adds states to this set.
-
- @param states: State(s) to add
- @type states: Accessibility.StateType
- """
- for state in states:
- self.states.add(state)
-
- def remove(self, state):
- """
- Removes states from this set.
-
- @param states: State(s) to remove
- @type states: Accessibility.StateType
- """
- self.states.remove(state)
-
- def equals(self, state_set):
- """
- Checks if this StateSet contains exactly the same members as the given
- StateSet.
-
- @param state_set: Another set
- @type state_set: Accessibility.StateSet
- @return: Are the sets equivalent in terms of their contents?
- @rtype: boolean
- """
- return set(state_set.getStates()) == self.states
-
- def compare(self, state_set):
- """
- Finds the symmetric difference between this state set andthe one provided,
- and returns it as a new StateSet.
-
- @note: This does not use L{_StateSetImpl.compare} which cannot be
- implemented at this time
- @param state_set: Set to compare against
- @type state_set: Accessibility.StateSet
- @return: Proxy for the new set
- @rtype: L{StateSet}
- """
- a = set(self.getStates())
- b = set(state_set.getStates())
- diff = a.symmetric_difference(b)
- return StateSet(*diff)
-
- def isEmpty(self):
- """
- Checks if this StateSet is empty.
-
- @return: Is it empty?
- @rtype: boolean
- """
- return len(self.states) == 0
-
- def getStates(self):
- """
- Gets the sequence of all states in this set.
-
- @return: List of states
- @rtype: list
- """
- return list(self.states)
-
-#END----------------------------------------------------------------------------
diff --git a/pyatspi/table.py b/pyatspi/table.py
deleted file mode 100644
index dd8879f7..00000000
--- a/pyatspi/table.py
+++ /dev/null
@@ -1,376 +0,0 @@
-#Copyright (C) 2008 Codethink Ltd
-
-#This library is free software; you can redistribute it and/or
-#modify it under the terms of the GNU Lesser General Public
-#License version 2 as published by the Free Software Foundation.
-
-#This program 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 General Public License for more details.
-#You should have received a copy of the GNU Lesser General Public License
-#along with this program; if not, write to the Free Software
-#Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-from interfaces import *
-from accessible import Accessible
-from factory import accessible_factory
-
-import dbus
-
-__all__ = [
- "Table",
- ]
-
-#------------------------------------------------------------------------------
-
-class Table(Accessible):
- """
- 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.
- """
-
- def addColumnSelection(self, column):
- """
- Select the specified column, adding it to the current column
- selection, if the table's selection model permits it.
- @param : column
- @return True if the specified column was successfully selected,
- False if not.
- """
- func = self.get_dbus_method("addColumnSelection", dbus_interface=ATSPI_TABLE)
- return func(column)
-
- def addRowSelection(self, row):
- """
- Select the specified row, adding it to the current row selection,
- if the table's selection model permits it.
- @param : row
- @return True if the specified row was successfully selected,
- False if not.
- """
- func = self.get_dbus_method("addRowSelection", dbus_interface=ATSPI_TABLE)
- return func(row)
-
- def getAccessibleAt(self, row, column):
- """
- Get the table cell at the specified row and column indices.
- @param : row
- the specified table row, zero-indexed.
- @param : column
- the specified table column, zero-indexed.
- @return an Accessible object representing the specified table
- cell.
- """
- func = self.get_dbus_method("getAccessibleAt", dbus_interface=ATSPI_TABLE)
- return self._cache.create_accessible(self._app_name, func(row, column),
- interfaces.ATSPI_ACCESSIBLE)
-
- def getColumnAtIndex(self, index):
- """
- Get the table column index occupied by the child at a particular
- 1-D child index.
- @param : index
- the specified child index, zero-indexed.
- @return a long integer indicating the first column spanned by
- the child of a table, at the specified 1-D (zero-offset) index.
- """
- func = self.get_dbus_method("getColumnAtIndex", dbus_interface=ATSPI_TABLE)
- return func(index)
-
- def getColumnDescription(self, column):
- """
- Get a text description of a particular table column. This differs
- from AccessibleTable_getColumnHeader, which returns an Accessible.
- @param : column
- the specified table column, zero-indexed.
- @return a UTF-8 string describing the specified table column,
- if available.
- """
- func = self.get_dbus_method("getColumnDescription", dbus_interface=ATSPI_TABLE)
- return func(column)
-
- def getColumnExtentAt(self, row, column):
- """
- 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).
- @param : row
- the specified table row, zero-indexed.
- @param : column
- the specified table column, zero-indexed.
- @return a long integer indicating the number of columns spanned
- by the specified cell.
- """
- func = self.get_dbus_method("getColumnExtentAt", dbus_interface=ATSPI_TABLE)
- return func(row, column)
-
- def getColumnHeader(self, index):
- """
- Get the header associated with a table column, if available,
- as an instance of Accessible. This differs from getColumnDescription,
- which returns a string.
- @param : column
- the specified table column, zero-indexed.
- @return an Accessible representatin of the specified table column,
- if available.
- """
- func = self.get_dbus_method("getColumnHeader", dbus_interface=ATSPI_TABLE)
- return self._cache.create_accessible(self._app_name, func(index),
- interfaces.ATSPI_ACCESSIBLE)
-
- def getIndexAt(self, row, column):
- """
- Get the 1-D child index corresponding to the specified 2-D row
- and column indices.
- @param : row
- the specified table row, zero-indexed.
- @param : column
- the specified table column, zero-indexed.
- @return a long integer which serves as the index of a specified
- cell in the table, in a form usable by Accessible::getChildAtIndex.
- """
- func = self.get_dbus_method("getIndexAt", dbus_interface=ATSPI_TABLE)
- return func(row, column)
-
- def getRowAtIndex(self, index):
- """
- Get the table row index occupied by the child at a particular
- 1-D child index.
- @param : index
- the specified child index, zero-indexed.
- @return a long integer indicating the first row spanned by the
- child of a table, at the specified 1-D (zero-offset) index.
- """
- func = self.get_dbus_method("getRowAtIndex", dbus_interface=ATSPI_TABLE)
- return func(index)
-
- def getRowColumnExtentsAtIndex(self, index):
- """
- Given a child index, determine the row and column indices and
- extents, and whether the cell is currently selected. If the child
- at index is not a cell (for instance, if it is a summary, caption,
- etc.), 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 index.
- @param : col
- back-filled with the first table column associated with the cell
- with child index index.
- @param : row_extents
- back-filled with the number of table rows across which child
- i extends.
- @param : col_extents
- back-filled with the number of table columns across which child
- i extends.
- @param : is_selected
- a boolean which is back-filled with True if the child at index
- i corresponds to a selected table cell, 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 retval=table::getRowColumnExtentsAtIndex(6,row,col,
- row_extents,
- col_extents,
- is_selected);
- will return True, and after the call row, col, row_extents,
- col_extents, and is_selected will contain 2, 5, 1, 2, and True,
- respectively.
- @return True if the index is associated with a valid table cell,
- False if the index does not correspond to a cell. If False is
- returned, the values of the out parameters are undefined.
- """
- func = self.get_dbus_method("getRowColumnExtentsAtIndex", dbus_interface=ATSPI_TABLE)
- return func(index)
-
- def getRowDescription(self, index):
- """
- Get a text description of a particular table row. This differs
- from AccessibleTable_getRowHeader, which returns an Accessible.
- @param : row
- the specified table row, zero-indexed.
- @return a UTF-8 string describing the specified table row, if
- available.
- """
- func = self.get_dbus_method("getRowDescription", dbus_interface=ATSPI_TABLE)
- return func(index)
-
- def getRowExtentAt(self, row, column):
- """
- 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).
- @param : row
- the specified table row, zero-indexed.
- @param : column
- the specified table column, zero-indexed.
- @return a long integer indicating the number of rows spanned
- by the specified cell.
- """
- func = self.get_dbus_method("getRowExtentAt", dbus_interface=ATSPI_TABLE)
- return func(row, column)
-
- def getRowHeader(self, row):
- """
- Get the header associated with a table row, if available. This
- differs from getRowDescription, which returns a string.
- @param : row
- the specified table row, zero-indexed.
- @return an Accessible representatin of the specified table row,
- if available.
- """
- func = self.get_dbus_method("getRowHeader", dbus_interface=ATSPI_TABLE)
- return self._cache.create_accessible(self._app_name, func(row),
- interfaces.ATSPI_ACCESSIBLE)
-
- def getSelectedColumns(self):
- """
- Obtain the indices of all columns which are currently selected.
- @return a sequence of integers comprising the indices of columns
- currently selected.
- """
- func = self.get_dbus_method("getSelectedColumns", dbus_interface=ATSPI_TABLE)
- return func()
-
- def getSelectedRows(self):
- """
- Obtain the indices of all rows which are currently selected.
- @return a sequence of integers comprising the indices of rows
- currently selected.
- """
- func = self.get_dbus_method("getSelectedRows", dbus_interface=ATSPI_TABLE)
- return func()
-
- def isColumnSelected(self, column):
- """
- Determine whether a table column is selected.
- @param : column
- the column being queried.
- @return True if the specified column is currently selected, False
- if not.
- """
- func = self.get_dbus_method("isColumnSelected", dbus_interface=ATSPI_TABLE)
- return func(column)
-
- def isRowSelected(self, row):
- """
- Determine whether a table row is selected.
- @param : row
- the row being queried.
- @return True if the specified row is currently selected, False
- if not.
- """
- func = self.get_dbus_method("isRowSelected", dbus_interface=ATSPI_TABLE)
- return func(row)
-
- def isSelected(self, row, column):
- """
- 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.
- @return True if the specified cell is currently selected, False
- if not.
- """
- func = self.get_dbus_method("isSelected", dbus_interface=ATSPI_TABLE)
- return func(row, column)
-
- def removeColumnSelection(self, column):
- """
- Remove the specified column from current column selection, if
- the table's selection model permits it.
- @param : column
- @return True if the specified column was successfully de-selected,
- False if not.
- """
- func = self.get_dbus_method("removeColumnSelection", dbus_interface=ATSPI_TABLE)
- return func(column)
-
- def removeRowSelection(self, row):
- """
- Remove the specified row from current row selection, if the table's
- selection model permits it.
- @param : row
- @return True if the specified row was successfully de-selected,
- False if not.
- """
- func = self.get_dbus_method("removeRowSelection", dbus_interface=ATSPI_TABLE)
- return func(row)
-
- def get_caption(self):
- accessible = self._pgetter(self._dbus_interface, "caption")
- return self._cache.create_accessible(self._app_name, accessible,
- interfaces.ATSPI_ACCESSIBLE)
- _captionDoc = \
- """
- An Accessible which represents of a caption for a Table.
- """
- caption = property(fget=get_caption, doc=_captionDoc)
-
- def get_nColumns(self):
- return dbus.Int32(self._pgetter(self._dbus_interface, "nColumns"))
- _nColumnsDoc = \
- """
- 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.
- """
- nColumns = property(fget=get_nColumns, doc=_nColumnsDoc)
-
- def get_nRows(self):
- return dbus.Int32(self._pgetter(self._dbus_interface, "nRows"))
- _nRowsDoc = \
- """
- 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.
- """
- nRows = property(fget=get_nRows, doc=_nRowsDoc)
-
- def get_nSelectedColumns(self):
- return dbus.Int32(self._pgetter(self._dbus_interface, "nSelectedColumns"))
- _nSelectedColumnsDoc = \
- """
- The number of columns currently selected. A selected column is
- one in which all included cells are selected.
- """
- nSelectedColumns = property(fget=get_nSelectedColumns, doc=_nSelectedColumnsDoc)
-
- def get_nSelectedRows(self):
- return dbus.Int32(self._pgetter(self._dbus_interface, "nSelectedRows"))
- _nSelectedRowsDoc = \
- """
- The number of rows currently selected. A selected row is one
- in which all included cells are selected.
- """
- nSelectedRows = property(fget=get_nSelectedRows, doc=_nSelectedRowsDoc)
-
- def get_summary(self):
- accessible = self._pgetter(self._dbus_interface, "summary")
- return self._cache.create_accessible(self._app_name, accessible,
- interfaces.ATSPI_ACCESSIBLE)
- _summaryDoc = \
- """
- An accessible object which summarizes the contents of a Table.
- This object is frequently itself a Table instance, albeit a simplified
- one.
- """
- summary = property(fget=get_summary, doc=_summaryDoc)
-
-# Register the accessible class with the factory.
-accessible_factory.register_accessible_class(ATSPI_TABLE, Table)
-
-#END----------------------------------------------------------------------------
diff --git a/pyatspi/text.py b/pyatspi/text.py
deleted file mode 100644
index 7b55ef70..00000000
--- a/pyatspi/text.py
+++ /dev/null
@@ -1,592 +0,0 @@
-#Copyright (C) 2008 Codethink Ltd
-
-#This library is free software; you can redistribute it and/or
-#modify it under the terms of the GNU Lesser General Public
-#License version 2 as published by the Free Software Foundation.
-
-#This program 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 General Public License for more details.
-#You should have received a copy of the GNU Lesser General Public License
-#along with this program; if not, write to the Free Software
-#Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-import dbus
-
-from interfaces import *
-from accessible import Accessible
-from base import Enum
-from factory import accessible_factory
-
-from dbus.types import UInt32
-
-__all__ = [
- "Text",
- "TEXT_BOUNDARY_TYPE",
- "TEXT_BOUNDARY_CHAR",
- "TEXT_BOUNDARY_WORD_START",
- "TEXT_BOUNDARY_WORD_END",
- "TEXT_BOUNDARY_SENTENCE_START",
- "TEXT_BOUNDARY_SENTENCE_END",
- "TEXT_BOUNDARY_LINE_START",
- "TEXT_BOUNDARY_LINE_END",
- "TEXT_CLIP_TYPE",
- "TEXT_CLIP_NONE",
- "TEXT_CLIP_MIN",
- "TEXT_CLIP_MAX",
- "TEXT_CLIP_BOTH",
- ]
-
-#------------------------------------------------------------------------------
-
-class TEXT_BOUNDARY_TYPE(Enum):
- _enum_lookup = {
- 0:'TEXT_BOUNDARY_CHAR',
- 1:'TEXT_BOUNDARY_WORD_START',
- 2:'TEXT_BOUNDARY_WORD_END',
- 3:'TEXT_BOUNDARY_SENTENCE_START',
- 4:'TEXT_BOUNDARY_SENTENCE_END',
- 5:'TEXT_BOUNDARY_LINE_START',
- 6:'TEXT_BOUNDARY_LINE_END',
- }
-
-TEXT_BOUNDARY_CHAR = TEXT_BOUNDARY_TYPE(0)
-TEXT_BOUNDARY_LINE_END = TEXT_BOUNDARY_TYPE(6)
-TEXT_BOUNDARY_LINE_START = TEXT_BOUNDARY_TYPE(5)
-TEXT_BOUNDARY_SENTENCE_END = TEXT_BOUNDARY_TYPE(4)
-TEXT_BOUNDARY_SENTENCE_START = TEXT_BOUNDARY_TYPE(3)
-TEXT_BOUNDARY_WORD_END = TEXT_BOUNDARY_TYPE(2)
-TEXT_BOUNDARY_WORD_START = TEXT_BOUNDARY_TYPE(1)
-
-#------------------------------------------------------------------------------
-
-class TEXT_CLIP_TYPE(Enum):
- _enum_lookup = {
- 0:'TEXT_CLIP_NONE',
- 1:'TEXT_CLIP_MIN',
- 2:'TEXT_CLIP_MAX',
- 3:'TEXT_CLIP_BOTH',
- }
-
-TEXT_CLIP_BOTH = TEXT_CLIP_TYPE(3)
-TEXT_CLIP_MAX = TEXT_CLIP_TYPE(2)
-TEXT_CLIP_MIN = TEXT_CLIP_TYPE(1)
-TEXT_CLIP_NONE = TEXT_CLIP_TYPE(0)
-
-#------------------------------------------------------------------------------
-
-class Text(Accessible):
- """
- 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.
- 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.
- """
-
- def addSelection(self, index):
- """
- 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.
- @return True of the selection was successfully added, False otherwise.
- Selection may fail if the object does not support selection of
- text (see STATE_SELECTABLE_TEXT), if the object 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).
- """
- func = self.get_dbus_method("addSelection", dbus_interface=ATSPI_TEXT)
- return func(index)
-
- def getAttributeRun(self, offset):
- """
- 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 offset, i.e. the start
- of the homogeneous attribute run including offset.
- @param : endOffset
- backfilled with the offset of the first character past the character
- range over which all text attributes match those of offset, i.e.
- the character immediately after the homogeneous attribute run
- including 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.
- @return the AttributeSet defined at offset, optionally including
- the 'default' attributes.
- """
- func = self.get_dbus_method("getAttributeRun", dbus_interface=ATSPI_TEXT)
- [attrs, startOffset, endOffset] = func(offset, includeDefaults)
- dict = [key + ':' + value for key, value in attrs.values()]
- return [dict, startOffset, endOffset]
-
- def getAttributeValue(self, offset, attributeName):
- """
- 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 offset.
- @param : endOffset
- back-filled with the offset of the first character past the end
- of the attribute run containing the character at offset.
- @param : defined
- back-filled with True if the attributeName has a defined value
- at offset, False otherwise.
- @return the value of attribute (name-value pair) corresponding
- to "name", if defined.
- """
- func = self.get_dbus_method("getAttributeValue", dbus_interface=ATSPI_TEXT)
- return func(offset, attributeName)
-
- def getAttributes(self, offset):
- """
- getAttributes is deprecated in favor of getAttributeRun.
- @return the attributes at offset, as a semicolon-delimited set
- of colon-delimited name-value pairs.
- """
- func = self.get_dbus_method("getAttributes", dbus_interface=ATSPI_TEXT)
- [attrs, startOffset, endOffset] = func(dbus.Int32(offset))
- dict = [key + ':' + value for key, value in attrs]
- return [dict, startOffset, endOffset]
-
- def getBoundedRanges(self, x, y, width, height, coordType, xClipType, yClipType):
- #TODO Return a list of range structures
- """
- 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.
- @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.
- """
- func = self.get_dbus_method("getBoundedRanges", dbus_interface=ATSPI_TEXT)
- return func(x, y, width, height, UInt32(coordType), xClipType, yClipType)
-
- def getCharacterAtOffset(self, offset):
- """
- @param : offset
- position
- @return an unsigned long integer whose value corresponds to the
- UCS-4 representation of the character at the specified text offset,
- or 0 if offset is out of range.
- """
- func = self.get_dbus_method("getCharacterAtOffset", dbus_interface=ATSPI_TEXT)
- return func(offset)
-
- def getCharacterExtents(self, offset, x, y, width, height, coordType):
- """
- 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 offset.
- @param : y
- the minimum vertical coordinate of the bounding box of the glyph
- representing the character at offset.
- @param : width
- the horizontal extent of the bounding box of the glyph representing
- the character at offset.
- @param : height
- the vertical extent of the bounding box of the glyph representing
- the character at 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.
- """
- func = self.get_dbus_method("getCharacterExtents", dbus_interface=ATSPI_TEXT)
- return func(offset, x, y, width, height, UInt32(coordType))
-
- def getDefaultAttributeSet(self):
- """
- 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.
- """
- func = self.get_dbus_method("getDefaultAttributeSet", dbus_interface=ATSPI_TEXT)
- return [key + ':' + value for key, value in func().values()]
-
- def getDefaultAttributes(self):
- """
- Deprecated in favor of getDefaultAttributeSet.
- @return the attributes which apply to the entire text content,
- but which were not explicitly specified by the content creator.
- """
- func = self.get_dbus_method("getDefaultAttributes", dbus_interface=ATSPI_TEXT)
- return ';'.join([key + ':' + value for key, value in func().iteritems()])
-
- def getNSelections(self):
- """
- 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.
- @return the number of contiguous selections in the current Text
- object.
- """
- func = self.get_dbus_method("getNSelections", dbus_interface=ATSPI_TEXT)
- return func()
-
- def getOffsetAtPoint(self, x, y, coordType):
- """
- 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.
- @return 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.
- """
- func = self.get_dbus_method("getOffsetAtPoint", dbus_interface=ATSPI_TEXT)
- return func(x, y, UInt32(coordType))
-
- def getRangeExtents(self, startOffset, endOffset, coordType):
- """
- 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.
- """
- func = self.get_dbus_method("getRangeExtents", dbus_interface=ATSPI_TEXT)
- return func(startOffset, endOffset, UInt32(coordType))
-
- def getSelection(self, selectionNum):
- """
- 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.
- @param : selectionNum
- indicates which of a set of non-contiguous selections to modify.
- @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.
- """
- func = self.get_dbus_method("getSelection", dbus_interface=ATSPI_TEXT)
- return func(selectionNum)
-
- def getText(self, startOffset, endOffset):
- """
- 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.
- @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.
- @return the textual content of the current Text object beginning
- startOffset (inclusive) up to but not including the character
- at endOffset.
- """
- func = self.get_dbus_method("getText", dbus_interface=ATSPI_TEXT)
- if not endOffset:
- endOffset = -1
- return func(dbus.Int32(startOffset), dbus.Int32(endOffset))
-
- def getTextAfterOffset(self, offset, type):
- """
- Obtain a subset of the text content of an object which entirely
- follows offset, delimited by character, word, line, or sentence
- boundaries as specified by type. The starting and ending offsets
- of the resulting substring are returned in startOffset and endOffset.
- By definition, if such a substring exists, startOffset must be
- greater than 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.
- @return a string which is a substring of the text content of
- the object, delimited by the specified boundary condition.
- """
- func = self.get_dbus_method("getTextAfterOffset", dbus_interface=ATSPI_TEXT)
- return func(offset, type)
-
- def getTextAtOffset(self, offset, type):
- """
- Obtain a subset of the text content of an object which includes
- the specified offset, delimited by character, word, line, or
- sentence boundaries as specified by type. The starting and ending
- offsets of the resulting substring are returned in startOffset
- and 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.
- @return a string which is a substring of the text content of
- the object, delimited by the specified boundary condition.
- """
- func = self.get_dbus_method("getTextAtOffset", dbus_interface=ATSPI_TEXT)
- return func(offset, type)
-
- def getTextBeforeOffset(self, offset, type):
- """
- Obtain a subset of the text content of an object which entirely
- precedes offset, delimited by character, word, line, or sentence
- boundaries as specified by type. The starting and ending offsets
- of the resulting substring are returned in startOffset and endOffset.
- By definition, if such a substring exists, endOffset is less
- than or equal to 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.
- @return a string which is a substring of the text content of
- the object, delimited by the specified boundary condition.
- """
- func = self.get_dbus_method("getTextBeforeOffset", dbus_interface=ATSPI_TEXT)
- return func(offset, type)
-
- def removeSelection(self, selectionNum):
- """
- 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.
- @param : selectionNum
- indicates which of a set of non-contiguous selections to modify.
- @return True if the selection was successfully removed, False
- otherwise.
- """
- func = self.get_dbus_method("removeSelection", dbus_interface=ATSPI_TEXT)
- return func(selectionNum)
-
- def setCaretOffset(self, offset):
- """
- 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.
- @return TRUE if the request was carried out, or FALSE if the
- caret could not be moved to the requested position.
- """
- func = self.get_dbus_method("setCaretOffset", dbus_interface=ATSPI_TEXT)
- return func(offset)
-
- def setSelection(self, selectionNum, startOffset, endOffset):
- """
- 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
- @return True if the selection corresponding to selectionNum is
- successfully modified, False otherwise.
- """
- func = self.get_dbus_method("setSelection", dbus_interface=ATSPI_TEXT)
- return func(selectionNum, startOffset, endOffset)
-
- def get_caretOffset(self):
- return dbus.Int32(self._pgetter(self._dbus_interface, "caretOffset"))
- _caretOffsetDoc = \
- """
- 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.
- """
- caretOffset = property(fget=get_caretOffset, doc=_caretOffsetDoc)
-
- def get_characterCount(self):
- return dbus.Int32(self._pgetter(self._dbus_interface, "characterCount"))
- _characterCountDoc = \
- """
- The total current number of characters in the Text object, including
- whitespace and non-spacing characters.
- """
- characterCount = property(fget=get_characterCount, doc=_characterCountDoc)
-
- class Range(list):
- def __new__(cls, startOffset, endOffset, content, data):
- list.__new__(cls, (startOffset, endOffset, content, data))
- def __init__(self, startOffset, endOffset, content, data):
- list.__init__(self, (startOffset, endOffset, content, data))
-
- def _get_startOffset(self):
- return self[0]
- def _set_startOffset(self, val):
- self[0] = val
- startOffset = property(fget=_get_startOffset, fset=_set_startOffset)
- def _get_endOffset(self):
- return self[1]
- def _set_endOffset(self, val):
- self[1] = val
- endOffset = property(fget=_get_endOffset, fset=_set_endOffset)
- def _get_content(self):
- return self[2]
- def _set_content(self, val):
- self[2] = val
- content = property(fget=_get_content, fset=_set_content)
- def _get_data(self):
- return self[3]
- def _set_data(self, val):
- self[3] = val
- data = property(fget=_get_data, fset=_set_data)
-
-# Register the accessible class with the factory.
-accessible_factory.register_accessible_class(ATSPI_TEXT, Text)
-
-#END----------------------------------------------------------------------------
diff --git a/pyatspi/utils.py b/pyatspi/utils.py
deleted file mode 100644
index 61cad1e6..00000000
--- a/pyatspi/utils.py
+++ /dev/null
@@ -1,331 +0,0 @@
-#Copyright (C) 2008 Codethink Ltd
-#copyright: Copyright (c) 2005, 2007 IBM Corporation
-
-#This library is free software; you can redistribute it and/or
-#modify it under the terms of the GNU Lesser General Public
-#License version 2 as published by the Free Software Foundation.
-
-#This program 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 General Public License for more details.
-#You should have received a copy of the GNU Lesser General Public License
-#along with this program; if not, write to the Free Software
-#Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#Portions of this code originally licensed and copyright (c) 2005, 2007
-#IBM Corporation under the BSD license, available at
-#U{http://www.opensource.org/licenses/bsd-license.php}
-
-#authors: Peter Parente, Mark Doffman
-
-import relation
-import state
-import registry
-
-__all__ = [
- "setCacheLevel",
- "getCacheLevel",
- "clearCache",
- "printCache",
- "getInterfaceIID",
- "getInterfaceName",
- "listInterfaces",
- "stringToConst",
- "stateToString",
- "relationToString",
- "allModifiers",
- "findDescendant",
- "findAllDescendants",
- "findAncestor",
- "getPath",
- ]
-
-def setCacheLevel(level):
- pass
-
-def getCacheLevel():
- return None
-
-def clearCache():
- pass
-
-def printCache():
- print "Print cache function is deprecated";
-
-def getInterfaceIID(obj):
- """
- Gets the ID of an interface class or object in string format for use in
- queryInterface.
-
- @param obj: Class representing an AT-SPI interface or instance
- @type obj: object
- @return: IID for the interface
- @rtype: string
- @raise AttributeError: When the parameter does not provide typecode info
-
- WARNING!! DEPRECATED!!
-
- In current D-Bus version of pyatspi this simply returns a null string.
- """
- return ""
-
-def getInterfaceName(obj):
- """
- Gets the human readable name of an interface class or object in string
- format.
-
- @param obj: Class representing an AT-SPI interface or instance
- @type obj: class
- @return: Name of the interface
- @rtype: string
- @raise AttributeError: When the parameter does not provide typecode info
- """
- return obj._dbus_interface.lstrip("org.freedesktop.atspi.")
-
-def listInterfaces(obj):
- """
- Gets a list of the names of all interfaces supported by this object. The
- names are the short-hand interface names like "Accessible" and "Component",
- not the full interface identifiers.
-
- @param obj: Arbitrary object to query for all accessibility related
- interfaces. Must provide a queryInterface method.
- @type obj: object
- @return: Set of supported interface names
- @rtype: set
- @raise AttributeError: If the object provide does not implement
- queryInterface
- """
- return [itf.lstrip("org.freedesktop.atspi.") for itf in obj.interfaces]
-
-def stringToConst(prefix, suffix):
- """
- Maps a string name to an AT-SPI constant. The rules for the mapping are as
- follows:
- - The prefix is captalized and has an _ appended to it.
- - All spaces in the suffix are mapped to the _ character.
- - All alpha characters in the suffix are mapped to their uppercase.
-
- The resulting name is used with getattr to look up a constant with that name
- in the L{constants} module. If such a constant does not exist, the string
- suffix is returned instead.
-
- This method allows strings to be used to refer to roles, relations, etc.
- without direct access to the constants. It also supports the future expansion
- of roles, relations, etc. by allowing arbitrary strings which may or may not
- map to the current standard set of roles, relations, etc., but may still
- match some non-standard role, relation, etc. being reported by an
- application.
-
- @param prefix: Prefix of the constant name such as role, relation, state,
- text, modifier, key
- @type prefix: string
- @param suffix: Name of the role, relation, etc. to use to lookup the constant
- @type suffix: string
- @return: The matching constant value
- @rtype: object
- """
- name = prefix.upper()+'_'+suffix.upper().replace(' ', '_')
- return getattr(constants, name, suffix)
-
-def stateToString(value):
- """
- Converts a state value to a string based on the name of the state constant in
- the L{constants} module that has the given value.
-
- @param value: An AT-SPI state
- @type value: Accessibility.StateType
- @return: Human readable, untranslated name of the state
- @rtype: string
- """
- return state.STATE_VALUE_TO_NAME.get(value)
-
-def relationToString(value):
- """
- Converts a relation value to a string based on the name of the state constant
- in the L{constants} module that has the given value.
-
- @param value: An AT-SPI relation
- @type value: Accessibility.RelationType
- @return: Human readable, untranslated name of the relation
- @rtype: string
- """
- return relation.RELATION_VALUE_TO_NAME.get(value)
-
-def allModifiers():
- """
- Generates all possible keyboard modifiers for use with
- L{registry.Registry.registerKeystrokeListener}.
- """
- mask = 0
- while mask <= (1 << registry.MODIFIER_NUMLOCK):
- yield mask
- mask += 1
-
-def findDescendant(acc, pred, breadth_first=False):
- """
- Searches for a descendant node satisfying the given predicate starting at
- this node. The search is performed in depth-first order by default or
- in breadth first order if breadth_first is True. For example,
-
- my_win = findDescendant(lambda x: x.name == 'My Window')
-
- will search all descendants of x until one is located with the name 'My
- Window' or all nodes are exausted. Calls L{_findDescendantDepth} or
- L{_findDescendantBreadth} to start the recursive search.
-
- @param acc: Root accessible of the search
- @type acc: Accessibility.Accessible
- @param pred: Search predicate returning True if accessible matches the
- search criteria or False otherwise
- @type pred: callable
- @param breadth_first: Search breadth first (True) or depth first (False)?
- @type breadth_first: boolean
- @return: Accessible matching the criteria or None if not found
- @rtype: Accessibility.Accessible or None
- """
- if breadth_first:
- return _findDescendantBreadth(acc, pred)
-
- for child in acc:
- try:
- ret = _findDescendantDepth(acc, pred)
- except Exception:
- ret = None
- if ret is not None: return ret
-
-def _findDescendantBreadth(acc, pred):
- """
- Internal function for locating one descendant. Called by L{findDescendant} to
- start the search.
-
- @param acc: Root accessible of the search
- @type acc: Accessibility.Accessible
- @param pred: Search predicate returning True if accessible matches the
- search criteria or False otherwise
- @type pred: callable
- @return: Matching node or None to keep searching
- @rtype: Accessibility.Accessible or None
- """
- for child in acc:
- try:
- if pred(child): return child
- except Exception:
- pass
- for child in acc:
- try:
- ret = _findDescendantBreadth(child, pred)
- except Exception:
- ret = None
- if ret is not None: return ret
-
-def _findDescendantDepth(acc, pred):
- """
- Internal function for locating one descendant. Called by L{findDescendant} to
- start the search.
-
- @param acc: Root accessible of the search
- @type acc: Accessibility.Accessible
- @param pred: Search predicate returning True if accessible matches the
- search criteria or False otherwise
- @type pred: callable
- @return: Matching node or None to keep searching
- @rtype: Accessibility.Accessible or None
- """
- try:
- if pred(acc): return acc
- except Exception:
- pass
- for child in acc:
- try:
- ret = _findDescendantDepth(child, pred)
- except Exception:
- ret = None
- if ret is not None: return ret
-
-def findAllDescendants(acc, pred):
- """
- Searches for all descendant nodes satisfying the given predicate starting at
- this node. Does an in-order traversal. For example,
-
- pred = lambda x: x.getRole() == pyatspi.ROLE_PUSH_BUTTON
- buttons = pyatspi.findAllDescendants(node, pred)
-
- will locate all push button descendants of node.
-
- @param acc: Root accessible of the search
- @type acc: Accessibility.Accessible
- @param pred: Search predicate returning True if accessible matches the
- search criteria or False otherwise
- @type pred: callable
- @return: All nodes matching the search criteria
- @rtype: list
- """
- matches = []
- _findAllDescendants(acc, pred, matches)
- return matches
-
-def _findAllDescendants(acc, pred, matches):
- """
- Internal method for collecting all descendants. Reuses the same matches
- list so a new one does not need to be built on each recursive step.
- """
- for child in acc:
- try:
- if pred(child): matches.append(child)
- except Exception:
- pass
- _findAllDescendants(child, pred, matches)
-
-def findAncestor(acc, pred):
- """
- Searches for an ancestor satisfying the given predicate. Note that the
- AT-SPI hierarchy is not always doubly linked. Node A may consider node B its
- child, but B is not guaranteed to have node A as its parent (i.e. its parent
- may be set to None). This means some searches may never make it all the way
- up the hierarchy to the desktop level.
-
- @param acc: Starting accessible object
- @type acc: Accessibility.Accessible
- @param pred: Search predicate returning True if accessible matches the
- search criteria or False otherwise
- @type pred: callable
- @return: Node matching the criteria or None if not found
- @rtype: Accessibility.Accessible
- """
- if acc is None:
- # guard against bad start condition
- return None
- while 1:
- if acc.parent is None:
- # stop if there is no parent and we haven't returned yet
- return None
- try:
- if pred(acc.parent): return acc.parent
- except Exception:
- pass
- # move to the parent
- acc = acc.parent
-
-def getPath(acc):
- """
- Gets the path from the application ancestor to the given accessible in
- terms of its child index at each level.
-
- @param acc: Target accessible
- @type acc: Accessibility.Accessible
- @return: Path to the target
- @rtype: list of integer
- @raise LookupError: When the application accessible cannot be reached
- """
- path = []
- while 1:
- if acc.parent is None:
- path.reverse()
- return path
- try:
- path.append(acc.getIndexInParent())
- except Exception:
- raise LookupError
- acc = acc.parent
diff --git a/pyatspi/value.py b/pyatspi/value.py
deleted file mode 100644
index 121d5c8e..00000000
--- a/pyatspi/value.py
+++ /dev/null
@@ -1,74 +0,0 @@
-#Copyright (C) 2008 Codethink Ltd
-
-#This library is free software; you can redistribute it and/or
-#modify it under the terms of the GNU Lesser General Public
-#License version 2 as published by the Free Software Foundation.
-
-#This program 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 General Public License for more details.
-#You should have received a copy of the GNU Lesser General Public License
-#along with this program; if not, write to the Free Software
-#Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-from interfaces import *
-from accessible import Accessible
-from factory import accessible_factory
-
-import dbus
-
-__all__ = [
- "Value",
- ]
-
-#------------------------------------------------------------------------------
-
-class Value(Accessible):
- """
- 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".
- """
-
- def get_currentValue(self):
- return dbus.Double(self._pgetter(self._dbus_interface, "currentValue"))
- def set_currentValue(self, value):
- self._psetter(self._dbus_interface, "currentValue", dbus.Double(value, variant_level=1))
- _currentValueDoc = \
- """
- The current value of the valuator.
- """
- currentValue = property(fget=get_currentValue, fset=set_currentValue, doc=_currentValueDoc)
-
- def get_maximumValue(self):
- return dbus.Double(self._pgetter(self._dbus_interface, "maximumValue"))
- _maximumValueDoc = \
- """
- The maximum value allowed by this valuator.
- """
- maximumValue = property(fget=get_maximumValue, doc=_maximumValueDoc)
-
- def get_minimumIncrement(self):
- return dbus.Double(self._pgetter(self._dbus_interface, "minimumIncrement"))
- _minimumIncrementDoc = \
- """
- 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.
- """
- minimumIncrement = property(fget=get_minimumIncrement, doc=_minimumIncrementDoc)
-
- def get_minimumValue(self):
- return dbus.Double(self._pgetter(self._dbus_interface, "minimumValue"))
- _minimumValueDoc = \
- """
- The minimum value allowed by this valuator.
- """
- minimumValue = property(fget=get_minimumValue, doc=_minimumValueDoc)
-
-# Register the accessible class with the factory.
-accessible_factory.register_accessible_class(ATSPI_VALUE, Value)
-
-#END----------------------------------------------------------------------------
diff --git a/spi-common/Makefile.am b/spi-common/Makefile.am
index 283b8dc4..c839e13e 100644
--- a/spi-common/Makefile.am
+++ b/spi-common/Makefile.am
@@ -16,7 +16,6 @@ spicommoninclude_HEADERS = \
generated-types.h \
keymasks.h \
spi-dbus.h \
- spi-stateset.h \
spi-types.h
#BUILT_SOURCES = generated-types.h
@@ -25,13 +24,11 @@ spicommoninclude_HEADERS = \
nodist_libspicommon_la_SOURCES = generated-types.h
libspicommon_la_SOURCES = \
- bitarray.h \
+ bitarray.h \
event-types.h \
spi-types.h \
spi-dbus.h \
- spi-dbus.c \
- spi-stateset.h \
- spi-stateset.c
+ spi-dbus.c
#generated-types.h: $(top_srcdir)/xml/spec.xml $(top_srcdir)/tools/c-constants-generator.xsl
# xsltproc --stringparam mixed-case-prefix Accessibility_ $(top_srcdir)/tools/c-constants-generator.xsl $< >$@
diff --git a/tests/Makefile.am b/tests/Makefile.am
deleted file mode 100644
index 8daea179..00000000
--- a/tests/Makefile.am
+++ /dev/null
@@ -1,11 +0,0 @@
-SUBDIRS = dummyatk apps data pyatspi cspi
-
-#TESTS=testrunner.py
-TESTS_ENVIRONMENT = PYTHONPATH=$(abs_top_srcdir)/python \
- ATSPI_INTROSPECTION_PATH=$(top_srcdir)/xml/introspection \
- TEST_DATA_DIRECTORY=$(abs_top_srcdir)/tests/data \
- TEST_ATSPI_LIBRARY=$(abs_top_srcdir)/atk-adaptor/.libs/libspiatk.so \
- TEST_MODULES_DIRECTORY=$(abs_top_srcdir)/tests/apps/.libs \
- TEST_APPLICATION=$(abs_top_srcdir)/tests/apps/test-application
-
-CLEANFILES = *.pyc
diff --git a/tests/apps/Makefile.am b/tests/apps/Makefile.am
deleted file mode 100644
index 12a32572..00000000
--- a/tests/apps/Makefile.am
+++ /dev/null
@@ -1,47 +0,0 @@
-check_PROGRAMS = test-application
-check_LTLIBRARIES = libnoopapp.la \
- libaccessibleapp.la \
- libcomponentapp.la \
- libactionapp.la \
- librelationapp.la
-
-test_application_CFLAGS = $(DBUS_GLIB_CFLAGS) \
- $(ATK_CFLAGS) \
- $(GMODULE_CFLAGS) \
- -I$(top_srcdir)
-
-test_application_LDADD = $(DBUS_GLIB_LIBS) \
- $(GMODULE_LIBS) \
- $(ATK_LIBS)
-
-test_application_SOURCES = test-application.c
-
-
-TEST_APP_CFLAGS = $(ATK_CFLAGS) $(GMODULE_CFLAGS) -I$(top_srcdir) -I$(top_srcdir)/tests/dummyatk/
-TEST_APP_LDFLAGS = -no-undefined -module -avoid-version -rpath /a/fake/path
-TEST_APP_LIBADD = $(ATK_LIBS) $(GMODULE_LIBS) $(top_builddir)/tests/dummyatk/libdummyatk.la
-
-libnoopapp_la_CFLAGS = $(TEST_APP_CFLAGS)
-libnoopapp_la_LDFLAGS = $(TEST_APP_LDFLAGS)
-libnoopapp_la_LIBADD = $(TEST_APP_LIBADD)
-libnoopapp_la_SOURCES = noop-app.c
-
-libaccessibleapp_la_CFLAGS = $(TEST_APP_CFLAGS) $(LIB_XML_CFLAGS)
-libaccessibleapp_la_LDFLAGS = $(TEST_APP_LDFLAGS)
-libaccessibleapp_la_LIBADD = $(TEST_APP_LIBADD) $(LIB_XML_LIBS)
-libaccessibleapp_la_SOURCES = accessible-app.c atk-object-xml-loader.c atk-object-xml-loader.h
-
-libcomponentapp_la_CFLAGS = $(TEST_APP_CFLAGS)
-libcomponentapp_la_LDFLAGS = $(TEST_APP_LDFLAGS)
-libcomponentapp_la_LIBADD = $(TEST_APP_LIBADD)
-libcomponentapp_la_SOURCES = component-app.c
-
-libactionapp_la_CFLAGS = $(TEST_APP_CFLAGS)
-libactionapp_la_LDFLAGS = $(TEST_APP_LDFLAGS)
-libactionapp_la_LIBADD = $(TEST_APP_LIBADD)
-libactionapp_la_SOURCES = action-app.c
-
-librelationapp_la_CFLAGS = $(TEST_APP_CFLAGS)
-librelationapp_la_LDFLAGS = $(TEST_APP_LDFLAGS)
-librelationapp_la_LIBADD = $(TEST_APP_LIBADD)
-librelationapp_la_SOURCES = relation-app.c
diff --git a/tests/apps/accessible-app.c b/tests/apps/accessible-app.c
deleted file mode 100644
index 2796bf52..00000000
--- a/tests/apps/accessible-app.c
+++ /dev/null
@@ -1,57 +0,0 @@
-#include <gmodule.h>
-#include <atk/atk.h>
-#include <my-atk.h>
-
-#include "atk-object-xml-loader.h"
-
-static gchar *tdata_path = NULL;
-
-static AtkObject *root_accessible;
-
-static AtkStateType states[] =
-{
- ATK_STATE_MULTI_LINE,
- ATK_STATE_MODAL,
- ATK_STATE_INDETERMINATE,
- ATK_STATE_SUPPORTS_AUTOCOMPLETION,
- ATK_STATE_VERTICAL
-};
-
-#define OBJECT_TEST_1 "accessible-test.xml"
-
-G_MODULE_EXPORT void
-test_init (gchar *path)
-{
- AtkStateSet *ss;
- gchar *td;
-
- if (path == NULL)
- g_error("No test data path provided");
- tdata_path = path;
-
- td = g_build_path(G_DIR_SEPARATOR_S, tdata_path, OBJECT_TEST_1, NULL);
- root_accessible = ATK_OBJECT(atk_object_xml_parse(td));
- g_free(td);
-
- ss = atk_object_ref_state_set(ATK_OBJECT(root_accessible));
- atk_state_set_add_states(ss, states, 5);
- g_object_unref(G_OBJECT(ss));
-}
-
-G_MODULE_EXPORT void
-test_next (int argc, char *argv[])
-{
- ;
-}
-
-G_MODULE_EXPORT void
-test_finished (int argc, char *argv[])
-{
- ;
-}
-
-G_MODULE_EXPORT AtkObject *
-test_get_root (void)
-{
- return root_accessible;
-}
diff --git a/tests/apps/action-app.c b/tests/apps/action-app.c
deleted file mode 100644
index 612cd599..00000000
--- a/tests/apps/action-app.c
+++ /dev/null
@@ -1,29 +0,0 @@
-#include <gmodule.h>
-#include <atk/atk.h>
-#include <my-atk.h>
-
-static AtkObject *root_accessible;
-
-G_MODULE_EXPORT void
-test_init (gchar *path)
-{
- root_accessible = g_object_new(MY_TYPE_ATK_ACTION, NULL);
-}
-
-G_MODULE_EXPORT void
-test_next (int argc, char *argv[])
-{
- g_print("Moving to next stage\n");
-}
-
-G_MODULE_EXPORT void
-test_finished (int argc, char *argv[])
-{
- g_print("Test has completed\n");
-}
-
-G_MODULE_EXPORT AtkObject *
-test_get_root (void)
-{
- return root_accessible;
-}
diff --git a/tests/apps/atk-object-xml-loader.c b/tests/apps/atk-object-xml-loader.c
deleted file mode 100644
index 5fa23548..00000000
--- a/tests/apps/atk-object-xml-loader.c
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * Copyright 2008 Codethink Ltd.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#include <stdlib.h>
-#include <string.h>
-#include <glib.h>
-#include <libxml/parser.h>
-#include <libxml/tree.h>
-
-#include <my-atk.h>
-
-#define ACCESSIBLE_NODE ((const xmlChar *) "accessible")
-#define INTERFACE_NODE ((const xmlChar *) "interface")
-
-#define NAME_ATTR ((const xmlChar *) "name")
-#define DESC_ATTR ((const xmlChar *) "description")
-#define ROLE_ATTR ((const xmlChar *) "role")
-
-static MyAtkObject *
-create_atk_object_from_element(xmlNode *element)
-{
- xmlNode *child_node;
-
- MyAtkObject *obj = NULL;
- MyAtkObject *child_obj;
-
- xmlChar *name;
- xmlChar *description;
- xmlChar *role_text;
- gint role;
-
- name = xmlGetProp(element, NAME_ATTR);
- description = xmlGetProp(element, DESC_ATTR);
- role_text = xmlGetProp(element, ROLE_ATTR);
- role = atoi(role_text);
-
- obj = MY_ATK_OBJECT(g_object_new(MY_TYPE_ATK_OBJECT,
- "accessible-name", name,
- "accessible-description", description,
- "accessible-role", role,
- NULL));
-
- child_node = element->xmlChildrenNode;
- while (child_node != NULL)
- {
- if (!xmlStrcmp(child_node->name, ACCESSIBLE_NODE))
- {
- child_obj = create_atk_object_from_element(child_node);
- my_atk_object_add_child(obj, child_obj);
- }
- child_node = child_node->next;
- }
- return obj;
-}
-
-/*
- * Reads the XML from filename and uses it
- * to create a tree of MyAtkObjects.
- *
- * returns: The root object of the tree.
- */
-MyAtkObject *
-atk_object_xml_parse(gchar *filename)
-{
- xmlDoc *doc;
- xmlNode *root_element;
- MyAtkObject *new_atk_object = NULL;
-
- doc = xmlReadFile(filename, NULL, 0);
- g_assert(doc != NULL);
-
- root_element = xmlDocGetRootElement(doc);
-
- if (!xmlStrcmp(root_element->name, ACCESSIBLE_NODE))
- new_atk_object = create_atk_object_from_element(root_element);
-
- xmlFreeDoc(doc);
- return new_atk_object;
-}
diff --git a/tests/apps/atk-object-xml-loader.h b/tests/apps/atk-object-xml-loader.h
deleted file mode 100644
index ce707bd4..00000000
--- a/tests/apps/atk-object-xml-loader.h
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Copyright 2008 Codethink Ltd.
- *
- * 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.
- */
-
-#ifndef ATK_OBJECT_XML_LOADER_H
-#define ATK_OBJECT_XML_LOADER_H
-
-#include <glib.h>
-#include <my-atk.h>
-
-MyAtkObject *
-atk_object_xml_parse(gchar *filename);
-
-#endif /*ATK_OBJECT_XML_LOADER_H*/
diff --git a/tests/apps/component-app.c b/tests/apps/component-app.c
deleted file mode 100644
index d51e1ac3..00000000
--- a/tests/apps/component-app.c
+++ /dev/null
@@ -1,55 +0,0 @@
-#include <gmodule.h>
-#include <atk/atk.h>
-#include <my-atk.h>
-
-static gchar *tdata_path = NULL;
-
-static AtkComponent *comps[] = {NULL, NULL, NULL};
-static const AtkRectangle extents[] = {{0,0,30,20}, {40,30,30,40}, {0,0,70,70}};
-static const AtkLayer layers[] = {ATK_LAYER_WINDOW, ATK_LAYER_WIDGET, ATK_LAYER_MDI};
-static const guint zorders[] = {0, -100, 100};
-static const gboolean extent_may_changed[] = {TRUE, FALSE, TRUE};
-
-G_MODULE_EXPORT void
-test_init (gchar *path)
-{
- int i;
-
- if (path == NULL)
- g_error("No test data path provided");
- tdata_path = path;
-
- g_type_init();
- for(i = 0; i < sizeof(comps) / sizeof(comps[0]); i++)
- {
- MyAtkComponent *mycomp = MY_ATK_COMPONENT(g_object_new(MY_TYPE_ATK_COMPONENT, NULL));
-
- mycomp->extent = extents[i];
- mycomp->is_extent_may_changed = extent_may_changed[i];
- mycomp->layer = layers[i];
- mycomp->zorder = zorders[i];
-
- comps[i] = ATK_COMPONENT(mycomp);
- }
-
- my_atk_object_add_child(MY_ATK_OBJECT(comps[2]), MY_ATK_OBJECT(comps[0]));
- my_atk_object_add_child(MY_ATK_OBJECT(comps[2]), MY_ATK_OBJECT(comps[1]));
-}
-
-G_MODULE_EXPORT void
-test_next (int argc, char *argv[])
-{
- g_print("Moving to next stage\n");
-}
-
-G_MODULE_EXPORT void
-test_finished (int argc, char *argv[])
-{
- g_print("Test has completed\n");
-}
-
-G_MODULE_EXPORT AtkObject *
-test_get_root (void)
-{
- return ATK_COMPONENT(comps[2]);
-}
diff --git a/tests/apps/noop-app.c b/tests/apps/noop-app.c
deleted file mode 100644
index f2a5f515..00000000
--- a/tests/apps/noop-app.c
+++ /dev/null
@@ -1,26 +0,0 @@
-#include <gmodule.h>
-#include <atk/atk.h>
-
-G_MODULE_EXPORT void
-test_init (int argc, char *argv[])
-{
- ;
-}
-
-G_MODULE_EXPORT void
-test_next (int argc, char *argv[])
-{
- ;
-}
-
-G_MODULE_EXPORT void
-test_finished (int argc, char *argv[])
-{
- ;
-}
-
-G_MODULE_EXPORT AtkObject *
-test_get_root (void)
-{
- return NULL;
-}
diff --git a/tests/apps/relation-app.c b/tests/apps/relation-app.c
deleted file mode 100644
index 5734ffe4..00000000
--- a/tests/apps/relation-app.c
+++ /dev/null
@@ -1,90 +0,0 @@
-#include <gmodule.h>
-#include <atk/atk.h>
-#include <my-atk.h>
-
-static AtkObject *root_accessible;
-
-G_MODULE_EXPORT void
-test_init (gchar *path)
-{
- AtkObject *r1, *r2, *r3;
- AtkObject *m1, *m2, *m3;
- AtkRelationSet *rset;
- AtkRelation *rel;
- AtkObject *rls[3];
-
- root_accessible = g_object_new(MY_TYPE_ATK_OBJECT, NULL);
-
- r1 = ATK_OBJECT(g_object_new(MY_TYPE_ATK_OBJECT,
- "accessible-name", "r1",
- "accessible-description", "",
- "accessible-role", ATK_ROLE_INVALID,
- NULL));
- my_atk_object_add_child(MY_ATK_OBJECT(root_accessible), MY_ATK_OBJECT(r1));
-
- r2 = ATK_OBJECT(g_object_new(MY_TYPE_ATK_OBJECT,
- "accessible-name", "r2",
- "accessible-description", "",
- "accessible-role", ATK_ROLE_INVALID,
- NULL));
- my_atk_object_add_child(MY_ATK_OBJECT(root_accessible), MY_ATK_OBJECT(r2));
-
- r3 = ATK_OBJECT(g_object_new(MY_TYPE_ATK_OBJECT,
- "accessible-name", "r3",
- "accessible-description", "",
- "accessible-role", ATK_ROLE_INVALID,
- NULL));
- my_atk_object_add_child(MY_ATK_OBJECT(root_accessible), MY_ATK_OBJECT(r3));
-
- m1 = ATK_OBJECT(g_object_new(MY_TYPE_ATK_OBJECT,
- "accessible-name", "m1",
- "accessible-description", "",
- "accessible-role", ATK_ROLE_INVALID,
- NULL));
- my_atk_object_add_child(MY_ATK_OBJECT(root_accessible), MY_ATK_OBJECT(m1));
-
- m2 = ATK_OBJECT(g_object_new(MY_TYPE_ATK_OBJECT,
- "accessible-name", "m2",
- "accessible-description", "",
- "accessible-role", ATK_ROLE_INVALID,
- NULL));
- my_atk_object_add_child(MY_ATK_OBJECT(root_accessible), MY_ATK_OBJECT(m2));
-
- m3 = ATK_OBJECT(g_object_new(MY_TYPE_ATK_OBJECT,
- "accessible-name", "m3",
- "accessible-description", "",
- "accessible-role", ATK_ROLE_INVALID,
- NULL));
- my_atk_object_add_child(MY_ATK_OBJECT(root_accessible), MY_ATK_OBJECT(m3));
-
- atk_object_add_relationship(root_accessible, ATK_RELATION_EMBEDS, r1);
- atk_object_add_relationship(root_accessible, ATK_RELATION_PARENT_WINDOW_OF, r2);
- atk_object_add_relationship(root_accessible, ATK_RELATION_DESCRIBED_BY, r3);
-
- rls[0] = m1;
- rls[1] = m2;
- rls[2] = m3;
-
- rset = atk_object_ref_relation_set(root_accessible);
- rel = atk_relation_new(rls, 3, ATK_RELATION_POPUP_FOR);
- atk_relation_set_add(rset, rel);
- g_object_unref(G_OBJECT(rset));
-}
-
-G_MODULE_EXPORT void
-test_next (int argc, char *argv[])
-{
- g_print("Moving to next stage\n");
-}
-
-G_MODULE_EXPORT void
-test_finished (int argc, char *argv[])
-{
- g_print("Test has completed\n");
-}
-
-G_MODULE_EXPORT AtkObject *
-test_get_root (void)
-{
- return root_accessible;
-}
diff --git a/tests/apps/test-application.c b/tests/apps/test-application.c
deleted file mode 100644
index 9c0bd3c8..00000000
--- a/tests/apps/test-application.c
+++ /dev/null
@@ -1,286 +0,0 @@
-/*
- * AT-SPI - Assistive Technology Service Provider Interface
- * (Gnome Accessibility Project; http://developer.gnome.org/projects/gap)
- *
- * Copyright 2008 Codethink Ltd.
- *
- * 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.
- */
-
-/*
- * Testing AT-SPI requires both a test application and AT client.
- * Test applications are built using the Dummy ATK implementation: MyAtk.
- * This file contains the entry point for all test applications.
- * Each test is built as a GModule, and this program loads the
- * test module, as well as the AT-SPI module. The test module will
- * provide its own implementation of atk_get_root, and as such provide
- * all the application state for the test.
- */
-
-#include <stdlib.h>
-#include <glib.h>
-#include <gmodule.h>
-#include <atk/atk.h>
-#include <dbus/dbus.h>
-
-/* The test module, GModule containing interface for an atk-test */
-static GModule *test_module;
-static gpointer test_module_get_root;
-static gpointer test_module_next;
-static gpointer test_module_finished;
-
-static DBusConnection *dbus_bus;
-static GMainLoop *mainloop;
-
-/* Test module interface */
-/*************************/
-
-typedef AtkObject *(*TestModuleGetRoot) (void);
-
-/* Calls into the test module to get the root atk object */
-static AtkObject *
-get_root(void)
-{
- return ((TestModuleGetRoot) test_module_get_root)();
-}
-
-typedef void (*VoidVoid) (void);
-
-/* Called to move to next stage of test.*/
-static void
-next(void)
-{
- ((VoidVoid) test_module_next)();
-}
-
-
-/*************************/
-
-/* The AtkUtil class is called to find the root accessible and to deal
- * with events. Its an incomplete class, its v-table needs to be filled in.
- */
-static void
-setup_atk_util(void)
-{
- AtkUtilClass *klass;
-
- klass = g_type_class_ref(ATK_TYPE_UTIL);
- klass->get_root = get_root;
- g_type_class_unref(klass);
-}
-
-typedef void (*GtkModuleInit) (int *argc, char **argv[]);
-
-/* AT-SPI is a gtk module that must be loaded and initialized */
-static void
-load_atspi_module(const char *path, int *argc, char **argv[])
-{
- GModule *bridge;
- gpointer init;
-
- bridge = g_module_open(path, G_MODULE_BIND_LOCAL|G_MODULE_BIND_LAZY);
- if (!bridge)
- g_error("Couldn't load atk-bridge module : %s\n", g_module_error());
-
- if (!g_module_symbol(bridge, "gtk_module_init", &init))
- g_error("Couldn't load symbol \"gtk_module_init\"\n");
-
- ((GtkModuleInit) init)(argc, argv);
-}
-
-typedef void (*TestModuleInit) (gchar *path);
-
-static void
-load_test_module(const char *path, const char *tdpath)
-{
- gpointer init;
-
- test_module = g_module_open(path, G_MODULE_BIND_LOCAL|G_MODULE_BIND_LAZY);
- if (!test_module)
- g_error("Couldn't load test module : %s\n", path);
-
- if (!g_module_symbol(test_module, "test_init", &init))
- g_error("Couldn't load symbol \"test_init\"\n");
-
- if (!g_module_symbol(test_module, "test_get_root", &test_module_get_root))
- g_error("Couldn't load symbol \"test_get_root\"\n");
-
- if (!g_module_symbol(test_module, "test_next", &test_module_next))
- g_error("Couldn't load symbol \"test_next\"\n");
-
- if (!g_module_symbol(test_module, "test_finished", &test_module_finished))
- g_error("Couldn't load symbol \"test_finished\"\n");
-
- ((TestModuleInit) init)((gchar *)tdpath);
-}
-
-static const char* introspection_string =
-"<node name=\"/org/codethink/atspi/test\">"
-" <interface name=\"org.codethink.atspi.test\">"
-" <method name=\"next\"/>"
-" <method name=\"finish\"/>"
-" <signal name=\"started\"/>"
-" </interface>"
-"</node>";
-
-static DBusHandlerResult
-message_handler (DBusConnection *bus, DBusMessage *message, void *user_data)
-{
- const char *iface = dbus_message_get_interface (message);
- const char *member = dbus_message_get_member (message);
- DBusHandlerResult result = DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
- gboolean exit = FALSE;
-
- DBusMessage *reply = NULL;
-
- g_return_val_if_fail(iface != NULL, DBUS_HANDLER_RESULT_NOT_YET_HANDLED);
-
- if (!strcmp(iface, "org.codethink.atspi.test"))
- {
- if (!strcmp(member, "next"))
- {
- next();
- reply = dbus_message_new_method_return (message);
- g_assert(reply != NULL);
- result = DBUS_HANDLER_RESULT_HANDLED;
- }
-
- if (!strcmp(member, "finish"))
- {
- ((VoidVoid) test_module_finished)();
- reply = dbus_message_new_method_return (message);
- g_assert(reply != NULL);
- result = DBUS_HANDLER_RESULT_HANDLED;
- exit = TRUE;
- }
- }
-
- if (!strcmp(iface, "org.freedesktop.DBus.Introspectable"))
- {
- if (!strcmp(member, "Introspect"))
- {
- reply = dbus_message_new_method_return (message);
- g_assert(reply != NULL);
- dbus_message_append_args(reply, DBUS_TYPE_STRING, &introspection_string,
- DBUS_TYPE_INVALID);
- result = DBUS_HANDLER_RESULT_HANDLED;
- }
- }
-
- if (reply)
- {
- dbus_connection_send (bus, reply, NULL);
- dbus_message_unref (reply);
- }
-
- if (exit == TRUE)
- {
- dbus_connection_flush(bus);
- dbus_connection_unref(bus);
- g_main_loop_quit(mainloop);
- }
- return result;
-}
-
-static DBusObjectPathVTable test_vtable =
-{
- NULL,
- &message_handler,
- NULL, NULL, NULL, NULL
-};
-
-static void
-init_dbus_interface(void)
-{
- DBusError error;
-
- dbus_error_init(&error);
- dbus_bus = dbus_bus_get(DBUS_BUS_SESSION, &error);
- g_print("\nUnique D-Bus name is: %s\n", dbus_bus_get_unique_name(dbus_bus));
-
- if (!dbus_bus)
- g_error("Couldn't get the session bus - %s\n", error.message);
-
- g_assert(dbus_connection_register_object_path(dbus_bus,
- "/org/codethink/atspi/test",
- &test_vtable,
- NULL));
-
- dbus_connection_setup_with_g_main(dbus_bus, g_main_context_default());
-}
-
-static void
-send_started_signal(void)
-{
- DBusMessage* sig;
- DBusMessageIter args;
-
- sig = dbus_message_new_signal("/org/codethink/atspi/test", "org.codethink.atspi.test", "started");
- g_assert(sig != NULL);
- if (!dbus_connection_send(dbus_bus, sig, NULL))
- g_error("Out of memory");
- dbus_connection_flush(dbus_bus);
- dbus_message_unref(sig);
-}
-
-/*Command line data*/
-static gchar *tmodule_path = NULL;
-static gchar *amodule_path = NULL;
-static gchar *tdata_path = NULL;
-
-static GOptionEntry optentries[] =
-{
- {"test-module", 0, 0, G_OPTION_ARG_STRING, &tmodule_path, "Module containing test scenario", NULL},
- {"test-atspi-library", 0, 0, G_OPTION_ARG_STRING, &amodule_path, "Gtk module with atk-atspi adaptor", NULL},
- {"test-data-directory", 0, 0, G_OPTION_ARG_STRING, &tdata_path, "Path to directory of test data", NULL},
- {NULL}
-};
-
-/* main
- *
- * Entry point for all test applications.
- */
-main(int argc, char *argv[])
-{
- GOptionContext *opt;
- GError *err = NULL;
-
- /*Parse command options*/
- opt = g_option_context_new(NULL);
- g_option_context_add_main_entries(opt, optentries, NULL);
- g_option_context_set_ignore_unknown_options(opt, TRUE);
-
- if (!g_option_context_parse(opt, &argc, &argv, &err))
- g_error("Option parsing failed: %s\n", err->message);
-
- if (tmodule_path == NULL)
- g_error("No test module provided");
- if (amodule_path == NULL)
- g_error("No atspi module provided");
-
- g_type_init();
-
- setup_atk_util();
- load_test_module(tmodule_path, tdata_path);
- load_atspi_module(amodule_path, &argc, &argv);
- init_dbus_interface();
- send_started_signal();
-
- mainloop = g_main_loop_new (NULL, FALSE);
- g_main_loop_run (mainloop);
-
- return 0;
-}
diff --git a/tests/cspi/Makefile.am b/tests/cspi/Makefile.am
deleted file mode 100644
index ebdba44d..00000000
--- a/tests/cspi/Makefile.am
+++ /dev/null
@@ -1,18 +0,0 @@
-noinst_PROGRAMS = key-listener-test keysynth-test simple-at test-simple
-
-key_listener_test_SOURCES = key-listener-test.c
-keysynth_test_SOURCES = keysynth-test.c
-simple_at_SOURCES = simple-at.c
-test_simple_SOURCES = test-simple.c
-
-INCLUDES = -I$(top_srcdir) \
- -I$(top_builddir) \
- $(DBUS_CFLAGS) \
- $(GLIB_CFLAGS) \
- $(GTK_CFLAGS) \
- $(ATK_CFLAGS) \
- $(DEBUG_CFLAGS)
-
-LDADD = $(top_builddir)/spi-common/libspicommon.la \
- $(top_builddir)/cspi/libcspi.la \
- $(TESTS_LIBS) $(X_LIBS) $(XINPUT_LIBS) $(ATK_LIBS) $(GTK_LIBS)
diff --git a/tests/cspi/accessible-test.c b/tests/cspi/accessible-test.c
deleted file mode 100644
index ab490dbb..00000000
--- a/tests/cspi/accessible-test.c
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright (C) 2008 Codethink Ltd.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-#include <glib.h>
-#include <string.h>
-#include <stdlib.h>
-
-typedef struct {
- gchar *none;
-} AccessibleObjectFixture;
-
-static void
-test_getChildAtIndex (AccessibleObjectFixture *fix, gconstpointer test_data)
-{
- return;
-}
-
-int
-main (int argc, char *argv[])
-{
- return 0;
-}
diff --git a/tests/cspi/classy-test-suite.c b/tests/cspi/classy-test-suite.c
deleted file mode 100644
index dd22e7ab..00000000
--- a/tests/cspi/classy-test-suite.c
+++ /dev/null
@@ -1,211 +0,0 @@
-/*
- * Copyright (C) 2008 Codethink Ltd.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#include <glib-object.h>
-#include <string.h>
-#include <stdio.h>
-
-#include "classy-test.h"
-#include "classy-test-suite.h"
-
-/*---------------------------------------------------------------------------*/
-
-static gboolean
-run_test_app(gchar *module_name, gchar *dbus_name)
-{
- gboolean result;
- GPid pid;
- GError *err = NULL;
-
- const gchar *test_data_directory;
- const gchar *test_modules_directory;
- const gchar *test_atspi_library;
- const gchar *test_application;
- gchar *test_module;
- gchar *command_line;
-
- test_data_directory = g_getenv("TEST_DATA_DIRECTORY");
- test_modules_directory = g_getenv("TEST_MODULES_DIRECTORY");
- test_atspi_library = g_getenv("TEST_ATSPI_LIBRARY");
- test_application = g_getenv("TEST_APPLICATION");
-
- test_module = g_build_path("/", test_modules_directory, module_name, NULL);
-
- command_line = g_build_path(" ", test_application,
- "--atspi-dbus-name", dbus_name,
- "--test-atspi-library", test_atspi_library,
- "--test-module", test_module,
- "--test-data-directory", test_data_directory,
- NULL);
-
- if (!(result = g_spawn_command_line_async(NULL, &err)))
- {
- fprintf(stderr, "\nCould not spawn test application - %s", err->message);
- }
-
- g_free(test_module);
- g_free(command_line);
-
- return result;
-}
-
-/*---------------------------------------------------------------------------*/
-
-static gboolean
-suite_idle_handler(gpointer data);
-
-static void
-suite_finished_handler(gpointer data)
-{
- ClassyTestSuite *suite = CLASSY_TEST_SUITE(data);
- ClassyTest *test = CLASSY_TEST(g_array_index(suite->cases, gpointer, suite->current));
-
- if ((classy_test_state(test) == CLASSY_TEST_WIN) || suite->cont) {
- g_idle_add(suite_idle_handler, suite);
- }
- /* TODO If test has failed remember to send signal saying so */
-}
-
-static gboolean
-suite_idle_handler(gpointer data)
-{
- ClassyTestSuite *suite = CLASSY_TEST_SUITE(data);
-
- suite->current++;
- if (suite->current >= suite->cases->len) {
- /* No more tests, check for success or fail */
- gboolean succeeded = TRUE;
- gint i;
- for (i=0; i < suite->cases->len; i++) {
- ClassyTest *test;
- test = CLASSY_TEST(g_array_index(suite->cases, gpointer, i));
- succeeded = succeeded && (classy_test_state(test) == CLASSY_TEST_WIN);
- }
- if (succeeded == TRUE)
- classy_test_pass(CLASSY_TEST(suite));
- else
- classy_test_fail(CLASSY_TEST(suite), "Sub-test has failed");
- } else {
- /* More tests, run this one*/
- ClassyTest *test;
- test = CLASSY_TEST(g_array_index(suite->cases, gpointer, suite->current));
- g_signal_connect(test, "finished", (GCallback) suite_finished_handler, data);
- classy_test_run(test);
- }
- return FALSE;
-}
-
-static void
-suite_run(ClassyTest *test)
-{
- g_idle_add(suite_idle_handler, test);
-}
-
-/*---------------------------------------------------------------------------*/
-
-static gchar *
-suite_report(ClassyTest *test)
-{
- ClassyTestSuite *suite = CLASSY_TEST_SUITE(test);
- GString *report;
- gint i;
-
- report = g_string_new("");
-
- switch (classy_test_state(test)) {
- case CLASSY_TEST_FAIL:
- g_string_printf(report, "FAIL : %s\n : %s\n ", test->name);
- case CLASSY_TEST_WIN:
- g_string_printf(report, "PASS : %s\n", test->name);
- default:
- g_string_printf(report, "INCOMPLETE : %s\n", test->name);
- }
-
- for (i=0; i < suite->cases->len; i++) {
- ClassyTest *subtest = CLASSY_TEST(g_array_index(suite->cases, gpointer, i));
- g_string_append_printf(report, " ");
- g_string_append_printf(report, "%s", classy_test_report(subtest));
- }
- return g_string_free(report, FALSE);
-}
-
-/*---------------------------------------------------------------------------*/
-
-G_DEFINE_TYPE (ClassyTestSuite, classy_test_suite, TYPE_CLASSY_TEST)
-
-static void
-classy_test_suite_finalize (GObject *obj)
-{
- ClassyTestSuite *suite = CLASSY_TEST_SUITE(obj);
- gint i;
-
- for (i=0; i < suite->cases->len; i++) {
- ClassyTest *test;
- test = CLASSY_TEST(g_array_index(suite->cases, gpointer, i));
- g_object_unref(test);
- }
- g_free(suite->data);
-
- G_OBJECT_CLASS (classy_test_suite_parent_class)->finalize (obj);
-}
-
-static void
-classy_test_suite_class_init (ClassyTestSuiteClass *klass)
-{
- GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
- ClassyTestClass *test_class = CLASSY_TEST_CLASS(klass);
-
- gobject_class->finalize = classy_test_suite_finalize;
-
- test_class->report = suite_report;
- test_class->run = suite_run;
-}
-
-static void
-classy_test_suite_init (ClassyTestSuite *suite)
-{
- suite->cases = g_array_new(FALSE, FALSE, sizeof(gpointer));
- suite->current = -1;
-}
-
-/*---------------------------------------------------------------------------*/
-
-ClassyTestSuite *
-classy_test_suite_new(gchar *name, gint dsize, gboolean cont)
-{
- ClassyTestSuite *suite;
- ClassyTest *test;
-
- suite = g_object_new(TYPE_CLASSY_TEST_SUITE, NULL);
- suite->cont = cont;
- suite->data = g_malloc0(dsize);
-
- test = CLASSY_TEST(suite);
- test->name = g_strdup(name);
-
- return suite;
-}
-
-void
-classy_test_suite_add(ClassyTestSuite *suite, ClassyTest *test)
-{
- g_array_append(suite->cases, test);
-}
-
-/*---------------------------------------------------------------------------*/
diff --git a/tests/cspi/classy-test-suite.h b/tests/cspi/classy-test-suite.h
deleted file mode 100644
index d27aad01..00000000
--- a/tests/cspi/classy-test-suite.h
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Classy Test - Terrible framework for testing asyncronous interface
- *
- * Copyright (C) 2008 Codethink Ltd
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser 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.
- */
-#ifndef CLASSY_TEST_SUITE_H
-#define CLASSY_TEST_SUITE_H
-
-#include <glib-object.h>
-
-G_BEGIN_DECLS
-
-GType classy_test_suite_get_type(void);
-
-#define TYPE_CLASSY_TEST_SUITE (classy_test_suite_get_type())
-
-#define CLASSY_TEST_SUITE(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), \
- TYPE_CLASSY_TEST_SUITE, \
- ClassyTestSuite))
-
-#define CLASSY_TEST_SUITE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), \
- TYPE_CLASSY_TEST_SUITE, \
- ClassyTestSuiteClass))
-
-#define IS_CLASSY_TEST_SUITE(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), \
- TYPE_CLASSY_TEST_SUITE))
-
-#define IS_CLASSY_TEST_SUITE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), \
- TYPE_CLASSY_TEST_SUITE))
-
-#define CLASSY_TEST_SUITE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), \
- TYPE_CLASSY_TEST_SUITE, \
- ClassyTestSuiteClass))
-
-typedef struct _ClassyTestSuite ClassyTestSuite;
-typedef struct _ClassyTestSuiteClass ClassyTestSuiteClass;
-
-struct _ClassyTestSuite {
- ClassyTest parent;
-
- GArray *cases;
- gint current;
- gboolean cont;
-
- gpointer data;
-};
-
-struct _ClassyTestSuiteClass {
- ClassyTestClass parent;
-};
-
-ClassyTestSuite *
-classy_test_suite_new(gchar *name, gint dsize, gboolean cont);
-
-void
-classy_test_suite_add(ClassyTestSuite *suite, ClassyTest *test);
-
-/*---------------------------------------------------------------------------*/
-
-G_END_DECLS
-#endif /* CLASSY_TEST_SUITE_H */
diff --git a/tests/cspi/classy-test.c b/tests/cspi/classy-test.c
deleted file mode 100644
index e5ef266c..00000000
--- a/tests/cspi/classy-test.c
+++ /dev/null
@@ -1,145 +0,0 @@
-/*
- * Classy Test - Terrible framework for testing asyncronous interface
- *
- * Copyright (C) 2008 Codethink Ltd
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#include <glib-object.h>
-
-#include "classy-test.h"
-
-static gchar *
-classy_test_report(ClassyTest *test)
-{
- switch (classy_test_state(test)) {
- case CLASSY_TEST_FAIL:
- return g_strdup_printf("FAIL : %s - %s\n ", test->name, test->failm);
- case CLASSY_TEST_WIN:
- return g_strdup_printf("PASS : %s\n", test->name);
- default:
- return g_strdup_printf("INCOMPLETE : %s\n", test->name);
- }
-}
-
-/*---------------------------------------------------------------------------*/
-
-static void
-classy_test_run(ClassyTest *test)
-{
- test->tstate = CLASSY_TEST_IN_PROGRESS;
- (test->entry)(test, test->data);
-}
-
-/*---------------------------------------------------------------------------*/
-
-G_DEFINE_TYPE (ClassyTest, classy_test, G_TYPE_OBJECT)
-
-static void
-classy_test_finalize (GObject *obj)
-{
- ClassyTest *test = CLASSY_TEST(obj);
-
- g_free(test->name);
- if (test->failm) {
- g_free(test->failm);
- test->failm = NULL;
- }
- G_OBJECT_CLASS (classy_test_parent_class)->finalize (obj);
-}
-
-static void
-classy_test_class_init (ClassyTestClass *klass)
-{
- GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
-
- gobject_class->finalize = classy_test_finalize;
-
- klass->report = classy_test_report;
- klass->run = classy_test_run;
-
- /*Signals*/
- klass->finished = g_signal_newv("finished",
- TYPE_CLASSY_TEST,
- G_SIGNAL_RUN_LAST | G_SIGNAL_NO_HOOKS,
- NULL,
- NULL,
- NULL,
- g_cclosure_marshal_VOID__VOID,
- G_TYPE_NONE,
- 0,
- NULL);
-}
-
-static void
-classy_test_init (ClassyTest *test)
-{
- test->failm = NULL;
- test->tstate = CLASSY_TEST_NOT_STARTED;
-}
-
-/*---------------------------------------------------------------------------*/
-
-ClassyTest *
-classy_test_new(gchar *name,
- void (*entry) (ClassyTest*, gpointer data),
- gint istate,
- gpointer data)
-{
- ClassyTest *test;
-
- test = g_object_new(TYPE_CLASSY_TEST, NULL);
-
- test->name = g_strdup(name);
- test->entry = entry;
- test->data = data;
-
- return test;
-}
-
-/*---------------------------------------------------------------------------*/
-
-void
-classy_test_pass(ClassyTest *test)
-{
- test->tstate = CLASSY_TEST_WIN;
- g_signal_emit (test, CLASSY_TEST_CLASS(test)->finished, 0, NULL);
-}
-
-/*---------------------------------------------------------------------------*/
-
-void
-classy_test_fail(ClassyTest *test, gchar *fmt, ...)
-{
- va_list args;
-
- va_start(args, fmt);
- test->failm = g_strdup_vprintf(fmt, args);
- va_end(args);
- test->tstate = CLASSY_TEST_FAIL;
- g_signal_emit (test, CLASSY_TEST_CLASS(test)->finished, 0, NULL);
-}
-
-/*---------------------------------------------------------------------------*/
-
-gint
-classy_test_state(ClassyTest *test)
-{
- return test->tstate;
-}
-
-/*---------------------------------------------------------------------------*/
diff --git a/tests/cspi/classy-test.h b/tests/cspi/classy-test.h
deleted file mode 100644
index 68e59e16..00000000
--- a/tests/cspi/classy-test.h
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- * Classy Test - Terrible framework for testing asyncronous interface
- *
- * Copyright (C) 2008 Codethink Ltd
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser 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.
- */
-#ifndef CLASSY_TEST_H
-#define CLASSY_TEST_H
-
-#include <glib-object.h>
-
-G_BEGIN_DECLS
-
-GType classy_test_get_type(void);
-
-#define TYPE_CLASSY_TEST (classy_test_get_type())
-
-#define CLASSY_TEST(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), \
- TYPE_CLASSY_TEST, \
- ClassyTest))
-
-#define CLASSY_TEST_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), \
- TYPE_CLASSY_TEST, \
- ClassyTestClass))
-
-#define IS_CLASSY_TEST(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), \
- TYPE_CLASSY_TEST))
-
-#define IS_CLASSY_TEST_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), \
- TYPE_CLASSY_TEST))
-
-#define CLASSY_TEST_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), \
- TYPE_CLASSY_TEST, \
- ClassyTestClass))
-
-typedef struct _ClassyTest ClassyTest;
-typedef struct _ClassyTestClass ClassyTestClass;
-
-enum {
- CLASSY_TEST_NOT_STARTED,
- CLASSY_TEST_IN_PROGRESS,
- CLASSY_TEST_FAIL,
- CLASSY_TEST_WIN
-};
-
-struct _ClassyTest {
- GObject parent;
-
- gchar *name;
- gchar *failm;
- gint tstate;
-
- void (*entry) (ClassyTest *tc, gpointer data);
-
- gpointer data;
-};
-
-struct _ClassyTestClass {
- GObjectClass parent;
-
- /*Virtuals*/
- gchar *(*report) (ClassyTest *test);
- void (*run) (ClassyTest *test);
-
- /*Signals*/
- gint finished;
-};
-
-ClassyTest *
-classy_test_new(gchar *name,
- void (*entry) (ClassyTest*, gpointer data),
- gint istate,
- gpointer data);
-
-void
-classy_test_pass(ClassyTest *test);
-
-void
-classy_test_fail(ClassyTest *test, gchar *fmt, ...);
-
-gint
-classy_test_state(ClassyTest *test);
-
-G_END_DECLS
-#endif /* CLASSY_TEST_H */
diff --git a/tests/cspi/key-listener-test.c b/tests/cspi/key-listener-test.c
deleted file mode 100644
index b212a215..00000000
--- a/tests/cspi/key-listener-test.c
+++ /dev/null
@@ -1,201 +0,0 @@
-/*
- * AT-SPI - Assistive Technology Service Provider Interface
- * (Gnome Accessibility Project; http://developer.gnome.org/projects/gap)
- *
- * Copyright 2001, 2002 Sun Microsystems Inc.,
- * Copyright 2001, 2002 Ximian, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <ctype.h>
-#include <unistd.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <sys/un.h>
-#include "../../cspi/spi.h"
-
-static SPIBoolean report_command_key_event (const AccessibleKeystroke *stroke, void *user_data);
-static SPIBoolean report_ordinary_key_event (const AccessibleKeystroke *stroke, void *user_data);
-static SPIBoolean report_synchronous_key_event (const AccessibleKeystroke *stroke, void *user_data);
-static SPIBoolean report_tab_key_event (const AccessibleKeystroke *stroke, void *user_data);
-static SPIBoolean report_all_key_event (const AccessibleKeystroke *stroke, void *user_data);
-
-static AccessibleKeystrokeListener *command_key_listener;
-static AccessibleKeystrokeListener *ordinary_key_listener;
-static AccessibleKeystrokeListener *synchronous_key_listener;
-static AccessibleKeystrokeListener *tab_key_listener;
-static AccessibleKeystrokeListener *all_key_listener;
-static AccessibleKeySet *command_keyset;
-static AccessibleKeySet *async_keyset;
-static AccessibleKeySet *sync_keyset;
-static AccessibleKeySet *tab_keyset;
-
-int
-main (int argc, char **argv)
-{
- const char *tab_strings[1] = {"Tab"};
- short keycodes[] = {65, 64, 23};
- SPIBoolean retval = FALSE;
-
- SPI_init ();
-
- /* prepare the keyboard snoopers */
- command_key_listener = SPI_createAccessibleKeystrokeListener (report_command_key_event, NULL);
- ordinary_key_listener = SPI_createAccessibleKeystrokeListener (report_ordinary_key_event, NULL);
- synchronous_key_listener = SPI_createAccessibleKeystrokeListener (report_synchronous_key_event, NULL);
- tab_key_listener = SPI_createAccessibleKeystrokeListener (report_tab_key_event, NULL);
- all_key_listener = SPI_createAccessibleKeystrokeListener (report_all_key_event, NULL);
-
- command_keyset = SPI_createAccessibleKeySet (1, "q", NULL, NULL);
- async_keyset = SPI_createAccessibleKeySet (3, NULL, keycodes, NULL);
- sync_keyset = SPI_createAccessibleKeySet (3, "def", NULL, NULL);
- tab_keyset = SPI_createAccessibleKeySet (1, NULL, NULL, tab_strings);
- retval = SPI_registerAccessibleKeystrokeListener(command_key_listener,
- command_keyset,
- SPI_KEYMASK_ALT | SPI_KEYMASK_CONTROL,
- (unsigned long) ( SPI_KEY_PRESSED ),
- SPI_KEYLISTENER_ALL_WINDOWS);
- fprintf (stderr, "Command key registry: result %s\n", retval ? "succeeded" :
- "failed");
- retval = SPI_registerAccessibleKeystrokeListener(ordinary_key_listener,
- async_keyset,
- SPI_KEYMASK_UNMODIFIED,
- (unsigned long) ( SPI_KEY_PRESSED | SPI_KEY_RELEASED ),
- SPI_KEYLISTENER_NOSYNC);
-
- retval = SPI_registerAccessibleKeystrokeListener(synchronous_key_listener,
- sync_keyset,
- SPI_KEYMASK_UNMODIFIED,
- (unsigned long) ( SPI_KEY_PRESSED | SPI_KEY_RELEASED ),
- SPI_KEYLISTENER_CANCONSUME);
-
- retval = SPI_registerAccessibleKeystrokeListener(tab_key_listener,
- tab_keyset,
- SPI_KEYMASK_ALT,
- (unsigned long) ( SPI_KEY_PRESSED | SPI_KEY_RELEASED ),
- SPI_KEYLISTENER_ALL_WINDOWS);
- fprintf (stderr, "tab listener registry: %s\n", retval ? "succeeded" : "failed");
-
- retval = SPI_registerAccessibleKeystrokeListener(all_key_listener,
- SPI_KEYSET_ALL_KEYS,
- SPI_KEYMASK_CONTROL | SPI_KEYMASK_SHIFT,
- (unsigned long) ( SPI_KEY_PRESSED | SPI_KEY_RELEASED ),
- SPI_KEYLISTENER_ALL_WINDOWS);
-
- fprintf (stderr, "all key registry: %s\n", retval ? "succeeded" : "failed" );
-
- SPI_registerAccessibleKeystrokeListener(all_key_listener,
- SPI_KEYSET_ALL_KEYS,
- SPI_KEYMASK_SHIFT,
- (unsigned long) ( SPI_KEY_PRESSED ),
- SPI_KEYLISTENER_NOSYNC | SPI_KEYLISTENER_CANCONSUME);
-
- SPI_event_main ();
-
- putenv ("AT_BRIDGE_SHUTDOWN=1");
-
- return SPI_exit ();
-}
-
-static void
-simple_at_exit (void)
-{
- SPI_deregisterAccessibleKeystrokeListener (command_key_listener, SPI_KEYMASK_ALT | SPI_KEYMASK_CONTROL);
- AccessibleKeystrokeListener_unref (command_key_listener);
- SPI_freeAccessibleKeySet (command_keyset);
-
-/*
- SPI_deregisterAccessibleKeystrokeListener (ordinary_key_listener, SPI_KEYMASK_ALT | SPI_KEYMASK_CONTROL); */
- AccessibleKeystrokeListener_unref (ordinary_key_listener);
- SPI_freeAccessibleKeySet (async_keyset);
-
-/* SPI_deregisterAccessibleKeystrokeListener (synchronous_key_listener, SPI_KEYMASK_ALT | SPI_KEYMASK_CONTROL); */
- AccessibleKeystrokeListener_unref (synchronous_key_listener);
- SPI_freeAccessibleKeySet (sync_keyset);
-
- SPI_deregisterAccessibleKeystrokeListener (tab_key_listener, SPI_KEYMASK_ALT | SPI_KEYMASK_CONTROL);
- AccessibleKeystrokeListener_unref (tab_key_listener);
- SPI_freeAccessibleKeySet (tab_keyset);
-
- SPI_event_quit ();
-}
-
-static SPIBoolean
-is_command_key (const AccessibleKeystroke *key)
-{
- switch (key->keyID)
- {
- case 'Q':
- case 'q':
- simple_at_exit();
- return TRUE; /* not reached */
- default:
- return FALSE;
- }
-}
-
-static void
-print_key_event (const AccessibleKeystroke *key, char *prefix)
-{
- fprintf (stderr, "%s KeyEvent %s%c (keycode %d); string=%s; time=%lx\n",
- prefix,
- (key->modifiers & SPI_KEYMASK_ALT)?"Alt-":"",
- ((key->modifiers & SPI_KEYMASK_SHIFT)^(key->modifiers & SPI_KEYMASK_SHIFTLOCK))?
- (char) toupper((int) key->keyID) : (char) tolower((int) key->keyID),
- (int) key->keycode,
- key->keystring,
- (long int) key->timestamp);
-}
-
-static SPIBoolean
-report_command_key_event (const AccessibleKeystroke *key, void *user_data)
-{
- print_key_event (key, "command");
- return is_command_key (key);
-}
-
-static SPIBoolean
-report_ordinary_key_event (const AccessibleKeystroke *key, void *user_data)
-{
- print_key_event (key, "ordinary");
- return FALSE;
-}
-
-static SPIBoolean
-report_synchronous_key_event (const AccessibleKeystroke *key, void *user_data)
-{
- /* consume 'd' key, let others pass through */
- print_key_event (key, "synchronous (consumable) ");
- return ( key->keyID == 'd' ) ? TRUE : FALSE;
-}
-
-static SPIBoolean
-report_tab_key_event (const AccessibleKeystroke *key, void *user_data)
-{
- print_key_event (key, "[TAB]");
- return FALSE;
-}
-
-static SPIBoolean
-report_all_key_event (const AccessibleKeystroke *key, void *user_data)
-{
- fprintf(stderr, "(%ld)", key->keyID);
- return FALSE;
-}
-
diff --git a/tests/cspi/keysynth-test.c b/tests/cspi/keysynth-test.c
deleted file mode 100644
index 2f275d45..00000000
--- a/tests/cspi/keysynth-test.c
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * AT-SPI - Assistive Technology Service Provider Interface
- * (Gnome Accessibility Project; http://developer.gnome.org/projects/gap)
- *
- * Copyright 2001, 2002 Sun Microsystems Inc.,
- * Copyright 2001, 2002 Ximian, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#include <unistd.h>
-#include <stdlib.h>
-#include "../../cspi/spi-private.h" /* A hack for now */
-#include <glib-object.h>
-#include <gtk/gtk.h>
-#include <atk/atk.h>
-#include <atk/atknoopobject.h>
-#include "spi-common/spi-dbus.h"
-
-typedef struct {
- long int val;
- char *string;
- AccessibleKeySynthType type;
-} TextTest;
-
-static TextTest text[] = {
- {65, NULL, SPI_KEY_PRESSRELEASE},
- {64, NULL, SPI_KEY_SYM},
- {0, "--hello!", SPI_KEY_STRING},
- {0, "StudlyCaps!", SPI_KEY_STRING}
-};
-
-static void
-test_key_synthesis (void)
-{
- int i;
- for (i = 0; i < G_N_ELEMENTS (text); ++i) {
- SPI_generateKeyboardEvent (text[i].val, text[i].string, text[i].type);
- }
-}
-
-int
-main (int argc, char **argv)
-{
- gtk_init (&argc, &argv);
- SPI_init ();
-
- test_key_synthesis ();
-
- return SPI_exit ();
-}
-
diff --git a/tests/cspi/simple-at.c b/tests/cspi/simple-at.c
deleted file mode 100644
index 23cb0ecf..00000000
--- a/tests/cspi/simple-at.c
+++ /dev/null
@@ -1,615 +0,0 @@
-/*
- * AT-SPI - Assistive Technology Service Provider Interface
- * (Gnome Accessibility Project; http://developer.gnome.org/projects/gap)
- *
- * Copyright 2001, 2002 Sun Microsystems Inc.,
- * Copyright 2001, 2002 Ximian, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-#include <stdio.h>
-#include <strings.h>
-#include <stdlib.h>
-#include <ctype.h>
-#include <unistd.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <sys/un.h>
-#undef MAGNIFIER_ENABLED
-#include "../../cspi/spi-private.h" /* A hack for now */
-
-#define PRINT_TREE
-
-static void report_focus_event (const AccessibleEvent *event, void *user_data);
-static void report_generic_event (const AccessibleEvent *event, void *user_data);
-static void report_window_event (const AccessibleEvent *event, void *user_data);
-static void report_text_event (const AccessibleEvent *event, void *user_data);
-static void report_button_press (const AccessibleEvent *event, void *user_data);
-static void check_property_change (const AccessibleEvent *event, void *user_data);
-static SPIBoolean report_command_key_event (const AccessibleKeystroke *stroke, void *user_data);
-static SPIBoolean report_ordinary_key_event (const AccessibleKeystroke *stroke, void *user_data);
-static void get_environment_vars (void);
-
-static int _festival_init (void);
-static void _festival_say (const char *text, const char *voice, SPIBoolean shutup);
-static void _festival_write (const char *buff, int fd);
-
-#ifdef PRINT_TREE
-static void print_accessible_tree (Accessible *accessible, char *prefix);
-#endif
-
-#ifdef MAGNIFIER_ENABLED
-static SPIBoolean use_magnifier = FALSE;
-#endif
-
-static SPIBoolean use_festival = FALSE;
-static SPIBoolean festival_chatty = FALSE;
-static SPIBoolean name_changed = FALSE;
-
-static AccessibleEventListener *focus_listener;
-static AccessibleEventListener *property_listener;
-static AccessibleEventListener *generic_listener;
-static AccessibleEventListener *window_listener;
-static AccessibleEventListener *button_listener;
-static AccessibleEventListener *text_listener;
-static AccessibleKeystrokeListener *command_key_listener;
-static AccessibleKeystrokeListener *ordinary_key_listener;
-static AccessibleKeySet *command_keyset;
-
-int
-main (int argc, char **argv)
-{
- int i, j;
- int n_desktops;
- int n_apps;
- char *s;
- Accessible *desktop;
- Accessible *application;
- const char *modules;
-
- if ((argc > 1) && (!strncmp (argv[1], "-h", 2)))
- {
- printf ("Usage: simple-at\n");
- printf ("\tEnvironment variables used:\n\t\tFESTIVAL\n\t\tMAGNIFIER\n\t\tFESTIVAL_CHATTY\n");
- exit (0);
- }
-
- modules = g_getenv ("GTK_MODULES");
- if (!modules || modules [0] == '\0')
- {
- putenv ("GTK_MODULES=");
- }
- modules = NULL;
-
- SPI_init ();
-
- focus_listener = SPI_createAccessibleEventListener (report_focus_event, NULL);
- property_listener = SPI_createAccessibleEventListener (check_property_change, NULL);
- generic_listener = SPI_createAccessibleEventListener (report_generic_event, NULL);
- window_listener = SPI_createAccessibleEventListener (report_window_event, NULL);
- text_listener = SPI_createAccessibleEventListener (report_text_event, NULL);
- button_listener = SPI_createAccessibleEventListener (report_button_press, NULL);
- SPI_registerGlobalEventListener (focus_listener, "focus:");
- SPI_registerGlobalEventListener (property_listener, "object:property-change");
-/* :accessible-selection"); */
- SPI_registerGlobalEventListener (property_listener, "object:property-change:accessible-name");
- SPI_registerGlobalEventListener (generic_listener, "object:selection-changed");
- SPI_registerGlobalEventListener (generic_listener, "object:children-changed");
- SPI_registerGlobalEventListener (generic_listener, "object:visible-data-changed");
- SPI_registerGlobalEventListener (generic_listener, "object:text-selection-changed");
- SPI_registerGlobalEventListener (text_listener, "object:text-caret-moved");
- SPI_registerGlobalEventListener (text_listener, "object:text-changed");
- SPI_registerGlobalEventListener (button_listener, "Gtk:GtkWidget:button-press-event");
- SPI_registerGlobalEventListener (window_listener, "window:minimize");
- SPI_registerGlobalEventListener (window_listener, "window:activate");
- n_desktops = SPI_getDesktopCount ();
-
- for (i=0; i<n_desktops; ++i)
- {
- desktop = SPI_getDesktop (i);
- s = Accessible_getName (desktop);
- fprintf (stderr, "desktop %d name: %s\n", i, s);
- SPI_freeString (s);
- n_apps = Accessible_getChildCount (desktop);
- for (j=0; j<n_apps; ++j)
- {
- application = Accessible_getChildAtIndex (desktop, j);
- s = Accessible_getName (application);
- fprintf (stderr, "app %d name: %s\n", j, s ? s : "(nil)");
-#ifdef PRINT_TREE
- print_accessible_tree (application, "*");
-#endif
- SPI_freeString (s);
- Accessible_unref (application);
- }
- Accessible_unref (desktop);
- }
-
- /* prepare the keyboard snoopers */
- command_key_listener = SPI_createAccessibleKeystrokeListener (report_command_key_event, NULL);
- ordinary_key_listener = SPI_createAccessibleKeystrokeListener (report_ordinary_key_event, NULL);
-
- command_keyset = SPI_createAccessibleKeySet (11, "qmf23456789", NULL, NULL);
-
- /* will listen only to Control-Alt-q KeyPress events */
- SPI_registerAccessibleKeystrokeListener(command_key_listener,
- command_keyset,
- SPI_KEYMASK_ALT | SPI_KEYMASK_CONTROL,
- (unsigned long) ( SPI_KEY_PRESSED ),
- SPI_KEYLISTENER_ALL_WINDOWS);
-
- /* will listen only to CAPSLOCK key events, both press and release */
- SPI_registerAccessibleKeystrokeListener(ordinary_key_listener,
- (AccessibleKeySet *) SPI_KEYSET_ALL_KEYS,
- SPI_KEYMASK_SHIFTLOCK,
- (unsigned long) ( SPI_KEY_PRESSED | SPI_KEY_RELEASED ),
- SPI_KEYLISTENER_NOSYNC);
-
- get_environment_vars ();
-
- SPI_event_main ();
-
- putenv ("AT_BRIDGE_SHUTDOWN=1");
-
- return SPI_exit ();
-}
-
-static void
-get_environment_vars (void)
-{
- if (g_getenv ("FESTIVAL"))
- {
- fprintf (stderr, "Using festival\n");
- use_festival = TRUE;
- if (g_getenv ("FESTIVAL_CHATTY"))
- {
- festival_chatty = TRUE;
- }
- }
-#ifdef MAGNIFIER_ENABLED
- if (g_getenv ("MAGNIFIER"))
- {
- fprintf (stderr, "Using magnifier\n");
- use_magnifier = TRUE;
- }
- else
- {
- fprintf (stderr, "Not using magnifier\n");
- }
-#endif
-
- if (!use_festival)
- {
- fprintf (stderr, "No speech output\n");
- }
-}
-
-#ifdef PRINT_TREE
-static void
-print_accessible_tree (Accessible *accessible, char *prefix)
-{
- int n_children;
- int i;
- char *name;
- char *role_name;
- char *parent_name = NULL;
- char *parent_role = NULL;
- char child_prefix[100];
- Accessible *child;
- Accessible *parent;
-
- strncpy (child_prefix, prefix, 98);
- strcat (child_prefix, "*");
- parent = Accessible_getParent (accessible);
- if (parent)
- {
- parent_name = Accessible_getName (parent);
- parent_role = Accessible_getRoleName (parent);
- Accessible_unref (parent);
- }
- name = Accessible_getName (accessible);
- role_name = Accessible_getRoleName (accessible);
- fprintf (stdout, "%sAccessible [%s] \"%s\"; parent [%s] %s.\n",
- prefix, role_name, name ? name : "(nil)",
- parent_role ? parent_role : "(nil)",
- parent_name ? parent_name : "(nil)");
- SPI_freeString (name);
- SPI_freeString (role_name);
- SPI_freeString (parent_name);
- SPI_freeString (parent_role);
- n_children = Accessible_getChildCount (accessible);
- for (i = 0; i < n_children; ++i)
- {
- child = Accessible_getChildAtIndex (accessible, i);
- print_accessible_tree (child, child_prefix);
- Accessible_unref (child);
- }
-}
-#endif
-
-void
-report_focussed_accessible (Accessible *obj, SPIBoolean shutup_previous_speech)
-{
- char *s;
- int len;
- long x, y, width, height;
- /* hack for GUADEC demo, to make sure name changes are spoken */
- shutup_previous_speech = (shutup_previous_speech && !name_changed);
-
- if (use_festival)
- {
- if (festival_chatty)
- {
- s = Accessible_getRoleName (obj);
- _festival_say (s, "voice_don_diphone", shutup_previous_speech);
- SPI_freeString (s);
- }
- fprintf (stderr, "getting Name\n");
- s = Accessible_getName (obj);
- _festival_say (s, "voice_kal_diphone",
- shutup_previous_speech || festival_chatty);
- SPI_freeString (s);
- }
-
- if (Accessible_isComponent (obj))
- {
- AccessibleComponent *component = Accessible_getComponent (obj);
- AccessibleComponent_getExtents (component, &x, &y, &width, &height,
- SPI_COORD_TYPE_SCREEN);
- fprintf (stderr, "Bounding box: (%ld, %ld) ; (%ld, %ld)\n",
- x, y, x+width, y+height);
- if (Accessible_isText (obj))
- {
- long x0, y0, xN, yN, w0, h0, wN, hN, nchars;
- AccessibleText *text = Accessible_getText (obj);
- nchars = AccessibleText_getCharacterCount (text);
- if (nchars > 0)
- {
- AccessibleText_getCharacterExtents (text, 0, &x0, &y0, &w0, &h0,
- SPI_COORD_TYPE_SCREEN);
- AccessibleText_getCharacterExtents (text, nchars-1, &xN, &yN, &wN, &hN,
- SPI_COORD_TYPE_SCREEN);
- x = MIN (x0, xN);
- width = MAX (x0 + w0, xN + wN) - x;
- fprintf (stderr, "Text bounding box: (%ld, %ld) ; (%ld, %ld)\n",
- x, y, x+width, y+height);
- }
- }
-#ifdef MAGNIFIER_ENABLED
- if (use_magnifier) {
- magnifier_set_roi ((short) 0, x, y, width, height);
- }
-#endif
- }
-
-
- if (Accessible_isValue (obj))
- {
- AccessibleValue *value = Accessible_getValue (obj);
- fprintf (stderr, "Current value = %f, min = %f; max = %f\n",
- AccessibleValue_getCurrentValue (value),
- AccessibleValue_getMinimumValue (value),
- AccessibleValue_getMaximumValue (value));
- }
- /* if this is a text object, speak the first sentence. */
-
- if (Accessible_isText(obj))
-
- {
- AccessibleText *text_interface;
- long start_offset, end_offset;
- char *first_sentence = "empty";
- text_interface = Accessible_getText (obj);
- first_sentence = AccessibleText_getTextAtOffset (
- text_interface, (long) 0, SPI_TEXT_BOUNDARY_SENTENCE_START, &start_offset, &end_offset);
- if (first_sentence && use_festival)
- {
- _festival_say(first_sentence, "voice_don_diphone", FALSE);
- SPI_freeString (first_sentence);
- }
- len = AccessibleText_getCharacterCount (text_interface);
- s = AccessibleText_getText (text_interface, 0, len);
- fprintf (stderr, "done reporting on focussed object, text=%s\n", s);
- }
-}
-
-void
-report_focus_event (const AccessibleEvent *event, void *user_data)
-{
- char *s;
-
- g_return_if_fail (event->source != NULL);
- s = Accessible_getName (event->source);
- if (s)
- {
- fprintf (stderr, "%s event from %s\n", event->type, s);
- SPI_freeString (s);
- report_focussed_accessible (event->source, TRUE);
- }
- Accessible_getParent (event->source);
- name_changed = FALSE;
-}
-
-void
-report_generic_event (const AccessibleEvent *event, void *user_data)
-{
- fprintf (stderr, "%s event received\n", event->type);
-}
-
-void
-report_window_event (const AccessibleEvent *event, void *user_data)
-{
- fprintf (stderr, "%s event received\n", event->type);
- if (!strcmp (event->type, "window:activate"))
- {
- print_accessible_tree (event->source, "window");
- }
-}
-
-void
-report_text_event (const AccessibleEvent *event, void *user_data)
-{
- AccessibleText *text = Accessible_getText (event->source);
- fprintf (stderr, "%s event received\n", event->type);
-#ifdef MAGNIFIER_ENABLED
- if (use_magnifier && strcmp (event->type, "object:text-changed"))
- {
- long offset = AccessibleText_getCaretOffset (text);
- long x, y, w, h;
- fprintf (stderr, "offset %d\n", (int) offset);
- AccessibleText_getCharacterExtents (text, offset, &x, &y, &w, &h,
- SPI_COORD_TYPE_SCREEN);
- fprintf (stderr, "new roi %d %d %d %d\n", (int) x, (int) y, (int) w, (int) h);
- magnifier_set_roi ((short) 0, x, y, w, h);
- }
-#endif
- if (!strcmp (event->type, "object:text-changed"))
- {
- long start, end;
- char *new_text = AccessibleText_getTextAtOffset (text, (long) event->detail1, SPI_TEXT_BOUNDARY_WORD_START, &start, &end);
- _festival_say (new_text, "voice_kal_diphone", FALSE);
- fprintf (stderr, "text changed: %s", new_text ? new_text : "");
- SPI_freeString (new_text);
- }
- else
- {
- long start, end;
- char *word_text = AccessibleText_getTextAtOffset (text, (long) event->detail1, SPI_TEXT_BOUNDARY_WORD_START, &start, &end);
- char *sentence_text = AccessibleText_getTextAtOffset (text, (long) event->detail1, SPI_TEXT_BOUNDARY_SENTENCE_START, &start, &end);
- fprintf (stderr, "text changed: word %s; sentence %s at %ld",
- (word_text ? word_text : ""),
- (sentence_text ? sentence_text : ""),
- event->detail1);
- if (word_text) SPI_freeString (word_text);
- if (sentence_text) SPI_freeString (sentence_text);
- }
-}
-
-void
-report_button_press (const AccessibleEvent *event, void *user_data)
-{
- char *s;
-
- g_return_if_fail (event->source != NULL);
-
- s = Accessible_getName (event->source);
-
- fprintf (stderr, "%s event from %s\n", event->type, s);
- SPI_freeString (s);
- s = Accessible_getDescription (event->source);
- fprintf (stderr, "Object description %s\n", s);
- SPI_freeString (s);
-}
-
-void
-check_property_change (const AccessibleEvent *event, void *user_data)
-{
- AccessibleSelection *selection = Accessible_getSelection (event->source);
- int n_selections;
- int i;
- char *s;
- fprintf (stderr, "property change event!\n");
- if (selection)
- {
- n_selections = (int) AccessibleSelection_getNSelectedChildren (selection);
- s = Accessible_getName (event->source);
- fprintf (stderr, "(Property) %s event from %s, %d selected children\n",
- event->type, s, n_selections);
- SPI_freeString (s);
- /* for now, speak entire selection set */
- for (i=0; i<n_selections; ++i)
- {
- Accessible *obj = AccessibleSelection_getSelectedChild (selection, (long) i);
- g_return_if_fail (obj);
- s = Accessible_getName (obj);
- fprintf (stderr, "Child %d, name=%s\n", i, s);
- SPI_freeString (s);
- report_focussed_accessible (obj, i==0);
- }
- }
- else if (!strcmp (event->type, "object:property-change:accessible-name"))
- {
- name_changed = TRUE;
- report_focussed_accessible (event->source, TRUE);
- }
- else
- {
- fprintf (stderr, "Property change %s received\n", event->type);
- }
-}
-
-static void
-simple_at_exit (void)
-{
- SPI_deregisterGlobalEventListenerAll (focus_listener);
- AccessibleEventListener_unref (focus_listener);
-
- SPI_deregisterGlobalEventListenerAll (property_listener);
- AccessibleEventListener_unref (property_listener);
-
- SPI_deregisterGlobalEventListenerAll (generic_listener);
- AccessibleEventListener_unref (generic_listener);
-
- SPI_deregisterGlobalEventListenerAll (text_listener);
- AccessibleEventListener_unref (text_listener);
-
- SPI_deregisterGlobalEventListenerAll (button_listener);
- AccessibleEventListener_unref (button_listener);
-
- SPI_deregisterAccessibleKeystrokeListener (command_key_listener, SPI_KEYMASK_ALT | SPI_KEYMASK_CONTROL);
- AccessibleKeystrokeListener_unref (command_key_listener);
- SPI_freeAccessibleKeySet (command_keyset);
-
- SPI_deregisterAccessibleKeystrokeListener (ordinary_key_listener, SPI_KEYMASK_SHIFTLOCK);
- AccessibleKeystrokeListener_unref (ordinary_key_listener);
-
- SPI_event_quit ();
-}
-
-static SPIBoolean
-is_command_key (const AccessibleKeystroke *key)
-{
- switch (key->keyID)
- {
- case 'Q':
- case 'q':
- simple_at_exit();
- return TRUE; /* not reached */
-#ifdef MAGNIFIER_ENABLED
- case 'M':
- case 'm':
- use_magnifier = ! use_magnifier;
- fprintf (stderr, "%ssing magnifier\n", use_magnifier ? "U" : "Not u");
- return TRUE;
-#endif
- case 'F':
- case 'f':
- use_festival = ! use_festival;
- fprintf (stderr, "%speech output\n", use_festival ? "S" : "No s");
- return TRUE;
- default:
- return FALSE;
- }
-}
-
-static SPIBoolean
-report_command_key_event (const AccessibleKeystroke *key, void *user_data)
-{
- fprintf (stderr, "Command KeyEvent %s%c (keycode %d); string=%s; time=%lx\n",
- (key->modifiers & SPI_KEYMASK_ALT)?"Alt-":"",
- ((key->modifiers & SPI_KEYMASK_SHIFT)^(key->modifiers & SPI_KEYMASK_SHIFTLOCK))?
- (char) toupper((int) key->keyID) : (char) tolower((int) key->keyID),
- (int) key->keycode,
- key->keystring,
- (long int) key->timestamp);
- return is_command_key (key);
-}
-
-
-static SPIBoolean
-report_ordinary_key_event (const AccessibleKeystroke *key, void *user_data)
-{
- fprintf (stderr, "Received key event:\tsym %ld\n\tmods %x\n\tcode %d\n\tstring=\'%s\'\n\ttime %lx\n",
- (long) key->keyID,
- (unsigned int) key->modifiers,
- (int) key->keycode,
- key->keystring,
- (long int) key->timestamp);
- return FALSE;
-}
-
-static int
-_festival_init (void)
-{
- int fd;
- struct sockaddr_in name;
- int tries = 2;
-
- name.sin_family = AF_INET;
- name.sin_port = htons (1314);
- name.sin_addr.s_addr = htonl(INADDR_ANY);
- fd = socket (PF_INET, SOCK_STREAM, 0);
-
- while (connect(fd, (struct sockaddr *) &name, sizeof (name)) < 0) {
- if (!tries--) {
- perror ("connect");
- return -1;
- }
- }
-
- _festival_write ("(audio_mode'async)\n", fd);
- _festival_write ("(Parameter.set 'Duration_Model 'Tree_ZScore)\n", fd);
- _festival_write ("(Parameter.set 'Duration_Stretch 0.75)\n", fd);
- return fd;
-}
-
-static void
-_festival_say (const char *text, const char *voice, SPIBoolean shutup)
-{
- static int fd = 0;
- gchar *quoted;
- gchar *p;
- gchar prefix[50];
- static gchar voice_spec[32];
-
- if (!fd)
- {
- fd = _festival_init ();
- }
-
- fprintf (stderr, "saying text: %s\n", text);
-
- quoted = g_malloc(64+strlen(text)*2);
-
- sprintf (prefix, "(SayText \"");
-
- strncpy(quoted, prefix, 10);
- p = quoted+strlen(prefix);
- while (*text) {
- if ( *text == '\\' || *text == '"' )
- *p = '\\';
- *p++ = *text++;
- }
- *p++ = '"';
- *p++ = ')';
- *p++ = '\n';
- *p = 0;
-
- if (shutup) _festival_write ("(audio_mode'shutup)\n", fd);
- if (voice && (strncmp (voice, (char *) (voice_spec+1), strlen(voice))))
- {
- snprintf (voice_spec, 32, "(%s)\n", voice);
- _festival_write (voice_spec, fd);
- _festival_write ("(Parameter.set 'Duration_Model 'Tree_ZScore)\n", fd);
- _festival_write ("(Parameter.set 'Duration_Stretch 0.75)\n", fd);
- }
-
- _festival_write (quoted, fd);
-
- g_free(quoted);
-}
-
-static void
-_festival_write (const gchar *command_string, int fd)
-{
- fprintf(stderr, command_string);
- if (fd < 0) {
- perror("socket");
- return;
- }
- write(fd, command_string, strlen(command_string));
-}
-
diff --git a/tests/cspi/simple-test.c b/tests/cspi/simple-test.c
deleted file mode 100644
index 21c74a6c..00000000
--- a/tests/cspi/simple-test.c
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright (C) 2008 Codethink Ltd.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#include <glib.h>
-#include <cspi/spi.h>
-
-#include <stdio.h>
-
-int
-main (int argc, char **argv)
-{
- gint i;
- gint n_desktops;
- gchar *s;
-
- SPI_init ();
-
- n_desktops = SPI_getDesktopCount ();
-
- for (i=0; i<n_desktops; ++i) {
- Accessible *desktop;
-
- desktop = SPI_getDesktop (i);
- s = Accessible_getName (desktop);
- fprintf (stderr, "desktop %d name: %s\n", i, s);
- SPI_freeString (s);
- Accessible_unref (desktop);
- }
- return SPI_exit ();
-}
diff --git a/tests/cspi/test-simple.c b/tests/cspi/test-simple.c
deleted file mode 100644
index 62bcb31a..00000000
--- a/tests/cspi/test-simple.c
+++ /dev/null
@@ -1,816 +0,0 @@
-/*
- * test-simple.c: A set of simple regression tests
- * (Gnome Accessibility Project; http://developer.gnome.org/projects/gap)
- *
- * Copyright 2001 Ximian, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-/*
- * ******** Do not copy this code as an example *********
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <locale.h>
-#include <gtk/gtk.h>
-#include <cspi/spi.h>
-#include <cspi/spi-private.h>
-
-#include "dbus/dbus.h"
-
-/* Known bugs */
-#define WHOLE_STRING -1
-
-static void validate_accessible (Accessible *accessible,
- gboolean has_parent,
- gboolean recurse_down);
-
-#define WINDOW_MAGIC 0x123456a
-#define TEST_STRING_A "A test string"
-#define TEST_STRING_A_OBJECT "A_test_string_object"
-#define TEST_STRING_B "Another test string"
-
-static int print_tree_depth = 0;
-static gboolean print_tree = FALSE;
-static gboolean do_poke = FALSE;
-static gboolean key_press_received = FALSE;
-static gboolean key_release_received = FALSE;
-
-typedef struct {
- gulong magic;
- GtkWidget *window;
-} TestWindow;
-
-static gboolean
-focus_me (GtkWidget *widget)
-{
- AtkObject *aobject = atk_implementor_ref_accessible (
- ATK_IMPLEMENTOR (widget));
-
- /* Force a focus event - even if the WM focused
- * us before our at-bridge's idle handler registered
- * our interest */
- if (!GTK_WIDGET_HAS_FOCUS (widget))
- gtk_widget_grab_focus (widget);
-/* else: FIXME - gtk_widget_grab_focus should send a notify */
- atk_focus_tracker_notify (aobject);
-
- g_object_unref (G_OBJECT (aobject));
-
- return FALSE;
-}
-
-static void
-test_window_add_and_show (GtkContainer *container, GtkWidget *widget)
-{
- gtk_container_add (container, widget);
- gtk_widget_show (widget);
-}
-
-static GtkWidget *
-create_tree (void)
-{
- GtkWidget *widget;
- GtkTreeIter iter;
- GtkListStore *store;
- GtkTreeViewColumn *column;
-
- store = gtk_list_store_new (1, G_TYPE_STRING);
- gtk_list_store_append (store, &iter);
- gtk_list_store_set (store, &iter, 0, TEST_STRING_A, -1);
- column = gtk_tree_view_column_new_with_attributes ("String",
- gtk_cell_renderer_text_new (), "text", 0, NULL);
- widget = gtk_tree_view_new_with_model (GTK_TREE_MODEL (store));
- g_object_unref (G_OBJECT (store));
- gtk_tree_view_append_column (GTK_TREE_VIEW (widget), column);
-
- return widget;
-}
-
-static TestWindow *
-create_test_window (void)
-{
- TestWindow *win = g_new0 (TestWindow, 1);
- GtkWidget *widget, *vbox;
- AtkObject *obj;
-
- win->magic = WINDOW_MAGIC;
- win->window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
-
- gtk_widget_show (win->window);
-
- vbox = gtk_vbox_new (0, 0);
- gtk_container_add (GTK_CONTAINER (win->window), vbox);
- gtk_widget_show (vbox);
-
- widget = gtk_entry_new ();
- gtk_entry_set_text (GTK_ENTRY (widget), TEST_STRING_A);
- obj = gtk_widget_get_accessible (widget);
- atk_object_set_name (obj, TEST_STRING_A_OBJECT);
-
- test_window_add_and_show (GTK_CONTAINER (vbox), widget);
-
- widget = gtk_button_new_with_label ("_Foobar");
- test_window_add_and_show (GTK_CONTAINER (vbox), widget);
-
- widget = gtk_hseparator_new ();
- test_window_add_and_show (GTK_CONTAINER (vbox), widget);
-
- widget = gtk_image_new_from_stock (GTK_STOCK_DIALOG_QUESTION,
- GTK_ICON_SIZE_LARGE_TOOLBAR);
- test_window_add_and_show (GTK_CONTAINER (vbox), widget);
-
- widget = g_object_new (GTK_TYPE_HSCALE, NULL);
- gtk_range_set_range (GTK_RANGE (widget), 0.0, 100.0);
- test_window_add_and_show (GTK_CONTAINER (vbox), widget);
-
- widget = create_tree ();
- test_window_add_and_show (GTK_CONTAINER (vbox), widget);
-
- g_idle_add ((GSourceFunc) focus_me, win->window);
-
- return win;
-}
-
-static void
-test_window_destroy (TestWindow *win)
-{
- gtk_widget_destroy (win->window);
- g_free (win);
-}
-
-static void
-test_roles (void)
-{
- int i;
-
- fprintf (stderr, "Testing roles...\n");
- for (i = -1; i < 1000; i++)
- g_assert (AccessibleRole_getName (i) != NULL);
-
- g_assert (!strcmp (AccessibleRole_getName (SPI_ROLE_FILE_CHOOSER), "file-chooser"));
- g_assert (!strcmp (AccessibleRole_getName (SPI_ROLE_RADIO_BUTTON), "radio-button"));
- g_assert (!strcmp (AccessibleRole_getName (SPI_ROLE_TABLE), "table"));
- g_assert (!strcmp (AccessibleRole_getName (SPI_ROLE_WINDOW), "window"));
-}
-
-static void
-test_action (AccessibleAction *action)
-{
- gint n_actions, i;
- gchar *s, *sd;
- g_assert ((n_actions = AccessibleAction_getNActions (action)) >= 0);
-
- fprintf (stderr, "Testing actions...");
- for (i = 0; i < n_actions; ++i)
- {
- s = AccessibleAction_getName (action, i);
- g_assert (s);
- sd = AccessibleAction_getDescription (action, i);
- g_assert (sd);
- fprintf (stderr, "%d: %s (%s); ", i, s, sd);
- SPI_freeString (s);
- SPI_freeString (sd);
- g_assert (AccessibleAction_doAction (action, i));
- }
- fprintf (stderr, "\n");
-}
-
-static void
-test_desktop (void)
-{
- Accessible *desktop;
- Accessible *application;
- Accessible **list;
-
- fprintf (stderr, "Testing desktop...\n");
-
- g_assert (SPI_getDesktop (-1) == NULL);
- desktop = SPI_getDesktop (0);
- g_assert (desktop != NULL);
-
- g_assert ((SPI_getDesktopList (&list)) > 0);
- g_assert (list[0] == desktop);
- SPI_freeDesktopList (list);
-
- validate_accessible (desktop, FALSE, FALSE);
-
- application = Accessible_getChildAtIndex (desktop, 0);
- g_assert (application != NULL);
- AccessibleApplication_unref (application);
-
- Accessible_unref (desktop);
-}
-
-static void
-test_application (Accessible *application)
-{
- char *str;
-
- fprintf (stderr, "Testing application ...\n");
- g_assert (Accessible_isApplication (application));
- g_assert (Accessible_getApplication (application) ==
- application);
- AccessibleApplication_unref (application);
-
- str = AccessibleApplication_getToolkitName (application);
- g_assert (str != NULL);
- g_assert (!strcmp (str, "GAIL"));
- SPI_freeString (str);
-
- str = AccessibleApplication_getLocale (application, LC_MESSAGES);
- g_assert (!strcmp (str, setlocale (LC_MESSAGES, NULL)));
- SPI_freeString (str);
-
- str = AccessibleApplication_getVersion (application);
- g_assert (str != NULL);
- SPI_freeString (str);
-
- AccessibleApplication_getID (application);
-}
-
-static void
-test_editable_text (AccessibleEditableText *etext)
-{
- char *str;
- AccessibleText *text;
-
- fprintf (stderr, "Testing editable text ...\n");
-
- g_assert (Accessible_isText (etext));
- text = Accessible_getText (etext);
-
- AccessibleEditableText_setTextContents (
- etext, TEST_STRING_B);
-
- str = AccessibleText_getText (text, 0, WHOLE_STRING);
- g_assert (!strcmp (str, TEST_STRING_B));
-
- SPI_freeString (str);
-
- /* FIXME: lots more editing here */
-
- AccessibleEditableText_setTextContents (
- etext, TEST_STRING_A);
-
- AccessibleText_unref (text);
-}
-
-static void
-test_table (AccessibleTable *table)
-{
- Accessible *header;
- gint index;
- gint rows, columns;
-
- fprintf (stderr, "Testing table ...\n");
-
- rows = AccessibleTable_getNRows (table);
- g_assert (rows > 0);
-
- columns = AccessibleTable_getNColumns (table);
- g_assert (columns > 0);
-
- index = AccessibleTable_getIndexAt (table, rows - 1, columns - 1);
-
- g_assert (AccessibleTable_getRowAtIndex (table, index) == rows - 1);
-
- g_assert (AccessibleTable_getColumnAtIndex (table, index) == columns - 1);
-
- g_assert ((header = AccessibleTable_getColumnHeader (table, 0)));
- Accessible_unref (header);
-
- AccessibleTable_isSelected (table, 0, 0);
-
- /* FIXME: lots more tests */
-}
-
-static void
-test_text (AccessibleText *text)
-{
- char *str;
-
- fprintf (stderr, "Testing text ...\n");
-
- g_assert (AccessibleText_getCharacterCount (text) ==
- strlen (TEST_STRING_A));
-
- str = AccessibleText_getText (text, 0, WHOLE_STRING);
- g_assert (!strcmp (str, TEST_STRING_A));
- SPI_freeString (str);
-
- str = AccessibleText_getText (text, 0, 5);
- g_assert (!strncmp (str, TEST_STRING_A, 5));
- SPI_freeString (str);
-
- AccessibleText_setCaretOffset (text, 7);
- g_assert (AccessibleText_getCaretOffset (text) == 7);
-
- /* FIXME: lots more tests - selections etc. etc. */
-}
-
-static void
-test_value (AccessibleValue *value)
-{
- float original_value;
-
- fprintf (stderr, "Testing value ...\n");
-
- original_value = AccessibleValue_getCurrentValue (value);
-
- g_assert (AccessibleValue_getCurrentValue (value) <=
- AccessibleValue_getMaximumValue (value));
-
- g_assert (AccessibleValue_getCurrentValue (value) >=
- AccessibleValue_getMinimumValue (value));
-
- AccessibleValue_setCurrentValue (value,
- AccessibleValue_getMinimumValue (value));
-
- g_assert (AccessibleValue_getCurrentValue (value) ==
- AccessibleValue_getMinimumValue (value));
-
- AccessibleValue_setCurrentValue (value,
- AccessibleValue_getMaximumValue (value));
-
- g_assert (AccessibleValue_getCurrentValue (value) ==
- AccessibleValue_getMaximumValue (value));
-
- AccessibleValue_setCurrentValue (value, original_value);
-
- g_assert (AccessibleValue_getCurrentValue (value) == original_value);
-}
-
-static void
-test_component (AccessibleComponent *component)
-{
- long x, y, width, height;
-
- fprintf (stderr, "Testing component...\n");
-
- AccessibleComponent_getExtents (
- component, &x, &y, &width, &height, SPI_COORD_TYPE_SCREEN);
-
- AccessibleComponent_getPosition (
- component, &x, &y, SPI_COORD_TYPE_SCREEN);
-
- AccessibleComponent_getSize (component, &width, &height);
-
- if (width > 0 && height > 0) {
-#ifdef FIXME
- Accessible *accessible, *componentb;
-#endif
-
- g_assert (AccessibleComponent_contains (
- component, x, y, SPI_COORD_TYPE_SCREEN));
-
- g_assert (AccessibleComponent_contains (
- component, x + width - 1, y, SPI_COORD_TYPE_SCREEN));
-
- g_assert (AccessibleComponent_contains (
- component, x + width - 1, y + height - 1,
- SPI_COORD_TYPE_SCREEN));
-
-#ifdef FIXME
- accessible = AccessibleComponent_getAccessibleAtPoint (
- component, x, y, SPI_COORD_TYPE_SCREEN);
-
- g_assert (Accessible_isComponent (accessible));
- componentb = Accessible_getComponent (accessible);
- g_assert (componentb == component);
-
- AccessibleComponent_unref (componentb);
- Accessible_unref (accessible);
-#endif
- }
-
- AccessibleComponent_getLayer (component);
- AccessibleComponent_getMDIZOrder (component);
-/* AccessibleComponent_grabFocus (component); */
-}
-
-static void
-test_image (AccessibleImage *image)
-{
- char *desc;
- long int x = -1, y = -1, width = -1, height = -1;
-
- desc = AccessibleImage_getImageDescription (image);
- g_assert (desc != NULL);
- SPI_freeString (desc);
-
- AccessibleImage_getImagePosition (image, &x, &y,
- SPI_COORD_TYPE_SCREEN);
- AccessibleImage_getImageSize (image, &width, &height);
- AccessibleImage_getImageExtents (image, &x, &y, &width, &height,
- SPI_COORD_TYPE_WINDOW);
-}
-
-static void
-validate_tree (Accessible *accessible,
- gboolean has_parent,
- gboolean recurse_down)
-{
- Accessible *parent;
- long len, i;
-
- parent = Accessible_getParent (accessible);
- if (has_parent) {
- long index;
- Accessible *child_at_index;
-
- g_assert (parent != NULL);
-
- index = Accessible_getIndexInParent (accessible);
- g_assert (index >= 0);
-
- child_at_index = Accessible_getChildAtIndex (parent, index);
-
- g_assert (child_at_index == accessible);
-
- Accessible_unref (child_at_index);
- Accessible_unref (parent);
- }
-
- len = Accessible_getChildCount (accessible);
- print_tree_depth++;
- for (i = 0; i < len; i++) {
- Accessible *child;
-
- child = Accessible_getChildAtIndex (accessible, i);
-#ifdef ROPEY
- if (!child)
- fprintf (stderr, "Unusual - ChildGone at %ld\n", i);
-
- g_assert (Accessible_getIndexInParent (child) == i);
- g_assert (Accessible_getParent (child) == accessible);
-#endif
-
- if (recurse_down && child)
- validate_accessible (child, has_parent, recurse_down);
-
- Accessible_unref (child);
- }
- print_tree_depth--;
-}
-
-static void
-validate_accessible (Accessible *accessible,
- gboolean has_parent,
- gboolean recurse_down)
-{
- Accessible *tmp;
- char *name, *descr;
- AccessibleRole role;
- AccessibleRelation **relations;
- char *role_name;
- GString *item_str = g_string_new ("");
- int i;
-
- name = Accessible_getName (accessible);
- g_assert (name != NULL);
-
- descr = Accessible_getDescription (accessible);
- g_assert (descr != NULL);
-
- role = Accessible_getRole (accessible);
- g_assert (role != SPI_ROLE_INVALID);
- role_name = Accessible_getRoleName (accessible);
- g_assert (role_name != NULL);
-
- relations = Accessible_getRelationSet (accessible);
- g_assert (relations != NULL);
-
- for (i = 0; relations [i]; i++) {
- AccessibleRelationType type;
- int targets;
-
- fprintf (stderr, "relation %d\n", i);
-
- type = AccessibleRelation_getRelationType (relations [i]);
- g_assert (type != SPI_RELATION_NULL);
-
- targets = AccessibleRelation_getNTargets (relations [i]);
- g_assert (targets != -1);
-
- AccessibleRelation_unref (relations [i]);
- relations [i] = NULL;
- }
- free (relations);
-
- if (print_tree) {
- int i;
-
- for (i = 0; i < print_tree_depth; i++)
- fputc (' ', stderr);
- fputs ("|-> [ ", stderr);
- }
-
- if (Accessible_isAction (accessible)) {
- tmp = Accessible_getAction (accessible);
- g_assert (tmp != NULL);
- if (print_tree)
- fprintf (stderr, "At");
- else
- test_action (tmp);
- AccessibleAction_unref (tmp);
- }
-
- if (Accessible_isApplication (accessible)) {
- tmp = Accessible_getApplication (accessible);
- if (print_tree)
- fprintf (stderr, "Ap");
- else
- test_application (tmp);
- AccessibleApplication_unref (tmp);
- }
-
- if (Accessible_isComponent (accessible)) {
- tmp = Accessible_getComponent (accessible);
- g_assert (tmp != NULL);
- if (print_tree)
- fprintf (stderr, "Co");
- else
- test_component (tmp);
- AccessibleComponent_unref (tmp);
- }
-
- if (Accessible_isEditableText (accessible)) {
- tmp = Accessible_getEditableText (accessible);
- g_assert (tmp != NULL);
- if (print_tree)
- fprintf (stderr, "Et");
- else
- test_editable_text (tmp);
- AccessibleEditableText_unref (tmp);
- }
-
- if (Accessible_isHypertext (accessible)) {
- tmp = Accessible_getHypertext (accessible);
- g_assert (tmp != NULL);
- if (print_tree)
- fprintf (stderr, "Ht");
- AccessibleHypertext_unref (tmp);
- }
-
- if (Accessible_isImage (accessible)) {
- tmp = Accessible_getImage (accessible);
- g_assert (tmp != NULL);
- if (print_tree) {
- char *desc;
-
- fprintf (stderr, "Im");
-
- desc = AccessibleImage_getImageDescription (tmp);
- g_string_append_printf (
- item_str, " image descr: '%s'", desc);
- SPI_freeString (desc);
- } else
- test_image (tmp);
-
- AccessibleImage_unref (tmp);
- }
-
- if (Accessible_isSelection (accessible)) {
- tmp = Accessible_getSelection (accessible);
- g_assert (tmp != NULL);
- if (print_tree)
- fprintf (stderr, "Se");
- AccessibleSelection_unref (tmp);
- }
-
- if (Accessible_isTable (accessible)) {
- tmp = Accessible_getTable (accessible);
- g_assert (tmp != NULL);
- if (print_tree)
- fprintf (stderr, "Ta");
- else
- test_table (tmp);
- AccessibleTable_unref (tmp);
- }
-
- if (Accessible_isText (accessible)) {
- tmp = Accessible_getText (accessible);
- g_assert (tmp != NULL);
- if (print_tree)
- fprintf (stderr, "Te");
- else {
- if (strcmp (name, TEST_STRING_A_OBJECT) == 0)
- test_text (tmp);
- }
- AccessibleText_unref (tmp);
- }
-
- if (Accessible_isValue (accessible)) {
- tmp = Accessible_getValue (accessible);
- g_assert (tmp != NULL);
- if (print_tree)
- fprintf (stderr, "Va");
- else
- test_value (tmp);
- AccessibleValue_unref (tmp);
- }
-
- if (print_tree)
- fprintf (stderr, " ] '%s' (%s) - %s: %s\n",
- name, descr, role_name, item_str->str);
-
- SPI_freeString (name);
- SPI_freeString (descr);
- SPI_freeString (role_name);
- g_string_free (item_str, TRUE);
-
- validate_tree (accessible, has_parent, recurse_down);
-}
-
-static void
-test_misc (void)
-{
- fprintf (stderr, "Testing misc bits ...\n");
-
- g_assert (!Accessible_isComponent (NULL));
- g_assert (Accessible_getComponent (NULL) == NULL);
- SPI_freeString (NULL);
-}
-
-static void
-global_listener_cb (const AccessibleEvent *event,
- void *user_data)
-{
- TestWindow *win = user_data;
- Accessible *desktop;
- AccessibleApplication *application;
-
- g_assert (win->magic == WINDOW_MAGIC);
- g_assert (!strcmp (event->type, "focus:"));
-
- fprintf (stderr, "Fielded focus event ...\n");
-
- if (!do_poke) {
- desktop = SPI_getDesktop (0);
- application = Accessible_getChildAtIndex (desktop, 0);
- g_assert (application != NULL);
- Accessible_unref (desktop);
-
- test_application (application);
-
- AccessibleApplication_unref (application);
-
- print_tree = FALSE;
-
- validate_accessible (event->source, TRUE, TRUE);
-
- fprintf (stderr, "quitting mainloop.\n");
- gtk_main_quit ();
- }
-
- print_tree = TRUE;
- validate_accessible (event->source, TRUE, TRUE);
-}
-
-static SPIBoolean
-key_listener_cb (const AccessibleKeystroke *stroke,
- void *user_data)
-{
- AccessibleKeystroke *s = user_data;
-
- *s = *stroke;
- if (stroke->keystring) s->keystring = g_strdup (stroke->keystring);
-
- if (s->type == SPI_KEY_PRESSED)
- key_press_received = TRUE;
- else if (s->type == SPI_KEY_RELEASED)
- key_release_received = TRUE;
-
- return TRUE;
-}
-
-
-static void
-test_keylisteners (void)
-{
- int i;
- AccessibleKeystroke stroke;
- AccessibleKeystrokeListener *key_listener;
- AccessibleKeySet *test_keyset;
-
- fprintf (stderr, "Testing keyboard listeners ...\n");
-
- key_listener = SPI_createAccessibleKeystrokeListener (
- key_listener_cb, &stroke);
-
- test_keyset = SPI_createAccessibleKeySet (1, "=", NULL, NULL);
-
- g_assert (SPI_registerAccessibleKeystrokeListener (
- key_listener,
- test_keyset,
- 0,
- SPI_KEY_PRESSED | SPI_KEY_RELEASED,
- SPI_KEYLISTENER_CANCONSUME | SPI_KEYLISTENER_ALL_WINDOWS));
-
- for (i = 0; i < 3; i++) {
- memset (&stroke, 0, sizeof (AccessibleKeystroke));
- g_assert (SPI_generateKeyboardEvent ('=', NULL, SPI_KEY_SYM));
- while (!(key_press_received))
- g_main_context_iteration (NULL, TRUE);
- fprintf (stderr, "p [%s]", stroke.keystring);
- g_assert (!strcmp (stroke.keystring, "="));
- while (!(key_release_received))
- g_main_context_iteration (NULL, TRUE);
- fprintf (stderr, "r [%s]", stroke.keystring);
- key_press_received = FALSE;
- key_release_received = FALSE;
- }
- g_assert (SPI_deregisterAccessibleKeystrokeListener (key_listener, 0));
- SPI_freeAccessibleKeySet (test_keyset);
-
- fprintf (stderr, "\n");
-
- AccessibleKeystrokeListener_unref (key_listener);
-
- g_assert (SPI_generateMouseEvent (100, 100, "rel"));
- g_assert (SPI_generateMouseEvent (-50, -50, "rel"));
- g_assert (SPI_generateMouseEvent (-50, -50, "rel"));
- g_assert (SPI_generateMouseEvent (-1, -1, "b1c"));
-}
-
-int
-main (int argc, char **argv)
-{
- int leaked, i;
- TestWindow *win;
- const char *modules;
- AccessibleEventListener *global_listener;
-
- modules = g_getenv ("GTK_MODULES");
- if (!modules || modules [0] == '\0')
- putenv ("GTK_MODULES=gail:atk-bridge");
- modules = NULL;
-
- for (i = 1; i < argc; i++) {
- if (!g_strcasecmp (argv [i], "--poke"))
- do_poke = TRUE;
- }
-
- gtk_init (&argc, &argv);
-
- g_assert (!SPI_init ());
- g_assert (SPI_init ());
- g_assert (SPI_getDesktopCount () == 1);
-
- test_roles ();
- test_misc ();
- test_desktop ();
- test_keylisteners ();
-
- win = create_test_window ();
-
- global_listener = SPI_createAccessibleEventListener (global_listener_cb, win);
-
- g_assert (SPI_registerGlobalEventListener (global_listener, "focus:"));
-
- fprintf (stderr, "Waiting for focus event ...\n");
- gtk_main ();
-
- g_assert (SPI_deregisterGlobalEventListenerAll (global_listener));
- AccessibleEventListener_unref (global_listener);
-
- test_window_destroy (win);
-
- /* Wait for any pending events from the registry */
- g_usleep (500*1000);
- for (i = 0; i < 100; i++)
- dbus_connection_read_write_dispatch (SPI_bus(), 5);
-
- if ((leaked = SPI_exit ()))
- g_error ("Leaked %d SPI handles", leaked);
-
- g_assert (!SPI_exit ());
-
- fprintf (stderr, "All tests passed\n");
-
- if (g_getenv ("_MEMPROF_SOCKET")) {
- fprintf (stderr, "Waiting for memprof\n");
- gtk_main ();
- }
-
- putenv ("AT_BRIDGE_SHUTDOWN=1");
-
- return 0;
-}
diff --git a/tests/data/Makefile.am b/tests/data/Makefile.am
deleted file mode 100644
index b06736b0..00000000
--- a/tests/data/Makefile.am
+++ /dev/null
@@ -1,3 +0,0 @@
-EXTRA_DIST = \
- accessible-test.xml\
- accessible-test-results.xml
diff --git a/tests/data/accessible-test-results.xml b/tests/data/accessible-test-results.xml
deleted file mode 100644
index a5221873..00000000
--- a/tests/data/accessible-test-results.xml
+++ /dev/null
@@ -1,136 +0,0 @@
-<?xml version="1.0" ?>
-<accessible description="The main accessible object, root of the accessible tree" name="main" role="69">
- <accessible description="" name="gnome-settings-daemon" role="79"/>
- <accessible description="" name="gnome-panel" role="79">
- <accessible description="" name="Bottom Expanded Edge Panel" role="25"/>
- <accessible description="" name="Top Expanded Edge Panel" role="25"/>
- </accessible>
- <accessible description="" name="nautilus" role="79">
- <accessible description="" name="Desktop" role="25"/>
- </accessible>
- <accessible description="" name="metacity" role="79"/>
- <accessible description="" name="tracker-applet" role="79"/>
- <accessible description="" name="empathy" role="79">
- <accessible description="" name="Contact List" role="25"/>
- </accessible>
- <accessible description="" name="nm-applet" role="79"/>
- <accessible description="" name="gnome-power-manager" role="79"/>
- <accessible description="" name="update-notifier" role="79"/>
- <accessible description="Firefox Application Accessible" name="Firefox" role="79">
- <accessible description="Firefox Application Accessible" name="Google Reader - Mozilla Firefox 3 Beta 5" role="25">
- <accessible description="" name="" role="35"/>
- <accessible description="" name="Strip originally conceived in conversation with Jeph Jacques. Soon to be a major motion picture." role="66"/>
- <accessible description="" name="" role="68">
- <accessible description="" name="" role="33">
- <accessible description="" name="" role="10"/>
- <accessible description="" name="" role="10"/>
- </accessible>
- </accessible>
- <accessible description="" name="" role="35">
- <accessible description="" name="" role="69"/>
- </accessible>
- <accessible description="" name="" role="35"/>
- <accessible description="" name="" role="35"/>
- <accessible description="" name="" role="35"/>
- <accessible description="" name="" role="35"/>
- <accessible description="" name="" role="35"/>
- <accessible description="" name="" role="66"/>
- <accessible description="" name="" role="66"/>
- <accessible description="" name="" role="65">
- <accessible description="" name="Application" role="36"/>
- <accessible description="" name="" role="53"/>
- <accessible description="" name="Activity Indicator" role="45"/>
- </accessible>
- <accessible description="" name="" role="65">
- <accessible description="Go back one page" name="Back" role="45"/>
- <accessible description="Go forwards one page" name="Forward" role="45"/>
- <accessible description="" name="" role="45"/>
- <accessible description="Reload current page" name="Reload" role="45"/>
- <accessible description="Stop loading this page" name="Stop" role="45"/>
- <accessible description="chrome://ubufox/content/startpage.html" name="Home" role="45"/>
- <accessible description="" name="Location" role="80"/>
- <accessible description="" name="Search using Google" role="80"/>
- </accessible>
- <accessible description="" name="" role="65">
- <accessible description="" name="Smart Bookmarks" role="45"/>
- <accessible description="" name="Getting Started" role="45"/>
- <accessible description="" name="Latest Headlines" role="45"/>
- </accessible>
- <accessible description="" name="" role="41">
- <accessible description="" name="Google Reader" role="66"/>
- <accessible description="" name="" role="35"/>
- <accessible description="" name="" role="40"/>
- <accessible description="" name="" role="51"/>
- <accessible description="" name="" role="51">
- <accessible description="" name="Google Reader" role="30">
- <accessible description="" name="Google Reader" role="86">
- <accessible description="" name="Click here for ARIA enhanced Google Reader." role="72"/>
- <accessible description="" name="" role="89"/>
- <accessible description="" name="" role="89"/>
- <accessible description="" name="" role="89"/>
- <accessible description="" name="Google Reader" role="72"/>
- <accessible description="" name="" role="63"/>
- <accessible description="" name="" role="89"/>
- <accessible description="" name="" role="89">
- <accessible description="" name="" role="89"/>
- <accessible description="" name="" role="89"/>
- <accessible description="" name="" role="89">
- <accessible description="" name="" role="57"/>
- <accessible description="" name="" role="89">
- <accessible description="" name="" role="89">
- <accessible description="" name="" role="89">
- <accessible description="" name="" role="57"/>
- <accessible description="" name="" role="57">
- <accessible description="" name="" role="58">
- <accessible description="" name="" role="89">
- <accessible description="" name="" role="89"/>
- <accessible description="" name="" role="63"/>
- <accessible description="" name="Google News" role="72"/>
- <accessible description="" name="" role="89">
- <accessible description="" name="" role="89"/>
- <accessible description="" name="" role="89">
- <accessible description="" name="Reader and ARIA: A new way to read" role="72"/>
- </accessible>
- <accessible description="" name="" role="89">
- <accessible description="" name="Official Google Reader Blog" role="72"/>
- </accessible>
- <accessible description="" name="" role="89"/>
- </accessible>
- </accessible>
- </accessible>
- <accessible description="" name="" role="58"/>
- </accessible>
- </accessible>
- <accessible description="" name="" role="89">
- <accessible description="" name="Google Reader Blog" role="72"/>
- <accessible description="" name="Discuss" role="72"/>
- <accessible description="" name="Privacy Policy" role="72"/>
- <accessible description="" name="Help" role="72"/>
- <accessible description="" name="" role="89"/>
- </accessible>
- </accessible>
- </accessible>
- </accessible>
- </accessible>
- <accessible description="" name="" role="89">
- <accessible description="" name="" role="29"/>
- <accessible description="" name="" role="29"/>
- <accessible description="" name="" role="29"/>
- <accessible description="" name="" role="29"/>
- <accessible description="" name="" role="29"/>
- </accessible>
- </accessible>
- </accessible>
- </accessible>
- </accessible>
- <accessible description="" name="" role="35"/>
- <accessible description="" name="" role="56">
- <accessible description="" name="Done" role="45"/>
- <accessible description="" name="" role="45"/>
- </accessible>
- </accessible>
- </accessible>
- <accessible description="" name="gnome-terminal" role="79">
- <accessible description="" name="mdoff@silver-wind: ~/Projects/accessibility/dbus-atspi/test" role="25"/>
- </accessible>
-</accessible>
diff --git a/tests/data/accessible-test.xml b/tests/data/accessible-test.xml
deleted file mode 100644
index c8818736..00000000
--- a/tests/data/accessible-test.xml
+++ /dev/null
@@ -1,136 +0,0 @@
-<?xml version="1.0" ?>
-<accessible description="The main accessible object, root of the accessible tree" name="main" role="68">
- <accessible description="" name="gnome-settings-daemon" role="77"/>
- <accessible description="" name="gnome-panel" role="77">
- <accessible description="" name="Bottom Expanded Edge Panel" role="24"/>
- <accessible description="" name="Top Expanded Edge Panel" role="24"/>
- </accessible>
- <accessible description="" name="nautilus" role="77">
- <accessible description="" name="Desktop" role="24"/>
- </accessible>
- <accessible description="" name="metacity" role="77"/>
- <accessible description="" name="tracker-applet" role="77"/>
- <accessible description="" name="empathy" role="77">
- <accessible description="" name="Contact List" role="24"/>
- </accessible>
- <accessible description="" name="nm-applet" role="77"/>
- <accessible description="" name="gnome-power-manager" role="77"/>
- <accessible description="" name="update-notifier" role="77"/>
- <accessible description="Firefox Application Accessible" name="Firefox" role="77">
- <accessible description="Firefox Application Accessible" name="Google Reader - Mozilla Firefox 3 Beta 5" role="24">
- <accessible description="" name="" role="34"/>
- <accessible description="" name="Strip originally conceived in conversation with Jeph Jacques. Soon to be a major motion picture." role="65"/>
- <accessible description="" name="" role="67">
- <accessible description="" name="" role="32">
- <accessible description="" name="" role="10"/>
- <accessible description="" name="" role="10"/>
- </accessible>
- </accessible>
- <accessible description="" name="" role="34">
- <accessible description="" name="" role="68"/>
- </accessible>
- <accessible description="" name="" role="34"/>
- <accessible description="" name="" role="34"/>
- <accessible description="" name="" role="34"/>
- <accessible description="" name="" role="34"/>
- <accessible description="" name="" role="34"/>
- <accessible description="" name="" role="65"/>
- <accessible description="" name="" role="65"/>
- <accessible description="" name="" role="64">
- <accessible description="" name="Application" role="35"/>
- <accessible description="" name="" role="51"/>
- <accessible description="" name="Activity Indicator" role="44"/>
- </accessible>
- <accessible description="" name="" role="64">
- <accessible description="Go back one page" name="Back" role="44"/>
- <accessible description="Go forwards one page" name="Forward" role="44"/>
- <accessible description="" name="" role="44"/>
- <accessible description="Reload current page" name="Reload" role="44"/>
- <accessible description="Stop loading this page" name="Stop" role="44"/>
- <accessible description="chrome://ubufox/content/startpage.html" name="Home" role="44"/>
- <accessible description="" name="Location" role="78"/>
- <accessible description="" name="Search using Google" role="78"/>
- </accessible>
- <accessible description="" name="" role="64">
- <accessible description="" name="Smart Bookmarks" role="44"/>
- <accessible description="" name="Getting Started" role="44"/>
- <accessible description="" name="Latest Headlines" role="44"/>
- </accessible>
- <accessible description="" name="" role="40">
- <accessible description="" name="Google Reader" role="65"/>
- <accessible description="" name="" role="34"/>
- <accessible description="" name="" role="39"/>
- <accessible description="" name="" role="50"/>
- <accessible description="" name="" role="50">
- <accessible description="" name="Google Reader" role="29">
- <accessible description="" name="Google Reader" role="84">
- <accessible description="" name="Click here for ARIA enhanced Google Reader." role="70"/>
- <accessible description="" name="" role="87"/>
- <accessible description="" name="" role="87"/>
- <accessible description="" name="" role="87"/>
- <accessible description="" name="Google Reader" role="70"/>
- <accessible description="" name="" role="62"/>
- <accessible description="" name="" role="87"/>
- <accessible description="" name="" role="87">
- <accessible description="" name="" role="87"/>
- <accessible description="" name="" role="87"/>
- <accessible description="" name="" role="87">
- <accessible description="" name="" role="56"/>
- <accessible description="" name="" role="87">
- <accessible description="" name="" role="87">
- <accessible description="" name="" role="87">
- <accessible description="" name="" role="56"/>
- <accessible description="" name="" role="56">
- <accessible description="" name="" role="57">
- <accessible description="" name="" role="87">
- <accessible description="" name="" role="87"/>
- <accessible description="" name="" role="62"/>
- <accessible description="" name="Google News" role="70"/>
- <accessible description="" name="" role="87">
- <accessible description="" name="" role="87"/>
- <accessible description="" name="" role="87">
- <accessible description="" name="Reader and ARIA: A new way to read" role="70"/>
- </accessible>
- <accessible description="" name="" role="87">
- <accessible description="" name="Official Google Reader Blog" role="70"/>
- </accessible>
- <accessible description="" name="" role="87"/>
- </accessible>
- </accessible>
- </accessible>
- <accessible description="" name="" role="57"/>
- </accessible>
- </accessible>
- <accessible description="" name="" role="87">
- <accessible description="" name="Google Reader Blog" role="70"/>
- <accessible description="" name="Discuss" role="70"/>
- <accessible description="" name="Privacy Policy" role="70"/>
- <accessible description="" name="Help" role="70"/>
- <accessible description="" name="" role="87"/>
- </accessible>
- </accessible>
- </accessible>
- </accessible>
- </accessible>
- <accessible description="" name="" role="87">
- <accessible description="" name="" role="28"/>
- <accessible description="" name="" role="28"/>
- <accessible description="" name="" role="28"/>
- <accessible description="" name="" role="28"/>
- <accessible description="" name="" role="28"/>
- </accessible>
- </accessible>
- </accessible>
- </accessible>
- </accessible>
- <accessible description="" name="" role="34"/>
- <accessible description="" name="" role="55">
- <accessible description="" name="Done" role="44"/>
- <accessible description="" name="" role="44"/>
- </accessible>
- </accessible>
- </accessible>
- <accessible description="" name="gnome-terminal" role="77">
- <accessible description="" name="mdoff@silver-wind: ~/Projects/accessibility/dbus-atspi/test" role="24"/>
- </accessible>
-</accessible>
diff --git a/tests/dummyatk/Makefile.am b/tests/dummyatk/Makefile.am
deleted file mode 100644
index 2e93052e..00000000
--- a/tests/dummyatk/Makefile.am
+++ /dev/null
@@ -1,38 +0,0 @@
-check_LTLIBRARIES = libdummyatk.la
-
-libdummyatk_la_CFLAGS = $(ATK_CFLAGS) \
- -I$(top_srcdir)
-
-libdummyatk_la_LDFLAGS = -no-undefined \
- -module \
- -avoid-version
-
-libdummyatk_la_LIBADD = $(ATK_LIBS)
-
-libdummyatk_la_SOURCES = my-atk-action.c \
- my-atk-action.h \
- my-atk-component.c \
- my-atk-component.h \
- my-atk-hyperlink.c \
- my-atk-hyperlink.h \
- my-atk-hypertext.c \
- my-atk-hypertext.h \
- my-atk-object.c \
- my-atk-object.h \
- my-atk-selection.c \
- my-atk-selection.h \
- my-atk-streamable-content.c \
- my-atk-streamable-content.h \
- my-atk-table.c \
- my-atk-table.h \
- my-atk-text.c \
- my-atk-text.h \
- my-atk-value.c \
- my-atk-value.h \
- my-atk.h \
- resources_storage.c \
- resources_storage.h \
- useful_functions.c \
- useful_functions.h \
- user_marshal.c \
- user_marshal.h
diff --git a/tests/dummyatk/my-atk-action.c b/tests/dummyatk/my-atk-action.c
deleted file mode 100644
index 363356ab..00000000
--- a/tests/dummyatk/my-atk-action.c
+++ /dev/null
@@ -1,222 +0,0 @@
-#include <stdio.h>
-#include <string.h>
-#include <atk/atk.h>
-
-#include "my-atk-object.h"
-#include "my-atk-action.h"
-
-static GObjectClass *parent_class = NULL;
-//implementaion of the interface
-static gboolean my_atk_action_do_action(AtkAction *action, gint i)
-{
- MyAtkAction *self = (MyAtkAction*)action;
- gboolean result = (i>=0) && (i < self->n);
- self->last_performed_action = result? i : -1;
- return result;
-}
-static gint my_atk_action_get_n_actions(AtkAction *action)
-{
- MyAtkAction *self = (MyAtkAction*)action;
- return self->n;
-}
-static const gchar* my_atk_action_get_description(AtkAction *action, gint i)
-{
- MyAtkAction *self = (MyAtkAction*)action;
- if((i>=0) && (i<self->n))
- {
- return self->actions[i].description;
- }
- else
- {
- printf("get_description: Wrong index.\n");
- return NULL;
- }
-}
-static const gchar* my_atk_action_get_name(AtkAction *action, gint i)
-{
- MyAtkAction *self = (MyAtkAction*)action;
- if((i >= 0) && (i < self->n))
- {
- return self->actions[i].name;
- }
- else
- {
- printf("get_name: Wrong index.\n");
- return NULL;
- }
-}
-static const gchar* my_atk_action_get_localized_name(AtkAction *action, gint i)
-{
- return my_atk_action_get_name(action,i);
-}
-
-static const gchar* my_atk_action_get_keybinding(AtkAction *action, gint i)
-{
- MyAtkAction *self = (MyAtkAction*)action;
- if((i >= 0) && (i < self->n))
- {
- gchar* keyb = self->actions[i].keybinding;
- if(keyb == NULL || keybinding_note_define == NULL)
- {
- //anywhere(if action has keybinding or not) NULL will return
- return NULL;
- }
- else
- {
- //verify, if string mean "no keybinding"
- return strcmp(keyb, keybinding_note_define) != 0 ? keyb : NULL;
- }
- }
- else
- {
- printf("get_keybinding: Wrong index.\n");
- return NULL;
- }
-}
-static gboolean my_atk_action_set_description(AtkAction *action, gint i, const gchar *desc)
-{
- MyAtkAction *self = (MyAtkAction*)action;
-
- if(!((i >= 0) && (i < self->n)) )
- {
- //index out of range, but this is not application error according documentation
- return FALSE;
- }
- //index in correct range
- if(self->actions[i].description == desc)
- {
- //self assignment - return immediately
- return TRUE;
- }
- if(self->actions[i].description != NULL)
- {
- //free old value of description if it is not NULL
- free(self->actions[i].description);
- }
- if(desc != NULL)
- {
- //dump new value of description if it is not NULL
- self->actions[i].description = (gchar*)strdup((const char*)desc);
- }
- return TRUE;
-}
-//////////
-static void my_atk_action_instance_init(GTypeInstance *instance, gpointer g_class)
-{
- int i;
- MyAtkAction *self = (MyAtkAction*)instance;
- self->n = DEFAULT_NUMBER_ACTIONS;
- self->actions = g_new(struct OneAction, self->n);
- if(self->actions == NULL)
- {
- self->n = 0;
- return;
- }
- //init fields of action 0 with values which differ from others actions
- self->actions[0].name = (gchar*)strdup(FIRST_ACTION_NAME);
- self->actions[0].description = (gchar*)strdup(FIRST_ACTION_DESCRIPTION);
- self->actions[0].keybinding = (gchar*)strdup(FIRST_ACTION_KEYBINDING);
-
- for(i = 1; i < self->n; i++)
- {
- self->actions[i].name = (gchar*)strdup(DEFAULT_ACTION_NAME);
- self->actions[i].description = (gchar*)strdup(DEFAULT_ACTION_DESCRIPTION);
- self->actions[i].keybinding = g_strdup_printf("%d", i);
- }
- self->disposed = FALSE;
- self->last_performed_action = -1;
-}
-
-static void
-my_atk_action_interface_init(gpointer g_iface, gpointer iface_data)
-{
- AtkActionIface *klass = (AtkActionIface *)g_iface;
-
- klass->do_action = my_atk_action_do_action;
- klass->get_n_actions = my_atk_action_get_n_actions;
- klass->get_description = my_atk_action_get_description;
- klass->get_name = my_atk_action_get_name;
- klass->get_localized_name = my_atk_action_get_localized_name;
- klass->get_keybinding = my_atk_action_get_keybinding;
- klass->set_description = my_atk_action_set_description;
-}
-
-static void
-my_atk_action_dispose(GObject *obj)
-{
- MyAtkAction *self = (MyAtkAction*)obj;
-
- if(self->disposed)
- {
- return;
- }
- self->disposed = TRUE;
-
- G_OBJECT_CLASS(parent_class)->dispose(obj);
-}
-
-static void
-my_atk_action_finalize(GObject *obj)
-{
- MyAtkAction *self = (MyAtkAction*)obj;
- int i;
-
- for(i = 0; i < self->n; i++)
- {
- struct OneAction oneAction = self->actions[i];
- if(oneAction.name != NULL)
- free(oneAction.name);
- if(oneAction.description != NULL)
- free(oneAction.description);
- if(oneAction.keybinding != NULL)
- free(oneAction.keybinding);
- }
- if(self->actions != NULL)
- g_free(self->actions);
-
- G_OBJECT_CLASS(parent_class)->finalize(obj);
-}
-static void
-my_atk_action_class_init (gpointer g_class, gpointer g_class_data)
-{
- GObjectClass *gobject_class = G_OBJECT_CLASS(g_class);
- MyAtkActionClass *klass = MY_ATK_ACTION_CLASS (g_class);
-
- gobject_class->dispose = my_atk_action_dispose;
- gobject_class->finalize = my_atk_action_finalize;
-
- parent_class = g_type_class_peek_parent(klass);
-}
-GType my_atk_action_get_type(void)
-{
- static GType type = 0;
- if(type == 0)
- {
- static const GTypeInfo info =
- {
- sizeof (MyAtkActionClass),
- NULL, /* base_init */
- NULL, /* base_finalize */
- my_atk_action_class_init, /* class_init */
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof (MyAtkAction),
- 0, /* n_preallocs */
- my_atk_action_instance_init /* instance_init */
- };
-
- static const GInterfaceInfo iface_info =
- {
- (GInterfaceInitFunc) my_atk_action_interface_init, /* interface_init */
- NULL, /* interface_finalize */
- NULL /* interface_data */
- };
- type = g_type_register_static (MY_TYPE_ATK_OBJECT,
- "MyAtkAction",
- &info, 0);
- g_type_add_interface_static (type,
- ATK_TYPE_ACTION,
- &iface_info);
- }
- return type;
-}
diff --git a/tests/dummyatk/my-atk-action.h b/tests/dummyatk/my-atk-action.h
deleted file mode 100644
index f33e75d6..00000000
--- a/tests/dummyatk/my-atk-action.h
+++ /dev/null
@@ -1,58 +0,0 @@
-#ifndef MY_ATK_ACTION_H
-#define MY_ATK_ACTION_H
-//Object, which implement interface AtkAction(all functions)
-#include <glib.h>
-#include <glib-object.h>
-#include <atk/atk.h>
-
-#include "my-atk-object.h"
-
-//declarations
-#define MY_TYPE_ATK_ACTION (my_atk_action_get_type ())
-#define MY_ATK_ACTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MY_TYPE_ATK_ACTION, MyAtkAction))
-#define MY_ATK_ACTION_CLASS(vtable) (G_TYPE_CHECK_CLASS_CAST ((vtable), MY_TYPE_ATK_ACTION, MyAtkActionClass))
-#define MY_IS_ATK_ACTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MY_TYPE_ATK_ACTION))
-#define MY_IS_ATK_ACTION_CLASS(vtable) (G_TYPE_CHECK_CLASS_TYPE ((vtable), MY_TYPE_ATK_ACTION))
-#define MY_ATK_ACTION_GET_CLASS(inst) (G_TYPE_INSTANCE_GET_CLASS ((inst), MY_TYPE_ATK_ACTION, MyAtkActionClass))
-
-static const gchar* keybinding_note_define = "none";
-
-#define FIRST_ACTION_NAME "First action"
-#define FIRST_ACTION_DESCRIPTION "First action performed"
-#define FIRST_ACTION_KEYBINDING "0"
-
-#define DEFAULT_NUMBER_ACTIONS 10
-#define DEFAULT_ACTION_NAME "Action"
-#define DEFAULT_ACTION_DESCRIPTION "Description of action"
-#define DEFAULT_ACTION_KEYBINDING keybinding_note_define
-
-
-//for external using
-#define LAST_PERFORMED_ACTION(myAtkAction) (MY_ATK_ACTION(myAtkAction)->last_performed_action)
-#define CLEAR_LAST_PERFOMED_ACTION(myAtkAction) (MY_ATK_ACTION(myAtkAction)->last_performed_action = -1
-
-typedef struct _MyAtkAction MyAtkAction;
-typedef struct _MyAtkActionClass MyAtkActionClass;
-
-struct _MyAtkAction
-{
- MyAtkObject parent;
-
- gboolean disposed;
- struct OneAction
- {
- gchar *name;
- gchar *description;
- gchar *keybinding;
- }*actions;
- gint n;
- gint last_performed_action;//this field is changed when perfoms action
-};
-
-struct _MyAtkActionClass
-{
- MyAtkObjectClass parent;
-};
-GType my_atk_action_get_type(void);
-
-#endif /*MY_ATK_ACTION_H*/
diff --git a/tests/dummyatk/my-atk-component.c b/tests/dummyatk/my-atk-component.c
deleted file mode 100644
index e304c7d9..00000000
--- a/tests/dummyatk/my-atk-component.c
+++ /dev/null
@@ -1,403 +0,0 @@
-#include <stdio.h>
-#include <atk/atk.h>
-#include <limits.h>
-
-#include "my-atk-object.h"
-#include "my-atk-component.h"
-
-//*************************implementation***********************
-static MyAtkObjectClass *component_parent_class = NULL;
-//current focus object
-static AtkComponent* focus_object = NULL;
-
-static guint focus_signal_id = 0;
-/*
- * Because of implementation of AtkUtils, we need to ensure that list of focus_trackers
- * is not empty. Otherwise function atk_focus_tracker_notify will not change focus.
- */
-static guint focus_tracker_id = 0;
-static void my_event_listener(AtkObject* obj)
-{
- //simply exist for register as focus_tracker
-}
-/*
- * If this flag is TRUE, then focus cannot be changed until someone clears the flag
- * via my_atk_component_set_modal(FALSE).
- */
-static gboolean is_modal = FALSE;
-//for debug
-void print_extent(AtkRectangle *extent)
-{
- printf("{%d,%d,%d,%d}", extent->x, extent->y, extent->width, extent->height);
-}
-//for internal use
-static void emit_bounds_changed(MyAtkComponent *component)
-{
- static guint bounds_changed_id = 0;
- if(bounds_changed_id == 0)
- {
- bounds_changed_id = g_signal_lookup("bounds-changed", ATK_TYPE_COMPONENT);
- }
- AtkRectangle *param = g_boxed_copy(ATK_TYPE_RECTANGLE, &(component->extent));
- g_signal_emit(component, bounds_changed_id, 0, param);
-}
-static void change_focus(AtkComponent* component, gboolean is_gain)
-{
- const gchar* state_name = atk_state_type_get_name(ATK_STATE_FOCUSED);
-
- g_signal_emit_by_name(component, "focus-event", is_gain);
- g_signal_emit_by_name(component, "state-change::focused",
- state_name, is_gain);
-
- AtkObject* parent = atk_object_get_parent((AtkObject*)component);
- if(parent != NULL)
- {
- AtkStateSet* stateSet = atk_object_ref_state_set(parent);
- if(atk_state_set_contains_state(stateSet, ATK_STATE_MANAGES_DESCENDANTS))
- g_signal_emit_by_name(parent, "active-descendant-changed",
- atk_get_focus_object());
- g_object_unref(stateSet);
- }
-}
-//implementation of virtual functions
-//******************ref_state_set(AtkObject)*****************************
-static AtkStateSet* my_atk_component_ref_state_set(AtkObject *object)
-{
- MyAtkComponent *self = (MyAtkComponent*)object;
-
- AtkStateSet* result = ((AtkObjectClass*)component_parent_class)->
- ref_state_set(object);
- if(self->is_manage_descendants)
- atk_state_set_add_state(result, ATK_STATE_MANAGES_DESCENDANTS);
- return result;
-}
-//******************get_size*******************
-static void my_atk_component_get_size(AtkComponent *component, gint *width, gint *height)
-{
- g_return_if_fail(MY_IS_ATK_COMPONENT(component));
-
- MyAtkComponent *self = MY_ATK_COMPONENT(component);
- *width = self->extent.width;
- *height = self->extent.height;
-}
-//*********************get_position*******************
-static void my_atk_component_get_position(AtkComponent *component, gint *x, gint *y, AtkCoordType coord_type)
-{
- g_return_if_fail(MY_IS_ATK_COMPONENT(component));
-
- MyAtkComponent *self = MY_ATK_COMPONENT(component);
- *x = self->extent.x;
- *y = self->extent.y;
-
-//**********************get_extents*******************
-}
-static void my_atk_component_get_extents(AtkComponent *component, gint *x, gint *y,
- gint *width, gint *height, AtkCoordType coord_type)
-{
- g_return_if_fail(MY_IS_ATK_COMPONENT(component));
-
- MyAtkComponent *self = MY_ATK_COMPONENT(component);
- *x = self->extent.x;
- *y = self->extent.y;
- *width = self->extent.width;
- *height = self->extent.height;
-}
-
-//**************************set_size*******************
-static gboolean my_atk_component_set_size(AtkComponent *component, gint width, gint height)
-{
- g_return_val_if_fail(MY_IS_ATK_COMPONENT(component), FALSE);
-
- MyAtkComponent *self = MY_ATK_COMPONENT(component);
- if(self->is_extent_may_changed)
- {
- self->extent.width = width;
- self->extent.height = height;
-
- emit_bounds_changed(self);
-
- return TRUE;
- }
- return FALSE;
-}
-//**************************set_position********************
-static gboolean my_atk_component_set_position(AtkComponent *component,
- gint x, gint y, AtkCoordType coord_type)
-{
- g_return_val_if_fail(MY_IS_ATK_COMPONENT(component), FALSE);
-
- MyAtkComponent *self = MY_ATK_COMPONENT(component);
- if(self->is_extent_may_changed)
- {
- self->extent.x = x;
- self->extent.y = y;
-
- emit_bounds_changed(self);
-
- return TRUE;
- }
- return FALSE;
-}
-//*************************************set_extents***************
-static gboolean my_atk_component_set_extents(AtkComponent *component,
- gint x, gint y, gint width, gint height, AtkCoordType coord_type)
-{
- g_return_val_if_fail(MY_IS_ATK_COMPONENT(component), FALSE);
-
- MyAtkComponent *self = MY_ATK_COMPONENT(component);
-
- if(self->is_extent_may_changed)
- {
- self->extent.x = x;
- self->extent.y = y;
- self->extent.width = width;
- self->extent.height = height;
-
- emit_bounds_changed(self);
-
- return TRUE;
- }
- return FALSE;
-}
-//**************************get_layer****************
-static AtkLayer my_atk_component_get_layer(AtkComponent *component)
-{
- g_return_val_if_fail(MY_IS_ATK_COMPONENT(component), ATK_LAYER_INVALID);
-
- MyAtkComponent *self = MY_ATK_COMPONENT(component);
- return self->layer;
-}
-//**************************get_mdi_zorder****************
-static gint my_atk_component_get_mdi_zorder(AtkComponent *component)
-{
- g_return_val_if_fail(MY_IS_ATK_COMPONENT(component), G_MININT);
-
- MyAtkComponent *self = MY_ATK_COMPONENT(component);
- return self->zorder;
-}
-//***********************contains**********************
-static gboolean my_atk_component_contains(AtkComponent *component,
- gint x, gint y, AtkCoordType coord_type)
-{
- g_return_val_if_fail(MY_IS_ATK_COMPONENT(component), FALSE);
- //for extract extent
- gint x_tmp, y_tmp, width_tmp, height_tmp;
- my_atk_component_get_extents(component, &x_tmp, &y_tmp, &width_tmp, &height_tmp, coord_type);
-
- if( (x >= x_tmp) &&(y >= y_tmp) &&(x < x_tmp + width_tmp) && (y < y_tmp + height_tmp) )
- {
- return TRUE;
- }
- else
- {
- return FALSE;
- }
-}
-//**********************ref_accessible_at_point***********************
-/*
- * Retuns accessible child that implements AtkCOmponent and contains the given point.
- */
-static AtkObject* my_atk_component_ref_accessible_at_point(AtkComponent* component,
- gint x, gint y, AtkCoordType coord_type)
-{
- g_return_val_if_fail(MY_IS_ATK_COMPONENT(component), NULL);
- gint i;
-
- gint n_children = atk_object_get_n_accessible_children((AtkObject*)component);
- for(i = 0; i < n_children; i++)
- {
- AtkObject *child = atk_object_ref_accessible_child((AtkObject*)component, i);
- if(ATK_IS_COMPONENT(child)
- && atk_component_contains((AtkComponent*)child, x, y, coord_type))
- {
- return child;
- }
- g_object_unref(child);
- }
- return NULL;
-}
-//*************************************grab_focus*********************************
-static gboolean my_atk_component_grab_focus(AtkComponent* component)
-{
- if(component == focus_object)
- {
- //Already has focus
- return TRUE;
- }
- if(is_modal)
- {
- //cannot grab focus
- return FALSE;
- }
- AtkComponent *focus_object_old = focus_object;
- focus_object = component;
-
- atk_focus_tracker_notify((AtkObject*)component);
-
- if(focus_object_old != NULL)
- {
- //signals for object which lost focus
- change_focus(focus_object_old, FALSE);
- }
- if(component != NULL)
- {
- //signals for object which grab focus
- change_focus(component, TRUE);
- }
- return TRUE;
-}
-//***********************my_atk_component_add_focus_handler*********************
-static guint my_atk_component_add_focus_handler(AtkComponent *component, AtkFocusHandler handler)
-{
- g_return_val_if_fail(MY_IS_ATK_COMPONENT(component),0);
- //verify whether handler already connect to object
- gulong found_handler_id = g_signal_handler_find(component,
- G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC,
- focus_signal_id,
- 0,
- NULL,
- (gpointer)handler,
- NULL);
- if(found_handler_id == 0)
- {
- //handler hasn't been connected yet
- return g_signal_connect_closure_by_id(component,
- focus_signal_id,
- 0,
- g_cclosure_new( (GCallback)handler,
- NULL,
- NULL),
- FALSE);
- }
- else/* found_handler_id != 0*/
- {
- //handler has already been connected
- return 0;
- }
-
-}
-//***********************my_atk_component_remove_focus_handler*********************
-static void my_atk_component_remove_focus_handler(AtkComponent *component, guint handler_id)
-{
- g_signal_handler_disconnect(component, handler_id);
-}
-//***********************my_atk_component_set_modal(my function)***************
-void my_atk_component_set_modal(gboolean value)
-{
- is_modal = value;
-}
-//******************my_atk_component_set_manage_descendants(my_function)*******
-void my_atk_component_set_manage_descendants(MyAtkComponent* component, gboolean value)
-{
- if(component->is_manage_descendants == value)return;
- component->is_manage_descendants = value;
- g_signal_emit_by_name(component, "state-change::manages-descendants",
- "manages-descendants", value);
-}
-//Others funtions
-static void my_atk_component_instance_init(GTypeInstance *obj, gpointer g_class)
-{
- MyAtkComponent *self = (MyAtkComponent*)obj;
- //set defaults values
- self->extent.x = 0;
- self->extent.y = 0;
- self->extent.width = 10;
- self->extent.height = 10;
- self->is_extent_may_changed = TRUE;
- self->layer = ATK_LAYER_INVALID;
- self->zorder = -2147;
-}
-static void my_atk_component_instance_finalize(GObject* obj)
-{
- MyAtkComponent* component = (MyAtkComponent*)obj;
-
- if(((AtkObject*)component) == atk_get_focus_object())
- {
- atk_focus_tracker_notify(NULL);
- }
-}
-
-static void my_atk_component_class_init(gpointer g_class, gpointer class_data)
-{
- GObjectClass* g_object_class = (GObjectClass*)g_class;
- AtkObjectClass* atkObject_class = (AtkObjectClass*)g_class;
- //GObject virtual table
- g_object_class->finalize = my_atk_component_instance_finalize;
- //AtkObject virtual table
- atkObject_class->ref_state_set = my_atk_component_ref_state_set;
- //parent_class
- component_parent_class = g_type_class_peek_parent(g_class);
- //make focus_tracker's table not empty.
- focus_tracker_id = atk_add_focus_tracker(my_event_listener);
- //store "focus-event"-signal id
- focus_signal_id = g_signal_lookup("focus-event",MY_TYPE_ATK_COMPONENT);
-}
-/*
- * Though, according to the documentation, this function will never called for
- * static-registred types.
- * Base_init function doesn't suite for this work,
- * because it will called in every derived classes.
- */
-/*static void my_atk_component_class_finalize(gpointer g_class, gpointer class_data)
-{
-
- if(focus_tracker_id != 0)
- {
- atk_remove_focus_tracker(focus_tracker_id);
- focus_tracker_id = 0;
- }
-}*/
-static void my_atk_component_interface_init(gpointer g_iface, gpointer iface_data)
-{
- AtkComponentIface *klass = (AtkComponentIface*)g_iface;
-
- klass->get_extents = my_atk_component_get_extents;
- klass->get_position = my_atk_component_get_position;
- klass->get_size = my_atk_component_get_size;
-
- klass->set_extents = my_atk_component_set_extents;
- klass->set_position = my_atk_component_set_position;
- klass->set_size = my_atk_component_set_size;
-
- klass->contains = my_atk_component_contains;
- klass->ref_accessible_at_point = my_atk_component_ref_accessible_at_point;
-
- klass->get_layer = my_atk_component_get_layer;
- klass->get_mdi_zorder = my_atk_component_get_mdi_zorder;
-
- klass->grab_focus = my_atk_component_grab_focus;
- klass->add_focus_handler = my_atk_component_add_focus_handler;
- klass->remove_focus_handler = my_atk_component_remove_focus_handler;
-}
-
-GType my_atk_component_get_type()
-{
- static GType type = 0;
- if(type == 0)
- {
- static const GTypeInfo typeInfo =
- {
- sizeof(MyAtkComponentClass),
- NULL, //base_init
- NULL, //base_finalize
- my_atk_component_class_init, //class_init
- NULL, //class_finalize
- NULL, //class_data
- sizeof(MyAtkComponent),
- 0, //n_preallocs
- my_atk_component_instance_init //instance_init
- };
-
- static const GInterfaceInfo iface_info =
- {
- my_atk_component_interface_init, /* interface_init*/
- NULL, /* interface_finalize*/
- NULL /* interface_data */
- };
- type = g_type_register_static(MY_TYPE_ATK_OBJECT, "MyAtkComponent", &typeInfo, 0);
- g_type_add_interface_static(type,
- ATK_TYPE_COMPONENT,
- &iface_info);
- }
- return type;
-}
diff --git a/tests/dummyatk/my-atk-component.h b/tests/dummyatk/my-atk-component.h
deleted file mode 100644
index 3fa5850d..00000000
--- a/tests/dummyatk/my-atk-component.h
+++ /dev/null
@@ -1,41 +0,0 @@
-#ifndef MY_ATK_COMPONENT_H
-#define MY_ATK_COMPONENT_H
-/*
- * MyAtkComponent: derives AtkObject(with parent-child accessibilities)
- * and implements AtkComponent.
- */
-#include <atk/atk.h>
-
-#include "my-atk-object.h"
-
-#define MY_TYPE_ATK_COMPONENT (my_atk_component_get_type ())
-#define MY_ATK_COMPONENT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MY_TYPE_ATK_COMPONENT, MyAtkComponent))
-#define MY_ATK_COMPONENT_CLASS(vtable) (G_TYPE_CHECK_CLASS_CAST ((vtable), MY_TYPE_ATK_COMPONENT, MyAtkComponentClass))
-#define MY_IS_ATK_COMPONENT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MY_TYPE_ATK_COMPONENT))
-#define MY_IS_ATK_COMPONENT_CLASS(vtable) (G_TYPE_CHECK_CLASS_TYPE ((vtable), MY_TYPE_ATK_COMPONENT))
-#define MY_ATK_COMPONENT_GET_CLASS(inst) (G_TYPE_INSTANCE_GET_CLASS ((inst), MY_TYPE_ATK_COMPONENT, MyAtkComponentClass))
-
-typedef struct _MyAtkComponent MyAtkComponent;
-typedef struct _MyAtkComponentClass MyAtkComponentClass;
-
-struct _MyAtkComponent
-{
- MyAtkObject parent;
- //relative coordinates, which coincides with absolute ones
- AtkRectangle extent;
- //whether component may be relocated
- gboolean is_extent_may_changed;
- //for emit "active-descendant-changed" signal
- gboolean is_manage_descendants;
- //
- AtkLayer layer;
- gint zorder;
-};
-
-struct _MyAtkComponentClass
-{
- MyAtkObjectClass parent;
-};
-
-GType my_atk_component_get_type();
-#endif /*MY_ATK_COMPONENT_H*/
diff --git a/tests/dummyatk/my-atk-hyperlink.c b/tests/dummyatk/my-atk-hyperlink.c
deleted file mode 100644
index cb6b435b..00000000
--- a/tests/dummyatk/my-atk-hyperlink.c
+++ /dev/null
@@ -1,137 +0,0 @@
-#include <atk/atk.h>
-
-#include "my-atk-text.h"
-#include "my-atk-hyperlink.h"
-#include "resources_storage.h"
-
-//***************************implementation****************************************
-static MyAtkTextClass *parent_class_atk_hyperlink = NULL;
-
-// Implementation of virtual functions
-//***************************my_atk_hyperlink_get_uri**************
-gchar* my_atk_hyperlink_get_uri(AtkHyperlink* link_, gint index)
-{
- MyAtkHyperlink* self = (MyAtkHyperlink*)link_;
-
- if(index < 0 || index >= self->number_of_anchors) return NULL;
- return g_strdup(self->uri);
-}
-//**************************my_atk_hyperlink_is_valid**************************
-gboolean my_atk_hyperlink_is_valid(AtkHyperlink* link_)
-{
- MyAtkHyperlink* self = (MyAtkHyperlink*)link_;
-
- return (resource_storage_get(self->uri) != NULL);
-}
-//*************************my_atk_hyperlink_get_object************************
-AtkObject* my_atk_hyperlink_get_object(AtkHyperlink* link_, gint index)
-{
- MyAtkHyperlink* self = (MyAtkHyperlink*)link_;
-
- if(index < 0 || index >= self->number_of_anchors) return NULL;
- return resource_storage_get(self->uri);
-}
-//***************************my_atk_hyperlink_get_start_index**************
-gint my_atk_hyperlink_get_start_index(AtkHyperlink* link_)
-{
- MyAtkHyperlink* self = (MyAtkHyperlink*)link_;
-
- return self->start_index;
-}
-//***************************my_atk_hyperlink_get_end_index**************
-gint my_atk_hyperlink_get_end_index(AtkHyperlink* link_)
-{
- MyAtkHyperlink* self = (MyAtkHyperlink*)link_;
-
- return self->end_index;
-}
-//***************************my_atk_hyperlink_link_state*******************
-guint my_atk_hyperlink_link_state(AtkHyperlink* link_)
-{
- return 0;
-}
-//***************************my_atk_hyperlink_get_n_anchors*******************
-gboolean my_atk_hyperlink_get_n_anchors(AtkHyperlink* link_)
-{
- return ((MyAtkHyperlink*)link_)->number_of_anchors;
-}
-//***************************my_atk_hypertlink_is_selected_link***********
-gboolean my_atk_hyperlink_is_selected_link(AtkHyperlink* link_)
-{
- MyAtkHyperlink* self = (MyAtkHyperlink*)link_;
-
- return self->is_selected;
-}
-//others functions
-MyAtkHyperlink* my_atk_hyperlink_new(gint start_index, gint end_index,const gchar* uri)
-{
- MyAtkHyperlink* result = g_object_new(MY_TYPE_ATK_HYPERLINK, NULL);
- if(result == NULL) return NULL;
- result->start_index = start_index;
- result->end_index = end_index;
- result->uri = g_strdup(uri);
- result->number_of_anchors = 1;
- return result;
-}
-void my_atk_hyperlink_activate(MyAtkHyperlink* hyperlink)
-{
- g_signal_emit_by_name(hyperlink, "link-activated");
-}
-//initialize/finalize functions
-static void my_atk_hyperlink_instance_init(GTypeInstance *obj, gpointer g_class)
-{
- MyAtkHyperlink *self = (MyAtkHyperlink*)obj;
-
- self->start_index = self->end_index = 0;
- self->uri = NULL;
- self->is_selected = FALSE;
- self->number_of_anchors = 0;
-}
-static void my_atk_hyperlink_instance_finalize(GObject* obj)
-{
- MyAtkHyperlink *self = (MyAtkHyperlink*)obj;
-
- g_free(self->uri);
-}
-
-static void my_atk_hyperlink_class_init(gpointer g_class, gpointer class_data)
-{
- GObjectClass* g_object_class = (GObjectClass*)g_class;
- //GObject virtual table
- g_object_class->finalize = my_atk_hyperlink_instance_finalize;
- //parent_class
- parent_class_atk_hyperlink = g_type_class_peek_parent(g_class);
- //
- AtkHyperlinkClass* atkHyperlinkClass = (AtkHyperlinkClass*)g_class;
-
- atkHyperlinkClass->get_uri = my_atk_hyperlink_get_uri;
- atkHyperlinkClass->get_object = my_atk_hyperlink_get_object;
- atkHyperlinkClass->get_start_index = my_atk_hyperlink_get_start_index;
- atkHyperlinkClass->get_end_index = my_atk_hyperlink_get_end_index;
- atkHyperlinkClass->is_valid = my_atk_hyperlink_is_valid;
- atkHyperlinkClass->link_state = my_atk_hyperlink_link_state;
- atkHyperlinkClass->get_n_anchors = my_atk_hyperlink_get_n_anchors;
- atkHyperlinkClass->is_selected_link = my_atk_hyperlink_is_selected_link;
-}
-
-GType my_atk_hyperlink_get_type()
-{
- static GType type = 0;
- if(type == 0)
- {
- static const GTypeInfo typeInfo =
- {
- sizeof(MyAtkHyperlinkClass),
- NULL, //base_init
- NULL, //base_finalize
- my_atk_hyperlink_class_init, //class_init
- NULL, //class_finalize
- NULL, //class_data
- sizeof(MyAtkHyperlink),
- 0, //n_preallocs
- my_atk_hyperlink_instance_init //instance_init
- };
- type = g_type_register_static(ATK_TYPE_HYPERLINK, "MyAtkHyperlink", &typeInfo, 0);
- }
- return type;
-}
diff --git a/tests/dummyatk/my-atk-hyperlink.h b/tests/dummyatk/my-atk-hyperlink.h
deleted file mode 100644
index 026ba548..00000000
--- a/tests/dummyatk/my-atk-hyperlink.h
+++ /dev/null
@@ -1,35 +0,0 @@
-#ifndef MY_ATK_HYPERLINK_H
-#define MY_ATK_HYPERLINK_H
-/*
- * MyAtkHyperlink: implements AtkHyperlink
- */
-#include <atk/atk.h>
-
-#define MY_TYPE_ATK_HYPERLINK (my_atk_hyperlink_get_type ())
-#define MY_ATK_HYPERLINK(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MY_TYPE_ATK_HYPERLINK, MyAtkHyperlink))
-#define MY_ATK_HYPERLINK_CLASS(vtable) (G_TYPE_CHECK_CLASS_CAST ((vtable), MY_TYPE_ATK_HYPERLINK, MyAtkHyperlinkClass))
-#define MY_IS_ATK_HYPERLINK(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MY_TYPE_ATK_HYPERLINK))
-#define MY_IS_ATK_HYPERLINK_CLASS(vtable) (G_TYPE_CHECK_CLASS_TYPE ((vtable), MY_TYPE_ATK_HYPERLINK))
-#define MY_ATK_HYPERLINK_GET_CLASS(inst) (G_TYPE_INSTANCE_GET_CLASS ((inst), MY_TYPE_ATK_HYPERLINK, MyAtkHyperlinkClass))
-
-typedef struct _MyAtkHyperlink MyAtkHyperlink;
-typedef struct _MyAtkHyperlinkClass MyAtkHyperlinkClass;
-
-struct _MyAtkHyperlink
-{
- AtkHyperlink parent;
-
- gint start_index, end_index;
-
- gchar* uri;
- gint number_of_anchors;//0 on "clear" hyperlink and 1 after set it
- gboolean is_selected;
-};
-
-struct _MyAtkHyperlinkClass
-{
- AtkHyperlinkClass parent;
-};
-
-GType my_atk_hyperlink_get_type();
-#endif /*MY_ATK_HYPERLINK_H*/
diff --git a/tests/dummyatk/my-atk-hypertext.c b/tests/dummyatk/my-atk-hypertext.c
deleted file mode 100644
index 1bba620c..00000000
--- a/tests/dummyatk/my-atk-hypertext.c
+++ /dev/null
@@ -1,172 +0,0 @@
-#include <atk/atk.h>
-
-#include "my-atk-text.h"
-#include "my-atk-hyperlink.h"
-#include "my-atk-hypertext.h"
-
-//***************************implementation****************************************
-static MyAtkTextClass *parent_class_atk_text = NULL;
-
-typedef struct
-{
- gint start_offset, end_offset;
- gint index;
-}HyperlinkRange;
-// Implementation of virtual functions
-
-//***************************my_atk_hypertext_get_n_links*************************
-gint my_atk_hypertext_get_n_links(AtkHypertext* hypertext)
-{
- MyAtkHypertext* self = (MyAtkHypertext*)hypertext;
-
- return self->hyperlinks->len;
-}
-//***************************my_atk_hypertext_get_link***********************
-AtkHyperlink* my_atk_hypertext_get_link(AtkHypertext* hypertext, gint link_index)
-{
- MyAtkHypertext* self = (MyAtkHypertext*)hypertext;
-
- if(link_index < 0 || link_index >= self->hyperlinks->len)
- return NULL;
- return g_ptr_array_index(self->hyperlinks, link_index);
-}
-//*************************my_atk_hypertext_get_link_index*******************
-gint my_atk_hypertext_get_link_index(AtkHypertext* hypertext, gint char_index)
-{
- gint i;
- MyAtkHypertext* self = (MyAtkHypertext*)hypertext;
- GArray* ranges = self->hyperlink_ranges;
- for(i = ranges->len - 1; i >= 0; i--)
- {
- HyperlinkRange *range = &g_array_index(ranges, HyperlinkRange, i);
- if(range->start_offset <= char_index)
- {
- if(range->end_offset > char_index)return range->index;
- break;
- }
- }
- return -1;
-}
-//others functions
-gboolean my_atk_hypertext_add_hyperlink(MyAtkHypertext* hypertext,
- gint start_index, gint end_index, const gchar* uri)
-{
- MyAtkHyperlink* new_hyperlink;
- GArray* ranges = hypertext->hyperlink_ranges;
- gint i;
- for(i = 0; i < ranges->len; i++)
- {
- HyperlinkRange *range = &g_array_index(ranges, HyperlinkRange, i);
- if(range->end_offset <= start_index) continue;
- if(range->start_offset < end_index) return FALSE;
- break;
- }
- new_hyperlink = my_atk_hyperlink_new(start_index, end_index, uri);
- g_ptr_array_add(hypertext->hyperlinks, new_hyperlink);
- HyperlinkRange new_range;
- new_range.start_offset = start_index;
- new_range.end_offset = end_index;
- new_range.index = hypertext->hyperlinks->len - 1;
- g_array_insert_val(ranges, i, new_range);
- return TRUE;
-}
-//
-void my_atk_hypertext_select_link(MyAtkHypertext* hypertext, gint index)
-{
- if(index < 0 || index >= my_atk_hypertext_get_n_links((AtkHypertext*)hypertext))
- return;
-
- if(hypertext->current_selected_link != -1)
- {
- MyAtkHyperlink *selected_link_old =
- (MyAtkHyperlink*)my_atk_hypertext_get_link(
- (AtkHypertext*)hypertext, hypertext->current_selected_link);
- selected_link_old->is_selected = FALSE;
- }
-
- hypertext->current_selected_link = index;
- MyAtkHyperlink *selected_link_new = (MyAtkHyperlink*)my_atk_hypertext_get_link(
- (AtkHypertext*)hypertext, hypertext->current_selected_link);
- selected_link_new->is_selected = TRUE;
-
- g_signal_emit_by_name(hypertext,
- "link-selected", hypertext->current_selected_link);
-}
-//initialize/finalize functions
-static void my_atk_hypertext_instance_init(GTypeInstance *obj, gpointer g_class)
-{
- MyAtkHypertext *self = (MyAtkHypertext*)obj;
-
- self->hyperlink_ranges = g_array_new(FALSE, FALSE, sizeof(HyperlinkRange));
- self->hyperlinks = g_ptr_array_new();
-
- self->current_selected_link = -1;
-}
-static void my_atk_hypertext_instance_finalize(GObject* obj)
-{
- MyAtkHypertext *self = (MyAtkHypertext*)obj;
-
- g_array_free(self->hyperlink_ranges, FALSE);
-
- g_ptr_array_foreach(self->hyperlinks,(GFunc)g_object_unref, NULL);
- g_ptr_array_free(self->hyperlinks, FALSE);
-}
-
-static void my_atk_hypertext_class_init(gpointer g_class, gpointer class_data)
-{
- GObjectClass* g_object_class = (GObjectClass*)g_class;
- //GObject virtual table
- g_object_class->finalize = my_atk_hypertext_instance_finalize;
- //parent_class
- parent_class_atk_text = g_type_class_peek_parent(g_class);
-}
-static void my_atk_hypertext_interface_init(gpointer g_iface, gpointer iface_data)
-{
- AtkHypertextIface *klass = (AtkHypertextIface*)g_iface;
-
- klass->get_link = my_atk_hypertext_get_link;
- klass->get_n_links = my_atk_hypertext_get_n_links;
- klass->get_link_index = my_atk_hypertext_get_link_index;
-}
-
-GType my_atk_hypertext_get_type()
-{
- static GType type = 0;
- if(type == 0)
- {
- static const GTypeInfo typeInfo =
- {
- sizeof(MyAtkHypertextClass),
- NULL, //base_init
- NULL, //base_finalize
- my_atk_hypertext_class_init, //class_init
- NULL, //class_finalize
- NULL, //class_data
- sizeof(MyAtkHypertext),
- 0, //n_preallocs
- my_atk_hypertext_instance_init //instance_init
- };
-
- static const GInterfaceInfo AtkTextIface_info =
- {
- my_atk_text_interface_init, /* interface_init*/
- NULL, /* interface_finalize*/
- NULL /* interface_data */
- };
- static const GInterfaceInfo AtkHypertextIface_info =
- {
- my_atk_hypertext_interface_init,/* interface_init*/
- NULL, /* interface_finalize*/
- NULL /* interface_data */
- };
- type = g_type_register_static(MY_TYPE_ATK_TEXT, "MyAtkHypertext", &typeInfo, 0);
- g_type_add_interface_static(type,
- ATK_TYPE_TEXT,
- &AtkTextIface_info);
-
- g_type_add_interface_static(type,
- ATK_TYPE_HYPERTEXT,
- &AtkHypertextIface_info);
- }
- return type;
-}
diff --git a/tests/dummyatk/my-atk-hypertext.h b/tests/dummyatk/my-atk-hypertext.h
deleted file mode 100644
index 50d02cf4..00000000
--- a/tests/dummyatk/my-atk-hypertext.h
+++ /dev/null
@@ -1,33 +0,0 @@
-#ifndef MY_ATK_HYPERTEXT_H
-#define MY_ATK_HYPERTEXT_H
-/*
- * MyAtkHypertext: implements AtkHypertext
- */
-#include <atk/atk.h>
-#include <my-atk-text.h>
-
-#define MY_TYPE_ATK_HYPERTEXT (my_atk_hypertext_get_type ())
-#define MY_ATK_HYPERTEXT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MY_TYPE_ATK_HYPERTEXT, MyAtkHypertext))
-#define MY_ATK_HYPERTEXT_CLASS(vtable) (G_TYPE_CHECK_CLASS_CAST ((vtable), MY_TYPE_ATK_HYPERTEXT, MyAtkHypertextClass))
-#define MY_IS_ATK_HYPERTEXT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MY_TYPE_ATK_HYPERTEXT))
-#define MY_IS_ATK_HYPERTEXT_CLASS(vtable) (G_TYPE_CHECK_CLASS_TYPE ((vtable), MY_TYPE_ATK_HYPERTEXT))
-#define MY_ATK_HYPERTEXT_GET_CLASS(inst) (G_TYPE_INSTANCE_GET_CLASS ((inst), MY_TYPE_ATK_HYPERTEXT, MyAtkHypertextClass))
-
-typedef struct _MyAtkHypertext MyAtkHypertext;
-typedef struct _MyAtkHypertextClass MyAtkHypertextClass;
-
-struct _MyAtkHypertext
-{
- MyAtkText parent;
-
- GArray* hyperlink_ranges;
- GPtrArray* hyperlinks;
-
- gint current_selected_link;
-};
-
-struct _MyAtkHypertextClass
-{
- MyAtkTextClass parent;
-};
-#endif /*MY_ATK_HYPERTEXT_H*/
diff --git a/tests/dummyatk/my-atk-object.c b/tests/dummyatk/my-atk-object.c
deleted file mode 100644
index 40294248..00000000
--- a/tests/dummyatk/my-atk-object.c
+++ /dev/null
@@ -1,186 +0,0 @@
-
-#include <stdio.h>
-#include <atk/atk.h>
-
-#include "my-atk-object.h"
-
-static AtkObjectClass *atk_object_parent_class = NULL;
-
-void my_atk_object_add_child(MyAtkObject* parent, MyAtkObject* child)
-{
- g_ptr_array_add(parent->children, child);
- g_object_ref_sink(child);
-
- atk_object_set_parent(ATK_OBJECT(child), ATK_OBJECT(parent));
-
- g_signal_emit_by_name(parent, "children-changed::add",
- parent->children->len - 1, child);
-}
-
-void my_atk_object_remove_child(MyAtkObject* parent, MyAtkObject* child)
-{
- gint i;
- for(i = parent->children->len - 1; i >= 0; i--)
- {
- if(g_ptr_array_index(parent->children, i) == child) break;
- }
- if(i < 0)return;
-
- g_ptr_array_remove_index(parent->children, i);
- g_object_unref(child);
- g_signal_emit_by_name(parent, "children-changed::remove",
- i, child);
-}
-
-static void my_atk_object_set_parent(AtkObject *accessible, AtkObject *parent)
-{
- g_return_if_fail(parent != NULL);
-
- MyAtkObject *self = MY_ATK_OBJECT(accessible);
- AtkObject *parent_old = (atk_object_get_parent(accessible));
-
- if(parent_old == parent)
- {
- //nothing to do because parent does not change
- return;
- }
-
- //set field 'parent' in child using 'base-method'
- atk_object_parent_class->set_parent(accessible, parent);
-
- if(parent_old != NULL)
- {
- my_atk_object_remove_child((MyAtkObject*)parent_old, self);
- }
-}
-
-static gint my_atk_object_get_n_children(AtkObject *accessible)
-{
- return MY_ATK_OBJECT(accessible)->children->len;
-}
-
-static AtkObject* my_atk_object_ref_child(AtkObject *accessible, gint i)
-{
- MyAtkObject *self = MY_ATK_OBJECT(accessible);
- if(i < 0 || i >= self->children->len)
- {
- printf("ref_child: Incorrect index of child.\n");
- return NULL;
- }
-
- AtkObject* child = (AtkObject*)
- g_ptr_array_index(self->children, i);
-
- return (child == NULL) ? NULL : g_object_ref(child);
-}
-
-static gint my_atk_object_get_index_in_parent(AtkObject *accessible)
-{
- AtkObject *parent = atk_object_get_parent(accessible);
- if(parent == NULL) return -1;//no parent
-
- MyAtkObject *parent_my = MY_ATK_OBJECT(parent);
-
- int i = parent_my->children->len;
- for(; i>=0; i--)
- {
- if(g_ptr_array_index(parent_my->children,i) == accessible)
- break;
- }
- if(i < 0)printf("Something wrong in parent-child strucutre.\n");
- return i;//if error, i will be equal to -1
-}
-
-static AtkStateSet *my_atk_object_ref_state_set(AtkObject *accessible)
-{
- MyAtkObject *obj = MY_ATK_OBJECT(accessible);
-
- if (obj->state_set == NULL)
- obj->state_set = atk_state_set_new();
- return g_object_ref(G_OBJECT(obj->state_set));
-}
-
-static AtkAttributeSet *my_atk_object_get_attributes (AtkObject *accessible)
-{
- MyAtkObject *obj = MY_ATK_OBJECT(accessible);
- AtkAttributeSet *rs = obj->attributes = NULL;
- AtkAttribute *a, *b, *c;
-
- a = g_new(AtkAttribute, 1);
- b = g_new(AtkAttribute, 1);
- c = g_new(AtkAttribute, 1);
-
- a->name = g_strdup("foo");
- a->value = g_strdup("bar");
- b->name = g_strdup("baz");
- b->value = g_strdup("qux");
- c->name = g_strdup("quux");
- c->value = g_strdup("corge");
-
- rs = g_slist_append(rs, (gpointer) a);
- rs = g_slist_append(rs, (gpointer) b);
- rs = g_slist_append(rs, (gpointer) c);
-}
-
-//function, needed in instance_finalize()
-static void my_unref1(gpointer data, gpointer user_data)
-{
- g_object_unref(data);
-}
-
-static void my_atk_object_instance_finalize(GObject *obj)
-{
- MyAtkObject *self = (MyAtkObject*) obj;
- //unrefs all children
- g_ptr_array_foreach(self->children, my_unref1, NULL);
- //then free array (without frees pointers)
- g_ptr_array_free(self->children, FALSE);
- //chain to parent class
- G_OBJECT_CLASS(atk_object_parent_class)->finalize(obj);
-}
-
-void my_atk_object_class_init(gpointer g_class, gpointer g_class_data)
-{
- AtkObjectClass *atkObjectClass = (AtkObjectClass*)g_class;
-
- ((GObjectClass*)g_class)->finalize = my_atk_object_instance_finalize;
- //set pointers to new functions in table of virtuals functions
- atkObjectClass->set_parent = my_atk_object_set_parent;
- atkObjectClass->get_n_children = my_atk_object_get_n_children;
- atkObjectClass->ref_child = my_atk_object_ref_child;
- atkObjectClass->get_index_in_parent = my_atk_object_get_index_in_parent;
- atkObjectClass->ref_state_set = my_atk_object_ref_state_set;
- atkObjectClass->get_attributes = my_atk_object_get_attributes;
-
- atk_object_parent_class = g_type_class_peek_parent(g_class);
-}
-
-static void my_atk_object_instance_init(GTypeInstance *obj, gpointer g_class)
-{
- MyAtkObject *self = (MyAtkObject*)obj;
-
- self->children = g_ptr_array_sized_new(10);
- self->attributes = g_slist_alloc();
-}
-
-GType my_atk_object_get_type()
-{
- static GType type = 0;
- if(type == 0)
- {
- static const GTypeInfo typeInfo =
- {
- sizeof(MyAtkObjectClass),
- NULL, //base_init
- NULL, //base_finalize
- my_atk_object_class_init, //class_init
- NULL, //class_finalize
- NULL, //class_data
- sizeof(MyAtkObject),
- 0, //n_preallocs
- my_atk_object_instance_init //instance_init
- };
- type = g_type_register_static(ATK_TYPE_OBJECT,"MyAtkObject",&typeInfo,0);
- }
- return type;
-}
diff --git a/tests/dummyatk/my-atk-object.h b/tests/dummyatk/my-atk-object.h
deleted file mode 100644
index 72a4aea3..00000000
--- a/tests/dummyatk/my-atk-object.h
+++ /dev/null
@@ -1,37 +0,0 @@
-#ifndef MY_ATK_OBJECT_H
-#define MY_ATK_OBJECT_H
-
-#include <atk/atk.h>
-
-#define MY_TYPE_ATK_OBJECT (my_atk_object_get_type ())
-#define MY_ATK_OBJECT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MY_TYPE_ATK_OBJECT, MyAtkObject))
-#define MY_ATK_OBJECT_CLASS(vtable) (G_TYPE_CHECK_CLASS_CAST ((vtable), MY_TYPE_ATK_OBJECT, MyAtkObjectClass))
-#define MY_IS_ATK_OBJECT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MY_TYPE_ATK_OBJECT))
-#define MY_IS_ATK_OBJECT_CLASS(vtable) (G_TYPE_CHECK_CLASS_TYPE ((vtable), MY_TYPE_ATK_OBJECT))
-#define MY_ATK_OBJECT_GET_CLASS(inst) (G_TYPE_INSTANCE_GET_CLASS ((inst), MY_TYPE_ATK_OBJECT, MyAtkObjectClass))
-
-typedef struct _MyAtkObject MyAtkObject;
-typedef struct _MyAtkObjectClass MyAtkObjectClass;
-
-struct _MyAtkObject
-{
- AtkObject parent;
- //array of children
- AtkStateSet *state_set;
- AtkAttributeSet *attributes;
- GPtrArray* children;
- gint id;
-};
-
-struct _MyAtkObjectClass
-{
- AtkObjectClass parent;
-};
-
-GType my_atk_object_get_type();
-
-void my_atk_object_add_child(MyAtkObject* parent, MyAtkObject* child);
-
-void my_atk_object_remove_child(MyAtkObject* parent, MyAtkObject* child);
-
-#endif /*MY_ATK_OBJECT_H*/
diff --git a/tests/dummyatk/my-atk-selection.c b/tests/dummyatk/my-atk-selection.c
deleted file mode 100644
index e3f386f3..00000000
--- a/tests/dummyatk/my-atk-selection.c
+++ /dev/null
@@ -1,332 +0,0 @@
-/* This file contains both declaration and definition of the MyAtkSelection,
- * a GObject that implements the AtkSelectionIface interface.
- */
-
-#include <glib-object.h>
-#include <atk/atk.h>
-
-#include "my-atk-object.h"
-#include "my-atk-selection.h"
-
-/******************************************************************/
-/* Implementation */
-/******************************************************************/
-static GObjectClass *parent_class_simple_selection = NULL;
-
-/* Implementation of the AtkSelectionIface interface. */
-static gboolean
-simple_selection_add_selection (AtkSelection *selection, gint i)
-{
- MyAtkSelection* self = (MyAtkSelection*)selection;
- if ((!self) || self->disposed)
- {
- return FALSE;
- }
-
- if ((i >= 0) && (i < TEST_SELECTION_NCHILDREN))
- {
- /* If the child is not selected, select it and send the signal */
- if (!self->is_selected[i])
- {
- self->is_selected[i] = TRUE;
- g_signal_emit_by_name ((gpointer)self, "selection-changed");
- }
-
- return TRUE;
- }
- else
- {
- return FALSE;
- }
-
-}
-
-static gboolean
-simple_selection_clear_selection (AtkSelection *selection)
-{
- MyAtkSelection* self = (MyAtkSelection*)selection;
- if ((!self) || self->disposed)
- {
- return FALSE;
- }
-
- /* clear selection */
- {
- gboolean changed = FALSE;
- int i;
- for (i = 0; i < TEST_SELECTION_NCHILDREN; ++i)
- {
- changed |= self->is_selected[i];
- self->is_selected[i] = FALSE;
- }
-
- if (changed)
- {
- g_signal_emit_by_name ((gpointer)self, "selection-changed");
- }
- }
-
- return TRUE;
-}
-
-static AtkObject*
-simple_selection_ref_selection (AtkSelection *selection, gint i)
-{
- int pos;
- int nsel;
- MyAtkSelection* self = (MyAtkSelection*)selection;
- if ((!self) || self->disposed)
- {
- return NULL;
- }
-
- nsel = 0;
- for (pos = 0; pos < TEST_SELECTION_NCHILDREN; ++pos)
- {
- if (self->is_selected[pos])
- {
- if (i == nsel)
- {
- g_object_ref (G_OBJECT (self->child[pos]));
- return ATK_OBJECT(self->child[pos]);
- }
- ++nsel;
- }
- }
-
- return NULL;
-}
-
-static gint
-simple_selection_get_selection_count (AtkSelection *selection)
-{
- MyAtkSelection* self = (MyAtkSelection*)selection;
-
- int cnt = 0;
- int i;
-
- if ((!self) || self->disposed)
- {
- return 0;
- }
-
- for (i = 0; i < TEST_SELECTION_NCHILDREN; ++i)
- {
- if (self->is_selected[i])
- {
- ++cnt;
- }
- }
-
- return cnt;
-}
-
-static gboolean
-simple_selection_is_child_selected (AtkSelection *selection, gint i)
-{
- MyAtkSelection* self = (MyAtkSelection*)selection;
- if ((!self) || self->disposed)
- {
- return FALSE;
- }
-
- if ((i >= 0) && (i < TEST_SELECTION_NCHILDREN))
- {
- return (self->is_selected[i]);
- }
- else
- {
- return FALSE;
- }
-}
-
-static gboolean
-simple_selection_remove_selection (AtkSelection *selection, gint i)
-{
- int pos;
- int nsel;
-
- MyAtkSelection* self = (MyAtkSelection*)selection;
- if ((!self) || self->disposed)
- {
- return FALSE;
- }
-
- nsel = 0;
- for (pos = 0; pos < TEST_SELECTION_NCHILDREN; ++pos)
- {
- if (self->is_selected[pos])
- {
- if (i == nsel)
- {
- self->is_selected[pos] = FALSE;
- g_signal_emit_by_name ((gpointer)self, "selection-changed");
- return TRUE;
- }
- ++nsel;
- }
- }
-
- return TRUE;
-}
-
-static gboolean
-simple_selection_select_all_selection (AtkSelection *selection)
-{
- MyAtkSelection* self = (MyAtkSelection*)selection;
- if ((!self) || self->disposed)
- {
- return FALSE;
- }
-
- if (!self->multisel_supported)
- {
- return FALSE;
- }
-
- /* select all */
- {
- gboolean changed = FALSE;
- int i;
- for (i = 0; i < TEST_SELECTION_NCHILDREN; ++i)
- {
- changed |= !self->is_selected[i];
- self->is_selected[i] = TRUE;
- }
-
- if (changed)
- {
- g_signal_emit_by_name ((gpointer)self, "selection-changed");
- }
- }
-
- return TRUE;
-}
-
-/******************************************************************/
-static void
-simple_selection_interface_init (gpointer g_iface, gpointer iface_data)
-{
- AtkSelectionIface *klass = (AtkSelectionIface *)g_iface;
-
- /* set up overrides here */
- klass->add_selection =
- (gboolean (*) (AtkSelection *selection, gint i)) simple_selection_add_selection;
-
- klass->clear_selection =
- (gboolean (*) (AtkSelection *selection)) simple_selection_clear_selection;
-
- klass->ref_selection =
- (AtkObject* (*) (AtkSelection *selection, gint i)) simple_selection_ref_selection;
-
- klass->get_selection_count =
- (gint (*) (AtkSelection *selection)) simple_selection_get_selection_count;
-
- klass->is_child_selected =
- (gboolean (*) (AtkSelection *selection, gint i)) simple_selection_is_child_selected;
-
- klass->remove_selection =
- (gboolean (*) (AtkSelection *selection, gint i)) simple_selection_remove_selection;
-
- klass->select_all_selection =
- (gboolean (*) (AtkSelection *selection)) simple_selection_select_all_selection;
-}
-
-static void
-simple_selection_instance_init (GTypeInstance *instance, gpointer g_class)
-{
- MyAtkSelection *self = (MyAtkSelection *)instance;
- int i;
-
- self->disposed = FALSE;
- self->multisel_supported = TRUE;
- for (i = 0; i < TEST_SELECTION_NCHILDREN; ++i)
- {
- self->child[i] = MY_ATK_OBJECT (g_object_new (MY_TYPE_ATK_OBJECT, NULL));
- self->child[i]->id = i;
- self->is_selected[i] = FALSE; /* not selected by default */
- }
-}
-
-static void
-my_atk_selection_dispose (GObject *obj)
-{
- MyAtkSelection *self = (MyAtkSelection *)obj;
- int i;
-
- if (self->disposed)
- {
- return;
- }
-
- /* Make sure dispose does not run twice. */
- self->disposed = TRUE;
-
- for (i = 0; i < TEST_SELECTION_NCHILDREN; ++i)
- {
- g_object_unref (G_OBJECT (self->child[i]));
- }
-
- /* Chain up to the parent class */
- G_OBJECT_CLASS (parent_class_simple_selection)->dispose (obj);
-}
-
-static void
-my_atk_selection_finalize (GObject *obj)
-{
- /*MyAtkSelection *self = (MyAtkSelection *)obj;
- if (self)
- {
- }*/
-
- /* Chain up to the parent class */
- G_OBJECT_CLASS (parent_class_simple_selection)->finalize (obj);
-}
-
-static void
-my_atk_selection_class_init (gpointer g_class, gpointer g_class_data)
-{
- GObjectClass *gobject_class = G_OBJECT_CLASS (g_class);
- MyAtkSelectionClass *klass = MY_ATK_SELECTION_CLASS (g_class);
-
- gobject_class->dispose = my_atk_selection_dispose;
- gobject_class->finalize = my_atk_selection_finalize;
-
- parent_class_simple_selection = g_type_class_peek_parent (klass);
-}
-
-GType
-my_atk_selection_get_type (void)
-{
- static GType type = 0;
- if (type == 0)
- {
- static const GTypeInfo info =
- {
- sizeof (MyAtkSelectionClass),
- NULL, /* base_init */
- NULL, /* base_finalize */
- my_atk_selection_class_init, /* class_init */
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof (MyAtkSelection),
- 0, /* n_preallocs */
- simple_selection_instance_init /* instance_init */
- };
-
- static const GInterfaceInfo iface_info =
- {
- (GInterfaceInitFunc) simple_selection_interface_init, /* interface_init */
- NULL, /* interface_finalize */
- NULL /* interface_data */
- };
- type = g_type_register_static (MY_TYPE_ATK_OBJECT,
- "MyAtkSelectionType",
- &info, 0);
- g_type_add_interface_static (type,
- ATK_TYPE_SELECTION,
- &iface_info);
- }
- return type;
-}
-
diff --git a/tests/dummyatk/my-atk-selection.h b/tests/dummyatk/my-atk-selection.h
deleted file mode 100644
index 8e8fcf52..00000000
--- a/tests/dummyatk/my-atk-selection.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/* This file contains both declaration and definition of the MyAtkSelection,
- * a GObject that implements the AtkSelectionIface interface.
- */
-
-#ifndef MY_ATK_SELECTION_H
-#define MY_ATK_SELECTION_H
-
-#include <glib-object.h>
-#include <atk/atk.h>
-
-#include <my-atk-object.h>
-
-#define MY_TYPE_ATK_SELECTION (my_atk_selection_get_type ())
-#define MY_ATK_SELECTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MY_TYPE_ATK_SELECTION, MyAtkSelection))
-#define MY_ATK_SELECTION_CLASS(vtable) (G_TYPE_CHECK_CLASS_CAST ((vtable), MY_TYPE_ATK_SELECTION, MyAtkSelectionClass))
-#define MY_IS_ATK_SELECTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MY_TYPE_ATK_SELECTION))
-#define MY_IS_ATK_SELECTION_CLASS(vtable) (G_TYPE_CHECK_CLASS_TYPE ((vtable), MY_TYPE_ATK_SELECTION))
-#define MY_ATK_SELECTION_GET_CLASS(inst) (G_TYPE_INSTANCE_GET_CLASS ((inst), MY_TYPE_ATK_SELECTION, MyAtkSelectionClass))
-
-/* Number of child objects for the MyAtkSelection instance */
-#define TEST_SELECTION_NCHILDREN 10
-
-typedef struct _MyAtkSelection MyAtkSelection;
-typedef struct _MyAtkSelectionClass MyAtkSelectionClass;
-
-struct _MyAtkSelection
-{
- MyAtkObject parent;
-
- gboolean disposed;
-
- /* TRUE if multiple selection is supported, FALSE otherwise.
- * default - TRUE.
- */
- gboolean multisel_supported;
-
- /* Children of this object */
- MyAtkObject* child[TEST_SELECTION_NCHILDREN];
-
- /* is_selected[i] == TRUE means the ith child is selected, == FALSE -
- * it is not.
- */
- gboolean is_selected[TEST_SELECTION_NCHILDREN];
-};
-
-struct _MyAtkSelectionClass
-{
- MyAtkObjectClass parent;
-};
-
-GType
-my_atk_selection_get_type (void);
-
-#endif /*MY_ATK_SELECTION_H*/
-
diff --git a/tests/dummyatk/my-atk-streamable-content.c b/tests/dummyatk/my-atk-streamable-content.c
deleted file mode 100644
index 460dd9a6..00000000
--- a/tests/dummyatk/my-atk-streamable-content.c
+++ /dev/null
@@ -1,96 +0,0 @@
-#include <atk/atk.h>
-
-#include "my-atk-object.h"
-#include "my-atk-streamable-content.h"
-
-//*************************implementation***********************
-//implementation of virtual functions
-//*****************get_n_mime_types************
-static gint my_atk_streamable_content_get_n_mime_types(
- AtkStreamableContent *streamable)
-{
- g_return_val_if_fail(MY_IS_ATK_STREAMABLE_CONTENT(streamable), 0);
-
- return sizeof(mime_types) / sizeof(mime_types[0]);
-}
-//*****************get_mime_type****************
-static const gchar* my_atk_streamable_content_get_mime_type(
- AtkStreamableContent *streamable,
- gint i)
-{
- g_return_val_if_fail(MY_IS_ATK_STREAMABLE_CONTENT(streamable), NULL);
-
- if((i < 0) || (i >= sizeof(mime_types) / sizeof(mime_types[0])))
- {
- return NULL;
- }
- return mime_types[i];
-}
-//**********************get_stream*******************
-static GIOChannel* my_atk_streamable_content_get_stream(
- AtkStreamableContent *streamable,
- const gchar* mime_type)
-{
- gint i;
- g_return_val_if_fail(MY_IS_ATK_STREAMABLE_CONTENT(streamable), NULL);
-
- for(i = 0; i < sizeof(mime_types) / sizeof(mime_types[0]); i++)
- {
- if(strcmp(mime_type, mime_types[i]) == 0)
- {
- GError *error = NULL;
- gchar* full_filename = T2C_GET_DATA_PATH(file_names[i]);
- GIOChannel* channel = g_io_channel_new_file(full_filename, "r", &error);
- if(error != NULL)
- {
- TRACE("Cannot open file '%s' for read: %s", full_filename,
- error->message);
- g_error_free(error);
- }
- g_free(full_filename);
- return channel;
- }
- }
- return NULL;
-}
-//others functions
-static void my_atk_streamable_content_interface_init(gpointer g_iface, gpointer iface_data)
-{
- AtkStreamableContentIface *klass = (AtkStreamableContentIface*)g_iface;
-
- klass->get_n_mime_types = my_atk_streamable_content_get_n_mime_types;
- klass->get_mime_type = my_atk_streamable_content_get_mime_type;
- klass->get_stream = my_atk_streamable_content_get_stream;
-}
-
-GType my_atk_streamable_content_get_type()
-{
- static GType type = 0;
- if(type == 0)
- {
- static const GTypeInfo typeInfo =
- {
- sizeof(MyAtkStreamableContentClass),
- NULL, //base_init
- NULL, //base_finalize
- NULL, //class_init
- NULL, //class_finalize
- NULL, //class_data
- sizeof(MyAtkStreamableContent),
- 0, //n_preallocs
- NULL //instance_init
- };
-
- static const GInterfaceInfo iface_info =
- {
- my_atk_streamable_content_interface_init, /* interface_init*/
- NULL, /* interface_finalize*/
- NULL /* interface_data */
- };
- type = g_type_register_static(MY_TYPE_ATK_OBJECT, "MyAtkStreamableContent", &typeInfo, 0);
- g_type_add_interface_static(type,
- ATK_TYPE_STREAMABLE_CONTENT,
- &iface_info);
- }
- return type;
-}
diff --git a/tests/dummyatk/my-atk-streamable-content.h b/tests/dummyatk/my-atk-streamable-content.h
deleted file mode 100644
index 7a476ac7..00000000
--- a/tests/dummyatk/my-atk-streamable-content.h
+++ /dev/null
@@ -1,35 +0,0 @@
-#ifndef MY_ATK_STREAMABLE_CONTENT_H
-#define MY_ATK_STREAMABLE_CONTENT_H
-
-/*
- * MyAtkStreamableContent: derives GObject and implements AtkStreamableContent
- */
-
-#include <atk/atk.h>
-
-#include "my-atk-object.h"
-
-#define MY_TYPE_ATK_STREAMABLE_CONTENT (my_atk_streamable_content_get_type ())
-#define MY_ATK_STREAMABLE_CONTENT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MY_TYPE_ATK_STREAMABLE_CONTENT, MyAtkStreamableContent))
-#define MY_ATK_STREAMABLE_CONTENT_CLASS(vtable) (G_TYPE_CHECK_CLASS_CAST ((vtable), MY_TYPE_ATK_STREAMABLE_CONTENT, MyAtkStreamableContentClass))
-#define MY_IS_ATK_STREAMABLE_CONTENT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MY_TYPE_ATK_STREAMABLE_CONTENT))
-#define MY_IS_ATK_STREAMABLE_CONTENT_CLASS(vtable) (G_TYPE_CHECK_CLASS_TYPE ((vtable), MY_TYPE_ATK_STREAMABLE_CONTENT))
-#define MY_ATK_STREAMABLE_CONTENT_GET_CLASS(inst) (G_TYPE_INSTANCE_GET_CLASS ((inst), MY_TYPE_ATK_STREAMABLE_CONTENT, MyAtkStreamableContentClass))
-
-typedef struct _MyAtkStreamableContent MyAtkStreamableContent;
-typedef struct _MyAtkStreamableContentClass MyAtkStreamableContentClass;
-
-static const gchar* mime_types[]={"text/plain", "text/richtext"};
-static const gchar* file_names[]={"file1", "file2"};
-struct _MyAtkStreamableContent
-{
- MyAtkObject parent;
-};
-
-struct _MyAtkStreamableContentClass
-{
- MyAtkObjectClass parent;
-};
-
-GType my_atk_streamable_content_get_type();
-#endif /*MY_ATK_STREAMABLE_CONTENT_H*/
diff --git a/tests/dummyatk/my-atk-table.c b/tests/dummyatk/my-atk-table.c
deleted file mode 100644
index a76c70e2..00000000
--- a/tests/dummyatk/my-atk-table.c
+++ /dev/null
@@ -1,177 +0,0 @@
-/* This file contains both declaration and definition of the MyAtkTable,
- * a GObject that pretends to implement the AtkTableIface interface (it
- * registers appropriate interface), but provides no implementation for any of the
- * methods of this interface (NULL-filled vftbl).
- */
-
-#include <glib-object.h>
-#include <atk/atk.h>
-
-#include "my-atk-object.h"
-#include "my-atk-table.h"
-
-///////////////////////////////////////////////////////////////////////////
-// Helper functions and data
-///////////////////////////////////////////////////////////////////////////
-void
-my_atk_table_select_rows (MyAtkTable* table, gboolean sel_scheme[])
-{
- // the function does nothing
-}
-
-void
-my_atk_table_select_columns (MyAtkTable* table, gboolean sel_scheme[])
-{
- // the function does nothing
-}
-
-///////////////////////////////////////////////////////////////////////////
-// Implementation
-///////////////////////////////////////////////////////////////////////////
-static GObjectClass *parent_class_table = NULL;
-
-/******************************************************************/
-static void
-table_interface_init (gpointer g_iface, gpointer iface_data)
-{
- AtkTableIface *klass = (AtkTableIface *)g_iface;
-
- /* set up overrides here */
- klass-> ref_at =
- (AtkObject* (*) (AtkTable *table, gint row, gint column)) NULL;
- klass-> get_index_at =
- (gint (*) (AtkTable *table, gint row, gint column)) NULL;
- klass-> get_column_at_index =
- (gint (*) (AtkTable *table, gint index_)) NULL;
- klass-> get_row_at_index =
- (gint (*) (AtkTable *table, gint index_)) NULL;
- klass-> get_n_columns =
- (gint (*) (AtkTable *table)) NULL;
- klass-> get_n_rows =
- (gint (*) (AtkTable *table)) NULL;
- klass-> get_column_extent_at =
- (gint (*) (AtkTable *table, gint row, gint column)) NULL;
- klass-> get_row_extent_at =
- (gint (*) (AtkTable *table, gint row, gint column)) NULL;
- klass-> get_caption =
- (AtkObject* (*) (AtkTable *table)) NULL;
- klass-> get_column_description =
- (const gchar* (*) (AtkTable *table, gint column)) NULL;
- klass-> get_column_header =
- (AtkObject* (*) (AtkTable *table, gint column)) NULL;
- klass-> get_row_description =
- (const gchar* (*) (AtkTable *table, gint row)) NULL;
- klass-> get_row_header =
- (AtkObject* (*) (AtkTable *table, gint row)) NULL;
- klass-> get_summary =
- (AtkObject* (*) (AtkTable *table)) NULL;
- klass-> set_caption =
- (void (*) (AtkTable *table, AtkObject *caption)) NULL;
- klass-> set_column_description =
- (void (*) (AtkTable *table, gint column, const gchar *description)) NULL;
- klass-> set_column_header =
- (void (*) (AtkTable *table, gint column, AtkObject *header)) NULL;
- klass-> set_row_description =
- (void (*) (AtkTable *table, gint row, const gchar *description)) NULL;
- klass-> set_row_header =
- (void (*) (AtkTable *table, gint row, AtkObject *header)) NULL;
- klass-> set_summary =
- (void (*) (AtkTable *table, AtkObject *accessible)) NULL;
- klass-> get_selected_columns =
- (gint (*) (AtkTable *table, gint **selected)) NULL;
- klass-> get_selected_rows =
- (gint (*) (AtkTable *table, gint **selected)) NULL;
- klass-> is_column_selected =
- (gboolean (*) (AtkTable *table, gint column)) NULL;
- klass-> is_row_selected =
- (gboolean (*) (AtkTable *table, gint row)) NULL;
- klass-> is_selected =
- (gboolean (*) (AtkTable *table, gint row, gint column)) NULL;
- klass-> add_row_selection =
- (gboolean (*) (AtkTable *table, gint row)) NULL;
- klass-> remove_row_selection =
- (gboolean (*) (AtkTable *table, gint row)) NULL;
- klass-> add_column_selection =
- (gboolean (*) (AtkTable *table, gint column)) NULL;
- klass-> remove_column_selection =
- (gboolean (*) (AtkTable *table, gint column)) NULL;
-}
-
-static void
-table_instance_init (GTypeInstance *instance, gpointer g_class)
-{
- MyAtkTable *self = (MyAtkTable *)instance;
-
- self->disposed = FALSE;
-}
-
-static void
-my_atk_table_dispose (GObject *obj)
-{
- MyAtkTable *self = (MyAtkTable *)obj;
-
- if (self->disposed)
- {
- return;
- }
-
- /* Make sure dispose does not run twice. */
- self->disposed = TRUE;
-
- /* Chain up to the parent class */
- G_OBJECT_CLASS (parent_class_table)->dispose (obj);
-}
-
-static void
-my_atk_table_finalize (GObject *obj)
-{
- /* Chain up to the parent class */
- G_OBJECT_CLASS (parent_class_table)->finalize (obj);
-}
-
-static void
-my_atk_table_class_init (gpointer g_class, gpointer g_class_data)
-{
- GObjectClass *gobject_class = G_OBJECT_CLASS (g_class);
- MyAtkTableClass *klass = MY_ATK_TABLE_CLASS (g_class);
-
- gobject_class->dispose = my_atk_table_dispose;
- gobject_class->finalize = my_atk_table_finalize;
-
- parent_class_table = g_type_class_peek_parent (klass);
-}
-
-GType
-my_atk_table_get_type (void)
-{
- static GType type = 0;
- if (type == 0)
- {
- static const GTypeInfo info =
- {
- sizeof (MyAtkTableClass),
- NULL, /* base_init */
- NULL, /* base_finalize */
- my_atk_table_class_init, /* class_init */
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof (MyAtkTable),
- 0, /* n_preallocs */
- table_instance_init /* instance_init */
- };
-
- static const GInterfaceInfo iface_info =
- {
- (GInterfaceInitFunc) table_interface_init, /* interface_init */
- NULL, /* interface_finalize */
- NULL /* interface_data */
- };
- type = g_type_register_static (MY_TYPE_ATK_OBJECT,
- "MyAtkTableType",
- &info, 0);
- g_type_add_interface_static (type,
- ATK_TYPE_TABLE,
- &iface_info);
- }
- return type;
-}
diff --git a/tests/dummyatk/my-atk-table.h b/tests/dummyatk/my-atk-table.h
deleted file mode 100644
index 7860a2d1..00000000
--- a/tests/dummyatk/my-atk-table.h
+++ /dev/null
@@ -1,86 +0,0 @@
-#ifndef MY_ATK_TABLE_H
-#define MY_ATK_TABLE_H
-
-#include <glib-object.h>
-#include <atk/atk.h>
-#include <my-atk-object.h>
-
-#define MY_TYPE_ATK_TABLE (my_atk_table_get_type ())
-#define MY_ATK_TABLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MY_TYPE_ATK_TABLE, MyAtkTable))
-#define MY_ATK_TABLE_CLASS(vtable) (G_TYPE_CHECK_CLASS_CAST ((vtable), MY_TYPE_ATK_TABLE, MyAtkTableClass))
-#define MY_IS_ATK_TABLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MY_TYPE_ATK_TABLE))
-#define MY_IS_ATK_TABLE_CLASS(vtable) (G_TYPE_CHECK_CLASS_TYPE ((vtable), MY_TYPE_ATK_TABLE))
-#define MY_ATK_TABLE_GET_CLASS(inst) (G_TYPE_INSTANCE_GET_CLASS ((inst), MY_TYPE_ATK_TABLE, MyAtkTableClass))
-
-#define NROWS 4 /* row count */
-#define NCOLS 5 /* column count */
-
-static gint ids[NROWS][NCOLS] =
- { {0, 1, 2, 2, 3},
- {4, 5, 6, 7, 8},
- {9, 9, 10, 11, 12},
- {9, 9, 13, 14, -1} };
-
-static gint row_ext[NROWS][NCOLS] =
- { {1, 1, 1, 1, 1},
- {1, 1, 1, 1, 1},
- {2, 2, 1, 1, 1},
- {2, 2, 1, 1, 1} };
-
-static gint col_ext[NROWS][NCOLS] =
- { {1, 1, 2, 2, 1},
- {1, 1, 1, 1, 1},
- {2, 2, 1, 1, 1},
- {2, 2, 1, 1, 1} };
-
-#define NCHILDREN 16 /* child object count */
-
-// default string values
-#define DEF_CAPTION_TEXT "Default table caption"
-#define DEF_SUMMARY_TEXT "Default table summary"
-#define DEF_ROW_DESCR_TPL "Row No%d"
-#define DEF_COL_DESCR_TPL "Column No%d"
-
-/* row and column headers */
-typedef struct
-{
- AtkObject* hdr;
- gboolean selected; /* TRUE if the row/column is selected, FALSE otherwise */
-} TestSimpleHeaderStruct;
-
-/* This struct represents a table cell */
-typedef struct
-{
- MyAtkObject* elem; /* the element */
- guint ext_row; /* its row extent */
- guint ext_col; /* its column extent */
-} TestSimpleCell;
-
-typedef struct _MyAtkTable MyAtkTable;
-typedef struct _MyAtkTableClass MyAtkTableClass;
-
-struct _MyAtkTable
-{
- MyAtkObject parent;
-
- gboolean disposed;
-
- MyAtkObject* child[NCHILDREN];
- MyAtkObject* not_a_child;
- TestSimpleHeaderStruct row[NROWS];
- TestSimpleHeaderStruct col[NCOLS];
- guint nrows;
- guint ncols;
- AtkObject* caption;
- AtkObject* summary;
-};
-
-struct _MyAtkTableClass
-{
- MyAtkObjectClass parent;
-};
-
-GType
-my_atk_table_get_type (void);
-
-#endif /*MY_ATK_TABLE_H*/
diff --git a/tests/dummyatk/my-atk-text.c b/tests/dummyatk/my-atk-text.c
deleted file mode 100644
index 6729c4be..00000000
--- a/tests/dummyatk/my-atk-text.c
+++ /dev/null
@@ -1,1290 +0,0 @@
-
-#include <atk/atk.h>
-#include <string.h>
-#include <limits.h>
-#include <useful_functions.h>
-
-#include "my-atk-text.h"
-//*************************implementation***********************
-
-//Attributes
-/*
- * Auxiliary functions create/copy/print/free structures
- * Use the same naming principe, as atk, but without 'atk' prefix
- */
- //AtkAttribute
-AtkAttribute* attribute_new(const gchar* name, const gchar* value)
-{
- AtkAttribute* attr = g_malloc(sizeof(AtkAttribute));
- if(attr == NULL) return NULL;
- attr->name = g_strdup(name);
- attr->value = g_strdup(value);
- return attr;
-}
-AtkAttribute* attribute_copy(AtkAttribute* attr)
-{
- return attribute_new(attr->name, attr->value);
-}
-void attribute_print(AtkAttribute* attr)
-{
- TRACE("name=%s, value=%s", attr->name, attr->value);
-}
-
-//AtkAttributeSet
-AtkAttributeSet* attribute_set_copy(AtkAttributeSet* attr)
-{
- GSList *tmp;
- AtkAttributeSet* result = g_slist_copy(attr);
- for(tmp = result; tmp != NULL; tmp = tmp->next)
- tmp->data = attribute_copy((AtkAttribute*)tmp->data);
- return result;
-}
-void attribute_set_print(AtkAttributeSet *set)
-{
- if(set == NULL)
- TRACE0("(empty)");
- else
- g_slist_foreach(set, (GFunc)attribute_print, NULL);
-}
-
-// STATIC FUNCTIONS
-//
-//auxiliary functions for search tokens
-//Number of different characters
-#define TABLE_SIZE 256
-//modificator static isn't used because this tables will be use in tests
-/*static*/ gboolean table_word_symbols[TABLE_SIZE],
- table_sentence_symbols[TABLE_SIZE],
- table_line_symbols[TABLE_SIZE];
-static gboolean *tables[7]={NULL,
- table_word_symbols,
- table_word_symbols,
- table_sentence_symbols,
- table_sentence_symbols,
- table_line_symbols,
- table_line_symbols
- };
-
-static gboolean current_token(const gchar* str, gint offset, gint *token_start, gint *token_end,
- const gboolean table_token_symbols[TABLE_SIZE])
-{
- const gchar *current = str + offset;
- if(!table_token_symbols[(guchar)*current])
- {
- return FALSE;
- }
- for( --current; (current >= str) && table_token_symbols[(guchar)*current]; --current);
- *token_start = current - str + 1;
- for(current = str + offset + 1;
- (*current != 0) && table_token_symbols[(guchar)*current]; ++current);
- *token_end = current - str;
- return TRUE;
-}
-static gboolean next_token(const gchar* str, gint offset, gint *token_start, gint *token_end,
- const gboolean table_token_symbols[TABLE_SIZE])
-{
- const gchar *current = str + offset;
- for( ; (*current != 0) && table_token_symbols[(guchar)*current]; ++current);
- if(*current == 0)
- return FALSE;
- for(++current ; (*current != 0) && !table_token_symbols[(guchar)*current]; ++current);
- if(!table_token_symbols[(guchar)*current])
- return FALSE;
- return current_token(str, current - str, token_start, token_end, table_token_symbols);
-}
-static gboolean previous_token(const gchar* str, gint offset, gint *token_start, gint *token_end,
- const gboolean table_token_symbols[TABLE_SIZE])
-{
- const gchar *current = str + offset;
- for( ; (current > str) && table_token_symbols[(guchar)*current]; --current);
- if(current == str)
- return FALSE;
- for( ; (current > str) && !table_token_symbols[(guchar)*current]; --current);
- if(!table_token_symbols[(guchar)*current])
- return FALSE;
- return current_token(str, current - str, token_start, token_end, table_token_symbols);
-}
-
-
-//Range: type of data, containing in list of attributes
-typedef struct
-{
- gint start,end;//range, containing this attributes
- AtkAttributeSet* attributeSet;
-} Range;
-//auxiliary functions for ranges
-Range* range_new(gint start, gint end)
-{
- Range *range = g_malloc(sizeof(Range));
- range->start = start;
- range->end = end;
- range->attributeSet = NULL;
- return range;
-}
-
-void range_free(Range* range)
-{
- atk_attribute_set_free(range->attributeSet);
- g_free(range);
-}
-void range_print(const Range*range)
-{
- TRACE("[%d,%d):", range->start, range->end);
- attribute_set_print(range->attributeSet);
-}
-//only for correct list of ranges - ranges shouldn't intersect
-gint range_compare(const Range* range1, const Range* range2)
-{
- return range1->start - range2->start;//never equal
-}
-//Bounds of text
-void text_bounds_init(TextBounds *bounds)
-{
- bounds->base_x = 0;
- bounds->base_y = 0;
- bounds->pixels_above_line = 2;
- bounds->pixels_below_line = 3;
- bounds->size = 8;
- bounds->pixels_between_characters = 1;
- bounds->width = 3;
-}
-
-//auxiliary function - create new range according to start_offset and end_offset
-AtkTextRange* text_range_new(AtkText* text,
- gint start_offset, gint end_offset, AtkCoordType coord_type)
-{
- AtkTextRange* range = g_malloc(sizeof(AtkTextRange));
- if(range == NULL) return NULL;
- range->start_offset = start_offset;
- range->end_offset = end_offset;
- range->content = atk_text_get_text(text, start_offset, end_offset);
- atk_text_get_range_extents(text, start_offset, end_offset, coord_type, &range->bounds);
- return range;
-}
-// Returns number of line, which contain given character.
-// Also return relative offset - offset of this character from start of the line
-gint get_character_line(MyAtkText *text, gint offset, gint *relative_offset)
-{
- gint result = 0;
- //simple realization - counts lines from start of the text, until reaches offset
- const guchar *text_str = (guchar*)text->str;
- gboolean state_FSM = table_line_symbols[text_str[0]];
- gint i, last_line_start = 0;
- for(i = 1; i <= offset; state_FSM = table_line_symbols[text_str[i++]])
- {
- if(state_FSM)continue;
- result++;
- last_line_start = i;
- }
- if(relative_offset != NULL) *relative_offset = offset - last_line_start;
- return result;
-}
-// Compute extent of character,
-// as it was at line 'line' and at offset 'relative_offset' in that line
-//(geometry)
-void get_extents(MyAtkText *text, gint line, gint relative_offset, AtkTextRectangle *rect)
-{
- rect->x = text->bounds.base_x + relative_offset *
- (text->bounds.width + text->bounds.pixels_between_characters);
- rect->y = text->bounds.base_y + text->bounds.pixels_above_line + line *
- (text->bounds.size + text->bounds.pixels_below_line + text->bounds.pixels_above_line);
- rect->width = text->bounds.width;
- rect->height = text->bounds.size;
-}
-//return line, corresponding to given y-coordinate
-gint get_point_line(MyAtkText *text, gint y)
-{
- //slightly differ from invers operation
- if(y - text->bounds.base_y < 0)return -1;
- return (y - text->bounds.base_y)
- /(text->bounds.size + text->bounds.pixels_below_line + text->bounds.pixels_above_line);
-}
-// Returns offset from left boundary of text, correspondind to x-coordinate
-gint get_point_relative_offset(MyAtkText *text, gint x)
-{
- //slightly differ from invers operation
- if(x - text->bounds.base_x < 0)return -1;
- return (x - text->bounds.base_x)
- /(text->bounds.width + text->bounds.pixels_between_characters);
-}
-// Returns offset where given line start(even if this line is empty)
-// If line number too small(<0)return -1, if too big - return length of the text
-gint get_offset_at_line_start(MyAtkText *text, gint line)
-{
- gint i;
- if(line < 0)return -1;
- if(line == 0)return 0;
- gint len = my_strlen(text->str);
- guchar *str = (guchar*)text->str;
- gint current_line = 0;
- gboolean state_FSM = table_line_symbols[str[0]];
- for(i = 1; i < len; state_FSM = table_line_symbols[str[i++]])
- {
- if(state_FSM || ++current_line != line)continue;
- return i;
- }
- return len;
-
-}
-// Return offset of character at the given line and at the given offset at this line
-// If such character doesn't exist, return -1
-gint get_offset_at_line(MyAtkText *text, gint line, gint relative_offset)
-{
- gint j;
- if(line < 0 || relative_offset < 0)return -1;
- const guchar* str = (guchar*)text->str;
- gint len = my_strlen(text->str);
- gint offset_at_line_start = get_offset_at_line_start(text, line);
- if(offset_at_line_start + relative_offset >= len)return -1;
- for(j = 0; j <= relative_offset; j++)
- if(!table_line_symbols[str[offset_at_line_start + j]])
- return -1;
- return offset_at_line_start + relative_offset;
-}
-/*
- * Count ranges of text, which clipping by rel_start_offset and relative_end_offset.
- * 'offset' stands start of search(start of first line),
- * number_of_lines - maximum number of lines for search.
- * If 'ranges' not NULL, writes ranges to it. 'coord_type' used only in this case.
- */
-gint count_ranges(MyAtkText *text, gint offset, gint rel_start_offset, gint rel_end_offset,
- gint number_of_lines, AtkTextRange** ranges, AtkCoordType coord_type)
-{
- guchar *str = (guchar*)text->str;
- gint len = my_strlen(text->str);
-
- gint number_of_ranges = 0;
- gint current_line = 0;
- gint current_line_start = offset;
- for(;(current_line < number_of_lines) && (current_line_start < len); current_line ++)
- {
- if(!table_line_symbols[str[current_line_start]])
- {
- current_line_start++;
- continue;
- }
- gint start_offset,end_offset;
- gchar *tmp_str = atk_text_get_text_at_offset((AtkText*)text, current_line_start,
- ATK_TEXT_BOUNDARY_LINE_END, &start_offset, &end_offset);
- g_free(tmp_str);
- if(end_offset - current_line_start > rel_start_offset)
- {
- if(ranges != NULL)
- {
- gint range_start_offset = current_line_start + rel_start_offset;
- gint range_end_offset = current_line_start + rel_end_offset + 1;
- if(range_end_offset > end_offset)
- range_end_offset = end_offset;
- //add element
- ranges[number_of_ranges] = text_range_new((AtkText*)text,
- range_start_offset, range_end_offset, coord_type);
- }
- number_of_ranges++;
- }
- current_line_start = end_offset + 1;
- }
- if(ranges != NULL) ranges[number_of_ranges] = NULL;
- return number_of_ranges;
-}
-
-//"free"-functions(for internal using, because them don't emit signals)
-void my_atk_text_free_run_attributes(MyAtkText *text)
-{
- g_list_foreach(text->attributes, (GFunc)range_free, NULL);
- g_list_free(text->attributes);
- text->attributes = NULL;
-}
-void my_atk_text_free_default_attributes(MyAtkText *text)
-{
- atk_attribute_set_free(text->default_attributes);
- text->default_attributes = NULL;
-}
-void my_atk_text_clear_selections(MyAtkText *text)
-{
- if(text->selections->len != 0)
- g_array_remove_range(text->selections, 0, text->selections->len);
-}
-void table_symbols_init()
-{
- //word
- gint i;
- for(i = TABLE_SIZE - 1;i > 0 ; --i)
- table_word_symbols[i] = g_ascii_isalnum(i);
- table_word_symbols['\0'] = FALSE;
- //sentence
- for(i = TABLE_SIZE - 1;i >= 0x20; --i)
- table_sentence_symbols[i] = TRUE;
- table_sentence_symbols['.'] = FALSE;
- table_sentence_symbols['!'] = FALSE;
- table_sentence_symbols['?'] = FALSE;
- for(i = 0x1f;i > 0; --i)
- table_sentence_symbols[i] = FALSE;
- table_sentence_symbols['\0'] = FALSE;
- //line
- for(i = TABLE_SIZE - 1;i > 0 ; --i)
- table_line_symbols[i] = TRUE;
- table_line_symbols['\n'] = FALSE;
- table_line_symbols['\0'] = FALSE;
-}
-void correct_selections_after_insert(MyAtkText *text, gint position, gint length)
-{
- gint i;
- GArray* selections = text->selections;
- for(i = selections->len - 1; i >=0; i--)
- {
- TextSelection* sel = &g_array_index(selections, TextSelection, i);
- if(sel->end_offset >= position) sel->end_offset+= length;
- if(sel->start_offset >= position) sel->start_offset+= length;
- else break;
- }
-}
-void correct_selections_after_delete(MyAtkText *text, gint position, gint length)
-{
- gint i;
- GArray* selections = text->selections;
- for(i = selections->len - 1; i >=0; i--)
- {
- TextSelection* sel = &g_array_index(selections, TextSelection, i);
- if(sel->start_offset >= position)
- {
- if(sel->start_offset >= position + length)
- {
- sel->start_offset-= length;
- sel->end_offset-= length;
- }
- //position <= sel->start_offset < position + length
- else if(sel->end_offset > position + length)
- {
- sel->start_offset = position;
- sel->end_offset -= length;
- }
- else
- {
- g_array_remove_index(selections, i);
- }
- continue;
- }
- /*sel->start_offset < position*/
- if(sel->end_offset > position + length) sel->end_offset-= length;
- else if(sel->end_offset > position) sel->end_offset = position;
- break;
- }
-}
-void correct_attributes_after_insert(MyAtkText* text, gint position, gint length)
-{
- GList *attributes = text->attributes;
- GList *tmp;
- //before inserted position
- for(tmp = attributes; tmp != NULL; tmp = tmp -> next)
- {
- Range* range = (Range*)tmp->data;
- if(range->end <= position)continue;
- //range->end > position
- if(range->start < position)
- range->start -= length;//will be restore in the next loop
- break;
- }
- //after inserted position
- for(; tmp != NULL; tmp = tmp -> next)
- {
- Range* range = (Range*)tmp->data;
- range->end += length;
- range->start += length;
- }
-}
-void correct_attributes_after_delete(MyAtkText* text, gint position, gint length)
-{
- GList *attributes = text->attributes;
- GList *tmp = attributes;
- //before deleting range
- for(tmp = attributes; tmp != NULL; tmp = tmp->next)
- {
- Range* range = (Range*)tmp->data;
- if(range->end <= position) continue;
- if(range->start < position)
- {
- if(range->end > position + length) range->end -= length;
- else range->end = position;
- tmp = tmp->next;
- }
- break;
- }
- //at deleting range
- while(tmp != NULL)
- {
- Range* range = (Range*)tmp->data;
- if(range->start >= position + length) break;
- if(range->end <= position + length)
- {
- GList *tmp1 = tmp->next;
- range_free(range);
- attributes = g_list_remove_link(attributes, tmp);
- tmp = tmp1;
- continue;
- }
- //range->end > position + length
- //range->start < position + length
- range->start = position + length;//will be restored in next loop
- break;
- }
- //after deleting range
- for(;tmp != NULL; tmp = tmp->next)
- {
- Range* range = (Range*)tmp->data;
- range->end -= length;
- range->start -= length;
- }
- text->attributes = attributes;
-}
-void correct_caret_after_insert(MyAtkText* text, gint position, gint length)
-{
- if(text->caret_offset > position)text->caret_offset += length;
-}
-void correct_caret_after_delete(MyAtkText* text, gint position, gint length)
-{
- if(text->caret_offset >= position + length)text->caret_offset -= length;
- else if(text->caret_offset > position) text->caret_offset = position;
-}
-
-// Implementation of virtual functions
-//******************************my_atk_text_get_character_count*************************
-static gint my_atk_text_get_character_count(AtkText *text)
-{
- MyAtkText *self = (MyAtkText*)text;
- return my_strlen(self->str);
-}
-//**************************************my_atk_text_get_text*****************************
-static gchar* my_atk_text_get_text(AtkText *text, gint start_offset, gint end_offset)
-{
- gchar *str = ((MyAtkText*)text)->str;
- if((start_offset < 0) || (end_offset > my_strlen(str)) || (end_offset <= start_offset))
- {
- //incorrect bounds
- return NULL;
- }
- return g_strndup(str + start_offset, end_offset - start_offset);
-
-}
-//*******************************my_atk_text_get_character_at_offset************************
-static gunichar my_atk_text_get_character_at_offset(AtkText *text, gint offset)
-{
- gchar *str = ((MyAtkText*)text)->str;
- if(offset < 0 || offset >= my_strlen(str))
- {
- return 0;
- }
- return (gunichar)str[offset];
-}
-// In the next 3 functions some code is commented for verify tests themselves on 'mutants'
-// in realization.
-//******************************my_atk_text_get_text_after_offset***************************
-static gchar* my_atk_text_get_text_after_offset(AtkText *text, gint offset,
- AtkTextBoundary boundary_type, gint *start_offset, gint *end_offset)
-{
- gchar *str = ((MyAtkText*)text)->str;
- gint len = my_strlen(str);
- if((offset < 0) || (offset >= len))
- {
- return NULL;//incorrect offset
- }
-
- // This variable is set in switch statement. If after that statement variable is TRUE,
- // then return text from 'strat_offset' to 'end_offset'. Otherwise NULL will be returned.
- gboolean is_successed = TRUE;
-
- gint start_tmp;
- gint end_tmp;
-
- switch(boundary_type)
- {
- case ATK_TEXT_BOUNDARY_CHAR:
- if(offset + 1 == len)
- {
- is_successed = FALSE;
- break;
- }
- *start_offset = offset + 1;
- *end_offset = offset + 2;
- is_successed = TRUE;
- break;
- case ATK_TEXT_BOUNDARY_WORD_START:
- case ATK_TEXT_BOUNDARY_SENTENCE_START:
- case ATK_TEXT_BOUNDARY_LINE_START:
- if(!next_token(str, offset, start_offset, &end_tmp, tables[boundary_type]))
- {
- //debug
-// if(current_token(str, offset, start_offset, end_offset, tables[boundary_type]))
-// {
-// is_successed = TRUE;
-// break;
-// }
- is_successed = FALSE;
- break;
- }
- if(!next_token(str, end_tmp, end_offset, &end_tmp, tables[boundary_type]))
- {
- *end_offset = len;
- }
- is_successed = TRUE;
- //debug
-// (*start_offset)++;
-// if(*start_offset > 10) ++(*start_offset);
- break;
- case ATK_TEXT_BOUNDARY_WORD_END:
- case ATK_TEXT_BOUNDARY_SENTENCE_END:
- case ATK_TEXT_BOUNDARY_LINE_END:
- if(!current_token(str, offset, &start_tmp, start_offset, tables[boundary_type]))
- {
- if(!next_token(str, offset, &start_tmp, start_offset, tables[boundary_type]))
- {
- is_successed = FALSE;
- break;
- }
- }
- //debug
-// else if(*start_offset > strlen(str) - 7)
-// {
-// *end_offset = *start_offset + 3;
-// is_successed = TRUE;
-// break;
-// }
- if(!next_token(str, *start_offset, &start_tmp, end_offset, tables[boundary_type]))
- {
- is_successed = FALSE;
- break;
- }
- //debug
-// --(*start_offset);
- is_successed = TRUE;
-
- break;
- default:
- is_successed = FALSE;
- }
-
- if(is_successed)
- {
- return my_atk_text_get_text(text, *start_offset, *end_offset);
- }
- else
- {
- return NULL;
- }
-}
-//*******************************my_atk_text_get_text_at_offset*******************************
-static gchar* my_atk_text_get_text_at_offset(AtkText *text, gint offset,
- AtkTextBoundary boundary_type, gint *start_offset, gint *end_offset)
-{
- gchar *str = ((MyAtkText*)text)->str;
- gint len = my_strlen(str);
- if((offset < 0) || (offset >= len))
- {
- return NULL;
- }
-
- // This variable is set in switch statement. If after that statement variable is TRUE,
- // then return text from 'strat_offset' to 'end_offset'. Otherwise NULL will be returned.
- gboolean is_successed = TRUE;
-
- gint start_tmp;
- gint end_tmp;
-
- switch(boundary_type)
- {
- case ATK_TEXT_BOUNDARY_CHAR:
- *start_offset = offset;
- *end_offset = offset + 1;
- is_successed = TRUE;
- break;
- case ATK_TEXT_BOUNDARY_WORD_START:
- case ATK_TEXT_BOUNDARY_SENTENCE_START:
- case ATK_TEXT_BOUNDARY_LINE_START:
- if(!current_token(str, offset, start_offset, &end_tmp, tables[boundary_type]))
- {
- if(!previous_token(str, offset, start_offset, &end_tmp, tables[boundary_type]))
- {
- is_successed = FALSE;
- break;
- }
- }
- if(!next_token(str, offset, end_offset, &end_tmp, tables[boundary_type]))
- {
- *end_offset = len;
- }
- is_successed = TRUE;
- break;
- case ATK_TEXT_BOUNDARY_WORD_END:
- case ATK_TEXT_BOUNDARY_SENTENCE_END:
- case ATK_TEXT_BOUNDARY_LINE_END:
- if(!current_token(str, offset, &start_tmp, end_offset, tables[boundary_type]))
- {
- if(!next_token(str, offset, &start_tmp, end_offset, tables[boundary_type]))
- {
- is_successed = FALSE;
- break;
- }
- }
- if(!previous_token(str, start_tmp, &start_tmp, start_offset, tables[boundary_type]))
- {
- *start_offset = 0;
- }
- is_successed = TRUE;
- //debug
-// ++(*start_offset);
- break;
- default:
- is_successed = FALSE;
- }
-
- if(is_successed)
- {
- //debug
-// if(boundary_type == ATK_TEXT_BOUNDARY_LINE_START)
-// return my_atk_text_get_text(text, ++(*start_offset), *end_offset);
- return my_atk_text_get_text(text, *start_offset, *end_offset);
- }
- else
- {
- return NULL;
- }
-}
-//***********************************my_atk_text_get_text_before_offset******************
-static gchar* my_atk_text_get_text_before_offset(AtkText *text, gint offset,
- AtkTextBoundary boundary_type, gint *start_offset, gint *end_offset)
-{
- gchar *str = ((MyAtkText*)text)->str;
- gint len = my_strlen(str);
- if((offset < 0) || (offset >= len))
- {
- return NULL;
- }
-
- // This variable is set in switch statement. If after that statement variable is TRUE,
- // then return text from 'strat_offset' to 'end_offset'. Otherwise NULL will be returned.
- gboolean is_successed = TRUE;
-
- gint start_tmp;
- gint end_tmp;
-
- switch(boundary_type)
- {
- case ATK_TEXT_BOUNDARY_CHAR:
- if(offset == 0)
- {
- is_successed = FALSE;
- break;
- }
- *start_offset = offset - 1;
- *end_offset = offset;
- is_successed = TRUE;
- break;
- case ATK_TEXT_BOUNDARY_WORD_START:
- case ATK_TEXT_BOUNDARY_SENTENCE_START:
- case ATK_TEXT_BOUNDARY_LINE_START:
- if(!current_token(str, offset, end_offset, &end_tmp, tables[boundary_type]))
- {
- if(!previous_token(str, offset, end_offset, &end_tmp, tables[boundary_type]))
- {
- is_successed = FALSE;
- break;
- }
- }
- if(!previous_token(str, *end_offset, start_offset, &end_tmp, tables[boundary_type]))
- {
- is_successed = FALSE;
- break;
- }
- is_successed = TRUE;
- //debug
-// ++(*start_offset);
- break;
- case ATK_TEXT_BOUNDARY_WORD_END:
- case ATK_TEXT_BOUNDARY_SENTENCE_END:
- case ATK_TEXT_BOUNDARY_LINE_END:
- if(!previous_token(str, offset, &start_tmp, end_offset, tables[boundary_type]))
- {
- is_successed = FALSE;
- break;
- }
- if(!previous_token(str, start_tmp, &start_tmp, start_offset, tables[boundary_type]))
- {
- *start_offset = 0;
- }
- is_successed = TRUE;
- break;
- default:
- is_successed = FALSE;
- }
-
- if(is_successed)
- {
- return my_atk_text_get_text(text, *start_offset, *end_offset);
- }
- else
- {
- return NULL;
- }
-}
-//*********************************my_atk_text_get_run_attributes*****************
-AtkAttributeSet* my_atk_text_get_run_attributes(AtkText* text, gint offset,
- gint *start_offset, gint *end_offset)
-{
- GList *tmp;
- GList *attributes = ((MyAtkText*)text)->attributes;
- if(offset < 0 || offset >= my_atk_text_get_character_count(text))
- {
- TRACE0("Incorrect value of offset.");
- return NULL;
- }
- gint start = -1, end = -1;
- for(tmp = attributes; tmp != NULL; tmp = tmp->next)
- {
- Range* range = (Range*)(tmp->data);
- if(range->end <= offset)
- {
- start = range->end;
- continue;
- }
- if(range->start > offset)
- {
- end = range->start;
- break;
- }
-
- *start_offset = range->start;
- *end_offset = range->end;
- return attribute_set_copy(range->attributeSet);
- }
- *start_offset = (start == -1) ? 0 : start;
- *end_offset = (end == -1) ? my_atk_text_get_character_count(text) : end;
- return NULL;
-}
-//*********************************my_atk_text_get_default_attributes*****************
-AtkAttributeSet* my_atk_text_get_default_attributes(AtkText* text)
-{
- return attribute_set_copy(((MyAtkText*)text)->default_attributes);
-}
-//*********************************my_atk_text_get_character_extents*****************
-void my_atk_text_get_character_extents(AtkText* text, gint offset, gint *x, gint *y,
- gint *width, gint *height, AtkCoordType coord_type)
-{
- AtkTextRectangle result;
- gint relative_offset, line;
- line = get_character_line((MyAtkText*)text, offset, &relative_offset);
- get_extents((MyAtkText*)text, line, relative_offset, &result);
- *x = result.x;
- *y = result.y;
- *width = result.width;
- *height = result.height;
-}
-//*******************************my_atk_text_get_range_extents************************
-void my_atk_text_get_range_extents(AtkText *text, gint start_offset, gint end_offset,
- AtkCoordType coord_type, AtkTextRectangle *rect)
-{
- //simple - union of extents of the characters, contained in this range
- AtkTextRectangle result, bounds_tmp;
- gint i;
-
- atk_text_get_character_extents (text, start_offset,
- &result.x, &result.y,
- &result.width, &result.height,
- coord_type);
-
- for (i = start_offset + 1; i < end_offset; i++)
- {
- my_atk_text_get_character_extents (text, i,&bounds_tmp.x, &bounds_tmp.y,
- &bounds_tmp.width, &bounds_tmp.height, coord_type);
-
- if(bounds_tmp.x < result.x)
- {
- //corrects left boundary
- result.width += result.x - bounds_tmp.x;
- result.x = bounds_tmp.x;
- }
- if(bounds_tmp.x + bounds_tmp.width > result.x + result.width)
- {
- //corrects right boundary
- result.width = bounds_tmp.x + bounds_tmp.width - result.x;
- }
- if(bounds_tmp.y < result.y)
- {
- //corrects top boundary
- result.height += result.y - bounds_tmp.y;
- result.y = bounds_tmp.y;
- }
- if(bounds_tmp.y + bounds_tmp.height > result.y + result.height)
- {
- //corrects buttom boundary
- result.height = bounds_tmp.y + bounds_tmp.height - result.y;
- }
- }
- *rect = result;
-}
-//**********************************my_atk_text_get_offset_at_point*********************
-gint my_atk_text_get_offset_at_point(AtkText* text, gint x, gint y, AtkCoordType coord_type)
-{
- gint line, relative_offset;
-
- line = get_point_line((MyAtkText*)text, y);
- relative_offset = get_point_relative_offset((MyAtkText*)text, x);
-
- return get_offset_at_line((MyAtkText*)text, line, relative_offset);
-}
-//*****************************my_atk_text_get_bounded_ranges******************************
-AtkTextRange** my_atk_text_get_bounded_ranges(AtkText *text, AtkTextRectangle *rect,
- AtkCoordType coord_type, AtkTextClipType x_clip_type, AtkTextClipType y_clip_type)
-{
- MyAtkText *self = (MyAtkText*)text;
-
- gint start_line, end_line, start_rel_offset, end_rel_offset;
- AtkTextRange** result;
- gint len = my_strlen(self->str);
-//macro for simplify return empty ranges when fail to do smth
-#define RETURN_EMTPY_RANGES {result = g_malloc(sizeof(AtkTextRange*));result[0] = NULL;return result;}
- //start line
- start_line = (y_clip_type == ATK_TEXT_CLIP_NONE) || (y_clip_type == ATK_TEXT_CLIP_MAX)
- ? 0 : get_point_line(self, rect->y);
- if(start_line < 0) start_line = 0;
- //end line
- end_line = (y_clip_type == ATK_TEXT_CLIP_NONE) || (y_clip_type == ATK_TEXT_CLIP_MIN)
- ? G_MAXINT/2 : get_point_line(self, rect->y + rect->height);
- if(end_line < 0) RETURN_EMTPY_RANGES;
- //start relative offset
- start_rel_offset = (x_clip_type == ATK_TEXT_CLIP_NONE) || (x_clip_type == ATK_TEXT_CLIP_MAX)
- ? 0 : get_point_relative_offset(self, rect->x);
- if(start_rel_offset < 0) start_rel_offset = 0;
- //end relative offset
- end_rel_offset = (x_clip_type == ATK_TEXT_CLIP_NONE) || (x_clip_type == ATK_TEXT_CLIP_MIN)
- ? G_MAXINT/2 : get_point_relative_offset(self, rect->x + rect->width);
- if(end_rel_offset < 0) RETURN_EMTPY_RANGES;
- //start offset(at the start of 'start_line')
- gint start_offset = get_offset_at_line_start(self, start_line);
- if(start_offset + start_rel_offset >= len) RETURN_EMTPY_RANGES;
-
- //count ranges
- gint number_of_ranges = count_ranges(self, start_offset,
- start_rel_offset, end_rel_offset, end_line - start_line + 1, NULL, coord_type);
- //create array(with just getting size)
- result = g_malloc(sizeof(AtkTextRange*) * (number_of_ranges + 1));
- //write ranges
- count_ranges(self, start_offset,
- start_rel_offset, end_rel_offset, end_line - start_line + 1, result, coord_type);
-#undef RETURN_EMPTY_RANGES
- return result;
-}
-
-//********************************my_atk_text_get_n_selections*******************************
-gint my_atk_text_get_n_selections(AtkText *text)
-{
- MyAtkText *self = (MyAtkText*)text;
- return self->selections->len;
-}
-
-//********************************my_atk_text_get_selection*******************************
-gchar* my_atk_text_get_selection(AtkText *text,
- gint selection_num, gint *start_offset, gint *end_offset)
-{
- MyAtkText *self = (MyAtkText*)text;
- GArray *selections = self->selections;
- if(selection_num < 0 || selection_num >= selections->len) return NULL;
- *start_offset = g_array_index(selections, TextSelection, selection_num).start_offset;
- *end_offset = g_array_index(selections, TextSelection, selection_num).end_offset;
- return my_atk_text_get_text(text, *start_offset, *end_offset);
-}
-//********************************my_atk_text_remove_selection*******************************
-gboolean my_atk_text_remove_selection(AtkText *text, gint selection_num)
-{
- MyAtkText *self = (MyAtkText*)text;
- GArray *selections = self->selections;
- if(selection_num < 0 || selection_num >= selections->len) return FALSE;
- g_array_remove_index(selections, selection_num);
-
- g_signal_emit_by_name(text, "text-selection-changed");
- return TRUE;
-}
-//********************************my_atk_text_add_selection*******************************
-gboolean my_atk_text_add_selection(AtkText *text, gint start_offset, gint end_offset)
-{
- if(start_offset < 0 || end_offset > my_atk_text_get_character_count(text)
- || start_offset >= end_offset) return FALSE;
-
- MyAtkText *self = (MyAtkText*)text;
- GArray *selections = self->selections;
- gint i;
- for(i = 0; i < selections->len; i++)
- {
- if(g_array_index(selections, TextSelection, i).start_offset >= start_offset)
- {
- if(g_array_index(selections, TextSelection, i).start_offset < end_offset)
- return FALSE;
- break;
- }
- }
- TextSelection new_selection;
- new_selection.start_offset = start_offset;
- new_selection.end_offset = end_offset;
- g_array_insert_val(selections, i, new_selection);
-
- g_signal_emit_by_name(text, "text-selection-changed");
- return TRUE;
-}
-//********************************my_atk_text_set_selection*******************************
-gboolean my_atk_text_set_selection(AtkText *text,
- gint selection_num, gint start_offset, gint end_offset)
-{
- MyAtkText *self = (MyAtkText*)text;
- GArray *selections = self->selections;
- if(selection_num < 0 || selection_num >= selections->len) return NULL;
-
- if((selection_num == 0
- || g_array_index(selections, TextSelection, selection_num - 1).end_offset <= start_offset)
- && (selection_num == selections->len - 1
- || g_array_index(selections, TextSelection, selection_num + 1).start_offset >= end_offset)
- )
- {
- //Arrange of selections won't change
- g_array_index(selections, TextSelection, selection_num).start_offset =
- start_offset;
- g_array_index(selections, TextSelection, selection_num).end_offset =
- end_offset;
- g_signal_emit_by_name(text, "text-selection-changed");
- return TRUE;
- }
- gint start_offset_old =
- g_array_index(selections, TextSelection, selection_num).start_offset;
- gint end_offset_old =
- g_array_index(selections, TextSelection, selection_num).end_offset;
-
- my_atk_text_remove_selection(text, selection_num);
- if(!my_atk_text_add_selection(text, start_offset, end_offset))
- {
- //fail when adding selection. Restore initial state.
- my_atk_text_add_selection(text, start_offset_old, end_offset_old);
- return FALSE;
- }
- g_signal_emit_by_name(text, "text-selection-changed");
- return TRUE;
-
-}
-
-//************************************my_atk_text_get_caret_offset******************
-gint my_atk_text_get_caret_offset(AtkText *text)
-{
- MyAtkText *self = (MyAtkText*)text;
- return self->caret_offset;
-}
-//************************************my_atk_text_set_caret_offset******************
-gboolean my_atk_text_set_caret_offset(AtkText *text, gint offset)
-{
- MyAtkText *self = (MyAtkText*)text;
- //caret may be set just after the last character
- if(offset < 0 || offset > my_atk_text_get_character_count(text))return FALSE;
- self->caret_offset = offset;
- g_signal_emit_by_name(self, "text-caret-moved", offset);
- return TRUE;
-}
-
-//***********************my_atk_text_insert_text*******************************
-void my_atk_text_insert_text(AtkEditableText* text, const gchar* string,
- gint length, gint *position)
-{
- gint i;
- MyAtkText* myAtkText = (MyAtkText*)text;
- gchar *str = myAtkText->str;
- gint strlen_old = my_strlen(str);
-
- if(string == NULL) return;
- //correct length
- for(i = 0; i < length; i ++)
- {
- if(string[i] == '\0') {length = i; break;}
- }
-
- if(*position < 0 || *position > strlen_old || length <= 0 )return;
-
-
- gchar *new_str = g_malloc(strlen_old + length + 1);
- if(new_str == NULL)return;
-
- if(*position != 0)
- memcpy(new_str, str, (size_t)*position);
- memcpy(new_str + *position, string, (size_t)length);
- if(strlen_old != *position)
- memcpy(new_str + *position + length, str + *position,
- (size_t)(strlen_old - *position));
- new_str[strlen_old + length] = '\0';
-
- g_free(str);
- myAtkText->str = new_str;
- correct_selections_after_insert(myAtkText, *position, length);
- correct_attributes_after_insert(myAtkText, *position, length);
- correct_caret_after_insert(myAtkText, *position, length);
- g_signal_emit_by_name(text, "text-changed::insert", *position, length);
- g_signal_emit_by_name(text, "text-selection-changed");
- g_signal_emit_by_name(text, "text-attributes-changed");
- g_signal_emit_by_name(text, "text-caret-moved", myAtkText->caret_offset);
-
- (*position) += length;
-}
-//*************************my_atk_text_delete_text*******************
-void my_atk_text_delete_text(AtkEditableText* text, gint start_pos, gint end_pos)
-{
- MyAtkText* myAtkText = (MyAtkText*)text;
- gchar *str = myAtkText->str;
- gint strlen_old = my_strlen(str);
-
- if(start_pos < 0 || end_pos > strlen_old || start_pos >= end_pos )return;
- if(strlen_old != end_pos)
- memmove(str + start_pos, str + end_pos, strlen_old - end_pos);
- str[start_pos - end_pos + strlen_old] = '\0';
-
- correct_selections_after_delete(myAtkText, start_pos, end_pos - start_pos);
- correct_attributes_after_delete(myAtkText, start_pos, end_pos - start_pos);
- correct_caret_after_delete(myAtkText, start_pos, end_pos - start_pos);
- g_signal_emit_by_name(text, "text-changed::delete", start_pos, end_pos - start_pos);
- g_signal_emit_by_name(text, "text-selection-changed");
- g_signal_emit_by_name(text, "text-attributes-changed");
- g_signal_emit_by_name(text, "text-caret-moved", myAtkText->caret_offset);
-}
-//***********************my_atk_text_set_text_contents*************************
-void my_atk_text_set_text_contents(AtkEditableText* text, const gchar* string)
-{
- my_atk_text_delete_text(text, 0, my_atk_text_get_character_count((AtkText*)text));
- gint position = 0;
- my_atk_text_insert_text(text, string, my_strlen(string), &position);
-}
-//**********************my_atk_text_copy_text***************************
-void my_atk_text_copy_text(AtkEditableText* text, gint start_pos, gint end_pos)
-{
- MyAtkText* myAtkText = (MyAtkText*)text;
- const gchar *str = myAtkText->str;
- gint strlen_old = my_strlen(str);
- if(start_pos < 0 || end_pos > strlen_old || start_pos >= end_pos )return;
-
- MyAtkTextClass *parent = MY_ATK_TEXT_GET_CLASS(text);
- g_free(parent->clipboard);
- /*parent->clipboard = g_malloc(end_pos - start_pos + 1);
-
- strncpy(parent->clipboard, str + start_pos, end_pos - start_pos);
- parent->clipboard[end_pos - start_pos] = '\0';*/
- parent->clipboard = g_strndup(str + start_pos, end_pos - start_pos);
-}
-//**********************my_atk_text_paste_text***************************
-void my_atk_text_paste_text(AtkEditableText *text, gint position)
-{
- //NULL-clipboard process corretly
- MyAtkTextClass* parent = MY_ATK_TEXT_GET_CLASS(text);
- my_atk_text_insert_text(text, parent->clipboard, my_strlen(parent->clipboard), &position);
-}
-//**********************my_atk_text_cut_text***************************
-void my_atk_text_cut_text(AtkEditableText* text, gint start_pos, gint end_pos)
-{
- my_atk_text_copy_text(text, start_pos, end_pos);
- my_atk_text_delete_text(text, start_pos, end_pos);
-}
-//*********************my_atk_text_set_run_attributes************************
-gboolean my_atk_text_set_run_attributes(AtkEditableText* text, AtkAttributeSet* attrib_set,
- gint start_offset, gint end_offset)
-{
- MyAtkText* self = (MyAtkText*)text;
- gint len = atk_text_get_character_count((AtkText*)text);
- if(start_offset < 0 || start_offset >= end_offset || end_offset > len)
- return FALSE;
- GList *attributes = self->attributes;
- GList *tmp = attributes;
-
- while(tmp != NULL)
- {
- Range *range = (Range*)tmp->data;
- if(range->start < start_offset)
- {
- if(range->end <= end_offset)
- {
- if(range->end > start_offset) range->end = start_offset;
- tmp = tmp->next;
- continue;
- }
- /*range->end > end_offset*/
- Range* additional_range = range_new(end_offset, range->end);
- additional_range->attributeSet = attribute_set_copy(range->attributeSet);
- range->end = start_offset;
- attributes = g_list_insert_before(attributes, tmp->next, additional_range);
- tmp = tmp->next;
- break;
- }
- else/*range->start >= start_offset*/
- {
- if(range->end <= end_offset)
- {
- GList *tmp1 = tmp->next;
- attributes = g_list_remove_link(attributes, tmp);
- tmp = tmp1;
- continue;
- }
- /*range->end > end_offset*/
- if(range->start < end_offset) range->start = end_offset;
- break;
- }
- }
- Range *new_range = range_new(start_offset, end_offset);
- new_range->attributeSet = attribute_set_copy(attrib_set);
- if(tmp == NULL)attributes = g_list_append(attributes, new_range);
- else attributes = g_list_insert_before(attributes, tmp, new_range);
-
- self->attributes = attributes;
- g_signal_emit_by_name(self, "text_attributes_changed");
- return TRUE;
-}
-
-//others functions
-//sets default attributes
-void my_atk_text_set_default_attributes(MyAtkText* text, AtkAttributeSet *set)
-{
- atk_attribute_set_free(text->default_attributes);
- text->default_attributes = attribute_set_copy(set);
- g_signal_emit_by_name(text, "text-attributes-changed");
-}
-
-void my_atk_text_print_run_attributes(MyAtkText *text)
-{
- g_list_foreach(text->attributes, (GFunc)range_print, NULL);
-}
-void my_atk_text_print_default_attributes(MyAtkText *text)
-{
- attribute_set_print(text->default_attributes);
-}
-//need for separate testing interfaces
-void auxiliary_atk_text_set_text_contents(MyAtkText* text, const gchar* string)
-{
- my_atk_text_set_text_contents((AtkEditableText*)text, string);
-}
-void auxiliary_atk_text_set_run_attributes(MyAtkText* text, AtkAttributeSet* attrib_set,
- gint start_offset, gint end_offset)
-{
- my_atk_text_set_run_attributes((AtkEditableText*)text, attrib_set, start_offset, end_offset);
-}
-
-//initialize/finalize functions
-static void my_atk_text_instance_init(GTypeInstance *obj, gpointer g_class)
-{
- MyAtkText *self = (MyAtkText*)obj;
-
- self->str = NULL;
- self->attributes = NULL;
- self->default_attributes = NULL;
- text_bounds_init(&self->bounds);
-
- self->selections = g_array_new(FALSE, FALSE, sizeof(TextSelection));
-
- self->caret_offset = 0;
-}
-static void my_atk_text_instance_finalize(GObject* obj)
-{
- MyAtkText *self = (MyAtkText*)obj;
- g_free(self->str);
- my_atk_text_free_run_attributes(self);
- my_atk_text_free_default_attributes(self);
- if(self->selections != NULL)g_array_free(self->selections, FALSE);
-}
-
-static void my_atk_text_class_init(gpointer g_class, gpointer class_data)
-{
- GObjectClass* g_object_class = (GObjectClass*)g_class;
- //GObject virtual table
- g_object_class->finalize = my_atk_text_instance_finalize;
- //Fills tables of symbols
- table_symbols_init();
- //initialize clipboard
- ((MyAtkTextClass*)g_class)->clipboard = NULL;
-}
-//Because of static registration of type, finalization function will never been called
-//And glib prints warning if use it in registration.
-/*static void my_atk_text_class_finalize(gpointer g_class, gpointer class_data)
-{
- MyAtkTextClass *self = (MyAtkTextClass*)g_class;
-
- g_free(self->clipboard);
- self->clipboard = NULL;
-}*/
-void my_atk_text_interface_init(gpointer g_iface, gpointer iface_data)
-{
- AtkTextIface *klass = (AtkTextIface*)g_iface;
- //"get_text"
- klass->get_character_count = my_atk_text_get_character_count;
- klass->get_text = my_atk_text_get_text;
- klass->get_character_at_offset = my_atk_text_get_character_at_offset;
- klass->get_text_after_offset = my_atk_text_get_text_after_offset;
- klass->get_text_at_offset = my_atk_text_get_text_at_offset;
- klass->get_text_before_offset = my_atk_text_get_text_before_offset;
- //"attributes"
- klass->get_run_attributes = my_atk_text_get_run_attributes;
- klass->get_default_attributes = my_atk_text_get_default_attributes;
- //"bounds"
- klass->get_character_extents = my_atk_text_get_character_extents;
- klass->get_range_extents = my_atk_text_get_range_extents;
- klass->get_offset_at_point = my_atk_text_get_offset_at_point;
- klass->get_bounded_ranges = my_atk_text_get_bounded_ranges;
- //"selection"
- klass->get_n_selections = my_atk_text_get_n_selections;
- klass->get_selection = my_atk_text_get_selection;
- klass->remove_selection = my_atk_text_remove_selection;
- klass->add_selection = my_atk_text_add_selection;
- klass->set_selection = my_atk_text_set_selection;
- //"caret"
- klass->get_caret_offset = my_atk_text_get_caret_offset;
- klass->set_caret_offset = my_atk_text_set_caret_offset;
-}
-
-static void my_atk_editable_text_interface_init(gpointer g_iface, gpointer iface_data)
-{
- AtkEditableTextIface *klass = (AtkEditableTextIface*)g_iface;
-
- klass->set_text_contents = my_atk_text_set_text_contents;
- klass->set_run_attributes = my_atk_text_set_run_attributes;
- klass->copy_text = my_atk_text_copy_text;
- klass->insert_text = my_atk_text_insert_text;
- klass->paste_text = my_atk_text_paste_text;
- klass->cut_text = my_atk_text_cut_text;
- klass->delete_text = my_atk_text_delete_text;
-}
-GType my_atk_text_get_type()
-{
- static GType type = 0;
- if(type == 0)
- {
- static const GTypeInfo typeInfo =
- {
- sizeof(MyAtkTextClass),
- NULL, //base_init
- NULL, //base_finalize
- my_atk_text_class_init, //class_init
- NULL, //class_finalize
- NULL, //class_data
- sizeof(MyAtkText),
- 0, //n_preallocs
- my_atk_text_instance_init //instance_init
- };
-
- static const GInterfaceInfo AtkTextIface_info =
- {
- my_atk_text_interface_init, /* interface_init*/
- NULL, /* interface_finalize*/
- NULL /* interface_data */
- };
- static const GInterfaceInfo AtkEditableTextIface_info =
- {
- my_atk_editable_text_interface_init,/* interface_init*/
- NULL, /* interface_finalize*/
- NULL /* interface_data */
- };
- type = g_type_register_static(MY_TYPE_ATK_OBJECT, "MyAtkText", &typeInfo, 0);
- g_type_add_interface_static(type,
- ATK_TYPE_TEXT,
- &AtkTextIface_info);
-
- g_type_add_interface_static(type,
- ATK_TYPE_EDITABLE_TEXT,
- &AtkEditableTextIface_info);
- }
- return type;
-}
diff --git a/tests/dummyatk/my-atk-text.h b/tests/dummyatk/my-atk-text.h
deleted file mode 100644
index 7a6a73ef..00000000
--- a/tests/dummyatk/my-atk-text.h
+++ /dev/null
@@ -1,60 +0,0 @@
-#ifndef MY_ATK_TEXT_H
-#define MY_ATK_TEXT_H
-/*
- * MyAtkText: implements AtkText and AtkEditableText
- */
-#include <atk/atk.h>
-
-#include "my-atk-object.h"
-
-#define MY_TYPE_ATK_TEXT (my_atk_text_get_type ())
-#define MY_ATK_TEXT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MY_TYPE_ATK_TEXT, MyAtkText))
-#define MY_ATK_TEXT_CLASS(vtable) (G_TYPE_CHECK_CLASS_CAST ((vtable), MY_TYPE_ATK_TEXT, MyAtkTextClass))
-#define MY_IS_ATK_TEXT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MY_TYPE_ATK_TEXT))
-#define MY_IS_ATK_TEXT_CLASS(vtable) (G_TYPE_CHECK_CLASS_TYPE ((vtable), MY_TYPE_ATK_TEXT))
-#define MY_ATK_TEXT_GET_CLASS(inst) (G_TYPE_INSTANCE_GET_CLASS ((inst), MY_TYPE_ATK_TEXT, MyAtkTextClass))
-
-typedef struct _MyAtkText MyAtkText;
-typedef struct _MyAtkTextClass MyAtkTextClass;
-
-//Struct, describing bounds of one selection.
-typedef struct
-{
- gint start_offset, end_offset;
-}TextSelection;
-//Struct, describing values, needed for determine extent of characters
-typedef struct
-{
- gint base_x, base_y;//coordinates of the top-left corner of text
- gint pixels_above_line;
- gint pixels_below_line;
- gint size;//size of the character(height in pixels)
- gint pixels_between_characters;//monoscaped font
- gint width;//width of character
-}TextBounds;
-
-struct _MyAtkText
-{
- MyAtkObject parent;
-
- gchar* str;//string, containing text
- GList* attributes;//running atributes
- AtkAttributeSet *default_attributes;//default attributes
-
- TextBounds bounds;
-
- GArray* selections;
-
- gint caret_offset;
-};
-
-struct _MyAtkTextClass
-{
- MyAtkObjectClass parent;
- gchar* clipboard;
-};
-
-GType my_atk_text_get_type();
-
-void my_atk_text_interface_init(gpointer g_iface, gpointer iface_data);
-#endif /*MY_ATK_TEXT_H*/
diff --git a/tests/dummyatk/my-atk-value.c b/tests/dummyatk/my-atk-value.c
deleted file mode 100644
index 3530d4f6..00000000
--- a/tests/dummyatk/my-atk-value.c
+++ /dev/null
@@ -1,113 +0,0 @@
-#include <atk/atk.h>
-#include <limits.h>
-
-#include "my-atk-object.h"
-#include "my-atk-value.h"
-
-//*************************implementation***********************
-//implementation of virtual functions
-//******************get_current_value*******************
-static void my_atk_value_get_current_value(AtkValue *obj, GValue *value)
-{
- g_return_if_fail(MY_IS_ATK_VALUE(obj));
- MyAtkValue* self = (MyAtkValue*)obj;
-
- g_value_init(value, G_TYPE_INT);
- g_value_set_int(value, self->current);
-}
-//******************get_maximum_value*******************
-static void my_atk_value_get_maximum_value(AtkValue *obj, GValue *value)
-{
- g_return_if_fail(MY_IS_ATK_VALUE(obj));
- MyAtkValue* self = (MyAtkValue*)obj;
-
- g_value_init(value, G_TYPE_INT);
- g_value_set_int(value, self->maximum);
-}
-//******************get_minimum_value*******************
-static void my_atk_value_get_minimum_value(AtkValue *obj, GValue *value)
-{
- g_return_if_fail(MY_IS_ATK_VALUE(obj));
- MyAtkValue* self = (MyAtkValue*)obj;
-
- g_value_init(value, G_TYPE_INT);
- g_value_set_int(value, self->minimum);
-}
-//******************set_current_value*******************
-static gboolean my_atk_value_set_current_value(AtkValue *obj, const GValue *value)
-{
- g_return_val_if_fail(MY_IS_ATK_VALUE(obj), FALSE);
- MyAtkValue* self = (MyAtkValue*)obj;
-
- if(self->readonly) return FALSE;
-
- gint new_value = g_value_get_int(value);
- if(new_value < self->minimum || new_value > self->maximum) return FALSE;
-
- self->current = new_value;
- return TRUE;
-}
-
-//others
-MyAtkValue* my_atk_value_new(gint minimum, gint maximum, gint current)
-{
- MyAtkValue* result = g_object_new(MY_TYPE_ATK_VALUE, NULL);
- if(result == NULL) return NULL;
- result->minimum = minimum;
- result->maximum = maximum;
- result->current = current;
-
- return result;
-}
-static void my_atk_value_instance_init(GTypeInstance *obj, gpointer g_class)
-{
- MyAtkValue *self = (MyAtkValue*)obj;
-
- self->minimum = 0;
- self->maximum = 0;
- self->current = 0;
-
- self->readonly = FALSE;
-}
-static void my_atk_value_interface_init(gpointer g_iface, gpointer iface_data)
-{
- AtkValueIface *klass = (AtkValueIface*)g_iface;
-
- klass->get_current_value = my_atk_value_get_current_value;
- klass->get_minimum_value = my_atk_value_get_minimum_value;
- klass->get_maximum_value = my_atk_value_get_maximum_value;
-
- klass->set_current_value = my_atk_value_set_current_value;
-}
-
-GType my_atk_value_get_type()
-{
- static GType type = 0;
- if(type == 0)
- {
- static const GTypeInfo typeInfo =
- {
- sizeof(MyAtkValueClass),
- NULL, //base_init
- NULL, //base_finalize
- NULL, //class_init
- NULL, //class_finalize
- NULL, //class_data
- sizeof(MyAtkValue),
- 0, //n_preallocs
- my_atk_value_instance_init //instance_init
- };
-
- static const GInterfaceInfo iface_info =
- {
- my_atk_value_interface_init, /* interface_init*/
- NULL, /* interface_finalize*/
- NULL /* interface_data */
- };
- type = g_type_register_static(MY_TYPE_ATK_OBJECT, "MyAtkValue", &typeInfo, 0);
- g_type_add_interface_static(type,
- ATK_TYPE_VALUE,
- &iface_info);
- }
- return type;
-}
diff --git a/tests/dummyatk/my-atk-value.h b/tests/dummyatk/my-atk-value.h
deleted file mode 100644
index 03ed6d1c..00000000
--- a/tests/dummyatk/my-atk-value.h
+++ /dev/null
@@ -1,34 +0,0 @@
-#ifndef MY_ATK_VALUE_H
-#define MY_ATK_VALUE_H
-/*
- * MyAtkValue: derives AtkObject
- * and implements AtkValue
- */
-#include <atk/atk.h>
-
-#define MY_TYPE_ATK_VALUE (my_atk_value_get_type ())
-#define MY_ATK_VALUE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MY_TYPE_ATK_VALUE, MyAtkValue))
-#define MY_ATK_VALUE_CLASS(vtable) (G_TYPE_CHECK_CLASS_CAST ((vtable), MY_TYPE_ATK_VALUE, MyAtkValueClass))
-#define MY_IS_ATK_VALUE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MY_TYPE_ATK_VALUE))
-#define MY_IS_ATK_VALUE_CLASS(vtable) (G_TYPE_CHECK_CLASS_TYPE ((vtable), MY_TYPE_ATK_VALUE))
-#define MY_ATK_VALUE_GET_CLASS(inst) (G_TYPE_INSTANCE_GET_CLASS ((inst), MY_TYPE_ATK_VALUE, MyAtkValueClass))
-
-typedef struct _MyAtkValue MyAtkValue;
-typedef struct _MyAtkValueClass MyAtkValueClass;
-
-struct _MyAtkValue
-{
- MyAtkObject parent;
-
- gint minimum, maximum, current;
- gboolean readonly;
-};
-
-struct _MyAtkValueClass
-{
- MyAtkObjectClass parent;
-};
-
-MyAtkValue* my_atk_value_new(gint minimum, gint maximium, gint current);
-GType my_atk_value_get_type();
-#endif /*MY_ATK_VALUE_H*/
diff --git a/tests/dummyatk/my-atk.h b/tests/dummyatk/my-atk.h
deleted file mode 100644
index 935d3d84..00000000
--- a/tests/dummyatk/my-atk.h
+++ /dev/null
@@ -1,14 +0,0 @@
-#ifndef MY_ATK_H
-#define MY_ATK_H
-
-#include <my-atk-action.h>
-#include <my-atk-component.h>
-#include <my-atk.h>
-#include <my-atk-hyperlink.h>
-#include <my-atk-hypertext.h>
-#include <my-atk-object.h>
-#include <my-atk-streamable-content.h>
-#include <my-atk-text.h>
-#include <my-atk-value.h>
-
-#endif /*MY_ATK_H*/
diff --git a/tests/dummyatk/resources_storage.c b/tests/dummyatk/resources_storage.c
deleted file mode 100644
index e86051db..00000000
--- a/tests/dummyatk/resources_storage.c
+++ /dev/null
@@ -1,34 +0,0 @@
-#include <atk/atk.h>
-
-GHashTable* resources = NULL;
-
-void resource_storage_init()
-{
- if(resources == NULL)
- resources = g_hash_table_new_full(g_str_hash, g_str_equal,
- (GDestroyNotify)g_free, (GDestroyNotify)g_object_unref);
-}
-
-void resource_storage_free()
-{
- if(resources == NULL) return;
- g_hash_table_destroy(resources);
- resources = NULL;
-}
-
-void resource_storage_add(const gchar* name, AtkObject* resource)
-{
- if(resources == NULL) return;
- g_hash_table_insert(resources, g_strdup(name), g_object_ref(resource));
-}
-
-AtkObject* resource_storage_get(const gchar* name)
-{
- if(resources == NULL) return NULL;
- return g_hash_table_lookup(resources, name);
-}
-void resources_storage_remove(const gchar* name)
-{
- if(resources == NULL) return;
- g_hash_table_remove(resources, name);
-}
diff --git a/tests/dummyatk/resources_storage.h b/tests/dummyatk/resources_storage.h
deleted file mode 100644
index 3decd86c..00000000
--- a/tests/dummyatk/resources_storage.h
+++ /dev/null
@@ -1,16 +0,0 @@
-#ifndef RESOURCES_STORAGE_H
-#define RESOURCES_STORAGE_H
-
-#include <glib.h>
-
-void resource_storage_init();
-
-void resource_storage_free();
-
-void resource_storage_add(const gchar* name, AtkObject* resource);
-
-AtkObject* resource_storage_get(const gchar* name);
-
-void resources_storage_remove(const gchar* name);
-
-#endif /*RESOURCES_STORAGE_H*/
diff --git a/tests/dummyatk/useful_functions.c b/tests/dummyatk/useful_functions.c
deleted file mode 100644
index 49b6a828..00000000
--- a/tests/dummyatk/useful_functions.c
+++ /dev/null
@@ -1,29 +0,0 @@
-#include <string.h>
-#include <glib.h>
-/*
- * Functions and macros widely used in the tests.
- */
-
-//same as strcmp() == 0 but works properly for NULL pointers
-gboolean my_strcmp(const gchar* str1, const gchar* str2)
-{
- if(str1 == str2) return TRUE;
- if(str1 == NULL || str2 == NULL) return FALSE;
-
- return strcmp(str1,str2) == 0;
-}
-//same as strlen but works properly for NULL pointer and returns gint instead of guint
-gint my_strlen(const gchar* str)
-{
- if(str == NULL)return 0;
- return (gint)strlen(str);
-}
-//same as strncmp() == 0 but works properly for NULL pointers
-gboolean my_strncmp(const gchar* str1, const gchar* str2, gint n)
-{
- if(n <= 0)return TRUE;
- if(str1 == str2)return TRUE;
- if(str1 == NULL || str2 == NULL)return FALSE;
-
- return strncmp(str1, str2, n) == 0;
-}
diff --git a/tests/dummyatk/useful_functions.h b/tests/dummyatk/useful_functions.h
deleted file mode 100644
index 4fbce6c0..00000000
--- a/tests/dummyatk/useful_functions.h
+++ /dev/null
@@ -1,30 +0,0 @@
-#ifndef USEFUL_FUNCTIONS_H
-#define USEFUL_FUNCTIONS_H
-/*
- * Functions and macros widely used in the tests.
- */
-
-//macro for creating objects in startup section
-#define OBJECT_NEW(obj, type, type_str) obj = g_object_new(type,NULL);\
- if(obj == NULL)\
- {\
- INIT_FAILED("Cannot create instance of type" type_str ".\n");\
- }
-//macro for destroying object
-#define OBJECT_UNREF(obj) if(obj != NULL)\
- {\
- g_object_unref((gpointer)obj);\
- }
-//for testing signals
-#define HANDLER_DISCONNECT(obj, h) if((h) != 0)\
- {\
- g_signal_handler_disconnect(obj, h);\
- }
-
-gboolean my_strcmp(const gchar* str1, const gchar* str2);
-
-gint my_strlen(const gchar* str);
-
-gboolean my_strncmp(const gchar* str1, const gchar* str2, gint n);
-
-#endif /*USEFUL_FUNCTIONS_H*/
diff --git a/tests/dummyatk/user_marshal.c b/tests/dummyatk/user_marshal.c
deleted file mode 100644
index 1f8ecf09..00000000
--- a/tests/dummyatk/user_marshal.c
+++ /dev/null
@@ -1,41 +0,0 @@
-#include <glib-object.h>
-
-/* INT:BOXED (marshal.list:1) */
-void
-g_cclosure_user_marshal_INT__BOXED (GClosure *closure,
- GValue *return_value,
- guint n_param_values,
- const GValue *param_values,
- gpointer invocation_hint,
- gpointer marshal_data)
-{
- typedef gint (*GMarshalFunc_INT__BOXED) (gpointer data1,
- gpointer arg_1,
- gpointer data2);
- register GMarshalFunc_INT__BOXED callback;
- register GCClosure *cc = (GCClosure*) closure;
- register gpointer data1, data2;
- gint v_return;
-
- g_return_if_fail (return_value != NULL);
- g_return_if_fail (n_param_values == 2);
-
- if (G_CCLOSURE_SWAP_DATA (closure))
- {
- data1 = closure->data;
- data2 = g_value_peek_pointer (param_values + 0);
- }
- else
- {
- data1 = g_value_peek_pointer (param_values + 0);
- data2 = closure->data;
- }
- callback = (GMarshalFunc_INT__BOXED) (marshal_data ? marshal_data : cc->callback);
-
- v_return = callback (data1,
- g_marshal_value_peek_boxed (param_values + 1),
- data2);
-
- g_value_set_int (return_value, v_return);
-}
-
diff --git a/tests/dummyatk/user_marshal.h b/tests/dummyatk/user_marshal.h
deleted file mode 100644
index a8459253..00000000
--- a/tests/dummyatk/user_marshal.h
+++ /dev/null
@@ -1,60 +0,0 @@
-#ifndef USER_MARSHAL_H
-#define USER_MARSHAL_H
-
-#include <glib-object.h>
-
-
-#ifdef G_ENABLE_DEBUG
-#define g_marshal_value_peek_boolean(v) g_value_get_boolean (v)
-#define g_marshal_value_peek_char(v) g_value_get_char (v)
-#define g_marshal_value_peek_uchar(v) g_value_get_uchar (v)
-#define g_marshal_value_peek_int(v) g_value_get_int (v)
-#define g_marshal_value_peek_uint(v) g_value_get_uint (v)
-#define g_marshal_value_peek_long(v) g_value_get_long (v)
-#define g_marshal_value_peek_ulong(v) g_value_get_ulong (v)
-#define g_marshal_value_peek_int64(v) g_value_get_int64 (v)
-#define g_marshal_value_peek_uint64(v) g_value_get_uint64 (v)
-#define g_marshal_value_peek_enum(v) g_value_get_enum (v)
-#define g_marshal_value_peek_flags(v) g_value_get_flags (v)
-#define g_marshal_value_peek_float(v) g_value_get_float (v)
-#define g_marshal_value_peek_double(v) g_value_get_double (v)
-#define g_marshal_value_peek_string(v) (char*) g_value_get_string (v)
-#define g_marshal_value_peek_param(v) g_value_get_param (v)
-#define g_marshal_value_peek_boxed(v) g_value_get_boxed (v)
-#define g_marshal_value_peek_pointer(v) g_value_get_pointer (v)
-#define g_marshal_value_peek_object(v) g_value_get_object (v)
-#else /* !G_ENABLE_DEBUG */
-/* WARNING: This code accesses GValues directly, which is UNSUPPORTED API.
- * Do not access GValues directly in your code. Instead, use the
- * g_value_get_*() functions
- */
-#define g_marshal_value_peek_boolean(v) (v)->data[0].v_int
-#define g_marshal_value_peek_char(v) (v)->data[0].v_int
-#define g_marshal_value_peek_uchar(v) (v)->data[0].v_uint
-#define g_marshal_value_peek_int(v) (v)->data[0].v_int
-#define g_marshal_value_peek_uint(v) (v)->data[0].v_uint
-#define g_marshal_value_peek_long(v) (v)->data[0].v_long
-#define g_marshal_value_peek_ulong(v) (v)->data[0].v_ulong
-#define g_marshal_value_peek_int64(v) (v)->data[0].v_int64
-#define g_marshal_value_peek_uint64(v) (v)->data[0].v_uint64
-#define g_marshal_value_peek_enum(v) (v)->data[0].v_long
-#define g_marshal_value_peek_flags(v) (v)->data[0].v_ulong
-#define g_marshal_value_peek_float(v) (v)->data[0].v_float
-#define g_marshal_value_peek_double(v) (v)->data[0].v_double
-#define g_marshal_value_peek_string(v) (v)->data[0].v_pointer
-#define g_marshal_value_peek_param(v) (v)->data[0].v_pointer
-#define g_marshal_value_peek_boxed(v) (v)->data[0].v_pointer
-#define g_marshal_value_peek_pointer(v) (v)->data[0].v_pointer
-#define g_marshal_value_peek_object(v) (v)->data[0].v_pointer
-#endif /* !G_ENABLE_DEBUG */
-
-
-void
-g_cclosure_user_marshal_INT__BOXED (GClosure *closure,
- GValue *return_value,
- guint n_param_values,
- const GValue *param_values,
- gpointer invocation_hint,
- gpointer marshal_data);
-
-#endif /*USER_MARSHAL_H*/
diff --git a/tests/pyatspi/Makefile.am b/tests/pyatspi/Makefile.am
deleted file mode 100644
index 97213ce9..00000000
--- a/tests/pyatspi/Makefile.am
+++ /dev/null
@@ -1,20 +0,0 @@
-SUBDIRS = pasytest
-
-EXTRA_DIST = \
- accessibletest.py\
- actiontest.py\
- componenttest.py\
- desktoptest.py\
- statetest.py\
- Makefile.am\
- Makefile.in\
- setvars.sh\
- relationtest.py\
- runtests.sh\
- testrunner
-
-TESTS_ENVIRONMENT = top_builddir=$(top_builddir) top_srcdir=$(top_srcdir)
-
-TESTS = runtests.sh
-
-CLEANFILES = *.pyc
diff --git a/tests/pyatspi/accessibletest.py b/tests/pyatspi/accessibletest.py
deleted file mode 100644
index 6cd2cddf..00000000
--- a/tests/pyatspi/accessibletest.py
+++ /dev/null
@@ -1,219 +0,0 @@
-import dbus
-import gobject
-import os.path
-
-from xml.dom import minidom
-import os
-
-from pasytest import PasyTest as _PasyTest
-
-import pyatspi
-from pyatspi import StateSet
-
-st = [pyatspi.STATE_MULTI_LINE,
- pyatspi.STATE_MODAL,
- pyatspi.STATE_INDETERMINATE,
- pyatspi.STATE_SUPPORTS_AUTOCOMPLETION,
- pyatspi.STATE_VERTICAL,]
-
-def _createNode(accessible, parentElement):
- e = minidom.Element("accessible")
-
- e.attributes["name"] = accessible.name
- e.attributes["role"] = str(int(accessible.getRole()))
- e.attributes["description"] = accessible.description
-
- for i in range(0, accessible.childCount):
- _createNode(accessible.getChildAtIndex(i), e)
-
- parentElement.appendChild(e)
-
-class AccessibleTest(_PasyTest):
-
- __tests__ = ["setup",
- "test_name",
- "test_getChildAtIndex",
- "test_isEqual",
- "test_getApplication",
- "test_getAttributes",
- "test_parent",
- "test_getIndexInParent",
- "test_getLocalizedRoleName",
- "test_getRelationSet",
- "test_getRole",
- "test_getRoleName",
- "test_getState",
- "test_childCount",
- "test_description",
- "test_tree",
- "teardown",
- ]
-
- def __init__(self, bus, path):
- _PasyTest.__init__(self, "Accessible", False)
- self._bus = bus
- self._path = path
-
- def setup(self, test):
- self._registry = pyatspi.Registry()
- print self._path
- self._desktop = self._registry.getDesktop(0)
-
- def test_name(self, test):
- root = self._desktop.getChildAtIndex(0)
- test.assertEqual(root.name, "main", "Expected name - \"main\". Recieved - \"%s\"" % (root.name,))
-
- def test_getChildAtIndex(self, test):
- root = self._desktop.getChildAtIndex(0)
- a = root.getChildAtIndex(0)
- test.assertEqual(a.name, "gnome-settings-daemon",
- "Expected name - \"gnome-settings-daemon\". Recieved - \"%s\"" % (a.name,))
- b = root.getChildAtIndex(1)
- test.assertEqual(b.name, "gnome-panel",
- "Expected name - \"gnome-panel\". Recieved - \"%s\"" % (b.name,))
- c = root.getChildAtIndex(2)
- test.assertEqual(c.name, "nautilus",
- "Expected name - \"nautilus\". Recieved - \"%s\"" % (c.name,))
-
- def test_isEqual(self, test):
- root = self._desktop.getChildAtIndex(0)
-
- a = root.getChildAtIndex(1)
- if not a.isEqual(a):
- test.fail("Same accessible found unequal to self")
-
- b = root.getChildAtIndex(1)
- if not a.isEqual(b):
- test.fail("Similar accessibles found unequal")
- if not b.isEqual(a):
- test.fail("Similar accessibles found unequal")
-
- c = root.getChildAtIndex(2)
- if c.isEqual(a):
- test.fail("Different accessibles found equal")
- if a.isEqual(c):
- test.fail("Different accessibles found equal")
-
- def test_getApplication(self, test):
- root = self._desktop.getChildAtIndex(0)
- application = root.getApplication()
- if not root.isEqual(application):
- test.fail("Root accessible does not provide itself as its Application")
-
- a = root.getChildAtIndex(1)
- application = a.getApplication()
- if not root.isEqual(application):
- test.fail("Child accessible does not provide the root as its Application")
-
-
- def test_getAttributes(self, test):
- root = self._desktop.getChildAtIndex(0)
- attr = root.getAttributes()
- res = ["foo:bar", "baz:qux", "quux:corge"]
- attr.sort()
- res.sort()
- test.assertEqual(attr, res, "Attributes expected %s, recieved %s" % (attr, res))
-
- def test_parent(self, test):
- root = self._desktop.getChildAtIndex(0)
-
- a = root.getChildAtIndex(1)
- pa = a.parent
- if not root.isEqual(pa):
- test.fail("Child does not correctly report its parent")
-
- def test_getIndexInParent(self, test):
- root = self._desktop.getChildAtIndex(0)
-
- for i in range(0, root.childCount):
- child = root.getChildAtIndex(i)
- test.assertEqual(i, child.getIndexInParent(), "Childs index in parent reported incorrectly")
-
- def test_getLocalizedRoleName(self, test):
- root = self._desktop.getChildAtIndex(0)
-
- ans = "window"
- res = root.getLocalizedRoleName()
- test.assertEqual(ans, res,
- "Expected LocalizedRoleName - \"%s\". Recieved - \"%s\"" % (ans, res,))
-
- a = root.getChildAtIndex(1)
- a = a.getChildAtIndex(0)
- ans = "html container"
- res = a.getLocalizedRoleName()
- test.assertEqual(ans, res,
- "Expected LocalizedRoleName - \"%s\". Recieved - \"%s\"" % (ans, res,))
-
- def test_getRelationSet(self, test):
- root = self._desktop.getChildAtIndex(0)
- # Complete test of Relation interface is separate
- rset = root.getRelationSet()
-
- def test_getRole(self, test):
- root = self._desktop.getChildAtIndex(0)
- test.assertEqual(root.getRole(), 69,
- "Expected role - \"69\". Recieved - \"%d\"" % (int(root.getRole()),))
-
- def test_getRoleName(self, test):
- root = self._desktop.getChildAtIndex(0)
-
- ans = "window"
- res = root.getRoleName()
- test.assertEqual(ans, res,
- "Expected roleName - \"%s\". Recieved - \"%s\"" % (ans, res,))
-
- a = root.getChildAtIndex(1)
- a = a.getChildAtIndex(0)
- ans = "html container"
- res = a.getRoleName()
- test.assertEqual(ans, res,
- "Expected roleName - \"%s\". Recieved - \"%s\"" % (ans, res,))
-
- def test_getState(self, test):
- root = self._desktop.getChildAtIndex(0)
- state = root.getState()
- res = StateSet(*st)
- if not res.equals(state):
- test.fail("States not reported correctly")
-
- def test_childCount(self, test):
- root = self._desktop.getChildAtIndex(0)
- test.assertEqual(root.childCount, 11,
- "Expected role - \"11\". Recieved - \"%d\"" % (root.childCount,))
-
- def test_description(self, test):
- root = self._desktop.getChildAtIndex(0)
- description = "The main accessible object, root of the accessible tree"
- test.assertEqual(root.description, description,
- "Expected description - \"%s\". Recieved - \"%s\"" % (description, root.description,))
-
- def test_tree(self, test):
- """
- This is a mild stress test for the
- methods:
-
- getChildAtIndex
-
- And the attributes:
-
- name
- description
-
- It checks a tree of these values is correctly
- passed from Application to AT.
- """
- root = self._desktop.getChildAtIndex(0)
-
- doc = minidom.Document()
- _createNode(root, doc)
- answer = doc.toprettyxml()
-
- correct = os.path.join(os.environ["TEST_DATA_DIRECTORY"],
- "accessible-test-results.xml")
- file = open(correct)
- cstring = file.read()
-
- test.assertEqual(answer, cstring, "Object tree not passed correctly")
-
- def teardown(self, test):
- pass
diff --git a/tests/pyatspi/actiontest.py b/tests/pyatspi/actiontest.py
deleted file mode 100644
index 405f898c..00000000
--- a/tests/pyatspi/actiontest.py
+++ /dev/null
@@ -1,73 +0,0 @@
-import dbus
-import gobject
-import os.path
-
-from xml.dom import minidom
-import os
-
-from pasytest import PasyTest as _PasyTest
-
-import pyatspi
-
-class ActionTest(_PasyTest):
-
- __tests__ = ["setup",
- "test_nActions",
- "test_getDescription",
- "test_getName",
- "test_doAction",
- "test_getKeyBinding",
- "teardown",
- ]
-
- def __init__(self, bus, path):
- _PasyTest.__init__(self, "Action", False)
- self._bus = bus
- self._path = path
-
- def setup(self, test):
- self._registry = pyatspi.Registry()
- self._desktop = self._registry.getDesktop(0)
-
- def test_nActions(self, test):
- root = self._desktop[0]
- root = root.queryAction()
- nact = root.nActions
- test.assertEqual(nact, 10, "nActions expected %d, recieved %d" % (10, nact))
-
- def test_getName(self, test):
- root = self._desktop[0]
- root = root.queryAction()
- name = root.getName(0)
- test.assertEqual(name, "First action", "Name expected %s, recieved %s" % ("First action", name))
- name = root.getName(1)
- test.assertEqual(name, "Action", "Name expected %s, recieved %s" % ("Action", name))
-
- def test_getDescription(self, test):
- root = self._desktop[0]
- root = root.queryAction()
- description = root.getDescription(0)
- expected = "First action performed"
- test.assertEqual(description, expected, "Description expected %s, recieved %s" % (expected, description))
- description = root.getDescription(1)
- expected = "Description of action"
- test.assertEqual(description, expected, "Description expected %s, recieved %s" % (expected, description))
-
- def test_doAction(self, test):
- root = self._desktop[0]
- root = root.queryAction()
- #TODO have event emitted to check action has been performed
- for i in range(0, root.nActions):
- root.doAction(i)
-
- def test_getKeyBinding(self, test):
- root = self._desktop[0]
- root = root.queryAction()
- for i in range(0, root.nActions):
- keybinding = root.getKeyBinding(i)
- expected = "%s" % (i,)
- test.assertEqual(keybinding, expected,
- "Keybinding expected %s, recieved %s" % (expected, keybinding))
-
- def teardown(self, test):
- pass
diff --git a/tests/pyatspi/componenttest.py b/tests/pyatspi/componenttest.py
deleted file mode 100644
index fe30c884..00000000
--- a/tests/pyatspi/componenttest.py
+++ /dev/null
@@ -1,145 +0,0 @@
-import dbus
-import gobject
-import os.path
-
-from xml.dom import minidom
-import os
-
-from pasytest import PasyTest as _PasyTest
-
-import pyatspi
-from pyatspi import Accessible
-from pyatspi import BoundingBox
-
-ATSPI_LAYER_WIDGET = 3
-ATSPI_LAYER_MDI = 4
-ATSPI_LAYER_WINDOW = 7
-
-extents_expected = [(0,0,30,20), (40,30,30,40), (0,0,70,70)]
-sizes_expected = [(30,20), (30,40), (70,70)]
-positions_expected = [(0,0), (40,30), (0,0)]
-layers_expected = [ATSPI_LAYER_WINDOW, ATSPI_LAYER_WIDGET, ATSPI_LAYER_MDI]
-zorders_expected = [-100, 100]
-
-class ComponentTest(_PasyTest):
-
- __tests__ = ["setup",
- "test_contains",
- "test_getAccessibleAtPoint",
- "test_getExtents",
- "test_getPosition",
- "test_getSize",
- "test_getLayer",
- "test_getMDIZOrder",
- "test_grabFocus",
- "test_registerFocusHandler",
- "test_deregisterFocusHandler",
- "test_getAlpha",
- "teardown",
- ]
-
- def __init__(self, bus, path):
- _PasyTest.__init__(self, "Component", False)
- self._bus = bus
- self._path = path
-
- def setup(self, test):
- self._registry = pyatspi.Registry()
- self._desktop = self._registry.getDesktop(0)
-
- def test_contains(self, test):
- pass
-
- def test_getAccessibleAtPoint(self, test):
- pass
-
- def test_getExtents(self, test):
- root = self._desktop.getChildAtIndex(0)
- one = root.getChildAtIndex(0)
- two = root.getChildAtIndex(1)
-
- comps = [one.queryComponent(),
- two.queryComponent(),
- root.queryComponent(),]
-
- for expected, comp in zip(extents_expected, comps):
- extents = comp.getExtents(0)
- test.assertEqual(extents, BoundingBox(*expected),
- "Extents not correct. Expected (%d, %d, %d, %d), Recieved (%d, %d, %d, %d)"
- % (expected[0], expected[1], expected[2], expected[3],
- extents[0], extents[1], extents[2], extents[3]))
-
- def test_getPosition(self, test):
- pass
- root = self._desktop.getChildAtIndex(0)
- one = root.getChildAtIndex(0)
- two = root.getChildAtIndex(1)
-
- comps = [one.queryComponent(),
- two.queryComponent(),
- root.queryComponent(),]
-
- for expected, comp in zip(positions_expected, comps):
- position = comp.getPosition(0)
- test.assertEqual(position, expected,
- "Position not correct. Expected (%d, %d) Recieved (%d, %d)"
- % (expected[0], expected[1], position[0], position[1]))
-
- def test_getSize(self, test):
- root = self._desktop.getChildAtIndex(0)
- one = root.getChildAtIndex(0)
- two = root.getChildAtIndex(1)
-
- comps = [one.queryComponent(),
- two.queryComponent(),
- root.queryComponent(),]
-
- for expected, comp in zip(sizes_expected, comps):
- size = comp.getSize()
- test.assertEqual(size, expected,
- "Size not correct. Expected (%d, %d) Recieved (%d, %d)"
- % (expected[0], expected[1], size[0], size[1]))
-
- def test_getLayer(self, test):
- root = self._desktop.getChildAtIndex(0)
- one = root.getChildAtIndex(0)
- two = root.getChildAtIndex(1)
-
- comps = [one.queryComponent(),
- two.queryComponent(),
- root.queryComponent(),]
-
- for expected, comp in zip(layers_expected, comps):
- layer = comp.getLayer()
- test.assertEqual(layer, expected,
- "Layer not correct. Expected %d, Recieved %d"
- % (int(layer), int(expected)))
-
- def test_getMDIZOrder(self, test):
- root = self._desktop.getChildAtIndex(0)
- one = root.getChildAtIndex(0)
- two = root.getChildAtIndex(1)
-
- comps = [two.queryComponent(),
- root.queryComponent(),]
-
- for expected, comp in zip(zorders_expected, comps):
- mdizo = comp.getMDIZOrder()
- test.assertEqual(mdizo, expected,
- "ZOrder not correct. Expected %d, Recieved %d"
- % (expected, mdizo))
-
- def test_grabFocus(self, test):
- pass
-
- def test_registerFocusHandler(self, test):
- pass
-
- def test_deregisterFocusHandler(self, test):
- pass
-
- def test_getAlpha(self, test):
- pass
-
- def teardown(self, test):
- pass
diff --git a/tests/pyatspi/desktoptest.py b/tests/pyatspi/desktoptest.py
deleted file mode 100644
index 409f634d..00000000
--- a/tests/pyatspi/desktoptest.py
+++ /dev/null
@@ -1,184 +0,0 @@
-import dbus
-import gobject
-import os.path
-
-from xml.dom import minidom
-import os
-
-from pasytest import PasyTest as _PasyTest
-
-import pyatspi
-
-class DesktopTest(_PasyTest):
-
- __tests__ = ["setup",
- "test_name",
- "test_getChildAtIndex",
- "test_isEqual",
- "test_getApplication",
- "test_getAttributes",
- "test_parent",
- "test_getIndexInParent",
- "test_getLocalizedRoleName",
- "test_getRelationSet",
- "test_getRole",
- "test_getRoleName",
- "test_getState",
- "test_childCount",
- "test_description",
- "test_contains",
- "test_getAccessibleAtPoint",
- "test_getExtents",
- "test_getPosition",
- "test_getSize",
- "test_getLayer",
- "test_getMDIZOrder",
- "test_grabFocus",
- "test_registerFocusHandler",
- "test_deregisterFocusHandler",
- "test_getAlpha",
- "teardown",
- ]
-
- def __init__(self, bus, path):
- _PasyTest.__init__(self, "Desktop", False)
- self._bus = bus
- self._path = path
-
- def setup(self, test):
- self._registry = pyatspi.Registry()
- self._desktop = self._registry.getDesktop(0)
-
- def test_name(self, test):
- name = self._desktop.name
- test.assertEqual(name, "main", "Expected name - \"main\". Recieved - \"%s\"" % (name,))
-
- def test_getChildAtIndex(self, test):
- root = self._desktop.getChildAtIndex(0)
- test.assertEqual(root.name, "main",
- "Expected name - \"main\". Recieved - \"%s\"" % (root.name,))
-
- def test_isEqual(self, test):
- if not self._desktop.isEqual(self._desktop):
- test.fail("Same accessible found unequal to self")
-
- root = self._desktop.getChildAtIndex(0)
- if root.isEqual(self._desktop):
- test.fail("Different accessibles found equal")
- if self._desktop.isEqual(root):
- test.fail("Different accessibles found equal")
-
- def test_getApplication(self, test):
- test.assertEqual(self._desktop.getApplication(), None,
- "Expected application - \"None\". Recieved - \"%s\"" % (self._desktop.getApplication(),))
-
- def test_getAttributes(self, test):
- test.assertEqual(self._desktop.getAttributes(), [],
- "Expected attributes - \"[]\". Recieved - \"%s\"" % (self._desktop.getAttributes(),))
-
- def test_parent(self, test):
- test.assertEqual(self._desktop.parent, None,
- "Expected parent - \"None\". Recieved - \"%s\"" % (self._desktop.parent,))
-
- def test_getIndexInParent(self, test):
- test.assertEqual(self._desktop.getIndexInParent(), -1,
- "Expected index - \"-1\". Recieved - \"%d\"" % (self._desktop.getIndexInParent(),))
-
- def test_getLocalizedRoleName(self, test):
- ans = "unknown"
- res = self._desktop.getLocalizedRoleName()
- test.assertEqual(ans, res,
- "Expected LocalizedRoleName - \"%s\". Recieved - \"%s\"" % (ans, res,))
-
- def test_getRelationSet(self, test):
- rset = self._desktop.getRelationSet()
- test.assertEqual(rset, [],
- "Expected relation set - \"[]\". Recieved - \"%s\"" % (rset,))
-
- def test_getRole(self, test):
- test.assertEqual(self._desktop.getRole(), pyatspi.ROLE_UNKNOWN,
- "Expected role - \"ROLE_UNKNOWN\". Recieved - \"%s\"" % (self._desktop.getRole(),))
-
- def test_getRoleName(self, test):
- ans = "unknown"
- res = self._desktop.getRoleName()
- test.assertEqual(ans, res,
- "Expected RoleName - \"%s\". Recieved - \"%s\"" % (ans, res,))
-
- def test_getState(self, test):
- state = self._desktop.getState()
- res = pyatspi.StateSet()
- if not state.equals(res):
- test.fail("Desktop state set is not empty")
-
- def test_childCount(self, test):
- test.assertEqual(self._desktop.childCount, 1,
- "Expected childCount - \"1\". Recieved - \"%d\"" % (self._desktop.childCount,))
-
- def test_description(self, test):
- description = ""
- test.assertEqual(self._desktop.description, description,
- "Expected description - \"%s\". Recieved - \"%s\"" % (description, self._desktop.description,))
-
- def test_contains(self, test):
- pass
-
- def test_getAccessibleAtPoint(self, test):
- pass
-
- def test_getExtents(self, test):
- comp = self._desktop.queryComponent()
-
- extents = comp.getExtents(0)
- expected = pyatspi.BoundingBox(*(0,0,1024, 768))
- test.assertEqual(extents, expected,
- "Extents not correct. Expected (%d, %d, %d, %d), Recieved (%d, %d, %d, %d)"
- % (expected[0], expected[1], expected[2], expected[3],
- extents[0], extents[1], extents[2], extents[3]))
-
- def test_getPosition(self, test):
- comp = self._desktop.queryComponent()
-
- position = comp.getPosition(0)
- test.assertEqual(position, (0,0),
- "Position not correct. Expected (%d, %d) Recieved (%d, %d)"
- % (0, 0, position[0], position[1]))
-
- def test_getSize(self, test):
- comp = self._desktop.queryComponent()
-
- size = comp.getSize()
- test.assertEqual(size, (1024, 768),
- "Size not correct. Expected (%d, %d) Recieved (%d, %d)"
- % (1024, 768, size[0], size[1]))
-
- def test_getLayer(self, test):
- comp = self._desktop.queryComponent()
-
- layer = comp.getLayer()
- test.assertEqual(layer, pyatspi.LAYER_WIDGET,
- "Layer not correct. Expected %d, Recieved %d"
- % (layer, pyatspi.LAYER_WIDGET))
-
- def test_getMDIZOrder(self, test):
- comp = self._desktop.queryComponent()
-
- mdizo = comp.getMDIZOrder()
- test.assertEqual(mdizo, 0,
- "ZOrder not correct. Expected %d, Recieved %d"
- % (0, mdizo))
-
- def test_grabFocus(self, test):
- pass
-
- def test_registerFocusHandler(self, test):
- pass
-
- def test_deregisterFocusHandler(self, test):
- pass
-
- def test_getAlpha(self, test):
- pass
-
- def teardown(self, test):
- pass
diff --git a/tests/pyatspi/pasytest/Events.py b/tests/pyatspi/pasytest/Events.py
deleted file mode 100644
index 8e340ff7..00000000
--- a/tests/pyatspi/pasytest/Events.py
+++ /dev/null
@@ -1,78 +0,0 @@
-#C#-Style Events in Python
-#Taken from http://code.activestate.com/recipes/410686/
-#By Zoran Isailovski
-
-class Events:
- def __getattr__(self, name):
- if hasattr(self.__class__, '__events__'):
- assert name in self.__class__.__events__, \
- "Event '%s' is not declared" % name
- self.__dict__[name] = ev = _EventSlot(name)
- return ev
- def __repr__(self): return 'Events' + str(list(self))
- __str__ = __repr__
- def __len__(self): return NotImplemented
- def __iter__(self):
- def gen(dictitems=self.__dict__.items()):
- for attr, val in dictitems:
- if isinstance(val, _EventSlot):
- yield val
- return gen()
-
-#------------------------------------------------------------------------------
-
-class _EventSlot:
- def __init__(self, name):
- self.targets = []
- self.__name__ = name
- def __repr__(self):
- return 'event ' + self.__name__
- def __call__(self, *a, **kw):
- for f in self.targets: f(*a, **kw)
- def __iadd__(self, f):
- self.targets.append(f)
- return self
- def __isub__(self, f):
- while f in self.targets: self.targets.remove(f)
- return self
-
-#------------------------------------------------------------------------------
-
-if __name__ == '__main__':
-
- class MyEvents(Events):
- __events__ = ('OnChange', )
-
- class ValueModel(object):
- def __init__(self):
- self.events = MyEvents()
- self.__value = None
- def __set(self, value):
- if (self.__value == value): return
- self.__value = value
- self.events.OnChange()
- ##self.events.OnChange2() # would fail
- def __get(self):
- return self.__value
- Value = property(__get, __set, None, 'The actual value')
-
- class SillyView(object):
- def __init__(self, model):
- self.model = model
- model.events.OnChange += self.DisplayValue
- ##model.events.OnChange2 += self.DisplayValue # would raise exeception
- def DisplayValue(self):
- print self.model.Value
-
-
- model = ValueModel()
- view = SillyView(model)
-
- print '\n--- Events Demo ---'
- # Events in action
- for i in range(5):
- model.Value = 2*i + 1
- # Events introspection
- print model.events
- for event in model.events:
- print event
diff --git a/tests/pyatspi/pasytest/Makefile.am b/tests/pyatspi/pasytest/Makefile.am
deleted file mode 100644
index 1fa89ed4..00000000
--- a/tests/pyatspi/pasytest/Makefile.am
+++ /dev/null
@@ -1,6 +0,0 @@
-EXTRA_DIST = \
- Events.py\
- Pasy.py\
- __init__.py
-
-CLEANFILES = *.pyc
diff --git a/tests/pyatspi/pasytest/Pasy.py b/tests/pyatspi/pasytest/Pasy.py
deleted file mode 100644
index 80318ee7..00000000
--- a/tests/pyatspi/pasytest/Pasy.py
+++ /dev/null
@@ -1,146 +0,0 @@
-#Copyright (C) 2008 Codethink Ltd
-
-#his program is free software; you can redistribute it and/or modify
-#it under the terms of the GNU General Public License as published by
-#the Free Software Foundation; either version 2 of the License, or
-#(at your option) any later version.
-
-#This program 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 General Public License for more details.
-#You should have received a copy of the GNU General Public License
-#along with this program; if not, write to the Free Software
-#Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-import gobject
-from Events import Events
-
-import traceback
-
-PASY_TEST_NOT_STARTED = 0
-PASY_TEST_IN_PROGRESS = 1
-PASY_TEST_FAIL = 2
-PASY_TEST_WIN = 3
-
-class PasyEvents(Events):
- __events__ = ('finished', )
-
-class PasyTestStep(object):
-
- def __init__(self, name):
- self.events = PasyEvents()
- self._state = PASY_TEST_NOT_STARTED
-
- self._name = name
-
- def win(self):
- if self._state == PASY_TEST_IN_PROGRESS:
- self._state = PASY_TEST_WIN
- self.events.finished()
-
- def fail(self, msg):
- if self._state == PASY_TEST_IN_PROGRESS:
- self._state = PASY_TEST_FAIL
- self.failMsg = msg
- self.events.finished()
-
- def assertEqual(self, a, b, msg):
- if a != b:
- self.fail(msg)
-
- def assertNotEqual(self, a, b, msg):
- if a == b:
- self.fail(msg)
-
- def run(self):
- self._state = PASY_TEST_IN_PROGRESS
- self.entry()
-
- def report(self):
- if self._state == PASY_TEST_WIN:
- return "%s - PASSED" % (self._name,)
- elif self._state == PASY_TEST_FAIL:
- return "%s - FAILED - %s" % (self._name, self.failMsg)
- else:
- return "%s - INCOMPLETE" % (self._name,)
-
- @property
- def state(self):
- return self._state
-
-class PasyTestFunc(PasyTestStep):
-
- def __init__(self, name, func):
- PasyTestStep.__init__(self, name)
- self._func = func
-
- def entry(self):
- try:
- self._func(self)
- except Exception, e:
- self.fail(e.message)
- traceback.print_exc()
- self.win()
-
-class PasyTest(PasyTestStep):
-
- __tests__ = []
-
- def __init__(self, name, cont):
- PasyTestStep.__init__(self, name)
-
- self._cont = cont
- self._tests = []
-
- for name in self.__tests__:
- func = getattr(self, name)
- self._addfunc(func.func_name, func)
-
- def _addfunc(self, name, func):
- functest = PasyTestFunc(func.func_name, func)
- self._tests.append(functest)
-
- def entry(self):
- self._iter = self._test_iterator()
- gobject.idle_add(self.idle_handler)
-
- def idle_handler(self):
- try:
- step = self._iter.next()
- def finished_handler():
- if step.state == PASY_TEST_WIN or self._cont == True:
- gobject.idle_add(self.idle_handler)
- elif step.state == PASY_TEST_FAIL and self._cont == False:
- self.fail("Sub test %s Failed" % step._name)
- step.events.finished += finished_handler
- step.run()
- except StopIteration:
- # No More tests, check for success or fail
- succeeded = True
- for test in self._tests:
- succeeded = succeeded and (test.state == PASY_TEST_WIN)
- if succeeded:
- self.win()
- else:
- self.fail()
- return False
-
- def _test_iterator(self):
- for test in self._tests:
- yield test
-
- def report(self):
- if self._state == PASY_TEST_WIN:
- header = "%s - PASSED" % (self._name,)
- elif self._state == PASY_TEST_FAIL:
- header = "%s - FAILED" % (self._name,)
- else:
- header = "%s - INCOMPLETE" %s (self._name,)
-
- step_messages = []
- for test in self._tests:
- step_messages.append(test.report())
-
- step_report = "\n\t".join(step_messages)
- return header + "\n\t" + step_report
diff --git a/tests/pyatspi/pasytest/__init__.py b/tests/pyatspi/pasytest/__init__.py
deleted file mode 100644
index c54bff1f..00000000
--- a/tests/pyatspi/pasytest/__init__.py
+++ /dev/null
@@ -1,16 +0,0 @@
-#Copyright (C) 2008 Codethink Ltd
-
-#his program is free software; you can redistribute it and/or modify
-#it under the terms of the GNU General Public License as published by
-#the Free Software Foundation; either version 2 of the License, or
-#(at your option) any later version.
-
-#This program 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 General Public License for more details.
-#You should have received a copy of the GNU General Public License
-#along with this program; if not, write to the Free Software
-#Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-from Pasy import PasyTestStep, PasyTestFunc, PasyTest
diff --git a/tests/pyatspi/relationtest.py b/tests/pyatspi/relationtest.py
deleted file mode 100644
index 77ce31ca..00000000
--- a/tests/pyatspi/relationtest.py
+++ /dev/null
@@ -1,70 +0,0 @@
-import dbus
-import gobject
-import os.path
-
-from xml.dom import minidom
-import os
-
-from pasytest import PasyTest as _PasyTest
-
-import pyatspi
-
-class RelationTest(_PasyTest):
-
- __tests__ = ["setup",
- "teardown",
- "test_getRelationType",
- "test_getRelationTypeName",
- "test_getNTargets",
- "test_getTarget",
- ]
-
- def __init__(self, bus, path):
- _PasyTest.__init__(self, "Relation", False)
- self._bus = bus
- self._path = path
-
- def setup(self, test):
- self._registry = pyatspi.Registry()
- self._desktop = self._registry.getDesktop(0)
- self._root = self._desktop[0]
- self._rset = self._root.getRelationSet()
- test.assertEqual(len(self._rset), 4, "Num relations expected %d, recieved %d" % (6, len(self._rset)))
-
- def test_getRelationType(self, test):
- expected = [pyatspi.RELATION_EMBEDS,
- pyatspi.RELATION_PARENT_WINDOW_OF,
- pyatspi.RELATION_DESCRIBED_BY,
- pyatspi.RELATION_POPUP_FOR,]
- rtypes = [rel.getRelationType() for rel in self._rset]
- for exp, type in zip(expected, rtypes):
- test.assertEqual(exp, type, "Relation type expected %s, recieved %s" % (exp, type))
-
- def test_getRelationTypeName(self, test):
- # FIXME This may not have been implemented in CORBA.
- # Completely unused?
- pass
-
- def test_getNTargets(self, test):
- expected = [1, 1, 1, 3]
- ntargs = [rel.getNTargets() for rel in self._rset]
- for exp, ntarg in zip(expected, ntargs):
- test.assertEqual(exp, ntarg, "Number of targets expected %s, recieved %s" % (exp, ntarg))
-
- def test_getTarget(self, test):
- rone = self._rset[0]
- tone = rone.getTarget(0)
- tonename = tone.name
- test.assertEqual(tonename, "r1", "Target name expected %s, recieved %s" % ("r1", tonename))
- tonerole = tone.getRoleName()
- test.assertEqual(tonerole, "invalid", "Target RoleName expected %s, recieved %s" % ("invalid", tonename))
-
- rtwo = self._rset[3]
- ttwo = rtwo.getTarget(2)
- ttwoname = ttwo.name
- test.assertEqual(ttwoname, "m3", "Target name expected %s, recieved %s" % ("m3", ttwoname))
- ttworole = ttwo.getRoleName()
- test.assertEqual(ttworole, "invalid", "Target RoleName expected %s, recieved %s" % ("invalid", ttwoname))
-
- def teardown(self, test):
- pass
diff --git a/tests/pyatspi/runtests.sh b/tests/pyatspi/runtests.sh
deleted file mode 100755
index 1ef12950..00000000
--- a/tests/pyatspi/runtests.sh
+++ /dev/null
@@ -1,12 +0,0 @@
-export PYTHONPATH=$top_srcdir
-
-export TEST_DATA_DIRECTORY=$top_srcdir/tests/data
-export TEST_ATSPI_LIBRARY=$top_builddir/atk-adaptor/.libs/libspiatk.so
-export TEST_MODULES_DIRECTORY=$top_builddir/tests/apps/.libs
-export TEST_APPLICATION=$top_builddir/tests/apps/test-application
-
-$PYTHON $top_srcdir/tests/pyatspi/testrunner -l libaccessibleapp.so -m accessibletest -n AccessibleTest
-$PYTHON $top_srcdir/tests/pyatspi/testrunner -l libactionapp.so -m actiontest -n ActionTest
-$PYTHON $top_srcdir/tests/pyatspi/testrunner -l libcomponentapp.so -m componenttest -n ComponentTest
-$PYTHON $top_srcdir/tests/pyatspi/testrunner -l librelationapp.so -m relationtest -n RelationTest
-$PYTHON $top_srcdir/tests/pyatspi/testrunner -l libaccessibleapp.so -m statetest -n StateTest
diff --git a/tests/pyatspi/setvars.sh b/tests/pyatspi/setvars.sh
deleted file mode 100644
index d9638a26..00000000
--- a/tests/pyatspi/setvars.sh
+++ /dev/null
@@ -1,6 +0,0 @@
-export PYTHONPATH=../../
-
-export TEST_DATA_DIRECTORY=../data
-export TEST_ATSPI_LIBRARY=../../atk-adaptor/.libs/libspiatk.so
-export TEST_MODULES_DIRECTORY=../apps/.libs
-export TEST_APPLICATION=../apps/test-application
diff --git a/tests/pyatspi/statetest.py b/tests/pyatspi/statetest.py
deleted file mode 100644
index 223cf6e3..00000000
--- a/tests/pyatspi/statetest.py
+++ /dev/null
@@ -1,101 +0,0 @@
-import dbus
-import gobject
-import os.path
-
-from xml.dom import minidom
-import os
-
-from pasytest import PasyTest as _PasyTest
-
-import pyatspi
-from pyatspi import StateSet
-
-os = [pyatspi.STATE_MULTISELECTABLE,
- pyatspi.STATE_PRESSED,
- pyatspi.STATE_SHOWING,
- pyatspi.STATE_TRANSIENT,
- pyatspi.STATE_COLLAPSED,
- pyatspi.STATE_EDITABLE,]
-
-class StateTest(_PasyTest):
-
- __tests__ = ["setup",
- "test_contains",
- "test_add",
- "test_remove",
- "test_equals",
- "test_compare",
- "test_isEmpty",
- "test_getStates",
- "teardown",
- ]
-
- def __init__(self, bus, path):
- _PasyTest.__init__(self, "State", False)
-
- def setup(self, test):
- pass
-
- def test_contains(self, test):
- state = StateSet(*os)
- if not state.contains(pyatspi.STATE_PRESSED):
- test.fail("Does not find contained state")
- if state.contains(pyatspi.STATE_ACTIVE):
- test.fail("Finds state not contained")
-
- def test_add(self, test):
- state = StateSet()
- state.add(pyatspi.STATE_PRESSED)
- if not state.contains(pyatspi.STATE_PRESSED):
- test.fail("State not added")
-
- def test_remove(self, test):
- state = StateSet(*os)
- state.remove(pyatspi.STATE_PRESSED)
- if state.contains(pyatspi.STATE_PRESSED):
- test.fail("State not removed")
-
- def test_equals(self, test):
- one = StateSet(*os)
- two = StateSet(*os)
- if not one.equals(two):
- test.fail("Same states not found equal")
- two.remove(pyatspi.STATE_PRESSED)
- if two.equals(one):
- test.fail("Unequal states found equal")
-
- def test_isEmpty(self, test):
- emp = StateSet()
- if not emp.isEmpty():
- test.fail("Empty state found non-empty")
- emp.add(pyatspi.STATE_PRESSED)
- if emp.isEmpty():
- test.fail("State incorrectly found empty")
-
- def test_compare(self, test):
- one = StateSet(*os)
- two = StateSet(*os)
-
- onemtwo = one.compare(two)
- if not onemtwo.isEmpty():
- test.fail("Equal states when compared yeilds non-empty state")
-
- one.add(pyatspi.STATE_ACTIVE)
- onemtwo = one.compare(two)
-
- act = StateSet(pyatspi.STATE_ACTIVE)
- if not onemtwo.equals(act):
- test.fail("Compared states do not yeild correct state")
-
- def test_getStates(self, test):
- state = StateSet(*os)
-
- states = state.getStates()
- cone = set(states)
- ctwo = set(os)
-
- if not (cone.issubset(ctwo) and ctwo.issubset(cone)):
- test.fail("States not reported correctly")
-
- def teardown(self, test):
- pass
diff --git a/tests/pyatspi/testrunner b/tests/pyatspi/testrunner
deleted file mode 100755
index 92531e2a..00000000
--- a/tests/pyatspi/testrunner
+++ /dev/null
@@ -1,94 +0,0 @@
-#!/usr/bin/python
-
-import gobject
-import dbus
-import sys
-import os
-import time
-from random import randint
-
-from optparse import OptionParser
-from pasytest import PasyTest
-
-from dbus.mainloop.glib import DBusGMainLoop
-
-DBusGMainLoop(set_as_default=True)
-
-def run_test_app(module_name, dbus_name=None, wait_for_debug=False):
- import os
- from subprocess import Popen
-
- test_data_directory = os.environ["TEST_DATA_DIRECTORY"]
- test_modules_directory = os.environ["TEST_MODULES_DIRECTORY"]
- test_atspi_library = os.environ["TEST_ATSPI_LIBRARY"]
- test_application = os.environ["TEST_APPLICATION"]
-
- test_module = os.path.join(test_modules_directory, module_name)
-
- if (dbus_name):
- print " ".join([test_application,
- "--atspi-dbus-name", dbus_name,
- "--test-atspi-library", test_atspi_library,
- "--test-module", test_module,
- "--test-data-directory", test_data_directory,])
- pop = Popen([test_application,
- "--atspi-dbus-name", dbus_name,
- "--test-atspi-library", test_atspi_library,
- "--test-module", test_module,
- "--test-data-directory", test_data_directory,])
- else:
- print " ".join([test_application,
- "--test-atspi-library", test_atspi_library,
- "--test-module", test_module,
- "--test-data-directory", test_data_directory,])
- pop = Popen([test_application,
- "--test-atspi-library", test_atspi_library,
- "--test-module", test_module,
- "--test-data-directory", test_data_directory,])
-
- wait_message = """
- The test application %s has been started with PID %d.
-
- To continue the test press ENTER.\n\n
- """
- if (wait_for_debug):
- raw_input(wait_message % (module_name, pop.pid))
-
-def main(argv):
- parser = OptionParser()
- parser.add_option("-l", "--library", dest="test_library")
- parser.add_option("-m", "--module", dest="test_module")
- parser.add_option("-n", "--name", dest="test_name")
- parser.add_option("-w", "--wait", action="store_true", dest="wait", default=False)
- (options, args) = parser.parse_args()
-
- bus = dbus.SessionBus()
- name = "test.atspi.R" + str(randint(1, 1000))
-
- app = run_test_app(options.test_library, name, wait_for_debug=options.wait)
- time.sleep(1)
- print "Started test app on bus name %s" % (name,)
-
- to = bus.get_object(name, "/org/codethink/atspi/test")
- test = dbus.Interface(to, "org.codethink.atspi.test")
-
- # Run the test script here
- os.environ["ATSPI_TEST_APP_NAME"] = name
- module = __import__(options.test_module)
- test_class = getattr(module, options.test_name)
- test_object = test_class(bus, name)
- test_object.run()
-
- loop = gobject.MainLoop()
-
- def finished_handler():
- loop.quit()
- print "\n" + test_object.report() + "\n"
- test.finish()
-
- test_object.events.finished += finished_handler
-
- loop.run()
-
-if __name__=="__main__":
- sys.exit(main(sys.argv))
diff --git a/tools/Makefile.am b/tools/Makefile.am
index 63fc983d..8ce6973e 100644
--- a/tools/Makefile.am
+++ b/tools/Makefile.am
@@ -1,5 +1,4 @@
EXTRA_DIST = \
c-constants-generator.xsl\
- spec-to-introspect.xsl\
- doc-generator.xsl\
- identity.xsl
+ identity.xsl \
+ spec-to-introspect.xsl
diff --git a/tools/doc-generator.xsl b/tools/doc-generator.xsl
deleted file mode 100644
index 98cfd8b4..00000000
--- a/tools/doc-generator.xsl
+++ /dev/null
@@ -1,689 +0,0 @@
-<!-- Generate HTML documentation from the Telepathy specification.
-The master copy of this stylesheet is in the Telepathy spec repository -
-please make any changes there.
-
-Copyright (C) 2006, 2007 Collabora Limited
-
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 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
-Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library; if not, write to the Free Software
-Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
--->
-
-<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
- xmlns:tp="http://telepathy.freedesktop.org/wiki/DbusSpec#extensions-v0"
- exclude-result-prefixes="tp">
- <!--Don't move the declaration of the HTML namespace up here - XMLNSs
- don't work ideally in the presence of two things that want to use the
- absence of a prefix, sadly. -->
-
- <xsl:template match="*" mode="identity">
- <xsl:copy>
- <xsl:apply-templates mode="identity"/>
- </xsl:copy>
- </xsl:template>
-
- <xsl:template match="tp:docstring">
- <xsl:apply-templates select="node()" mode="identity"/>
- </xsl:template>
-
- <xsl:template match="tp:errors">
- <h1 xmlns="http://www.w3.org/1999/xhtml">Errors</h1>
- <xsl:apply-templates/>
- </xsl:template>
-
- <xsl:template match="tp:generic-types">
- <h1 xmlns="http://www.w3.org/1999/xhtml">Generic types</h1>
- <xsl:call-template name="do-types"/>
- </xsl:template>
-
- <xsl:template name="do-types">
- <xsl:if test="tp:simple-type">
- <h2 xmlns="http://www.w3.org/1999/xhtml">Simple types</h2>
- <xsl:apply-templates select="tp:simple-type"/>
- </xsl:if>
-
- <xsl:if test="tp:enum">
- <h2 xmlns="http://www.w3.org/1999/xhtml">Enumerated types:</h2>
- <xsl:apply-templates select="tp:enum"/>
- </xsl:if>
-
- <xsl:if test="tp:flags">
- <h2 xmlns="http://www.w3.org/1999/xhtml">Sets of flags:</h2>
- <xsl:apply-templates select="tp:flags"/>
- </xsl:if>
-
- <xsl:if test="tp:struct">
- <h2 xmlns="http://www.w3.org/1999/xhtml">Structure types</h2>
- <xsl:apply-templates select="tp:struct"/>
- </xsl:if>
-
- <xsl:if test="tp:mapping">
- <h2 xmlns="http://www.w3.org/1999/xhtml">Mapping types</h2>
- <xsl:apply-templates select="tp:mapping"/>
- </xsl:if>
-
- <xsl:if test="tp:external-type">
- <h2 xmlns="http://www.w3.org/1999/xhtml">Types defined elsewhere</h2>
- <dl><xsl:apply-templates select="tp:external-type"/></dl>
- </xsl:if>
- </xsl:template>
-
- <xsl:template match="tp:error">
- <h2 xmlns="http://www.w3.org/1999/xhtml"><a name="{concat(../@namespace, '.', translate(@name, ' ', ''))}"></a><xsl:value-of select="concat(../@namespace, '.', translate(@name, ' ', ''))"/></h2>
- <xsl:apply-templates select="tp:docstring"/>
- </xsl:template>
-
- <xsl:template match="/tp:spec/tp:copyright">
- <div xmlns="http://www.w3.org/1999/xhtml">
- <xsl:apply-templates/>
- </div>
- </xsl:template>
- <xsl:template match="/tp:spec/tp:license">
- <div xmlns="http://www.w3.org/1999/xhtml" class="license">
- <xsl:apply-templates mode="identity"/>
- </div>
- </xsl:template>
-
- <xsl:template match="tp:copyright"/>
- <xsl:template match="tp:license"/>
-
- <xsl:template match="interface">
- <h1 xmlns="http://www.w3.org/1999/xhtml"><a name="{@name}"></a><xsl:value-of select="@name"/></h1>
-
- <xsl:if test="@tp:causes-havoc">
- <p xmlns="http://www.w3.org/1999/xhtml" class="causes-havoc">
- This interface is <xsl:value-of select="@tp:causes-havoc"/>
- and is likely to cause havoc to your API/ABI if bindings are generated.
- Don't include it in libraries that care about compatibility.
- </p>
- </xsl:if>
-
- <xsl:if test="tp:requires">
- <p>Implementations of this interface must also implement:</p>
- <ul xmlns="http://www.w3.org/1999/xhtml">
- <xsl:for-each select="tp:requires">
- <li><code><a href="#{@interface}"><xsl:value-of select="@interface"/></a></code></li>
- </xsl:for-each>
- </ul>
- </xsl:if>
-
- <xsl:apply-templates select="tp:docstring" />
-
- <xsl:choose>
- <xsl:when test="method">
- <h2 xmlns="http://www.w3.org/1999/xhtml">Methods:</h2>
- <xsl:apply-templates select="method"/>
- </xsl:when>
- <xsl:otherwise>
- <p xmlns="http://www.w3.org/1999/xhtml">Interface has no methods.</p>
- </xsl:otherwise>
- </xsl:choose>
-
- <xsl:choose>
- <xsl:when test="signal">
- <h2 xmlns="http://www.w3.org/1999/xhtml">Signals:</h2>
- <xsl:apply-templates select="signal"/>
- </xsl:when>
- <xsl:otherwise>
- <p xmlns="http://www.w3.org/1999/xhtml">Interface has no signals.</p>
- </xsl:otherwise>
- </xsl:choose>
-
- <xsl:choose>
- <xsl:when test="tp:property">
- <h2 xmlns="http://www.w3.org/1999/xhtml">Properties:</h2>
- <dl xmlns="http://www.w3.org/1999/xhtml">
- <xsl:apply-templates select="tp:property"/>
- </dl>
- </xsl:when>
- <xsl:otherwise>
- <p xmlns="http://www.w3.org/1999/xhtml">Interface has no properties.</p>
- </xsl:otherwise>
- </xsl:choose>
-
- <xsl:call-template name="do-types"/>
-
- </xsl:template>
-
- <xsl:template match="tp:flags">
- <h3>
- <a name="type-{@name}">
- <xsl:value-of select="@name"/>
- </a>
- </h3>
- <xsl:apply-templates select="tp:docstring" />
- <dl xmlns="http://www.w3.org/1999/xhtml">
- <xsl:variable name="value-prefix">
- <xsl:choose>
- <xsl:when test="@value-prefix">
- <xsl:value-of select="@value-prefix"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="@name"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
- <xsl:for-each select="tp:flag">
- <dt xmlns="http://www.w3.org/1999/xhtml"><code><xsl:value-of select="concat($value-prefix, '_', @suffix)"/> = <xsl:value-of select="@value"/></code></dt>
- <xsl:choose>
- <xsl:when test="tp:docstring">
- <dd xmlns="http://www.w3.org/1999/xhtml"><xsl:apply-templates select="tp:docstring" /></dd>
- </xsl:when>
- <xsl:otherwise>
- <dd xmlns="http://www.w3.org/1999/xhtml">(Undocumented)</dd>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:for-each>
- </dl>
- </xsl:template>
-
- <xsl:template match="tp:enum">
- <h3 xmlns="http://www.w3.org/1999/xhtml">
- <a name="type-{@name}">
- <xsl:value-of select="@name"/>
- </a>
- </h3>
- <xsl:apply-templates select="tp:docstring" />
- <dl xmlns="http://www.w3.org/1999/xhtml">
- <xsl:variable name="value-prefix">
- <xsl:choose>
- <xsl:when test="@value-prefix">
- <xsl:value-of select="@value-prefix"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="@name"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
- <xsl:for-each select="tp:enumvalue">
- <dt xmlns="http://www.w3.org/1999/xhtml"><code><xsl:value-of select="concat($value-prefix, '_', @suffix)"/> = <xsl:value-of select="@value"/></code></dt>
- <xsl:choose>
- <xsl:when test="tp:docstring">
- <dd xmlns="http://www.w3.org/1999/xhtml"><xsl:apply-templates select="tp:docstring" /></dd>
- </xsl:when>
- <xsl:otherwise>
- <dd xmlns="http://www.w3.org/1999/xhtml">(Undocumented)</dd>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:for-each>
- </dl>
- </xsl:template>
-
- <xsl:template match="tp:property">
- <dt xmlns="http://www.w3.org/1999/xhtml">
- <xsl:if test="@name">
- <code><xsl:value-of select="@name"/></code> -
- </xsl:if>
- <code><xsl:value-of select="@type"/></code>
- </dt>
- <dd xmlns="http://www.w3.org/1999/xhtml">
- <xsl:apply-templates select="tp:docstring"/>
- </dd>
- </xsl:template>
-
- <xsl:template match="tp:mapping">
- <div xmlns="http://www.w3.org/1999/xhtml" class="struct">
- <h3>
- <a name="type-{@name}">
- <xsl:value-of select="@name"/>
- </a> - a{
- <xsl:for-each select="tp:member">
- <xsl:value-of select="@type"/>
- <xsl:text>: </xsl:text>
- <xsl:value-of select="@name"/>
- <xsl:if test="position() != last()"> &#x2192; </xsl:if>
- </xsl:for-each>
- }
- </h3>
- <div class="docstring">
- <xsl:apply-templates select="tp:docstring"/>
- </div>
- <div>
- <h4>Members</h4>
- <dl>
- <xsl:apply-templates select="tp:member" mode="members-in-docstring"/>
- </dl>
- </div>
- </div>
- </xsl:template>
-
- <xsl:template match="tp:docstring" mode="in-index"/>
-
- <xsl:template match="tp:simple-type | tp:enum | tp:flags | tp:external-type"
- mode="in-index">
- - <xsl:value-of select="@type"/>
- </xsl:template>
-
- <xsl:template match="tp:simple-type">
- <div xmlns="http://www.w3.org/1999/xhtml" class="simple-type">
- <h3>
- <a name="type-{@name}">
- <xsl:value-of select="@name"/>
- </a> - <xsl:value-of select="@type"/>
- </h3>
- <div class="docstring">
- <xsl:apply-templates select="tp:docstring"/>
- </div>
- </div>
- </xsl:template>
-
- <xsl:template match="tp:external-type">
- <div xmlns="http://www.w3.org/1999/xhtml" class="external-type">
- <dt>
- <a name="type-{@name}">
- <xsl:value-of select="@name"/>
- </a> - <xsl:value-of select="@type"/>
- </dt>
- <dd>Defined by: <xsl:value-of select="@from"/></dd>
- </div>
- </xsl:template>
-
- <xsl:template match="tp:struct" mode="in-index">
- - ( <xsl:for-each select="tp:member">
- <xsl:value-of select="@type"/>
- <xsl:if test="position() != last()">, </xsl:if>
- </xsl:for-each> )
- </xsl:template>
-
- <xsl:template match="tp:mapping" mode="in-index">
- - a{ <xsl:for-each select="tp:member">
- <xsl:value-of select="@type"/>
- <xsl:if test="position() != last()"> &#x2192; </xsl:if>
- </xsl:for-each> }
- </xsl:template>
-
- <xsl:template match="tp:struct">
- <div xmlns="http://www.w3.org/1999/xhtml" class="struct">
- <h3>
- <a name="type-{@name}">
- <xsl:value-of select="@name"/>
- </a> - (
- <xsl:for-each select="tp:member">
- <xsl:value-of select="@type"/>
- <xsl:text>: </xsl:text>
- <xsl:value-of select="@name"/>
- <xsl:if test="position() != last()">, </xsl:if>
- </xsl:for-each>
- )
- </h3>
- <div class="docstring">
- <xsl:apply-templates select="tp:docstring"/>
- </div>
- <xsl:choose>
- <xsl:when test="string(@array-name) != ''">
- <p>In bindings that need a separate name, arrays of
- <xsl:value-of select="@name"/> should be called
- <xsl:value-of select="@array-name"/>.</p>
- </xsl:when>
- <xsl:otherwise>
- <p>Arrays of <xsl:value-of select="@name"/> don't generally
- make sense.</p>
- </xsl:otherwise>
- </xsl:choose>
- <div>
- <h4>Members</h4>
- <dl>
- <xsl:apply-templates select="tp:member" mode="members-in-docstring"/>
- </dl>
- </div>
- </div>
- </xsl:template>
-
- <xsl:template match="method">
- <div xmlns="http://www.w3.org/1999/xhtml" class="method">
- <h3 xmlns="http://www.w3.org/1999/xhtml">
- <a name="{concat(../@name, concat('.', @name))}">
- <xsl:value-of select="@name"/>
- </a> (
- <xsl:for-each xmlns="" select="arg[@direction='in']">
- <xsl:value-of select="@type"/>: <xsl:value-of select="@name"/>
- <xsl:if test="position() != last()">, </xsl:if>
- </xsl:for-each>
- ) &#x2192;
- <xsl:choose>
- <xsl:when test="arg[@direction='out']">
- <xsl:for-each xmlns="" select="arg[@direction='out']">
- <xsl:value-of select="@type"/>
- <xsl:if test="position() != last()">, </xsl:if>
- </xsl:for-each>
- </xsl:when>
- <xsl:otherwise>nothing</xsl:otherwise>
- </xsl:choose>
- </h3>
- <div xmlns="http://www.w3.org/1999/xhtml" class="docstring">
- <xsl:apply-templates select="tp:docstring" />
- </div>
-
- <xsl:if test="arg[@direction='in']">
- <div xmlns="http://www.w3.org/1999/xhtml">
- <h4>Parameters</h4>
- <dl xmlns="http://www.w3.org/1999/xhtml">
- <xsl:apply-templates select="arg[@direction='in']"
- mode="parameters-in-docstring"/>
- </dl>
- </div>
- </xsl:if>
-
- <xsl:if test="arg[@direction='out']">
- <div xmlns="http://www.w3.org/1999/xhtml">
- <h4>Returns</h4>
- <dl xmlns="http://www.w3.org/1999/xhtml">
- <xsl:apply-templates select="arg[@direction='out']"
- mode="returns-in-docstring"/>
- </dl>
- </div>
- </xsl:if>
-
- <xsl:if test="tp:possible-errors">
- <div xmlns="http://www.w3.org/1999/xhtml">
- <h4>Possible errors</h4>
- <dl xmlns="http://www.w3.org/1999/xhtml">
- <xsl:apply-templates select="tp:possible-errors/tp:error"/>
- </dl>
- </div>
- </xsl:if>
-
- </div>
- </xsl:template>
-
- <xsl:template name="parenthesized-tp-type">
- <xsl:if test="@tp:type">
- <xsl:variable name="tp-type" select="@tp:type"/>
- <xsl:variable name="single-type">
- <xsl:choose>
- <xsl:when test="contains($tp-type, '[]')">
- <xsl:value-of select="substring-before($tp-type, '[]')"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="$tp-type"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
- <xsl:choose>
- <xsl:when test="//tp:simple-type[@name=$tp-type]" />
- <xsl:when test="//tp:simple-type[concat(@name, '[]')=$tp-type]" />
- <xsl:when test="//tp:struct[concat(@name, '[]')=$tp-type][string(@array-name) != '']" />
- <xsl:when test="//tp:struct[@name=$tp-type]" />
- <xsl:when test="//tp:enum[@name=$tp-type]" />
- <xsl:when test="//tp:enum[concat(@name, '[]')=$tp-type]" />
- <xsl:when test="//tp:flags[@name=$tp-type]" />
- <xsl:when test="//tp:flags[concat(@name, '[]')=$tp-type]" />
- <xsl:when test="//tp:mapping[@name=$tp-type]" />
- <xsl:when test="//tp:external-type[concat(@name, '[]')=$tp-type]" />
- <xsl:when test="//tp:external-type[@name=$tp-type]" />
- <xsl:otherwise>
- <xsl:message terminate="yes">
- <xsl:text>ERR: Unable to find type '</xsl:text>
- <xsl:value-of select="$tp-type"/>
- <xsl:text>'&#10;</xsl:text>
- </xsl:message>
- </xsl:otherwise>
- </xsl:choose>
- (<a href="#type-{$single-type}"><xsl:value-of select="$tp-type"/></a>)
- </xsl:if>
- </xsl:template>
-
- <xsl:template match="tp:member" mode="members-in-docstring">
- <dt xmlns="http://www.w3.org/1999/xhtml">
- <code><xsl:value-of select="@name"/></code> -
- <code><xsl:value-of select="@type"/></code>
- <xsl:call-template name="parenthesized-tp-type"/>
- </dt>
- <dd xmlns="http://www.w3.org/1999/xhtml">
- <xsl:choose>
- <xsl:when test="tp:docstring">
- <xsl:apply-templates select="tp:docstring" />
- </xsl:when>
- <xsl:otherwise>
- <em>(undocumented)</em>
- </xsl:otherwise>
- </xsl:choose>
- </dd>
- </xsl:template>
-
- <xsl:template match="arg" mode="parameters-in-docstring">
- <dt xmlns="http://www.w3.org/1999/xhtml">
- <code><xsl:value-of select="@name"/></code> -
- <code><xsl:value-of select="@type"/></code>
- <xsl:call-template name="parenthesized-tp-type"/>
- </dt>
- <dd xmlns="http://www.w3.org/1999/xhtml">
- <xsl:apply-templates select="tp:docstring" />
- </dd>
- </xsl:template>
-
- <xsl:template match="arg" mode="returns-in-docstring">
- <dt xmlns="http://www.w3.org/1999/xhtml">
- <xsl:if test="@name">
- <code><xsl:value-of select="@name"/></code> -
- </xsl:if>
- <code><xsl:value-of select="@type"/></code>
- <xsl:call-template name="parenthesized-tp-type"/>
- </dt>
- <dd xmlns="http://www.w3.org/1999/xhtml">
- <xsl:apply-templates select="tp:docstring"/>
- </dd>
- </xsl:template>
-
- <xsl:template match="tp:possible-errors/tp:error">
- <dt xmlns="http://www.w3.org/1999/xhtml">
- <code><xsl:value-of select="@name"/></code>
- </dt>
- <dd xmlns="http://www.w3.org/1999/xhtml">
- <xsl:variable name="name" select="@name"/>
- <xsl:choose>
- <xsl:when test="tp:docstring">
- <xsl:apply-templates select="tp:docstring"/>
- </xsl:when>
- <xsl:when test="//tp:errors/tp:error[concat(../@namespace, '.', translate(@name, ' ', ''))=$name]/tp:docstring">
- <xsl:apply-templates select="//tp:errors/tp:error[concat(../@namespace, '.', translate(@name, ' ', ''))=$name]/tp:docstring"/> <em xmlns="http://www.w3.org/1999/xhtml">(generic description)</em>
- </xsl:when>
- <xsl:otherwise>
- (Undocumented.)
- </xsl:otherwise>
- </xsl:choose>
- </dd>
- </xsl:template>
-
- <xsl:template match="signal">
- <div xmlns="http://www.w3.org/1999/xhtml" class="signal">
- <h3 xmlns="http://www.w3.org/1999/xhtml">
- <a name="{concat(../@name, concat('.', @name))}">
- <xsl:value-of select="@name"/>
- </a> (
- <xsl:for-each xmlns="" select="arg">
- <xsl:value-of select="@type"/>: <xsl:value-of select="@name"/>
- <xsl:if test="position() != last()">, </xsl:if>
- </xsl:for-each>
- )</h3>
- <div xmlns="http://www.w3.org/1999/xhtml" class="docstring">
- <xsl:apply-templates select="tp:docstring"/>
- </div>
-
- <xsl:if test="arg">
- <div xmlns="http://www.w3.org/1999/xhtml">
- <h4>Parameters</h4>
- <dl xmlns="http://www.w3.org/1999/xhtml">
- <xsl:apply-templates select="arg" mode="parameters-in-docstring"/>
- </dl>
- </div>
- </xsl:if>
- </div>
- </xsl:template>
-
- <xsl:output method="xml" indent="no" encoding="ascii"
- omit-xml-declaration="yes"
- doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"
- doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN" />
-
- <xsl:template match="/tp:spec">
- <html xmlns="http://www.w3.org/1999/xhtml">
- <head>
- <title>
- <xsl:value-of select="tp:title"/>
- <xsl:if test="tp:version">
- <xsl:text> version </xsl:text>
- <xsl:value-of select="tp:version"/>
- </xsl:if>
- </title>
- <style type="text/css">
-
- body {
- font-family: sans-serif;
- margin: 2em;
- height: 100%;
- font-size: 1.2em;
- }
- h1 {
- padding-top: 5px;
- padding-bottom: 5px;
- font-size: 1.6em;
- background: #dadae2;
- }
- h2 {
- font-size: 1.3em;
- }
- h3 {
- font-size: 1.2em;
- }
- a:link, a:visited, a:link:hover, a:visited:hover {
- font-weight: bold;
- }
- .topbox {
- padding-top: 10px;
- padding-left: 10px;
- border-bottom: black solid 1px;
- padding-bottom: 10px;
- background: #dadae2;
- font-size: 2em;
- font-weight: bold;
- color: #5c5c5c;
- }
- .topnavbox {
- padding-left: 10px;
- padding-top: 5px;
- padding-bottom: 5px;
- background: #abacba;
- border-bottom: black solid 1px;
- font-size: 1.2em;
- }
- .topnavbox a{
- color: black;
- font-weight: normal;
- }
- .sidebar {
- float: left;
- /* width:9em;
- border-right:#abacba solid 1px;
- border-left: #abacba solid 1px;
- height:100%; */
- border: #abacba solid 1px;
- padding-left: 10px;
- margin-left: 10px;
- padding-right: 10px;
- margin-right: 10px;
- color: #5d5d5d;
- background: #dadae2;
- }
- .sidebar a {
- text-decoration: none;
- border-bottom: #e29625 dotted 1px;
- color: #e29625;
- font-weight: normal;
- }
- .sidebar h1 {
- font-size: 1.2em;
- color: black;
- }
- .sidebar ul {
- padding-left: 25px;
- padding-bottom: 10px;
- border-bottom: #abacba solid 1px;
- }
- .sidebar li {
- padding-top: 2px;
- padding-bottom: 2px;
- }
- .sidebar h2 {
- font-style:italic;
- font-size: 0.81em;
- padding-left: 5px;
- padding-right: 5px;
- font-weight: normal;
- }
- .date {
- font-size: 0.6em;
- float: right;
- font-style: italic;
- }
- .method {
- margin-left: 1em;
- margin-right: 4em;
- }
- .signal {
- margin-left: 1em;
- margin-right: 4em;
- }
-
- </style>
- </head>
- <body>
- <h1 class="topbox">
- <xsl:value-of select="tp:title" />
- </h1>
- <xsl:if test="tp:version">
- <h2>Version <xsl:apply-templates select="tp:version"/></h2>
- </xsl:if>
- <xsl:apply-templates select="tp:copyright"/>
- <xsl:apply-templates select="tp:license"/>
- <xsl:apply-templates select="tp:docstring"/>
-
- <h2>Interfaces</h2>
- <ul>
- <xsl:for-each select="node/interface">
- <li><code><a href="#{@name}"><xsl:value-of select="@name"/></a></code></li>
- </xsl:for-each>
- </ul>
-
- <xsl:apply-templates select="node"/>
- <xsl:apply-templates select="tp:generic-types"/>
- <xsl:apply-templates select="tp:errors"/>
-
- <h1>Index</h1>
- <h2>Index of interfaces</h2>
- <ul>
- <xsl:for-each select="node/interface">
- <li><code><a href="#{@name}"><xsl:value-of select="@name"/></a></code></li>
- </xsl:for-each>
- </ul>
- <h2>Index of types</h2>
- <ul>
- <xsl:for-each select="//tp:simple-type | //tp:enum | //tp:flags | //tp:mapping | //tp:struct | //tp:external-type">
- <xsl:sort select="@name"/>
- <li>
- <code>
- <a href="#type-{@name}">
- <xsl:value-of select="@name"/>
- </a>
- </code>
- <xsl:apply-templates mode="in-index" select="."/>
- </li>
- </xsl:for-each>
- </ul>
- </body>
- </html>
- </xsl:template>
-
-</xsl:stylesheet>
-
-<!-- vim:set sw=2 sts=2 et: -->