From: billh Date: Sat, 18 Aug 2001 20:27:40 +0000 (+0000) Subject: Added new test that uses the C bindings API (test/simple-at). X-Git-Tag: AT_SPI2_ATK_2_12_0~1590 X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fat-spi2-atk.git;a=commitdiff_plain;h=fdf87471b3d56d7a66d31f33c1ef3d631e9ef51c Added new test that uses the C bindings API (test/simple-at). Bugfix for AccessibleEventListener. git-svn-id: http://svn.gnome.org/svn/at-spi/trunk@38 e2bd861d-eb25-0410-b326-f6ed22b6b98c --- diff --git a/ChangeLog b/ChangeLog index 5c84fda..f0d5258 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,17 @@ 2001-08-18 Bill Haneman + * Makefile.am : changed build order to build test last. + * cspi/spi.h : + * cspi/spi_main.c : + Changed "createEventListener" to "CreateEventListener". + * libspi/accessibleeventlistener.c : + Bugfix for addition of callbacks. + * test/Makefile.am : + * test/simple-at.c : + Added new test that uses the C bindings API. + +2001-08-18 Bill Haneman + * Makefile.am: * configure.in : * cspi/Makefile.am : diff --git a/Makefile.am b/Makefile.am index d44e841..99b9331 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,3 +1,3 @@ -SUBDIRS=po docs idl libspi registryd test at-bridge cspi +SUBDIRS=po docs idl libspi registryd at-bridge cspi test EXTRA_DIST= xml-i18n-extract.in xml-i18n-merge.in xml-i18n-update.in diff --git a/cspi/spi.h b/cspi/spi.h index 7fd1ec0..b32aae8 100644 --- a/cspi/spi.h +++ b/cspi/spi.h @@ -79,7 +79,7 @@ SPI_exit (void); */ AccessibleEventListener * -createEventListener (AccessibleEventListenerCB callback); +CreateEventListener (AccessibleEventListenerCB callback); boolean EventListener_addCallback (AccessibleEventListener *listener, diff --git a/cspi/spi_main.c b/cspi/spi_main.c index 2eb15ce..fcf61d3 100644 --- a/cspi/spi_main.c +++ b/cspi/spi_main.c @@ -93,6 +93,7 @@ CreateEventListener (AccessibleEventListenerCB callback) { accessible_event_listener_add_callback (listener, callback); } + return listener; } boolean @@ -220,7 +221,7 @@ Accessible_getParent (Accessible *obj) long Accessible_getChildCount (Accessible *obj) { - return Accessibility_Accessible_getChildCount (*obj, &ev); + return Accessibility_Accessible__get_childCount (*obj, &ev); } Accessible * @@ -293,7 +294,7 @@ AccessibleApplication_getVersion (AccessibleApplication *obj) long AccessibleApplication_getID (AccessibleApplication *obj) { - return Accessibility_Application__getID (*obj, &ev); + return Accessibility_Application__get_id (*obj, &ev); } /* Not Yet Implemented */ diff --git a/libspi/accessibleeventlistener.c b/libspi/accessibleeventlistener.c index 8f4eaa2..41a4050 100644 --- a/libspi/accessibleeventlistener.c +++ b/libspi/accessibleeventlistener.c @@ -81,7 +81,10 @@ impl_accessible_event_notify_event (PortableServer_Servant servant, for (n=0; ncallbacks, n); - (*cb) (NULL); + if (cb) + { + (*cb) (NULL); + } } bonobo_object_release_unref (e->target, ev); } @@ -151,11 +154,11 @@ accessible_event_listener_new () void accessible_event_listener_add_callback (AccessibleEventListener *listener, VoidEventListenerCB callback) { - listener->callbacks = g_list_append (listener->callbacks, listener); + listener->callbacks = g_list_append (listener->callbacks, callback); } void accessible_event_listener_remove_callback (AccessibleEventListener *listener, VoidEventListenerCB callback) { - listener->callbacks = g_list_remove (listener->callbacks, listener); + listener->callbacks = g_list_remove (listener->callbacks, callback); } diff --git a/libspi/eventlistener.c b/libspi/eventlistener.c index 8f4eaa2..41a4050 100644 --- a/libspi/eventlistener.c +++ b/libspi/eventlistener.c @@ -81,7 +81,10 @@ impl_accessible_event_notify_event (PortableServer_Servant servant, for (n=0; ncallbacks, n); - (*cb) (NULL); + if (cb) + { + (*cb) (NULL); + } } bonobo_object_release_unref (e->target, ev); } @@ -151,11 +154,11 @@ accessible_event_listener_new () void accessible_event_listener_add_callback (AccessibleEventListener *listener, VoidEventListenerCB callback) { - listener->callbacks = g_list_append (listener->callbacks, listener); + listener->callbacks = g_list_append (listener->callbacks, callback); } void accessible_event_listener_remove_callback (AccessibleEventListener *listener, VoidEventListenerCB callback) { - listener->callbacks = g_list_remove (listener->callbacks, listener); + listener->callbacks = g_list_remove (listener->callbacks, callback); } diff --git a/test/Makefile.am b/test/Makefile.am index 0c48983..52c3020 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -1,19 +1,23 @@ NULL= -noinst_PROGRAMS = at app +noinst_PROGRAMS = at app simple-at at_SOURCES = at.c app_SOURCES = app.c +simple_at_SOURCES = simple-at.c + INCLUDES = -I$(top_srcdir) \ -I$(top_builddir) \ -I$(top_srcdir)/libspi \ -I$(top_builddir)/libspi \ + -I$(top_srcdir)/cspi \ + -I$(top_builddir)/cspi \ $(TESTS_CFLAGS) DEBUG_CFLAGS=-DSPI_DEBUG CFLAGS += $(TESTS_CFLAGS) $(DEBUG_CFLAGS) -LDADD = ../libspi/libspi.la $(TESTS_LIBS) +LDADD = ../libspi/libspi.la ../cspi/libcspi.la $(TESTS_LIBS) diff --git a/test/simple-at.c b/test/simple-at.c new file mode 100644 index 0000000..a0438f2 --- /dev/null +++ b/test/simple-at.c @@ -0,0 +1,75 @@ +/* + * 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. + */ + +#include +#include "spi.h" + +void report_focus_event (void *fp); + +void report_button_press (void *fp); + +int +main(int argc, char **argv) +{ + int i, j; + int n_desktops; + int n_apps; + Accessible *desktop; + Accessible *application; + AccessibleEventListener *focus_listener; + AccessibleEventListener *button_listener; + + SPI_init(); + + focus_listener = CreateEventListener (report_focus_event); + button_listener = CreateEventListener (report_button_press); + + RegisterGlobalEventListener (focus_listener, "focus:"); + RegisterGlobalEventListener (button_listener, "Gtk:GtkWidget:button-press-event"); + + n_desktops = GetDesktopCount (); + + for (i=0; i