From: billh Date: Sat, 18 Aug 2001 19:00:35 +0000 (+0000) Subject: Added makefile support for cspi directory. X-Git-Tag: AT_SPI2_ATK_2_12_0~1592 X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fat-spi2-atk.git;a=commitdiff_plain;h=fa9134cfafbbbb69a4aaa5ea280cd507c8e510ba Added makefile support for cspi directory. spi_main.c now builds. Added C binding support for event listeners, and added new object type in libspi, AccessibleEventListener, which allows dynamic addition and removal of in-process callbacks by listening clients. git-svn-id: http://svn.gnome.org/svn/at-spi/trunk@36 e2bd861d-eb25-0410-b326-f6ed22b6b98c --- diff --git a/ChangeLog b/ChangeLog index a0f51f3..5c84fda 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,26 @@ 2001-08-18 Bill Haneman + * Makefile.am: + * configure.in : + * cspi/Makefile.am : + Added makefile support for at-spi/cspi directory. + * cspi/spi.h : + * cspi/spi-impl.h : + * cspi/spi-listener.h : (NEW FILE) + Added support for/use of spi-listener.h. + * cspi/spi_main.c : + C bindings now build successfully, with no warnings. + * libspi/accessibleeventlistener.h : (NEW FILE) + * libspi/accessibleeventlistener.c : (NEW FILE) + * libspi/Makefile.am : + Added new object type "AccessibleEventListener" + which inherits from Listener, and allows attachment + of in-process callbacks (so that a client with a listening + object instance can add functionality to the local + implementation, dynamically). + +2001-08-18 Bill Haneman + * libspi/accessible.c: Add implementation for get_index_in_parent(). * cspi/spi.h : diff --git a/Makefile.am b/Makefile.am index c6abf4f..d44e841 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,3 +1,3 @@ -SUBDIRS=po docs idl libspi registryd test at-bridge +SUBDIRS=po docs idl libspi registryd test at-bridge cspi EXTRA_DIST= xml-i18n-extract.in xml-i18n-merge.in xml-i18n-update.in diff --git a/configure.in b/configure.in index 4b8e5c4..0b5a7d2 100644 --- a/configure.in +++ b/configure.in @@ -55,6 +55,10 @@ PKG_CHECK_MODULES(LIBSPI, bonobo-activation-2.0 >= 0.9.1 libbonobo-2.0 >= 1.97.0 AC_SUBST(LIBSPI_LIBS) AC_SUBST(LIBSPI_CFLAGS) +PKG_CHECK_MODULES(LIBCSPI, bonobo-activation-2.0 >= 0.9.1 libbonobo-2.0 >= 1.97.0 ORBit-2.0 >= 2.3.91 atk >= 0.2) +AC_SUBST(LIBCSPI_LIBS) +AC_SUBST(LIBCSPI_CFLAGS) + PKG_CHECK_MODULES(REGISTRYD, bonobo-activation-2.0 >= 0.9.1 libbonobo-2.0 >= 1.97.0 atk >= 0.2) AC_SUBST(REGISTRYD_LIBS) AC_SUBST(REGISTRYD_CFLAGS) @@ -91,6 +95,7 @@ registryd/Makefile registryd/Accessibility_Registry.server at-bridge/Makefile test/Makefile +cspi/Makefile ]) echo "AT-SPI setup: diff --git a/cspi/spi-impl.h b/cspi/spi-impl.h index 28653f6..82779f2 100644 --- a/cspi/spi-impl.h +++ b/cspi/spi-impl.h @@ -1,7 +1,17 @@ +/* + * Note: this header is a private implementation header, clients of + * the at-spi interfaces or the C bindings in libcspi should + * not depend on any of the information in this file directly, + * as it it not intended for use as a public interface. + * + * You have been warned ! + */ + #ifndef _SPI_IMPL_H_ #define _SPI_IMPL_H_ -#include +#include +#include "Accessibility.h" typedef unsigned int boolean; @@ -19,6 +29,6 @@ typedef CORBA_Object AccessibleStateSet; typedef CORBA_Object AccessibleTable; typedef CORBA_Object AccessibleText; typedef CORBA_Object AccessibleValue; -typedef CORBA_Object Accessibility_Registry; +typedef CORBA_Object AccessibilityRegistry; #endif diff --git a/cspi/spi-listener.h b/cspi/spi-listener.h new file mode 100644 index 0000000..ac6c4b8 --- /dev/null +++ b/cspi/spi-listener.h @@ -0,0 +1,47 @@ +#ifndef _SPI_LISTENER_H_ +#define _SPI_LISTENER_H_ + + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#include "accessibleeventlistener.h" + +/* + * + * Structure used to encapsulate event information + * + */ + +typedef struct _AccessibleEvent { + Accessible *source; + char *type; + char *detail1; + char *detail2; +} AccessibleEvent; + +/* + * + * Function prototype typedefs for Event Listener Callbacks. + * (see libspi/accessibleeventlistener.h for definition of VoidEventListenerCB). + * + * usage: signatures should be + * void (*AccessibleEventListenerCB) (AccessibleEvent *event); + * + * void (*KeystrokeListenerCB) (KeystrokeEvent *Event); + */ + +typedef VoidEventListenerCB AccessibleEventListenerCB; +typedef VoidEventListenerCB KeystrokeListenerCB; + +typedef struct _KeystrokeListener { + KeystrokeListenerCB callback; +} KeystrokeListener; + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + + +#endif diff --git a/cspi/spi.h b/cspi/spi.h index 18fee78..7fd1ec0 100644 --- a/cspi/spi.h +++ b/cspi/spi.h @@ -7,6 +7,7 @@ /* definitions for ACCESSIBLE_STATE */ #include "spi-roletypes.h" #include "spi-statetypes.h" +#include "spi-listener.h" /* * @@ -46,34 +47,11 @@ typedef enum -/* - * - * Structure used to encapsulate event information - * - */ - -typedef struct _AccessibleEvent { - Accessible *source; - char *type; - char *detail1; - char *detail2; -} AccessibleEvent; - typedef enum _AccessibleCoordType { COORD_TYPE_WINDOW, COORD_TYPE_SCREEN } AccessibleCoordType; -/* - * - * Function prototype typedef for AccessibleEventListener - * - */ - -typedef void (*AccessibleEventListener) (AccessibleEvent *e); -typedef void (*KeystrokeListener) (AccessibleEvent *e); - - /* * @@ -97,13 +75,28 @@ void SPI_exit (void); /* + * Event Listener creation and support. + */ + +AccessibleEventListener * +createEventListener (AccessibleEventListenerCB callback); + +boolean +EventListener_addCallback (AccessibleEventListener *listener, + AccessibleEventListenerCB callback); + +boolean +EventListener_removeCallback (AccessibleEventListener *listener, + AccessibleEventListenerCB callback); + +/* * * Global functions serviced by the registry * */ boolean -RegisterGlobalEventListener (AccessibleEventListener listener, +RegisterGlobalEventListener (AccessibleEventListener *listener, char *eventType); int diff --git a/cspi/spi_main.c b/cspi/spi_main.c index 09d9be9..2eb15ce 100644 --- a/cspi/spi_main.c +++ b/cspi/spi_main.c @@ -1,9 +1,9 @@ -/* #include */ +#include #include #include "spi.h" static CORBA_Environment ev; -static Accessibility_Registry registry; +static AccessibilityRegistry registry; Accessible * Obj_Add (Accessible object) @@ -24,10 +24,11 @@ int SPI_init (void) { int argc = 0; - CORBA_exception_init(&ev); CORBA_Object oclient; char *obj_id; + CORBA_exception_init(&ev); + if (!bonobo_init (&argc, NULL)) { g_error ("Could not initialize Bonobo"); @@ -84,6 +85,32 @@ SPI_exit (void) exit(0); } +AccessibleEventListener * +CreateEventListener (AccessibleEventListenerCB callback) +{ + AccessibleEventListener *listener = accessible_event_listener_new (); + if (callback) + { + accessible_event_listener_add_callback (listener, callback); + } +} + +boolean +EventListener_addCallback (AccessibleEventListener *listener, + AccessibleEventListenerCB callback) +{ + accessible_event_listener_add_callback (listener, callback); + return TRUE; +} + +boolean +EventListener_removeCallback (AccessibleEventListener *listener, + AccessibleEventListenerCB callback) +{ + accessible_event_listener_remove_callback (listener, callback); + return TRUE; +} + /* * * Global functions serviced by the registry @@ -96,7 +123,8 @@ RegisterGlobalEventListener (AccessibleEventListener *listener, { Accessibility_Registry_registerGlobalEventListener ( registry, - *listener, + (Accessibility_EventListener) + bonobo_object_corba_objref (bonobo_object (listener)), eventType, &ev); @@ -119,7 +147,7 @@ GetDesktopCount () Accessible *getDesktop (int n) { - return Obj_Add (Accessibility_Registry_getDesktop (registry, n, &ev)); + return Obj_Add (Accessibility_Registry_getDesktop (registry, (CORBA_short) n, &ev)); } int @@ -159,14 +187,16 @@ generateMouseEvent (long x, long y, char *name) int Accessible_ref (Accessible *obj) { - return Accessibility_Accessible_ref (*obj, &ev); + Accessibility_Accessible_ref (*obj, &ev); + return 0; } int Accessible_unref (Accessible *obj) { - return Accessibility_Accessible_unref (*obj, &ev); + Accessibility_Accessible_unref (*obj, &ev); + return 0; } char * @@ -237,25 +267,27 @@ Accessible_getStateSet (Accessible *obj) int AccessibleApplication_ref (AccessibleApplication *obj) { - return Accessibility_Application_ref (*obj, &ev); + Accessibility_Application_ref (*obj, &ev); + return 0; } int AccessibleApplication_unref (AccessibleApplication *obj) { - return Accessibility_Application_unref (*obj, &ev); + Accessibility_Application_unref (*obj, &ev); + return 0; } char * AccessibleApplication_getToolkitName (AccessibleApplication *obj) { - return Accessibility_Application__getToolkitName (*obj, &ev); + return Accessibility_Application__get_toolkitName (*obj, &ev); } char * AccessibleApplication_getVersion (AccessibleApplication *obj) { - return Accessibility_Application__getVersion (*obj, &ev); + return Accessibility_Application__get_version (*obj, &ev); } long diff --git a/libspi/Makefile.am b/libspi/Makefile.am index 654e3e8..af5a601 100644 --- a/libspi/Makefile.am +++ b/libspi/Makefile.am @@ -19,6 +19,7 @@ libspiinclude_HEADERS = accessible.h \ application.h \ desktop.h \ listener.h \ + accessibleeventlistener.h \ registry.h \ Accessibility.h @@ -48,6 +49,8 @@ libspi_la_SOURCES = accessible.c \ desktop.h \ listener.c \ listener.h \ + accessibleeventlistener.c \ + accessibleeventlistener.h \ registry.c \ registry.h \ $(IDL_OUT) diff --git a/libspi/accessibleeventlistener.c b/libspi/accessibleeventlistener.c new file mode 100644 index 0000000..8f4eaa2 --- /dev/null +++ b/libspi/accessibleeventlistener.c @@ -0,0 +1,161 @@ +/* + * AT-SPI - Assistive Technology Service Provider Interface + * (Gnome Accessibility Project; http://developer.gnome.org/projects/gap) + * + * Copyright 2001 Sun Microsystems Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +/* + * accessibleeventlistener.c: bonobo implementation of Listener.idl, + * with added ability to attach/remove in-process callbacks. + * + */ + +#ifdef SPI_DEBUG +#include +#endif + +#include +#include +#include + +/* + * This pulls the definition for the BonoboObject (GType) + */ +#include "accessibleeventlistener.h" + +/* + * Our parent Gtk object type + */ +#define PARENT_TYPE LISTENER_TYPE + +/* + * A pointer to our parent object class + */ +static ListenerClass *accessible_event_listener_parent_class; + +/* + * Implemented GObject::finalize + */ +static void +accessible_event_listener_object_finalize (GObject *object) +{ +#ifdef SPI_DEBUG + fprintf(stderr, "listener_object_finalize called\n"); +#endif + ((GObjectClass *) accessible_event_listener_parent_class)->finalize (object); +} + +/* + * CORBA Accessibility::Listener::notifyEvent method implementation + */ + +static void +impl_accessible_event_notify_event (PortableServer_Servant servant, + const Accessibility_Event *e, + CORBA_Environment *ev) +{ + + int n; + int len; + VoidEventListenerCB cb; + AccessibleEventListener *listener = ACCESSIBLE_EVENT_LISTENER ( + bonobo_object_from_servant (servant)); + len = g_list_length (listener->callbacks); + + for (n=0; ncallbacks, n); + (*cb) (NULL); + } + bonobo_object_release_unref (e->target, ev); +} + +static void +accessible_event_listener_class_init (AccessibleEventListenerClass *klass) +{ + GObjectClass * object_class = (GObjectClass *) klass; + ListenerClass * listener_class = (ListenerClass *) klass; + POA_Accessibility_EventListener__epv *epv = &listener_class->epv; + accessible_event_listener_parent_class = g_type_class_ref (LISTENER_TYPE); + + object_class->finalize = accessible_event_listener_object_finalize; + + epv->notifyEvent = impl_accessible_event_notify_event; +} + +static void +accessible_event_listener_init (Listener *listener) +{ +} + +GType +accessible_event_listener_get_type (void) +{ + static GType type = 0; + + if (!type) { + static const GTypeInfo tinfo = { + sizeof (AccessibleEventListenerClass), + (GBaseInitFunc) NULL, + (GBaseFinalizeFunc) NULL, + (GClassInitFunc) accessible_event_listener_class_init, + (GClassFinalizeFunc) NULL, + NULL, /* class data */ + sizeof (Listener), + 0, /* n preallocs */ + (GInstanceInitFunc) accessible_event_listener_init, + NULL /* value table */ + }; + /* + * Here we use bonobo_type_unique instead of + * gtk_type_unique, this auto-generates a load of + * CORBA structures for us. All derived types must + * use bonobo_type_unique. + */ + type = bonobo_type_unique ( + PARENT_TYPE, + POA_Accessibility_EventListener__init, + NULL, + G_STRUCT_OFFSET (ListenerClass, epv), + &tinfo, + "AccessibleEventListener"); + } + + return type; +} + +AccessibleEventListener * +accessible_event_listener_new () +{ + AccessibleEventListener *retval = + LISTENER (g_object_new (accessible_event_listener_get_type (), NULL)); + return retval; +} + +void accessible_event_listener_add_callback (AccessibleEventListener *listener, + VoidEventListenerCB callback) +{ + listener->callbacks = g_list_append (listener->callbacks, listener); +} + +void accessible_event_listener_remove_callback (AccessibleEventListener *listener, + VoidEventListenerCB callback) +{ + listener->callbacks = g_list_remove (listener->callbacks, listener); +} diff --git a/libspi/accessibleeventlistener.h b/libspi/accessibleeventlistener.h new file mode 100644 index 0000000..f303ade --- /dev/null +++ b/libspi/accessibleeventlistener.h @@ -0,0 +1,60 @@ +/* + * AT-SPI - Assistive Technology Service Provider Interface + * (Gnome Accessibility Project; http://developer.gnome.org/projects/gap) + * + * Copyright 2001 Sun Microsystems Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#ifndef ACCESSIBLE_EVENT_LISTENER_H_ +#define ACCESSIBLE_EVENT_LISTENER_H_ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#include "listener.h" + +#define ACCESSIBLE_EVENT_LISTENER_TYPE (accessible_event_listener_get_type ()) +#define ACCESSIBLE_EVENT_LISTENER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), ACCESSIBLE_EVENT_LISTENER_TYPE, AccessibleEventListener)) +#define ACCESSIBLE_EVENT_LISTENER_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), ACCESSIBLE_EVENT_LISTENER_TYPE, AccessibleEventListenerClass)) +#define IS_ACCESSIBLE_EVENT_LISTENER(o) (G_TYPE_CHECK__INSTANCE_TYPE ((o), ACCESSIBLE_EVENT_LISTENER_TYPE)) +#define IS_ACCESSIBLE_EVENT_LISTENER_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), ACCESSIBLE_EVENT_LISTENER_TYPE)) + +typedef void (*VoidEventListenerCB) (gpointer event_ptr); + +typedef struct { + Listener parent; + GList *callbacks; +} AccessibleEventListener; + +typedef struct { + ListenerClass parent_class; +} AccessibleEventListenerClass; + +GType accessible_event_listener_get_type (void); +AccessibleEventListener *accessible_event_listener_new (void); +void accessible_event_listener_add_callback (AccessibleEventListener *listener, + VoidEventListenerCB callback); +void accessible_event_listener_remove_callback (AccessibleEventListener *listener, + VoidEventListenerCB callback); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* ACCESSIBLE_EVENT_LISTENER_H_ */ diff --git a/libspi/eventlistener.c b/libspi/eventlistener.c new file mode 100644 index 0000000..8f4eaa2 --- /dev/null +++ b/libspi/eventlistener.c @@ -0,0 +1,161 @@ +/* + * AT-SPI - Assistive Technology Service Provider Interface + * (Gnome Accessibility Project; http://developer.gnome.org/projects/gap) + * + * Copyright 2001 Sun Microsystems Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +/* + * accessibleeventlistener.c: bonobo implementation of Listener.idl, + * with added ability to attach/remove in-process callbacks. + * + */ + +#ifdef SPI_DEBUG +#include +#endif + +#include +#include +#include + +/* + * This pulls the definition for the BonoboObject (GType) + */ +#include "accessibleeventlistener.h" + +/* + * Our parent Gtk object type + */ +#define PARENT_TYPE LISTENER_TYPE + +/* + * A pointer to our parent object class + */ +static ListenerClass *accessible_event_listener_parent_class; + +/* + * Implemented GObject::finalize + */ +static void +accessible_event_listener_object_finalize (GObject *object) +{ +#ifdef SPI_DEBUG + fprintf(stderr, "listener_object_finalize called\n"); +#endif + ((GObjectClass *) accessible_event_listener_parent_class)->finalize (object); +} + +/* + * CORBA Accessibility::Listener::notifyEvent method implementation + */ + +static void +impl_accessible_event_notify_event (PortableServer_Servant servant, + const Accessibility_Event *e, + CORBA_Environment *ev) +{ + + int n; + int len; + VoidEventListenerCB cb; + AccessibleEventListener *listener = ACCESSIBLE_EVENT_LISTENER ( + bonobo_object_from_servant (servant)); + len = g_list_length (listener->callbacks); + + for (n=0; ncallbacks, n); + (*cb) (NULL); + } + bonobo_object_release_unref (e->target, ev); +} + +static void +accessible_event_listener_class_init (AccessibleEventListenerClass *klass) +{ + GObjectClass * object_class = (GObjectClass *) klass; + ListenerClass * listener_class = (ListenerClass *) klass; + POA_Accessibility_EventListener__epv *epv = &listener_class->epv; + accessible_event_listener_parent_class = g_type_class_ref (LISTENER_TYPE); + + object_class->finalize = accessible_event_listener_object_finalize; + + epv->notifyEvent = impl_accessible_event_notify_event; +} + +static void +accessible_event_listener_init (Listener *listener) +{ +} + +GType +accessible_event_listener_get_type (void) +{ + static GType type = 0; + + if (!type) { + static const GTypeInfo tinfo = { + sizeof (AccessibleEventListenerClass), + (GBaseInitFunc) NULL, + (GBaseFinalizeFunc) NULL, + (GClassInitFunc) accessible_event_listener_class_init, + (GClassFinalizeFunc) NULL, + NULL, /* class data */ + sizeof (Listener), + 0, /* n preallocs */ + (GInstanceInitFunc) accessible_event_listener_init, + NULL /* value table */ + }; + /* + * Here we use bonobo_type_unique instead of + * gtk_type_unique, this auto-generates a load of + * CORBA structures for us. All derived types must + * use bonobo_type_unique. + */ + type = bonobo_type_unique ( + PARENT_TYPE, + POA_Accessibility_EventListener__init, + NULL, + G_STRUCT_OFFSET (ListenerClass, epv), + &tinfo, + "AccessibleEventListener"); + } + + return type; +} + +AccessibleEventListener * +accessible_event_listener_new () +{ + AccessibleEventListener *retval = + LISTENER (g_object_new (accessible_event_listener_get_type (), NULL)); + return retval; +} + +void accessible_event_listener_add_callback (AccessibleEventListener *listener, + VoidEventListenerCB callback) +{ + listener->callbacks = g_list_append (listener->callbacks, listener); +} + +void accessible_event_listener_remove_callback (AccessibleEventListener *listener, + VoidEventListenerCB callback) +{ + listener->callbacks = g_list_remove (listener->callbacks, listener); +} diff --git a/libspi/eventlistener.h b/libspi/eventlistener.h new file mode 100644 index 0000000..f303ade --- /dev/null +++ b/libspi/eventlistener.h @@ -0,0 +1,60 @@ +/* + * AT-SPI - Assistive Technology Service Provider Interface + * (Gnome Accessibility Project; http://developer.gnome.org/projects/gap) + * + * Copyright 2001 Sun Microsystems Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#ifndef ACCESSIBLE_EVENT_LISTENER_H_ +#define ACCESSIBLE_EVENT_LISTENER_H_ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#include "listener.h" + +#define ACCESSIBLE_EVENT_LISTENER_TYPE (accessible_event_listener_get_type ()) +#define ACCESSIBLE_EVENT_LISTENER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), ACCESSIBLE_EVENT_LISTENER_TYPE, AccessibleEventListener)) +#define ACCESSIBLE_EVENT_LISTENER_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), ACCESSIBLE_EVENT_LISTENER_TYPE, AccessibleEventListenerClass)) +#define IS_ACCESSIBLE_EVENT_LISTENER(o) (G_TYPE_CHECK__INSTANCE_TYPE ((o), ACCESSIBLE_EVENT_LISTENER_TYPE)) +#define IS_ACCESSIBLE_EVENT_LISTENER_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), ACCESSIBLE_EVENT_LISTENER_TYPE)) + +typedef void (*VoidEventListenerCB) (gpointer event_ptr); + +typedef struct { + Listener parent; + GList *callbacks; +} AccessibleEventListener; + +typedef struct { + ListenerClass parent_class; +} AccessibleEventListenerClass; + +GType accessible_event_listener_get_type (void); +AccessibleEventListener *accessible_event_listener_new (void); +void accessible_event_listener_add_callback (AccessibleEventListener *listener, + VoidEventListenerCB callback); +void accessible_event_listener_remove_callback (AccessibleEventListener *listener, + VoidEventListenerCB callback); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* ACCESSIBLE_EVENT_LISTENER_H_ */ diff --git a/libspi/registry.c b/libspi/registry.c index e7dbf3e..a257a39 100644 --- a/libspi/registry.c +++ b/libspi/registry.c @@ -142,7 +142,7 @@ register_with_toolkits (Registry *registry_bonobo_object, EventTypeStruct *etype Accessibility_Registry registry; registry = bonobo_object_corba_objref (bonobo_object (registry_bonobo_object)); - /* for each app in each desktop, call bridge_register_toolkit_event */ + /* for each app in each desktop, call ...Application_registerToolkitEventListener */ n_desktops = Accessibility_Registry_getDesktopCount (registry, ev); @@ -155,6 +155,7 @@ register_with_toolkits (Registry *registry_bonobo_object, EventTypeStruct *etype app = (Accessibility_Application) Accessibility_Desktop_getChildAtIndex (desktop, j, ev); + /* TODO: should we be ref-ing the registry object before each call ? */ Accessibility_Application_registerToolkitEventListener (app, registry, CORBA_string_dup (etype->event_name), diff --git a/registryd/registry.c b/registryd/registry.c index e7dbf3e..a257a39 100644 --- a/registryd/registry.c +++ b/registryd/registry.c @@ -142,7 +142,7 @@ register_with_toolkits (Registry *registry_bonobo_object, EventTypeStruct *etype Accessibility_Registry registry; registry = bonobo_object_corba_objref (bonobo_object (registry_bonobo_object)); - /* for each app in each desktop, call bridge_register_toolkit_event */ + /* for each app in each desktop, call ...Application_registerToolkitEventListener */ n_desktops = Accessibility_Registry_getDesktopCount (registry, ev); @@ -155,6 +155,7 @@ register_with_toolkits (Registry *registry_bonobo_object, EventTypeStruct *etype app = (Accessibility_Application) Accessibility_Desktop_getChildAtIndex (desktop, j, ev); + /* TODO: should we be ref-ing the registry object before each call ? */ Accessibility_Application_registerToolkitEventListener (app, registry, CORBA_string_dup (etype->event_name),