+2001-12-11 Michael Meeks <michael@ximian.com>
+
+ * cspi/bonobo/cspi-bonobo-listener.c:
+ (cspi_kestroke_listener_unref),
+ (cspi_event_listener_unref): impl. undoing previous
+ homenous environment - for Bill.
+
+ * cspi/spi_table.c (long_seq_to_array): use
+ malloc instead.
+
+ * cspi/spi_main.c: split out all bonoboish bits into
+ bonobo/
+
+ * cspi/spi-impl.h: upd. typedefs.
+
+ * cspi/spi_registry.c: update to lowlevel API,
+ return booleans to indicate success in some places.
+
+ * cspi/spi_event.c: update to lowlevel API.
+
+ * cspi/bonobo/Makefile.am: add.
+
+ * cspi/bonobo/cspi-lowlevel.h: add
+
+ * cspi/bonobo/cspi-bonobo.c: add
+
+ * cspi/bonobo/cspi-bonobo-listener.[ch]: impl.
+
+ * cspi/Makefile.am: remove spi-listener-impl.[ch],
+ (SUBDIRS): add bonobo, link in the libs.
+
+ * cspi/spi-util.c: kill this file.
+
+ * TODO: merge in my bits.
+
+2001-12-11 Michael Meeks <michael@ximian.com>
+
+ * test/test-simple.c (test_value, test_table, main):
+ remove unused variables causing warnings.
+
+ * configure.in: cleanup checks - require gail.
+
2001-12-11 Bill Haneman <bill.haneman@sun.com>
* idl/Value.idl:
TODO:
idl:
- possibly change Value.idl interface to return a value
-union. [Bill] *DONE*
+ + possibly change Value.idl interface to return a value union. [Bill]
+ + audit IDL for conformance with bonobo/doc/FAQ's [Java]
+ naming practice [Michael]
+ + possibly change Value.idl interface to return a value
+ union. [Bill] *DONE*
cspi:
- API change required if above IDL change is made. [Bill]
+ + API change required if above IDL change is made. [Bill]
+ + move bonobo bits into cspi/bonobo
+ + ensure spi-listener-impl's list notification methods don't
+ have a re-enterancy hazard.
+ + namespace all methods missing a prepending Acessible
+ or SPI_ prefix.
+ + Put LGPL headers everywhere.
+
+registry:
+ + move code into here from libspi
+ + kill the getDeviceWhatnot - and use queryInterface,
+ don't inherit from the Listener interface - use aggregation
+ + fire an event on dead application & re-factor the listen for
+ broken code.
+
+bridge:
+ + move code into here from libspi
libspi:
-
- Change the weird string-hash event matching to something sane,
-using GQuark. [Bill]
-
- Merge the DeviceEvent and KeyEvent structs to avoid the bogus casting of
-these back and forth.
-
- Complete implementation of support for RelationSet and StateSet, and
-export to cspi.
-
- Complete and test the pre-emptive key API so that we don't always do
-AnyKey grabs. [Bill]
+ + remove redundant casts throughout
+ + determine if there are other headers we don't need to install
+ + consider moving the non-impl. parts into registryd/ bridge/ etc.
+ + change the weird string-hash event matching to something sane,
+ using GQuark. [Bill]
+ + merge the DeviceEvent and KeyEvent structs to avoid the
+ bogus casting of these back and forth.
+ + complete implementation of support for RelationSet and
+ StateSet, and export to cspi.
+ + complete and test the pre-emptive key API so that we don't
+ always do AnyKey grabs. [Bill]
test:
-
- Add tests for AtkTable, and add table elements to the test window.
+ + update test-simple to do complete API tests
+ + Add tests for AtkTable, and add table elements to the test window.
+ + remove comment from test_value; ensure that it works.
AM_CONDITIONAL(ENABLE_GTK_DOC, test x$enable_gtk_doc = xyes)
dnl Checks for libraries
-PKG_CHECK_MODULES(LIBSPI, bonobo-activation-2.0 >= 0.9.1 libbonobo-2.0 >= 1.97.0 ORBit-2.0 >= 2.3.94 atk >= 0.2 gtk+-2.0 >= 1.3.2)
+PKG_CHECK_MODULES(LIBSPI, \
+ libbonobo-2.0 >= 1.107.0 \
+ atk >= 0.2 \
+ gtk+-2.0 >= 1.3.2 \
+ gail)
AC_SUBST(LIBSPI_LIBS)
AC_SUBST(LIBSPI_CFLAGS)
-PKG_CHECK_MODULES(REGISTRYD, bonobo-activation-2.0 >= 0.9.1 libbonobo-2.0 >= 1.97.0 atk >= 0.2)
+PKG_CHECK_MODULES(REGISTRYD, \
+ libbonobo-2.0 >= 1.107.0 \
+ atk >= 0.2)
AC_SUBST(REGISTRYD_LIBS)
AC_SUBST(REGISTRYD_CFLAGS)
-PKG_CHECK_MODULES(TESTS, bonobo-activation-2.0 >= 0.9.1 libbonobo-2.0 >= 1.97.0 ORBit-2.0 >= 2.3.94 atk >= 0.2 gtk+-2.0 >= 1.3.2)
+PKG_CHECK_MODULES(TESTS, \
+ libbonobo-2.0 >= 1.107.0 \
+ atk >= 0.2 \
+ gtk+-2.0 >= 1.3.2 \
+ gail)
AC_SUBST(TESTS_LIBS)
AC_SUBST(TESTS_CFLAGS)
-PKG_CHECK_MODULES(UTILS, gtk+-2.0 >= 1.3.0 gdk-pixbuf-2.0 >= 1.3.0 bonobo-activation-2.0 >= 0.9.1 libbonobo-2.0 >= 1.97.0 ORBit-2.0 >= 2.3.94)
+PKG_CHECK_MODULES(UTILS, \
+ libbonobo-2.0 >= 1.107.0 \
+ gtk+-2.0 >= 1.3.0 \
+ gdk-pixbuf-2.0 >= 1.3.0)
AC_SUBST(UTILS_LIBS)
AC_SUBST(UTILS_CFLAGS)
-PKG_CHECK_MODULES(AT_BRIDGE, bonobo-activation-2.0 >= 0.9.1 libbonobo-2.0 >= 1.97.0 ORBit-2.0 >= 2.3.94 atk >= 0.2)
+PKG_CHECK_MODULES(AT_BRIDGE, \
+ libbonobo-2.0 >= 1.107.0 \
+ atk >= 0.2)
AC_SUBST(AT_BRIDGE_LIBS)
AC_SUBST(AT_BRIDGE_CFLAGS)
-PKG_CHECK_MODULES(LIBCSPI, bonobo-activation-2.0 >= 0.9.1 libbonobo-2.0 >= 1.97.0 ORBit-2.0 >= 2.3.94 atk >= 0.2)
+PKG_CHECK_MODULES(LIBCSPI, \
+ libbonobo-2.0 >= 1.107.0 \
+ atk >= 0.2)
AC_SUBST(LIBCSPI_LIBS)
AC_SUBST(LIBCSPI_CFLAGS)
at-bridge/Makefile
test/Makefile
cspi/Makefile
+cspi/bonobo/Makefile
util/Makefile
util/Accessibility_Util.server
])
+SUBDIRS = bonobo
+
NULL=
lib_LTLIBRARIES = libcspi.la
LDFLAGS = $(LIBCSPI_LIBS) @LT_VERSION_INFO@
-LDADD = ../libspi/libspi.la $(LIBCSPI_LIBS)
+LDADD = \
+ ../libspi/libspi.la \
+ $(LIBCSPI_LIBS)
libcspidir = $(includedir)/at-spi-1.0/cspi
libcspi_HEADERS = \
spi-statetypes.h
libcspi_la_SOURCES = \
+ cspi-lowlevel.h \
spi_accessible.c \
spi_action.c \
spi_application.c \
spi_hyperlink.c \
spi_hypertext.c \
spi_image.c \
- spi-listener-impl.h \
- spi-listener-impl.c \
spi_main.c \
spi-private.h \
spi_registry.c \
spi_selection.c \
spi_table.c \
spi_text.c \
- spi-util.c \
spi_value.c
+
+libcspi_la_LIBADD = \
+ bonobo/libcspi-bonobo.la
klass->event = cspi_event;
}
-CORBA_Object
+gpointer
cspi_event_listener_new (void)
{
CSpiEventListener *listener;
listener = g_object_new (cspi_event_listener_get_type (), NULL);
- return CORBA_Object_duplicate (BONOBO_OBJREF (listener), cspi_ev ());
+ return listener;
}
void
AccessibleEventListenerCB callback,
void *user_data)
{
- CSpiEventListener *listener = bonobo_object (
- ORBit_small_get_servant (CSPI_OBJREF (al)));
+ CSpiEventListener *listener = al;
g_return_if_fail (CSPI_IS_EVENT_LISTENER (listener));
cspi_event_listener_remove_cb (AccessibleEventListener *al,
AccessibleEventListenerCB callback)
{
- CSpiEventListener *listener = bonobo_object (
- ORBit_small_get_servant (CSPI_OBJREF (al)));
+ CSpiEventListener *listener = al;
g_return_if_fail (CSPI_IS_EVENT_LISTENER (listener));
/*
* Key event dispatcher
*/
-
static gboolean
cspi_key_event (SpiKeystrokeListener *listener,
const Accessibility_KeyStroke *keystroke)
spi_keystroke_listener_get_type (),
cspi_keystroke_listener);
-CORBA_Object
+gpointer
cspi_keystroke_listener_new (void)
{
CSpiEventListener *listener;
listener = g_object_new (cspi_keystroke_listener_get_type (), NULL);
- return CORBA_Object_duplicate (BONOBO_OBJREF (listener), cspi_ev ());
+ return listener;
}
void
AccessibleKeystrokeListenerCB callback,
void *user_data)
{
- CSpiKeystrokeListener *listener = bonobo_object (
- ORBit_small_get_servant (CSPI_OBJREF (al)));
+ CSpiKeystrokeListener *listener = al;
g_return_if_fail (CSPI_IS_KEYSTROKE_LISTENER (listener));
cspi_keystroke_listener_remove_cb (AccessibleKeystrokeListener *al,
AccessibleKeystrokeListenerCB callback)
{
- CSpiKeystrokeListener *listener = bonobo_object (
- ORBit_small_get_servant (CSPI_OBJREF (al)));
+ CSpiKeystrokeListener *listener = al;
g_return_if_fail (CSPI_IS_KEYSTROKE_LISTENER (listener));
listener->callbacks = event_list_remove_by_cb (listener->callbacks, callback);
}
+
+void
+cspi_event_listener_unref (AccessibleEventListener *listener)
+{
+ bonobo_object_unref (BONOBO_OBJECT (listener));
+}
+
+void
+cspi_keystroke_listener_unref (AccessibleKeystrokeListener *listener)
+{
+ bonobo_object_unref (BONOBO_OBJECT (listener));
+}
+
+
+CORBA_Object
+cspi_event_listener_get_corba (AccessibleEventListener *listener)
+{
+ return BONOBO_OBJREF (listener);
+}
+
+CORBA_Object
+cspi_keystroke_listener_get_corba (AccessibleKeystrokeListener *listener)
+{
+ return BONOBO_OBJREF (listener);
+}
+
-#include "../cspi-lowlevel.h"
-
+#include <string.h>
#include <libbonobo.h>
+#include "../cspi-lowlevel.h"
void
cspi_dup_ref (CORBA_Object object)
}
}
+char *
+cspi_exception_get_text (void)
+{
+ char *ret, *txt;
+
+ txt = bonobo_exception_get_text (cspi_ev ());
+ ret = strdup (txt);
+ g_free (txt);
+
+ return ret;
+}
+
+CORBA_Object
+cspi_init (void)
+{
+ char *obj_id;
+ CORBA_Object registry;
+ CORBA_Environment ev;
+
+ if (!bonobo_init (0, NULL))
+ {
+ g_error ("Could not initialize Bonobo");
+ }
+
+ obj_id = "OAFIID:Accessibility_Registry:proto0.1";
+
+ CORBA_exception_init (&ev);
+
+ registry = bonobo_activation_activate_from_id (
+ obj_id, 0, NULL, &ev);
+
+ if (ev._major != CORBA_NO_EXCEPTION)
+ {
+ g_error ("AT-SPI error: during registry activation: %s\n",
+ bonobo_exception_get_text (&ev));
+ }
+
+ if (registry == CORBA_OBJECT_NIL)
+ {
+ g_error ("Could not locate registry");
+ }
+
+ bonobo_activate ();
+
+ return registry;
+}
+
+void
+cspi_main (void)
+{
+ bonobo_main ();
+}
+
+void
+cspi_main_quit (void)
+{
+ bonobo_main_quit ();
+}
/* Misc CORBA / bonobo bits */
-SPIBoolean cspi_check_ev (const char *error_string);
-void cspi_dup_ref (CORBA_Object object);
-void cspi_release_unref (CORBA_Object object);
+SPIBoolean cspi_check_ev (const char *error_string);
+void cspi_dup_ref (CORBA_Object object);
+void cspi_release_unref (CORBA_Object object);
+char *cspi_exception_get_text (void);
+CORBA_Object cspi_init (void);
+void cspi_main (void);
+void cspi_main_quit (void);
/* Listener bits */
-CORBA_Object cspi_event_listener_new (void);
+gpointer cspi_event_listener_new (void);
+void cspi_event_listener_unref (AccessibleEventListener *listener);
+CORBA_Object cspi_event_listener_get_corba (AccessibleEventListener *listener);
void cspi_event_listener_add_cb (AccessibleEventListener *listener,
AccessibleEventListenerCB callback,
void *user_data);
void cspi_event_listener_remove_cb (AccessibleEventListener *listener,
AccessibleEventListenerCB callback);
-CORBA_Object cspi_keystroke_listener_new (void);
+gpointer cspi_keystroke_listener_new (void);
+void cspi_keystroke_listener_unref (AccessibleKeystrokeListener *listener);
+CORBA_Object cspi_keystroke_listener_get_corba (AccessibleKeystrokeListener *listener);
void cspi_keystroke_listener_add_cb (AccessibleKeystrokeListener *listener,
AccessibleKeystrokeListenerCB callback,
void *user_data);
#ifndef _SPI_IMPL_H_
#define _SPI_IMPL_H_
-typedef struct _Accessible Accessible;
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef struct _Accessible AccessibleUnknown;
+typedef AccessibleUnknown Accessible;
+
typedef Accessible AccessibleAction;
typedef Accessible AccessibleApplication;
typedef Accessible AccessibleComponent;
typedef Accessible AccessibleText;
typedef Accessible AccessibleValue;
typedef Accessible AccessibilityRegistry;
-typedef Accessible GenericInterface;
-typedef struct _CSpiEventListener AccessibleEventListener;
-typedef struct _CSpiKeystrokeListener AccessibleKeystrokeListener;
+typedef void AccessibleEventListener;
+typedef void AccessibleKeystrokeListener;
typedef unsigned int SPIBoolean;
+
+#ifdef __cplusplus
+}
+#endif
+
#endif
+++ /dev/null
-#include <cspi/spi-private.h>
-#include <cspi/spi-listener-impl.h>
-
-typedef struct
-{
- union
- {
- AccessibleEventListenerCB event;
- AccessibleKeystrokeListenerCB key_event;
- gpointer method;
- } cb;
- gpointer user_data;
-} EventHandler;
-
-GObjectClass *event_parent_class;
-GObjectClass *keystroke_parent_class;
-
-/*
- * Misc. helpers.
- */
-
-static EventHandler *
-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
-event_handler_free (EventHandler *handler)
-{
- g_free (handler);
-}
-
-static GList *
-event_list_remove_by_callback (GList *list, gpointer callback)
-{
- GList *l, *next;
-
- for (l = list; l; l = next)
- {
- EventHandler *eh = l->data;
- next = l->next;
-
- list = g_list_delete_link (list, l);
-
- event_handler_free (eh);
- }
-
- return list;
-}
-
-/*
- * Standard event dispatcher
- */
-
-BONOBO_CLASS_BOILERPLATE (CSpiEventListener, cspi_event_listener,
- GObject, spi_event_listener_get_type ())
-
-static void
-cspi_event (SpiEventListener *listener,
- Accessibility_Event *event)
-{
- GList *l;
- CSpiEventListener *clistener = (CSpiEventListener *) listener;
- AccessibleEvent aevent;
- Accessible *source;
-
- source = cspi_object_add (bonobo_object_dup_ref (event->source, cspi_ev ()));
-
- aevent.type = event->type;
- aevent.source = source;
- aevent.detail1 = event->detail1;
- aevent.detail2 = event->detail2;
-
- /* FIXME: re-enterancy hazard on this list */
- for (l = clistener->callbacks; l; l = l->next)
- {
- EventHandler *eh = l->data;
-
- eh->cb.event (&aevent, eh->user_data);
- }
-
- cspi_object_unref (source);
-}
-
-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)
- {
- 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;
-}
-
-CSpiEventListener *
-cspi_event_listener_new (void)
-{
- return g_object_new (cspi_event_listener_get_type (), NULL);
-}
-
-void
-cspi_event_listener_add_callback (CSpiEventListener *listener,
- AccessibleEventListenerCB callback,
- void *user_data)
-{
- g_return_if_fail (CSPI_IS_EVENT_LISTENER (listener));
- listener->callbacks = g_list_prepend (listener->callbacks,
- event_handler_new (callback, user_data));
-}
-
-void
-cspi_event_listener_remove_callback (CSpiEventListener *listener,
- AccessibleEventListenerCB callback)
-{
- g_return_if_fail (CSPI_IS_EVENT_LISTENER (listener));
- listener->callbacks = event_list_remove_by_callback (listener->callbacks, callback);
-}
-
-/*
- * Key event dispatcher
- */
-
-static gboolean
-cspi_key_event (SpiKeystrokeListener *listener,
- const Accessibility_KeyStroke *keystroke)
-{
- GList *l;
- CSpiKeystrokeListener *clistener = (CSpiKeystrokeListener *) listener;
- AccessibleKeystroke akeystroke;
- gboolean handled = FALSE;
-
-#ifdef SPI_KEYEVENT_DEBUG
- fprintf (stderr, "%s%c",
- (keystroke->modifiers & SPI_KEYMASK_ALT)?"Alt-":"",
- ((keystroke->modifiers & SPI_KEYMASK_SHIFT)^(keystroke->modifiers & SPI_KEYMASK_SHIFTLOCK))?
- (char) toupper((int) keystroke->keyID) : (char) tolower((int) keystroke->keyID));
-
- fprintf (stderr, "Key:\tsym %ld\n\tmods %x\n\tcode %d\n\ttime %ld\n",
- (long) keystroke->keyID,
- (unsigned int) keystroke->modifiers,
- (int) keystroke->keycode,
- (long int) keystroke->timestamp);
-#endif
-
- switch (keystroke->type)
- {
- case Accessibility_KEY_PRESSED:
- akeystroke.type = SPI_KEY_PRESSED;
- break;
- case Accessibility_KEY_RELEASED:
- akeystroke.type = SPI_KEY_RELEASED;
- break;
- default:
- akeystroke.type = 0;
- break;
- }
- akeystroke.keyID = keystroke->keyID;
- akeystroke.keycode = keystroke->keycode;
- akeystroke.timestamp = keystroke->timestamp;
- akeystroke.modifiers = keystroke->modifiers;
-
- /* FIXME: re-enterancy hazard on this list */
- for (l = clistener->callbacks; l; l = l->next)
- {
- EventHandler *eh = l->data;
-
- if ((handled = eh->cb.key_event (&akeystroke, eh->user_data)))
- {
- break;
- }
- }
-
- return handled;
-}
-
-static void
-cspi_keystroke_listener_init (CSpiKeystrokeListener *listener)
-{
-}
-
-
-static void
-cspi_keystroke_listener_finalize (GObject *object)
-{
- CSpiKeystrokeListener *listener = (CSpiKeystrokeListener *) object;
- GList *l;
-
- for (l = listener->callbacks; l; l = l->next)
- {
- event_handler_free (l->data);
- }
-
- g_list_free (listener->callbacks);
-
- keystroke_parent_class->finalize (object);
-}
-
-static void
-cspi_keystroke_listener_class_init (CSpiKeystrokeListenerClass *klass)
-{
- GObjectClass *object_class = (GObjectClass *) klass;
-
- keystroke_parent_class = g_type_class_peek_parent (klass);
- object_class->finalize = cspi_keystroke_listener_finalize;
-
- klass->key_event = cspi_key_event;
-}
-
-BONOBO_TYPE_FUNC (CSpiKeystrokeListener,
- spi_keystroke_listener_get_type (),
- cspi_keystroke_listener);
-
-CSpiKeystrokeListener *
-cspi_keystroke_listener_new (void)
-{
- return g_object_new (cspi_keystroke_listener_get_type (), NULL);
-}
-
-void
-cspi_keystroke_listener_add_callback (CSpiKeystrokeListener *listener,
- AccessibleKeystrokeListenerCB callback,
- void *user_data)
-{
- g_return_if_fail (CSPI_IS_KEYSTROKE_LISTENER (listener));
- listener->callbacks = g_list_prepend (listener->callbacks,
- event_handler_new (callback, user_data));
-}
-
-void
-cspi_keystroke_listener_remove_callback (CSpiKeystrokeListener *listener,
- AccessibleKeystrokeListenerCB callback)
-{
- g_return_if_fail (CSPI_IS_KEYSTROKE_LISTENER (listener));
- listener->callbacks = event_list_remove_by_callback (listener->callbacks, callback);
-}
+++ /dev/null
-#ifndef __SPI_LISTENER_IMPL_H__
-#define __SPI_LISTENER_IMP_H__
-
-#include <libspi/eventlistener.h>
-#include <libspi/keystrokelistener.h>
-#include <cspi/spi-impl.h>
-#include <cspi/spi-listener.h>
-
-G_BEGIN_DECLS
-
-#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))
-
-typedef struct _CSpiEventListener CSpiEventListener;
-struct _CSpiEventListener {
- SpiEventListener parent;
- GList *callbacks;
-};
-typedef SpiEventListenerClass CSpiEventListenerClass;
-
-GType cspi_event_listener_get_type (void);
-CSpiEventListener *cspi_event_listener_new (void);
-void cspi_event_listener_add_callback (CSpiEventListener *listener,
- AccessibleEventListenerCB callback,
- void *user_data);
-void cspi_event_listener_remove_callback (CSpiEventListener *listener,
- AccessibleEventListenerCB callback);
-
-#define CSPI_KEYSTROKE_LISTENER_TYPE (cspi_keystroke_listener_get_type ())
-#define CSPI_KEYSTROKE_LISTENER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), CSPI_KEYSTROKE_LISTENER_TYPE, CSpiKeystrokeListener))
-#define CSPI_KEYSTROKE_LISTENER_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), CSPI_KEYSTROKE_LISTENER_TYPE, CSpiKeystrokeListenerClass))
-#define CSPI_IS_KEYSTROKE_LISTENER(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), CSPI_KEYSTROKE_LISTENER_TYPE))
-#define CSPI_IS_KEYSTROKE_LISTENER_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), CSPI_KEYSTROKE_LISTENER_TYPE))
-
-typedef struct _CSpiKeystrokeListener CSpiKeystrokeListener;
-struct _CSpiKeystrokeListener {
- SpiKeystrokeListener parent;
- GList *callbacks;
-};
-typedef SpiKeystrokeListenerClass CSpiKeystrokeListenerClass;
-
-GType cspi_keystroke_listener_get_type (void);
-CSpiKeystrokeListener *cspi_keystroke_listener_new (void);
-void cspi_keystroke_listener_add_callback (CSpiKeystrokeListener *listener,
- AccessibleKeystrokeListenerCB callback,
- void *user_data);
-void cspi_keystroke_listener_remove_callback (CSpiKeystrokeListener *listener,
- AccessibleKeystrokeListenerCB callback);
-
-G_END_DECLS
-
-#endif /* __SPI_LISTENER_IMPL_H__ */
#include <cspi/spi-impl.h>
-G_BEGIN_DECLS
+#ifdef __cplusplus
+extern "C" {
+#endif
/*
* Structure used to encapsulate event information
typedef SPIBoolean (*AccessibleKeystrokeListenerCB) (AccessibleKeystroke *stroke,
void *user_data);
-G_END_DECLS
+#ifdef __cplusplus
+}
+#endif
#endif
#ifndef _SPI_PRIVATE_H_
#define _SPI_PRIVATE_H_
-/*
- * Private internal implementation details of at-spi.
- */
+/* Private internal implementation details of at-spi. */
-#include <libbonobo.h>
#include <libspi/Accessibility.h>
#include <cspi/spi.h>
+#include "cspi/cspi-lowlevel.h"
#include "cspi/spi-listener.h"
struct _Accessible {
void cspi_object_unref (Accessible *accessible);
SPIBoolean cspi_accessible_is_a (Accessible *obj,
const char *interface_name);
-SPIBoolean cspi_check_ev (const char *error_string);
#define cspi_return_if_fail(val) \
if (!(val)) \
#ifndef _SPI_ROLETYPES_H_
#define _SPI_ROLETYPES_H_
-#include <glib/gmacros.h>
-
-G_BEGIN_DECLS
+#ifdef __cplusplus
+extern "C" {
+#endif
/**
* AccessibleRole:
const char* AccessibleRole_getName (AccessibleRole role);
-G_END_DECLS
+#ifdef __cplusplus
+}
+#endif
#endif
#ifndef _SPI_STATETYPES_H_
#define _SPI_STATETYPES_H_
-#include <glib/gmacros.h>
-
-G_BEGIN_DECLS
+#ifdef __cplusplus
+extern "C" {
+#endif
-/*
- *
- * Enumerated type for accessible state
- *
- */
+/* Enumerated type for accessible state */
typedef enum
{
SPI_STATE_LAST_DEFINED
} AccessibleState;
-G_END_DECLS
+#ifdef __cplusplus
+}
+#endif
#endif
+++ /dev/null
-#include <stdlib.h>
-#include <cspi/spi-private.h>
-
-/**
- * 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().
- * This API should not be used to free strings
- * from other libraries or allocated by the client.
- **/
-void
-SPI_freeString (char *s)
-{
- CORBA_free (s);
-}
-
-SPIBoolean
-cspi_check_ev (const char *error_string)
-{
- CORBA_Environment *ev = cspi_ev ();
-
- if (ev->_major != CORBA_NO_EXCEPTION)
- {
- char *err;
-
- err = bonobo_exception_get_text (ev);
-
- fprintf (stderr, "Warning: AT-SPI error: %s: %s\n",
- error_string, err);
-
- g_free (err);
-
- CORBA_exception_free (ev);
-
- return FALSE;
- }
- else
- {
- return TRUE;
- }
-}
#ifndef _SPI_H
#define _SPI_H
-#include <glib/gmacros.h>
-
#include <cspi/spi-impl.h>
/*
* Definitions for AccessibleRole, AccessibleState,
*/
#include <libspi/keymasks.h>
-G_BEGIN_DECLS
+#ifdef __cplusplus
+extern "C" {
+#endif
/*
* Enumerated type for text boundary types
const char *eventType);
SPIBoolean deregisterGlobalEventListenerAll (AccessibleEventListener *listener);
-void registerAccessibleKeystrokeListener (
+SPIBoolean registerAccessibleKeystrokeListener (
AccessibleKeystrokeListener *listener,
AccessibleKeySet *keys,
AccessibleKeyMaskType modmask,
AccessibleKeyEventMask eventmask,
AccessibleKeyListenerSyncType sync_type);
-void deregisterAccessibleKeystrokeListener (
+SPIBoolean deregisterAccessibleKeystrokeListener (
AccessibleKeystrokeListener *listener,
AccessibleKeyMaskType modmask);
Accessible *getDesktop (int i);
int getDesktopList (Accessible **list);
-void generateKeyEvent (long int keyval,
+SPIBoolean generateKeyEvent (long int keyval,
AccessibleKeySynthType synth_type);
-void generateMouseEvent (long int x, long int y, char *name);
+SPIBoolean generateMouseEvent (long int x, long int y, char *name);
/* Accessible function prototypes */
AccessibleTable * Accessible_getTable (Accessible *obj);
AccessibleText * Accessible_getText (Accessible *obj);
AccessibleValue * Accessible_getValue (Accessible *obj);
-GenericInterface * Accessible_queryInterface (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);
-
-/**
- * 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);
-
-/**
- * AccessibleAction_getDescription:
- * @obj: a pointer to the #AccessibleAction 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);
-
-SPIBoolean
-AccessibleAction_doAction (AccessibleAction *obj,
- long int i);
-
-/**
- * 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.
- *
- * 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);
-
-/*
- *
- * AccessibleApplication function prototypes
- *
- */
-
-/**
- * AccessibleApplication_unref:
- * @obj: a pointer to the #AccessibleApplication on which to operate.
- *
- * Decrement the reference count for an #AccessibleApplication.
- *
- * Returns: (no return code implemented yet).
- *
- **/
-void
-AccessibleApplication_ref (AccessibleApplication *obj);
-
-/**
- * AccessibleApplication_unref:
- * @obj: a pointer to the #AccessibleApplication object on which to operate.
- *
- * Decrement the reference count for an #AccessibleApplication.
- *
- * Returns: (no return code implemented yet).
- *
- **/
-void
-AccessibleApplication_unref (AccessibleApplication *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);
-
-/**
- * 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);
-
-/**
- * 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);
-
-/**
- * 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);
-
-/**
- * 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);
-
-/*
- *
- * 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);
-
-/**
- * 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. COORD_TYPE_WINDOW, 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);
-
-void
-AccessibleComponent_getPosition (AccessibleComponent *obj,
- long int *x,
- long int *y,
- AccessibleCoordType ctype);
-
-void
-AccessibleComponent_getSize (AccessibleComponent *obj,
- long int *width,
- long int *height);
-
-/**
- * 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.
- **/
+/* 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);
+SPIBoolean AccessibleApplication_pause (AccessibleApplication *obj);
+SPIBoolean AccessibleApplication_resume (AccessibleApplication *obj);
+
+/* 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);
+ AccessibleComponent_getLayer (AccessibleComponent *obj);
+void AccessibleComponent_grabFocus (AccessibleComponent *obj);
+short AccessibleComponent_getMDIZOrder(AccessibleComponent *obj);
-/**
- * AccessibleComponent_getMDIZOrder:
- * @obj: a pointer to the #AccessibleComponent to query.
- *
- * Query the z stacking order of a component which is in the MDI layer.
- *
- * 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);
-
-void
-AccessibleComponent_grabFocus (AccessibleComponent *obj);
-
-/*
- *
- * AccessibleEditableText function prototypes
- *
- */
+/* AccessibleEditableText function prototypes */
void
AccessibleEditableText_ref (AccessibleEditableText *obj);
long int startOffset,
long int endOffset);
-/*
- *
- * AccessibleValue Function Prototypes:
- *
- */
-
-void AccessibleValue_ref (AccessibleValue *obj);
-void AccessibleValue_unref (AccessibleValue *obj);
-
-float
-AccessibleValue_getMinimumValue (AccessibleValue *obj);
-
-float
-AccessibleValue_getCurrentValue (AccessibleValue *obj);
+/* AccessibleValue Function Prototypes: */
-float
-AccessibleValue_getMaximumValue (AccessibleValue *obj);
+void AccessibleValue_ref (AccessibleValue *obj);
+void AccessibleValue_unref (AccessibleValue *obj);
+float AccessibleValue_getMinimumValue (AccessibleValue *obj);
+float AccessibleValue_getCurrentValue (AccessibleValue *obj);
+float AccessibleValue_getMaximumValue (AccessibleValue *obj);
+SPIBoolean AccessibleValue_setCurrentValue (AccessibleValue *obj,
+ float newValue);
-SPIBoolean
-AccessibleValue_setCurrentValue (AccessibleValue *obj,
- float newValue);
-
-void
-SPI_freeString (char *s);
+/* Misc methods */
+void SPI_freeString (char *s);
-G_END_DECLS
+#ifdef __cplusplus
+}
+#endif
#endif
* by @obj, or NULL otherwise.
*
**/
-GenericInterface *
+AccessibleUnknown *
Accessible_queryInterface (Accessible *obj,
const char *interface_name)
{
* @obj: a pointer to the #AccessibleApplication on which to operate.
*
* Increment the reference count for an #AccessibleApplication.
- *
**/
void
AccessibleApplication_ref (AccessibleApplication *obj)
* @obj: a pointer to the #AccessibleApplication object on which to operate.
*
* Decrement the reference count for an #AccessibleApplication.
- *
**/
void
AccessibleApplication_unref (AccessibleApplication *obj)
*
* 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)
{
*/
#include <cspi/spi-private.h>
-#include <cspi/spi-listener-impl.h>
/**
* createAccessibleEventListener:
AccessibleEventListenerCB callback,
void *user_data)
{
- cspi_event_listener_add_callback (listener, callback, user_data);
+ cspi_event_listener_add_cb (listener, callback, user_data);
return TRUE;
}
void
AccessibleEventListener_unref (AccessibleEventListener *listener)
{
- /* Would prefer this not to be bonobo api */
- bonobo_object_unref (BONOBO_OBJECT (listener));
+ cspi_event_listener_unref (listener);
}
/**
AccessibleEventListener_removeCallback (AccessibleEventListener *listener,
AccessibleEventListenerCB callback)
{
- cspi_event_listener_remove_callback (listener, callback);
+ cspi_event_listener_remove_cb (listener, callback);
return TRUE;
}
createAccessibleKeystrokeListener (AccessibleKeystrokeListenerCB callback,
void *user_data)
{
- CSpiKeystrokeListener *listener = cspi_keystroke_listener_new ();
+ AccessibleKeystrokeListener *listener = cspi_keystroke_listener_new ();
if (callback)
{
AccessibleKeystrokeListener_addCallback (listener, callback, user_data);
}
- return (AccessibleKeystrokeListener *)listener;
+ return listener;
}
/**
AccessibleKeystrokeListenerCB callback,
void *user_data)
{
- cspi_keystroke_listener_add_callback (listener, callback, user_data);
+ cspi_keystroke_listener_add_cb (listener, callback, user_data);
return TRUE;
}
AccessibleKeystrokeListener_removeCallback (AccessibleKeystrokeListener *listener,
AccessibleKeystrokeListenerCB callback)
{
- cspi_keystroke_listener_remove_callback (listener, callback);
+ cspi_keystroke_listener_remove_cb (listener, callback);
return TRUE;
}
void
AccessibleKeystrokeListener_unref (AccessibleKeystrokeListener *listener)
{
- /* Would prefer this not to be bonobo api */
- bonobo_object_unref (BONOBO_OBJECT (listener));
+ cspi_keystroke_listener_unref (listener);
}
g_print ("releasing %p => %p\n", a, a->objref);
#endif
- bonobo_object_release_unref (a->objref, NULL);
+ cspi_release_unref (a->objref);
memset (a, 0xaa, sizeof (Accessible));
a->ref_count = -1;
#ifndef DEBUG_OBJECTS
- g_free (a);
+ free (a);
#endif
}
-
SPIBoolean
cspi_accessible_is_a (Accessible *obj,
const char *interface_name)
unknown = Bonobo_Unknown_queryInterface (CSPI_OBJREF (obj),
interface_name, cspi_ev ());
- if (BONOBO_EX (cspi_ev ()))
+ if (ev._major != CORBA_NO_EXCEPTION)
{
g_error ("Exception '%s' checking if is '%s'",
- bonobo_exception_get_text (cspi_ev ()),
+ cspi_exception_get_text (),
interface_name);
}
if (unknown != CORBA_OBJECT_NIL)
{
retval = TRUE;
- bonobo_object_release_unref (unknown, NULL);
+ cspi_release_unref (unknown);
}
else
{
{
SPIBoolean retval;
- if (BONOBO_EX (&ev))
+ if (ev._major != CORBA_NO_EXCEPTION)
{
CORBA_exception_free (&ev);
retval = TRUE;
{
g_assert (ref->ref_count > 0);
ref->ref_count++;
- bonobo_object_release_unref (corba_object, NULL);
+ cspi_release_unref (corba_object);
#ifdef DEBUG_OBJECTS
g_print ("returning cached %p => %p\n", ref, ref->objref);
#endif
}
else
{
- ref = g_new (Accessible, 1);
+ ref = malloc (sizeof (Accessible));
#ifdef DEBUG_OBJECTS
g_print ("allocating %p => %p\n", ref, corba_object);
if (registry != CORBA_OBJECT_NIL)
{
- bonobo_object_release_unref (registry, NULL);
+ cspi_release_unref (registry);
registry = CORBA_OBJECT_NIL;
}
}
int
SPI_init (void)
{
- int argc = 0;
- char *obj_id;
-
if (SPI_inited)
{
return 1;
CORBA_exception_init (&ev);
- if (!bonobo_init (&argc, NULL))
- {
- g_error ("Could not initialize Bonobo");
- }
-
- obj_id = "OAFIID:Accessibility_Registry:proto0.1";
-
- registry = bonobo_activation_activate_from_id (
- obj_id, 0, NULL, cspi_ev ());
-
- if (ev._major != CORBA_NO_EXCEPTION)
- {
- g_error ("AT-SPI error: during registry activation: %s\n",
- bonobo_exception_get_text (cspi_ev ()));
- }
-
- if (registry == CORBA_OBJECT_NIL)
- {
- g_error ("Could not locate registry");
- }
-
- bonobo_activate ();
+ registry = cspi_init ();
g_atexit (cspi_cleanup);
void
SPI_event_main (void)
{
- bonobo_main ();
+ cspi_main ();
}
/**
void
SPI_event_quit (void)
{
- bonobo_main_quit ();
+ cspi_main_quit ();
}
/**
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().
+ * This API should not be used to free strings
+ * from other libraries or allocated by the client.
+ **/
+void
+SPI_freeString (char *s)
+{
+ CORBA_free (s);
+}
* Add an in-process callback function to an existing AccessibleEventListener.
*
* Returns: #TRUE if successful, otherwise #FALSE.
- *
**/
SPIBoolean
registerGlobalEventListener (AccessibleEventListener *listener,
{
SPIBoolean retval;
+ if (!listener)
+ {
+ return FALSE;
+ }
+
Accessibility_Registry_registerGlobalEventListener (
- cspi_registry (),
- (Accessibility_EventListener)
- BONOBO_OBJREF (bonobo_object (listener)),
- eventType,
- cspi_ev ());
+ cspi_registry (),
+ cspi_event_listener_get_corba (listener),
+ eventType, cspi_ev ());
retval = !cspi_exception ();
* listener reference.
*
* Returns: #TRUE if successful, otherwise #FALSE.
- *
**/
SPIBoolean
deregisterGlobalEventListenerAll (AccessibleEventListener *listener)
{
+ if (!listener)
+ {
+ return FALSE;
+ }
+
Accessibility_Registry_deregisterGlobalEventListenerAll (
- cspi_registry (),
- (Accessibility_EventListener) BONOBO_OBJREF (listener),
- cspi_ev ());
+ cspi_registry (),
+ cspi_event_listener_get_corba (listener),
+ cspi_ev ());
return !cspi_exception ();
}
+
/**
* deregisterGlobalEventListener:
* @listener: the #AccessibleEventListener registered against an event type.
* event type.
*
* Returns: #TRUE if successful, otherwise #FALSE.
- *
**/
SPIBoolean
deregisterGlobalEventListener (AccessibleEventListener *listener,
const char *eventType)
{
+ if (!listener)
+ {
+ return FALSE;
+ }
+
Accessibility_Registry_deregisterGlobalEventListener (
- cspi_registry (),
- (Accessibility_EventListener) BONOBO_OBJREF (listener),
- (CORBA_char *) eventType,
- cspi_ev ());
+ cspi_registry (),
+ cspi_event_listener_get_corba (listener),
+ (CORBA_char *) eventType, cspi_ev ());
return !cspi_exception ();
}
* function always returns '1'.
*
* Returns: an integer indicating the number of active virtual desktops.
- *
**/
int
getDesktopCount ()
* function always returns '1'.
*
* Returns: a pointer to the 'i-th' virtual desktop's #Accessible representation.
- *
**/
Accessible*
getDesktop (int i)
{
- return cspi_object_add (Accessibility_Registry_getDesktop (cspi_registry (),
- (CORBA_short) i,
- cspi_ev ()));
+ return cspi_object_add (
+ Accessibility_Registry_getDesktop (
+ cspi_registry (), (CORBA_short) i, cspi_ev ()));
}
/**
* all windows (CSPI_KEYLISTENER_ALL_WINDOWS), or
* non-preemptively (CSPI_KEYLISTENER_NOSYNC).
* ( Other sync_type values may be available in the future.)
+ *
+ * Returns: #TRUE if successful, otherwise #FALSE.
**/
-void
+SPIBoolean
registerAccessibleKeystrokeListener (AccessibleKeystrokeListener *listener,
AccessibleKeySet *keys,
AccessibleKeyMaskType modmask,
Accessibility_ControllerEventMask controller_event_mask;
Accessibility_DeviceEventController device_event_controller;
+ if (!listener)
+ {
+ return FALSE;
+ }
+
device_event_controller =
Accessibility_Registry_getDeviceEventController (cspi_registry (), cspi_ev ());
- cspi_return_if_ev ("getting event controller");
+ cspi_return_val_if_ev ("getting event controller", FALSE);
/* copy the keyval filter values from the C api into the CORBA KeySet */
if (keys)
/* we overload the keyset long w/keycodes, the - bit acts as a flag */
key_set._buffer[i] = (keys->keysyms[i]) ? keys->keysyms[i] :
-keys->keycodes[i];
- /* g_print ("key-set %d = %d\n", i, (int) key_set->_buffer[i]); */
+ /* fprintf (stderr, "key-set %d = %d\n", i, (int) key_set->_buffer[i]); */
}
}
else
controller_event_mask.refcount = (CORBA_unsigned_short) 1;
Accessibility_DeviceEventController_registerKeystrokeListener (
- device_event_controller,
- BONOBO_OBJREF (listener),
- &key_set,
- &controller_event_mask,
- &key_events,
- (CORBA_boolean) ((sync_type & SPI_KEYLISTENER_ALL_WINDOWS)!=0),
- cspi_ev ());
-
- bonobo_object_release_unref (device_event_controller, cspi_ev ());
+ device_event_controller,
+ cspi_event_listener_get_corba (listener),
+ &key_set,
+ &controller_event_mask,
+ &key_events,
+ (CORBA_boolean) ((sync_type & SPI_KEYLISTENER_ALL_WINDOWS)!=0),
+ cspi_ev ());
+
+ cspi_release_unref (device_event_controller);
+
+ return TRUE;
}
/**
*
* 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.
**/
-void
+SPIBoolean
deregisterAccessibleKeystrokeListener (AccessibleKeystrokeListener *listener,
AccessibleKeyMaskType modmask)
{
Accessibility_KeyEventTypeSeq key_events;
Accessibility_DeviceEventController device_event_controller;
+ if (!listener)
+ {
+ return FALSE;
+ }
+
device_event_controller =
Accessibility_Registry_getDeviceEventController (cspi_registry (), cspi_ev ());
- cspi_return_if_ev ("getting keystroke listener");
+ cspi_return_val_if_ev ("getting keystroke listener", FALSE);
controller_event_mask.value = (CORBA_unsigned_long) modmask;
controller_event_mask.refcount = (CORBA_unsigned_short) 1;
key_set._length = 0;
Accessibility_DeviceEventController_deregisterKeystrokeListener (
- device_event_controller,
- BONOBO_OBJREF (listener),
- &key_set,
- &controller_event_mask,
- &key_events,
- (CORBA_boolean) TRUE,
- cspi_ev ());
-
- bonobo_object_release_unref (device_event_controller, NULL);
+ device_event_controller,
+ cspi_event_listener_get_corba (listener),
+ &key_set,
+ &controller_event_mask,
+ &key_events,
+ (CORBA_boolean) TRUE,
+ cspi_ev ());
+
+ cspi_release_unref (device_event_controller);
+
+ return TRUE;
}
/**
* Synthesize a keyboard event (as if a hardware keyboard event occurred in the
* current UI context).
*
+ * Returns: #TRUE if successful, otherwise #FALSE.
**/
-void
+SPIBoolean
generateKeyEvent (long int keyval, AccessibleKeySynthType synth_type)
{
/* TODO: check current modifier status and
Accessibility_DeviceEventController device_event_controller =
Accessibility_Registry_getDeviceEventController (cspi_registry (), cspi_ev ());
- cspi_return_if_ev ("getting event controller");
+ cspi_return_val_if_ev ("getting event controller", FALSE);
Accessibility_DeviceEventController_generateKeyEvent (device_event_controller,
keyval,
(unsigned long) synth_type,
cspi_ev ());
- bonobo_object_release_unref (device_event_controller, NULL);
+ cspi_release_unref (device_event_controller);
+
+ return TRUE;
}
/**
* tempted to generate mouse events, rather than this method.
* Not Yet Implemented.
*
+ * Returns: #TRUE if successful, otherwise #FALSE.
**/
-void
+SPIBoolean
generateMouseEvent (long x, long y, char *name)
{
- ;
+ return FALSE;
}
cspi_check_ev ("selectAll");
- return TRUE; /* TODO: change the bonobo method to return SPIBoolean */
+ return TRUE; /* TODO: change the CORBA method to return SPIBoolean */
}
/**
length = seq->_length;
- j = *array = g_new (long, length);
+ j = *array = malloc (sizeof (long) * length);
for (i = 0; i < length; i++)
{
}
static void
-create_gui ()
+create_gui (void)
{
GtkWidget *window, *button, *container, *hbox;
}
static void
-create_gui_x ()
+create_gui_x (void)
{
GtkWidget *window, *button, *container, *hbox, *range;
GtkAdjustment *adjustment;
controls[6] = control_struct_new (XkbMouseKeysAccelMask, &xkb->ctrls->mk_time_to_max, NULL, "Accel");
controls[7] = control_struct_new (XkbAccessXTimeoutMask, &xkb->ctrls->ax_timeout, "AccessX timeout", "Sec");
-
-
hbox = gtk_widget_new (gtk_hbox_get_type(),
"GtkWidget::parent", container,
"GtkWidget::visible", TRUE,
static void
test_table (AccessibleTable *table)
{
- char *str;
+ Accessible *header;
gint index;
gint rows, columns;
g_assert (rows > 0);
columns = AccessibleTable_getNColumns (table);
- g_assert (columns > 0); /* weird that this fails, surely a bug ? */
+ g_assert (columns > 0);
- index = AccessibleTable_getIndexAt (table, rows-1, columns-1);
+ index = AccessibleTable_getIndexAt (table, rows - 1, columns - 1);
- g_assert (AccessibleTable_getRowAtIndex (table, index) == rows-1);
+ g_assert (AccessibleTable_getRowAtIndex (table, index) == rows - 1);
- g_assert (AccessibleTable_getColumnAtIndex (table, index) == columns-1);
+ g_assert (AccessibleTable_getColumnAtIndex (table, index) == columns - 1);
- g_assert (AccessibleTable_getColumnHeader (table, 0));
- /* maybe bogus assertion */
+ g_assert ((header = AccessibleTable_getColumnHeader (table, 0)));
+ Accessible_unref (header);
AccessibleTable_isSelected (table, 0, 0);
- /* no assertion, but see if warnings are thrown */
/* FIXME: lots more tests */
}
static void
test_value (AccessibleValue *value)
{
- char *str;
float original_value;
/* Note: test_value assertions are known not to work as of Dec 09 */
{
int leaked;
TestWindow *win;
- const char *modules, *tmp;
+ const char *modules;
AccessibleEventListener *global_listener;
modules = g_getenv ("GTK_MODULES");