From b2a5db4cbac6002da97f26deac58339c7a6eb537 Mon Sep 17 00:00:00 2001 From: billh Date: Tue, 1 Jan 2002 22:35:33 +0000 Subject: [PATCH] API revisions: tweaks to key event API, added some reserved slots for upwards binary compat to IDL. Changed at-bridge to atk-bridge (renaming); Added definitions of window manager event type names; Hypertext no longer inherits from Accessibility::Text. git-svn-id: http://svn.gnome.org/svn/at-spi/trunk@194 e2bd861d-eb25-0410-b326-f6ed22b6b98c --- ChangeLog | 45 ++++ Makefile.am | 2 +- at-bridge/.cvsignore | 4 - at-bridge/Makefile.am | 28 -- at-bridge/bridge.c | 451 -------------------------------- atk-bridge/Makefile.am | 14 +- atk-bridge/bridge.c | 9 +- configure.in | 8 +- cspi/spi-impl.h | 1 + cspi/spi.h | 73 ++++-- cspi/spi_accessible.c | 33 +++ cspi/spi_registry.c | 73 +++++- cspi/spi_streamablecontent.c | 121 +++++++++ idl/Accessibility_Action.idl | 8 + idl/Accessibility_Component.idl | 10 +- idl/Accessibility_Desktop.idl | 7 + idl/Accessibility_EditableText.idl | 9 + idl/Accessibility_Event.idl | 1 - idl/Accessibility_Hyperlink.idl | 7 + idl/Accessibility_Hypertext.idl | 2 +- idl/Accessibility_Image.idl | 7 + idl/Accessibility_Registry.idl | 53 +++- idl/Accessibility_Relation.idl | 3 + idl/Accessibility_Selection.idl | 8 + idl/Accessibility_State.idl | 8 + idl/Accessibility_StreamableContent.idl | 18 +- idl/Accessibility_Table.idl | 11 +- idl/Accessibility_Text.idl | 10 +- idl/Accessibility_Value.idl | 8 + libspi/accessible.c | 8 +- libspi/hypertext.h | 4 +- registryd/deviceeventcontroller.c | 91 +++---- test/keysynth-demo.c | 12 +- 33 files changed, 534 insertions(+), 613 deletions(-) delete mode 100644 at-bridge/.cvsignore delete mode 100644 at-bridge/Makefile.am delete mode 100644 at-bridge/bridge.c create mode 100644 cspi/spi_streamablecontent.c diff --git a/ChangeLog b/ChangeLog index 71a25d1..d4d2407 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,48 @@ +2002-01-01 Bill Haneman + + API tweaks for today's API 'freeze'. + + * idl/*: + Added placeholder functions to allow future compatible expansion + of the IDL interfaces. + + * idl/Accessibility_Registry.idl: + Changed generateKeyEvent to generateKeyboardEvent. Changed + signature of this method to accept an optional keystring in + parameter (for complex text input synthesis) and changed use of + simple 'boolean' parameter in registerKeystrokeListener to a + struct, EventListenerMode. + + * cspi/spi_accessible.c: + * cspi/spi.h: + * cspi/spi_streamablecontent.c: + Added references to AccessibleStreamableContent interface, and + definition and implementation of AccessibleStreamableContent + C bindings. + + * cspi/spi_registry.c: + * cspi/spi.h: + Changed generateKeyEvent API to generateKeyboardEvent, + taking a new (optional) keystring parameter to support complex + text input. + + * at-bridge/*: + * atk-bridge/*: + Renamed directory (to better reflect its actual purpose, bridging + from at-spi to ATK). The .so module is also now named + libatk-bridge.so. + + * idl/Accessibility_Hypertext.idl: + * libspi/accessible.c: + * libspi/hypertext.h: + * libspi/hypertext.c: + Changed Accessibility_Hypertext to *not* derive from + Accessibility_Text. + + * cspi/spi_registry.c: + Added list of legal event type names for 'window' events, which + completes the registry event API. + 2001-12-22 Marc Mulcahy * at-bridge/bridge.c: Added registration for separate diff --git a/Makefile.am b/Makefile.am index 8dc5c71..4d2945b 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,4 +1,4 @@ -SUBDIRS = docs idl libspi registryd at-bridge cspi util test +SUBDIRS = docs idl libspi registryd atk-bridge cspi util test pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA = libspi-1.0.pc cspi-1.0.pc diff --git a/at-bridge/.cvsignore b/at-bridge/.cvsignore deleted file mode 100644 index 3045c51..0000000 --- a/at-bridge/.cvsignore +++ /dev/null @@ -1,4 +0,0 @@ -.deps -.libs -Makefile.in -Makefile diff --git a/at-bridge/Makefile.am b/at-bridge/Makefile.am deleted file mode 100644 index e1a6aa3..0000000 --- a/at-bridge/Makefile.am +++ /dev/null @@ -1,28 +0,0 @@ -lib_LTLIBRARIES = libat-bridge.la - -libat_bridge_la_SOURCES = \ - bridge.c - -libat_bridge_la_DEPENDENCIES = \ - $(top_srcdir)/libspi/application.h - -INCLUDES = -I $(top_srcdir) \ - -I $(top_builddir) \ - -I $(top_srcdir)/libspi \ - -I $(top_builddir)/libspi \ - -I $(top_builddir)/at-bridge \ - $(AT_BRIDGE_CFLAGS) - -DEPS = \ - $(libatk) \ - $(libbonobo-2) \ - $(liboaf-2) \ - $(libORBit-2) \ - $(libat-spi) - - -LDFLAGS += -no-undefined - -libat_bridge_la_LIBADD = $(AT_BRIDGE_LIBS) ../libspi/libspi.la - -CFLAGS += $(AT_BRIDGE_CFLAGS) diff --git a/at-bridge/bridge.c b/at-bridge/bridge.c deleted file mode 100644 index 53c3d87..0000000 --- a/at-bridge/bridge.c +++ /dev/null @@ -1,451 +0,0 @@ -/* - * 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 -#include -#include -#include -#include -#include -#include -#include -#include "accessible.h" -#include "application.h" - -#undef SPI_BRIDGE_DEBUG - -static CORBA_Environment ev; -static Accessibility_Registry registry; -static SpiApplication *this_app = NULL; - -static gboolean spi_atk_bridge_idle_init (gpointer user_data); -static void spi_atk_bridge_focus_tracker (AtkObject *object); -static void spi_atk_bridge_exit_func (void); -static void spi_atk_register_event_listeners (void); -static gboolean spi_atk_bridge_property_event_listener (GSignalInvocationHint *signal_hint, - guint n_param_values, - const GValue *param_values, - gpointer data); -static gboolean spi_atk_bridge_state_event_listener (GSignalInvocationHint *signal_hint, - guint n_param_values, - const GValue *param_values, - gpointer data); -static gboolean spi_atk_bridge_signal_listener (GSignalInvocationHint *signal_hint, - guint n_param_values, - const GValue *param_values, - gpointer data); -static gint spi_atk_bridge_key_listener (AtkKeyEventStruct *event, - gpointer data); - -int -gtk_module_init (gint *argc, gchar **argv[]) -{ - CORBA_Environment ev; - - if (!bonobo_init (argc, *argv)) - { - g_error ("Could not initialize Bonobo"); - } - - CORBA_exception_init(&ev); - - registry = bonobo_activation_activate_from_id ( - "OAFIID:Accessibility_Registry:proto0.1", 0, NULL, &ev); - - if (ev._major != CORBA_NO_EXCEPTION) - { - g_error ("Accessibility app error: exception during " - "registry activation from id: %s\n", - CORBA_exception_id (&ev)); - CORBA_exception_free (&ev); - } - - if (CORBA_Object_is_nil (registry, &ev)) - { - g_error ("Could not locate registry"); - } - - bonobo_activate (); - - /* Create the accessible application server object */ - - this_app = spi_application_new (atk_get_root ()); - - fprintf (stderr, "About to register application\n"); - - Accessibility_Registry_registerApplication (registry, - BONOBO_OBJREF (this_app), - &ev); - - g_atexit (spi_atk_bridge_exit_func); - - g_idle_add (spi_atk_bridge_idle_init, NULL); - - return 0; -} - -static gboolean -spi_atk_bridge_idle_init (gpointer user_data) -{ - spi_atk_register_event_listeners (); - - fprintf (stderr, "Application registered & listening\n"); - - return FALSE; -} - -static 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); - - /* Register for focus event notifications, and register app with central registry */ - - atk_add_focus_tracker (spi_atk_bridge_focus_tracker); - atk_add_global_event_listener (spi_atk_bridge_property_event_listener, "Gtk:AtkObject:property-change"); - atk_add_global_event_listener (spi_atk_bridge_signal_listener, "Gtk:AtkObject:children-changed"); - atk_add_global_event_listener (spi_atk_bridge_signal_listener, "Gtk:AtkObject:visible-data-changed"); - atk_add_global_event_listener (spi_atk_bridge_signal_listener, "Gtk:AtkSelection:selection-changed"); - atk_add_global_event_listener (spi_atk_bridge_signal_listener, "Gtk:AtkText:text-selection-changed"); - atk_add_global_event_listener (spi_atk_bridge_signal_listener, "Gtk:AtkText:text-changed"); - atk_add_global_event_listener (spi_atk_bridge_signal_listener, "Gtk:AtkText:text-caret-moved"); - atk_add_global_event_listener (spi_atk_bridge_signal_listener, "Gtk:AtkTable:row-inserted"); - atk_add_global_event_listener (spi_atk_bridge_signal_listener, "Gtk:AtkTable:row-reordered"); - atk_add_global_event_listener (spi_atk_bridge_signal_listener, "Gtk:AtkTable:row-deleted"); - atk_add_global_event_listener (spi_atk_bridge_signal_listener, "Gtk:AtkTable:column-inserted"); - atk_add_global_event_listener (spi_atk_bridge_signal_listener, "Gtk:AtkTable:column-reordered"); - atk_add_global_event_listener (spi_atk_bridge_signal_listener, "Gtk:AtkTable:column-deleted"); - atk_add_global_event_listener (spi_atk_bridge_signal_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_add_key_event_listener (spi_atk_bridge_key_listener, NULL); - - g_object_unref (G_OBJECT (bo)); - g_object_unref (ao); -} - -static void -spi_atk_bridge_exit_func (void) -{ - BonoboObject *app = (BonoboObject *) this_app; - - fprintf (stderr, "exiting bridge\n"); - - if (!app) - { - return; - } - this_app = NULL; - - /* - * FIXME: this may be incorrect for apps that do their own bonobo - * shutdown, until we can explicitly shutdown to get the ordering - * right. - */ - if (!bonobo_is_initialized ()) - { - fprintf (stderr, "Re-initializing bonobo\n"); - g_assert (bonobo_init (0, NULL)); - g_assert (bonobo_activate ()); - } - - Accessibility_Registry_deregisterApplication ( - registry, BONOBO_OBJREF (app), &ev); - - bonobo_object_release_unref (registry, &ev); - - bonobo_object_unref (app); - - fprintf (stderr, "bridge exit func complete.\n"); - - if (g_getenv ("AT_BRIDGE_SHUTDOWN")) - { - g_assert (!bonobo_debug_shutdown ()); - } -} - -static void -spi_atk_bridge_focus_tracker (AtkObject *object) -{ - SpiAccessible *source; - Accessibility_Event e; - - source = spi_accessible_new (object); - - e.type = "focus:"; - e.source = BONOBO_OBJREF (source); - e.detail1 = 0; - e.detail2 = 0; - - Accessibility_Registry_notifyEvent (registry, &e, &ev); - - CORBA_exception_free (&ev); -} - -static void -spi_atk_emit_eventv (GObject *gobject, - unsigned long detail1, - unsigned long detail2, - const char *format, ...) -{ - va_list args; - Accessibility_Event e; - SpiAccessible *source; - AtkObject *aobject; -#ifdef SPI_BRIDGE_DEBUG - CORBA_string s; -#endif - - va_start (args, format); - - if (ATK_IS_IMPLEMENTOR (gobject)) - { - aobject = atk_implementor_ref_accessible (ATK_IMPLEMENTOR (gobject)); - source = spi_accessible_new (aobject); - g_object_unref (G_OBJECT (aobject)); - } - else if (ATK_IS_OBJECT (gobject)) - { - aobject = ATK_OBJECT (gobject); - source = spi_accessible_new (aobject); - } - else - { - aobject = NULL; - source = NULL; - g_error ("received property-change event from non-AtkImplementor"); - } - - if (source != NULL) - { - e.type = g_strdup_vprintf (format, args); - e.source = BONOBO_OBJREF (source); - e.detail1 = detail1; - e.detail2 = detail2; - -#ifdef SPI_BRIDGE_DEBUG - s = Accessibility_Accessible__get_name (BONOBO_OBJREF (source), &ev); - g_warning ("Emitting event '%s' (%lu, %lu) on %s", - e.type, e.detail1, e.detail2, s); - CORBA_free (s); -#endif - - Accessibility_Registry_notifyEvent (registry, &e, &ev); - - CORBA_exception_free (&ev); - - g_free (e.type); - } - - va_end (args); -} - -static gboolean -spi_atk_bridge_property_event_listener (GSignalInvocationHint *signal_hint, - guint n_param_values, - const GValue *param_values, - gpointer data) -{ - AtkPropertyValues *values; - GObject *gobject; - -#ifdef SPI_BRIDGE_DEBUG - GSignalQuery signal_query; - const gchar *name; - gchar *s, *s2; - - g_signal_query (signal_hint->signal_id, &signal_query); - name = signal_query.signal_name; - - s2 = g_type_name (G_OBJECT_TYPE (g_value_get_object (param_values + 0))); - s = atk_object_get_name (ATK_OBJECT (g_value_get_object (param_values + 0))); - fprintf (stderr, "Received (property) signal %s:%s from object %s (gail %s)\n", - g_type_name (signal_query.itype), name, s, s2); -#endif - - gobject = g_value_get_object (param_values + 0); - values = (AtkPropertyValues*) g_value_get_pointer (param_values + 1); - - spi_atk_emit_eventv (gobject, 0, 0, "object:property-change:%s", values->property_name); - - return TRUE; -} - -static gboolean -spi_atk_bridge_state_event_listener (GSignalInvocationHint *signal_hint, - guint n_param_values, - const GValue *param_values, - gpointer data) -{ - GObject *gobject; - AtkPropertyValues *values; -#ifdef SPI_BRIDGE_DEBUG - GSignalQuery signal_query; - const gchar *name; - - g_signal_query (signal_hint->signal_id, &signal_query); - name = signal_query.signal_name; - fprintf (stderr, "Received (state) signal %s:%s\n", - g_type_name (signal_query.itype), name); -#endif - - gobject = g_value_get_object (param_values + 0); - values = (AtkPropertyValues*) g_value_get_pointer (param_values + 1); - - spi_atk_emit_eventv (gobject, - (unsigned long) values->old_value.data[0].v_ulong, - (unsigned long) values->new_value.data[0].v_ulong, - "object:%s:?", values->property_name); - - return TRUE; -} - -static void -spi_init_keystroke_from_atk_key_event (Accessibility_DeviceEvent *keystroke, - AtkKeyEventStruct *event) -{ -#ifdef SPI_DEBUG - if (event) - { - g_print ("event %c (%d)\n", (int) event->keyval, (int) event->keycode); - } - else -#endif - if (!event) - { - g_print ("WARNING: NULL key event!"); - } - - keystroke->id = (CORBA_long) event->keyval; - keystroke->hw_code = (CORBA_short) event->keycode; - keystroke->timestamp = (CORBA_unsigned_long) event->timestamp; - keystroke->modifiers = (CORBA_unsigned_short) (event->state & 0xFFFF); - if (event->string) - { - keystroke->event_string = CORBA_string_dup (event->string); - keystroke->is_text = CORBA_TRUE; - } - else - { - keystroke->event_string = CORBA_string_dup (""); - keystroke->is_text = CORBA_FALSE; - } - switch (event->type) - { - case (ATK_KEY_EVENT_PRESS): - keystroke->type = Accessibility_KEY_PRESSED; - break; - case (ATK_KEY_EVENT_RELEASE): - keystroke->type = Accessibility_KEY_RELEASED; - 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) -{ - CORBA_boolean result; - Accessibility_DeviceEvent key_event; - Accessibility_DeviceEventController controller = - Accessibility_Registry_getDeviceEventController (registry, &ev); - - if (BONOBO_EX (&ev)) - { - g_warning ("failure: no deviceeventcontroller found\n"); - CORBA_exception_free (&ev); - result = FALSE; - } - else - { - - spi_init_keystroke_from_atk_key_event (&key_event, event); - - result = Accessibility_DeviceEventController_notifyListenersSync ( - controller, &key_event, &ev); - - CORBA_exception_free (&ev); - } - - return result; -} - -static gboolean -spi_atk_bridge_signal_listener (GSignalInvocationHint *signal_hint, - guint n_param_values, - const GValue *param_values, - gpointer data) -{ - GObject *gobject; - GSignalQuery signal_query; - const gchar *name; - gint detail1 = 0, detail2 = 0; -#ifdef SPI_BRIDGE_DEBUG - gchar *s, *s2; -#endif - - g_signal_query (signal_hint->signal_id, &signal_query); - - name = signal_query.signal_name; - -#ifdef SPI_BRIDGE_DEBUG - s2 = g_type_name (G_OBJECT_TYPE (g_value_get_object (param_values + 0))); - s = atk_object_get_name (ATK_OBJECT (g_value_get_object (param_values + 0))); - fprintf (stderr, "Received signal %s:%s from object %s (gail %s)\n", - g_type_name (signal_query.itype), name, s, s2); -#endif - - gobject = g_value_get_object (param_values + 0); - 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); - - spi_atk_emit_eventv (gobject, detail1, detail2, "object:%s", name); - - return TRUE; -} - - - - - - - diff --git a/atk-bridge/Makefile.am b/atk-bridge/Makefile.am index e1a6aa3..4896496 100644 --- a/atk-bridge/Makefile.am +++ b/atk-bridge/Makefile.am @@ -1,17 +1,17 @@ -lib_LTLIBRARIES = libat-bridge.la +lib_LTLIBRARIES = libatk-bridge.la -libat_bridge_la_SOURCES = \ +libatk_bridge_la_SOURCES = \ bridge.c -libat_bridge_la_DEPENDENCIES = \ +libatk_bridge_la_DEPENDENCIES = \ $(top_srcdir)/libspi/application.h INCLUDES = -I $(top_srcdir) \ -I $(top_builddir) \ -I $(top_srcdir)/libspi \ -I $(top_builddir)/libspi \ - -I $(top_builddir)/at-bridge \ - $(AT_BRIDGE_CFLAGS) + -I $(top_builddir)/atk-bridge \ + $(ATK_BRIDGE_CFLAGS) DEPS = \ $(libatk) \ @@ -23,6 +23,6 @@ DEPS = \ LDFLAGS += -no-undefined -libat_bridge_la_LIBADD = $(AT_BRIDGE_LIBS) ../libspi/libspi.la +libatk_bridge_la_LIBADD = $(ATK_BRIDGE_LIBS) ../libspi/libspi.la -CFLAGS += $(AT_BRIDGE_CFLAGS) +CFLAGS += $(ATK_BRIDGE_CFLAGS) diff --git a/atk-bridge/bridge.c b/atk-bridge/bridge.c index 82f5959..53c3d87 100644 --- a/atk-bridge/bridge.c +++ b/atk-bridge/bridge.c @@ -416,6 +416,7 @@ spi_atk_bridge_signal_listener (GSignalInvocationHint *signal_hint, GObject *gobject; GSignalQuery signal_query; const gchar *name; + gint detail1 = 0, detail2 = 0; #ifdef SPI_BRIDGE_DEBUG gchar *s, *s2; #endif @@ -432,8 +433,12 @@ spi_atk_bridge_signal_listener (GSignalInvocationHint *signal_hint, #endif gobject = g_value_get_object (param_values + 0); - - spi_atk_emit_eventv (gobject, 0, 0, "object:%s", name); + 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); + + spi_atk_emit_eventv (gobject, detail1, detail2, "object:%s", name); return TRUE; } diff --git a/configure.in b/configure.in index 25fabb1..6d2502c 100644 --- a/configure.in +++ b/configure.in @@ -113,11 +113,11 @@ PKG_CHECK_MODULES(UTILS, \ AC_SUBST(UTILS_LIBS) AC_SUBST(UTILS_CFLAGS) -PKG_CHECK_MODULES(AT_BRIDGE, \ +PKG_CHECK_MODULES(ATK_BRIDGE, \ libbonobo-2.0 >= 1.107.0 \ atk >= 0.2) -AC_SUBST(AT_BRIDGE_LIBS) -AC_SUBST(AT_BRIDGE_CFLAGS) +AC_SUBST(ATK_BRIDGE_LIBS) +AC_SUBST(ATK_BRIDGE_CFLAGS) PKG_CHECK_MODULES(LIBCSPI, \ libbonobo-2.0 >= 1.107.0 \ @@ -173,7 +173,7 @@ idl/Makefile libspi/Makefile registryd/Makefile registryd/Accessibility_Registry.server -at-bridge/Makefile +atk-bridge/Makefile test/Makefile cspi/Makefile cspi/bonobo/Makefile diff --git a/cspi/spi-impl.h b/cspi/spi-impl.h index 82c529d..3af1f00 100644 --- a/cspi/spi-impl.h +++ b/cspi/spi-impl.h @@ -21,6 +21,7 @@ typedef Accessible AccessibleImage; typedef Accessible AccessibleRelation; typedef Accessible AccessibleSelection; typedef Accessible AccessibleStateSet; +typedef Accessible AccessibleStreamableContent; typedef Accessible AccessibleTable; typedef Accessible AccessibleText; typedef Accessible AccessibleValue; diff --git a/cspi/spi.h b/cspi/spi.h index b07f9d7..eb5db12 100644 --- a/cspi/spi.h +++ b/cspi/spi.h @@ -61,7 +61,8 @@ typedef enum { SPI_KEY_PRESS, SPI_KEY_RELEASE, SPI_KEY_PRESSRELEASE, - SPI_KEY_SYM + SPI_KEY_SYM, + SPI_KEY_STRING } AccessibleKeySynthType; typedef enum { @@ -197,8 +198,10 @@ int SPI_getDesktopCount (void); Accessible *SPI_getDesktop (int i); int SPI_getDesktopList (Accessible **list); -SPIBoolean SPI_generateKeyEvent (long int keyval, +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 */ @@ -219,29 +222,31 @@ AccessibleStateSet * Accessible_getStateSet (Accessible *obj); /* Interface query methods */ -SPIBoolean Accessible_isAction (Accessible *obj); -SPIBoolean Accessible_isApplication (Accessible *obj); -SPIBoolean Accessible_isComponent (Accessible *obj); -SPIBoolean Accessible_isEditableText (Accessible *obj); -SPIBoolean Accessible_isHypertext (Accessible *obj); -SPIBoolean Accessible_isImage (Accessible *obj); -SPIBoolean Accessible_isSelection (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); -AccessibleComponent * Accessible_getComponent (Accessible *obj); -AccessibleEditableText * Accessible_getEditableText (Accessible *obj); -AccessibleHypertext * Accessible_getHypertext (Accessible *obj); -AccessibleImage * Accessible_getImage (Accessible *obj); -AccessibleSelection * Accessible_getSelection (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); +SPIBoolean Accessible_isAction (Accessible *obj); +SPIBoolean Accessible_isApplication (Accessible *obj); +SPIBoolean Accessible_isComponent (Accessible *obj); +SPIBoolean Accessible_isEditableText (Accessible *obj); +SPIBoolean Accessible_isHypertext (Accessible *obj); +SPIBoolean Accessible_isImage (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); +AccessibleComponent * Accessible_getComponent (Accessible *obj); +AccessibleEditableText * Accessible_getEditableText (Accessible *obj); +AccessibleHypertext * Accessible_getHypertext (Accessible *obj); +AccessibleImage * Accessible_getImage (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 */ @@ -512,7 +517,23 @@ AccessibleStateSet_compare (AccessibleStateSet *obj, SPIBoolean AccessibleStateSet_isEmpty (AccessibleStateSet *obj); - +void +AccessibleStreamableContent_ref (AccessibleStreamableContent *obj); +void +AccessibleStreamableContent_unref (AccessibleStreamableContent *obj); +char ** +AccessibleStreamableContent_getContentTypes (AccessibleStreamableContent *obj); +SPIBoolean +AccessibleStreamableContent_open (AccessibleStreamableContent *obj, + const char *content_type); +SPIBoolean +AccessibleStreamableContent_seek (AccessibleStreamableContent *obj, + long int offset); +SPIBoolean +AccessibleStreamableContent_read (AccessibleStreamableContent *obj, + void *buff, + long int nbytes, + unsigned int read_type); /* * * AccessibleTable function prototypes diff --git a/cspi/spi_accessible.c b/cspi/spi_accessible.c index c8c13ac..deb496a 100644 --- a/cspi/spi_accessible.c +++ b/cspi/spi_accessible.c @@ -607,6 +607,23 @@ Accessible_isTable (Accessible *obj) } /** + * 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) +{ + return cspi_accessible_is_a (obj, + "IDL:Accessibility/StreamableContent:1.0"); +} + +/** * Accessible_isText: * @obj: a pointer to the #Accessible instance to query. * @@ -759,6 +776,22 @@ Accessible_getSelection (Accessible *obj) /** + * 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) +{ + return (AccessibleStreamableContent *) Accessible_queryInterface ( + obj, "IDL:Accessibility/StreamableContent:1.0"); +} + +/** * Accessible_getTable: * @obj: a pointer to the #Accessible instance to query. * diff --git a/cspi/spi_registry.c b/cspi/spi_registry.c index 0d75803..6771576 100644 --- a/cspi/spi_registry.c +++ b/cspi/spi_registry.c @@ -70,6 +70,26 @@ * object:column-deleted * object:model-changed * + * (window events) + * + * window:minimize + * window:maximize + * window:restore + * window:close + * window:create + * window:reparent + * window:desktop-create + * window:desktop-destroy + * window:focus-in + * window:focus-out + * window:raise + * window:lower + * window:move + * window:resize + * window:shade + * window:unshade + * window:restyle + * * 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. @@ -255,6 +275,7 @@ SPI_registerAccessibleKeystrokeListener (AccessibleKeystrokeListener *listener, Accessibility_KeyEventTypeSeq key_events; Accessibility_ControllerEventMask controller_event_mask; Accessibility_DeviceEventController device_event_controller; + Accessibility_EventListenerMode listener_mode; if (!listener) { @@ -312,13 +333,20 @@ SPI_registerAccessibleKeystrokeListener (AccessibleKeystrokeListener *listener, controller_event_mask = (CORBA_unsigned_long) modmask; + listener_mode.synchronous = + (CORBA_boolean) ((sync_type & SPI_KEYLISTENER_SYNCHRONOUS)!=0); + listener_mode.preemptive = + (CORBA_boolean) ((sync_type & SPI_KEYLISTENER_CANCONSUME)!=0); + listener_mode.global = + (CORBA_boolean) ((sync_type & SPI_KEYLISTENER_ALL_WINDOWS)!=0); + Accessibility_DeviceEventController_registerKeystrokeListener ( device_event_controller, cspi_event_listener_get_corba (listener), &key_set, controller_event_mask, &key_events, - ((sync_type & SPI_KEYLISTENER_ALL_WINDOWS)!=0) ? CORBA_TRUE : CORBA_FALSE, + &listener_mode, cspi_ev ()); cspi_return_val_if_ev ("registering keystroke listener", FALSE); @@ -373,7 +401,6 @@ SPI_deregisterAccessibleKeystrokeListener (AccessibleKeystrokeListener *listener &key_set, controller_event_mask, &key_events, - (CORBA_boolean) TRUE, cspi_ev ()); cspi_release_unref (device_event_controller); @@ -382,7 +409,7 @@ SPI_deregisterAccessibleKeystrokeListener (AccessibleKeystrokeListener *listener } /** - * SPI_generateKeyEvent: + * SPI_generateKeyboardEvent: * @keyval: a long integer indicating the keycode or keysym of the key event * being synthesized. * @synth_type: a #AccessibleKeySynthType flag indicating whether @keyval @@ -396,21 +423,47 @@ SPI_deregisterAccessibleKeystrokeListener (AccessibleKeystrokeListener *listener * Returns: #TRUE if successful, otherwise #FALSE. **/ SPIBoolean -SPI_generateKeyEvent (long int keyval, AccessibleKeySynthType synth_type) +SPI_generateKeyboardEvent (long int keyval, + char *keystring, + AccessibleKeySynthType synth_type) { /* TODO: check current modifier status and * send keycode to alter, if necessary */ + + /* TODO: implement keystring use case */ + Accessibility_KeySynthType keysynth_type; Accessibility_DeviceEventController device_event_controller = Accessibility_Registry_getDeviceEventController (cspi_registry (), cspi_ev ()); - g_print ("keyval %d\n", (int) keyval); - cspi_return_val_if_ev ("getting event controller", FALSE); + cspi_return_val_if_ev ("getting event controller for key event gen", FALSE); + + 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; + } + + Accessibility_DeviceEventController_generateKeyboardEvent (device_event_controller, + keyval, + "", + keysynth_type, + cspi_ev ()); - Accessibility_DeviceEventController_generateKeyEvent (device_event_controller, - keyval, - (unsigned long) synth_type, - cspi_ev ()); + cspi_return_val_if_ev ("generating keyboard event", FALSE); cspi_release_unref (device_event_controller); diff --git a/cspi/spi_streamablecontent.c b/cspi/spi_streamablecontent.c new file mode 100644 index 0000000..5fe36a5 --- /dev/null +++ b/cspi/spi_streamablecontent.c @@ -0,0 +1,121 @@ +#include + +/** + * AccessibleStreamableContent_ref: + * @obj: a pointer to the #AccessibleStreamableContent implementor on which to + * operate. + * + * Increment the reference count for an #AccessibleStreamableContent object. + * + **/ +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. + * + **/ +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. + * + * 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) +{ + char **content_types = malloc (sizeof (char *)); + content_types [0] = NULL; + + /* TODO: connect this to the correct libspi implementation code */ + return 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 ()). + * @fp: a pointer to a FILE pointer into which is placed a file handle suitable for + * reading the content, if possible. Not all content types support file-handle + * interaction, so check this parameter for NULL before use. + * + * Open a streaming connection to an AccessibleStreamableContent implementor, + * of a particular content type + * + * Returns: #TRUE if successful, #FALSE if unsuccessful. + * + **/ +SPIBoolean +AccessibleStreamableContent_open (AccessibleStreamableContent *obj, + const char *content_type) +{ + /* TODO: connect this to the correct libspi implementation code */ + 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. + * + * Returns: #TRUE if successful, #FALSE if unsuccessful. + * + **/ +SPIBoolean +AccessibleStreamableContent_seek (AccessibleStreamableContent *obj, + long int offset) +{ + /* TODO: connect this to the correct libspi implementation code */ + return FALSE; +} + +/** + * 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. + * + * 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) +{ + /* TODO: connect this to the correct libspi implementation code */ + return -1; +} + diff --git a/idl/Accessibility_Action.idl b/idl/Accessibility_Action.idl index 7a458c7..cbb1ea8 100644 --- a/idl/Accessibility_Action.idl +++ b/idl/Accessibility_Action.idl @@ -76,6 +76,14 @@ module Accessibility { * "" if none exists. **/ string getKeyBinding (in long index); + + /** + * unImplemented: + * + * placeholders for future expansion. + */ + void unImplemented (); + void unImplemented2 (); }; }; diff --git a/idl/Accessibility_Component.idl b/idl/Accessibility_Component.idl index c453cc3..71e30b7 100644 --- a/idl/Accessibility_Component.idl +++ b/idl/Accessibility_Component.idl @@ -47,5 +47,13 @@ module Accessibility { void grabFocus (); void registerFocusHandler (in EventListener handler); void deregisterFocusHandler (in EventListener handler); - }; + + /** + * unImplemented: + * + * placeholders for future expansion. + */ + void unImplemented (); + void unImplemented2 (); + }; }; diff --git a/idl/Accessibility_Desktop.idl b/idl/Accessibility_Desktop.idl index 315efa1..7a0cfb4 100644 --- a/idl/Accessibility_Desktop.idl +++ b/idl/Accessibility_Desktop.idl @@ -32,6 +32,13 @@ module Accessibility { * At the moment this is only a marker interface, it acts just like * any other Accessible. **/ + /** + * unImplemented: + * + * placeholders for future expansion. + */ + void unImplemented (); + void unImplemented2 (); }; }; diff --git a/idl/Accessibility_EditableText.idl b/idl/Accessibility_EditableText.idl index dc8218f..dbebd63 100644 --- a/idl/Accessibility_EditableText.idl +++ b/idl/Accessibility_EditableText.idl @@ -33,5 +33,14 @@ module Accessibility { void cutText (in long startPos, in long endPos); void deleteText (in long startPos, in long endPos); void pasteText (in long position); + /** + * unImplemented5: + * + * placeholders for future expansion. Note that these are named + * 'unimplemented5 and unimplemented6' to avoid conflict with + * placeholders from Accessibility::Text. + */ + void unImplemented5 (); + void unImplemented6 (); }; }; diff --git a/idl/Accessibility_Event.idl b/idl/Accessibility_Event.idl index 6372c47..06ac8ee 100644 --- a/idl/Accessibility_Event.idl +++ b/idl/Accessibility_Event.idl @@ -39,7 +39,6 @@ module Accessibility interface EventListener : Bonobo::Unknown { oneway void notifyEvent (in Event e); }; - }; #endif diff --git a/idl/Accessibility_Hyperlink.idl b/idl/Accessibility_Hyperlink.idl index 6d21519..95697cb 100644 --- a/idl/Accessibility_Hyperlink.idl +++ b/idl/Accessibility_Hyperlink.idl @@ -31,5 +31,12 @@ module Accessibility { Accessible getObject (in long i); string getURI (in long i); boolean isValid (); + /** + * unImplemented: + * + * placeholders for future expansion. + */ + void unImplemented (); + void unImplemented2 (); }; }; diff --git a/idl/Accessibility_Hypertext.idl b/idl/Accessibility_Hypertext.idl index 383400b..0b5f27e 100644 --- a/idl/Accessibility_Hypertext.idl +++ b/idl/Accessibility_Hypertext.idl @@ -24,7 +24,7 @@ module Accessibility { - interface Hypertext : Text { + interface Hypertext : Bonobo::Unknown { long getNLinks (); Hyperlink getLink (in long linkIndex); long getLinkIndex (in long characterIndex); diff --git a/idl/Accessibility_Image.idl b/idl/Accessibility_Image.idl index d819172..f784f22 100644 --- a/idl/Accessibility_Image.idl +++ b/idl/Accessibility_Image.idl @@ -27,5 +27,12 @@ module Accessibility { BoundingBox getImageExtents (in short coordType); void getImagePosition (out long x, out long y, in short coordType); void getImageSize (out long width, out long height); + /** + * unImplemented: + * + * placeholders for future expansion. + */ + void unImplemented (); + void unImplemented2 (); }; }; diff --git a/idl/Accessibility_Registry.idl b/idl/Accessibility_Registry.idl index 95bc6fb..1d2a225 100644 --- a/idl/Accessibility_Registry.idl +++ b/idl/Accessibility_Registry.idl @@ -144,6 +144,13 @@ module Accessibility { **/ DeviceEventController getDeviceEventController (); + /** + * unImplemented: + * + * placeholders for future expansion. + */ + void unImplemented (); + void unImplemented2 (); }; enum KeyEventType { @@ -160,7 +167,8 @@ module Accessibility { KEY_PRESS, KEY_RELEASE, KEY_PRESSRELEASE, - KEY_SYM + KEY_SYM, + KEY_STRING }; enum ModifierType { @@ -174,6 +182,12 @@ module Accessibility { MODIFIER_NUMLOCK }; + struct EventListenerMode { + boolean synchronous; + boolean preemptive; + boolean global; + }; + typedef unsigned long ControllerEventMask; struct DeviceEvent { @@ -215,7 +229,7 @@ module Accessibility { in KeySet keys, in ControllerEventMask mask, in KeyEventTypeSeq type, - in boolean is_synchronous); + in EventListenerMode mode); /** * deregisterKeystrokeListener: @@ -223,10 +237,7 @@ module Accessibility { * @keys: a @KeySet indicating which keys to intercept, or KEYSET_ALL_KEYS. * @mask: a @ControllerEventMask filtering the intercepted key events. * @type: an @EventType mask that may created by ORing event types together. - * @is_synchronous: a @boolean indicating whether the listener should - * receive the events synchronously, potentially consuming them, - * or just be notified asynchronously of those events that have - * been generated. + * * Returns: void * * De-register a previously registered keyboard eventlistener. @@ -235,29 +246,39 @@ module Accessibility { void deregisterKeystrokeListener (in DeviceEventListener listener, in KeySet keys, in ControllerEventMask mask, - in KeyEventTypeSeq type, - in boolean is_synchronous); + in KeyEventTypeSeq type); boolean notifyListenersSync (in DeviceEvent event); oneway void notifyListenersAsync (in DeviceEvent event); /** - * generateKeyEvent: + * generateKeyboardEvent: * @keycode: a long integer indicating the keycode of * the keypress to be synthesized. + * @keystring: an optional UTF-8 string indicating a complex + * keyboard input event. + * @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). * - * Note that this long may be truncated before being + * Note that @keycode may be truncated before being * processed, as keycode length may be platform-dependent * and keycode ranges are generally much smaller than * CORBA_long. + * One or the other of @keycode or @keystring are generally NULL, + * (but not both), depending on the value of @type. * * Returns: void * - * Synthesize a keypress event. + * Synthesize a keyboard event. * **/ - void generateKeyEvent (in long keycode, in KeySynthType type); + void generateKeyboardEvent (in long keycode, + in string keystring, + in KeySynthType type); /** * generateMouseEvent: @@ -270,6 +291,14 @@ module Accessibility { * **/ void generateMouseEvent (in long x, in long y, in string eventName); + + /** + * unImplemented: + * + * placeholders for future expansion. + */ + void unImplemented (); + void unImplemented2 (); }; }; diff --git a/idl/Accessibility_Relation.idl b/idl/Accessibility_Relation.idl index b562ffc..9a8931a 100644 --- a/idl/Accessibility_Relation.idl +++ b/idl/Accessibility_Relation.idl @@ -43,6 +43,9 @@ module Accessibility { RelationType getRelationType (); short getNTargets (); Object getTarget (in short index); + /* placeholders for future expansion */ + void unImplemented (); + void unImplemented2 (); }; }; diff --git a/idl/Accessibility_Selection.idl b/idl/Accessibility_Selection.idl index 42cadf5..e1a2628 100644 --- a/idl/Accessibility_Selection.idl +++ b/idl/Accessibility_Selection.idl @@ -32,5 +32,13 @@ module Accessibility { boolean isChildSelected (in long childIndex); void selectAll (); void clearSelection (); + + /** + * unImplemented: + * + * placeholders for future expansion. + */ + void unImplemented (); + void unImplemented2 (); }; }; diff --git a/idl/Accessibility_State.idl b/idl/Accessibility_State.idl index 7e37256..17eb00a 100644 --- a/idl/Accessibility_State.idl +++ b/idl/Accessibility_State.idl @@ -113,6 +113,14 @@ module Accessibility { /* returns a 'difference set' */ StateSet compare (in StateSet compareState); boolean isEmpty (); + + /** + * unImplemented: + * + * placeholders for future expansion. + */ + void unImplemented (); + void unImplemented2 (); }; }; diff --git a/idl/Accessibility_StreamableContent.idl b/idl/Accessibility_StreamableContent.idl index 13f3805..4ca62bb 100644 --- a/idl/Accessibility_StreamableContent.idl +++ b/idl/Accessibility_StreamableContent.idl @@ -26,17 +26,19 @@ module Accessibility { typedef sequence StringSeq; - typedef sequence OctetSeq; - - enum SeekType { - SEEK_START, - SEEK_END, - SEEK_CURRENT - }; - interface StreamableContent { StringSeq getContentTypes (); Bonobo::Stream getContent (in string contentType); /* methods used from Bonobo::Stream : seek, read. Others unsupported. */ + + /** + * unImplemented: + * + * placeholders for future expansion. + */ + void unImplemented (); + void unImplemented2 (); + void unImplemented3 (); + void unImplemented4 (); }; }; diff --git a/idl/Accessibility_Table.idl b/idl/Accessibility_Table.idl index acda3c3..04d0143 100644 --- a/idl/Accessibility_Table.idl +++ b/idl/Accessibility_Table.idl @@ -49,5 +49,14 @@ typedef sequence LongSeq; boolean isRowSelected (in long row); boolean isColumnSelected (in long column); boolean isSelected (in long row, in long column); - }; + /** + * unImplemented: + * + * placeholders for future expansion. + */ + void unImplemented (); + void unImplemented2 (); + void unImplemented3 (); + void unImplemented4 (); + }; }; diff --git a/idl/Accessibility_Text.idl b/idl/Accessibility_Text.idl index 2833a21..c733538 100644 --- a/idl/Accessibility_Text.idl +++ b/idl/Accessibility_Text.idl @@ -46,7 +46,6 @@ module Accessibility { unsigned long getCharacterAtOffset (in long offset); /* long instead of wchar, * to allow unicode chars > 16 bits */ - /* void getRowColAtOffset (in long offset, out long row, out long column); */ string getAttributes (in long offset, out long startOffset, out long endOffset); void getCharacterExtents (in long offset, out long x, out long y, out long length, out long width, in short coordType); @@ -56,5 +55,14 @@ module Accessibility { boolean addSelection (in long startOffset, in long endOffset); boolean removeSelection (in long selectionNum); boolean setSelection (in long selectionNum, in long startOffset, in long endOffset); + /** + * unImplemented: + * + * placeholders for future expansion. + */ + void unImplemented (); + void unImplemented2 (); + void unImplemented3 (); + void unImplemented4 (); }; }; diff --git a/idl/Accessibility_Value.idl b/idl/Accessibility_Value.idl index 9c24e7a..92afd62 100644 --- a/idl/Accessibility_Value.idl +++ b/idl/Accessibility_Value.idl @@ -27,5 +27,13 @@ module Accessibility { readonly attribute double maximumValue; readonly attribute double minimumIncrement; attribute double currentValue; + + /** + * unImplemented: + * + * placeholders for future expansion. + */ + void unImplemented (); + void unImplemented2 (); }; }; diff --git a/libspi/accessible.c b/libspi/accessible.c index 4b7cac5..c3801ef 100644 --- a/libspi/accessible.c +++ b/libspi/accessible.c @@ -481,16 +481,16 @@ spi_accessible_new (AtkObject *o) BONOBO_OBJECT(spi_editable_text_interface_new (o))); } - else if (ATK_IS_HYPERTEXT (o)) + else if (ATK_IS_TEXT (o)) { bonobo_object_add_interface (bonobo_object (retval), - BONOBO_OBJECT (spi_hypertext_interface_new (o))); + BONOBO_OBJECT (spi_text_interface_new (o))); } - else if (ATK_IS_TEXT (o)) + if (ATK_IS_HYPERTEXT (o)) { bonobo_object_add_interface (bonobo_object (retval), - BONOBO_OBJECT (spi_text_interface_new (o))); + BONOBO_OBJECT (spi_hypertext_interface_new (o))); } if (ATK_IS_IMAGE (o)) diff --git a/libspi/hypertext.h b/libspi/hypertext.h index b197ff7..04da61c 100644 --- a/libspi/hypertext.h +++ b/libspi/hypertext.h @@ -34,11 +34,11 @@ typedef struct _SpiHypertext SpiHypertext; typedef struct _SpiHypertextClass SpiHypertextClass; struct _SpiHypertext { - SpiText parent; + SpiBase parent; }; struct _SpiHypertextClass { - SpiTextClass parent_class; + SpiBaseClass parent_class; POA_Accessibility_Hypertext__epv epv; }; diff --git a/registryd/deviceeventcontroller.c b/registryd/deviceeventcontroller.c index 90bb733..a9ffd9d 100644 --- a/registryd/deviceeventcontroller.c +++ b/registryd/deviceeventcontroller.c @@ -75,7 +75,7 @@ struct _DEControllerKeyListener { Accessibility_KeySet *keys; Accessibility_ControllerEventMask mask; Accessibility_KeyEventTypeSeq *typeseq; - gboolean is_system_global; + Accessibility_EventListenerMode *mode; }; typedef struct _DEControllerKeyListener DEControllerKeyListener; @@ -161,7 +161,7 @@ spi_dec_key_listener_new (CORBA_Object l, const Accessibility_KeySet *keys, const Accessibility_ControllerEventMask mask, const Accessibility_KeyEventTypeSeq *typeseq, - const CORBA_boolean is_system_global, + const Accessibility_EventListenerMode *mode, CORBA_Environment *ev) { DEControllerKeyListener *key_listener = g_new0 (DEControllerKeyListener, 1); @@ -170,12 +170,15 @@ spi_dec_key_listener_new (CORBA_Object l, key_listener->keys = ORBit_copy_value (keys, TC_Accessibility_KeySet); key_listener->mask = mask; key_listener->typeseq = ORBit_copy_value (typeseq, TC_Accessibility_KeyEventTypeSeq); - key_listener->is_system_global = is_system_global; + if (mode) + key_listener->mode = ORBit_copy_value (mode, TC_Accessibility_EventListenerMode); + else + key_listener->mode = NULL; #ifdef SPI_DEBUG g_print ("new listener, with mask %x, is_global %d, keys %p\n", (unsigned int) key_listener->mask, - (int) key_listener->is_system_global, + (int) mode->global, (void *) key_listener->keys); #endif return key_listener; @@ -268,7 +271,7 @@ spi_controller_register_device_listener (SpiDeviceEventController *controller, case SPI_DEVICE_TYPE_KBD: key_listener = (DEControllerKeyListener *) listener; controller->key_listeners = g_list_prepend (controller->key_listeners, key_listener); - if (key_listener->is_system_global) + if (key_listener->mode->global) { spi_controller_register_global_keygrabs (controller, key_listener); } @@ -404,7 +407,7 @@ spi_key_event_matches_listener (const Accessibility_DeviceEvent *key_event, if ((key_event->modifiers == (CORBA_unsigned_short) (listener->mask & 0xFFFF)) && spi_key_set_contains_key (listener->keys, key_event) && spi_key_eventtype_seq_contains_event (listener->typeseq, key_event) && - (is_system_global == listener->is_system_global)) + (is_system_global == listener->mode->global)) { return TRUE; } @@ -636,7 +639,7 @@ impl_register_keystroke_listener (PortableServer_Servant servant, const Accessibility_KeySet *keys, const Accessibility_ControllerEventMask mask, const Accessibility_KeyEventTypeSeq *type, - const CORBA_boolean is_system_global, + const Accessibility_EventListenerMode *mode, CORBA_Environment *ev) { SpiDeviceEventController *controller = SPI_DEVICE_EVENT_CONTROLLER ( @@ -646,12 +649,8 @@ impl_register_keystroke_listener (PortableServer_Servant servant, fprintf (stderr, "registering keystroke listener %p with maskVal %lu\n", (void *) l, (unsigned long) mask); #endif - dec_listener = spi_dec_key_listener_new (l, keys, mask, type, - is_system_global, ev); - - spi_controller_register_device_listener (controller, - (DEControllerListener *) dec_listener, - ev); + dec_listener = spi_dec_key_listener_new (l, keys, mask, type, mode, ev); + spi_controller_register_device_listener (controller, (DEControllerListener *) dec_listener, ev); } /* @@ -664,7 +663,6 @@ impl_deregister_keystroke_listener (PortableServer_Servant servant, const Accessibility_KeySet *keys, const Accessibility_ControllerEventMask mask, const Accessibility_KeyEventTypeSeq *type, - const CORBA_boolean is_system_global, CORBA_Environment *ev) { SpiDeviceEventController *controller = SPI_DEVICE_EVENT_CONTROLLER ( @@ -673,7 +671,7 @@ impl_deregister_keystroke_listener (PortableServer_Servant servant, keys, mask, type, - is_system_global, + NULL, ev); #ifdef SPI_DEREGISTER_DEBUG fprintf (stderr, "deregistering keystroke listener %p with maskVal %lu\n", @@ -710,45 +708,50 @@ keycode_for_keysym (long keysym) return XKeysymToKeycode (spi_get_display (), (KeySym) keysym); } +#define SPI_DEBUG + /* * CORBA Accessibility::DeviceEventController::registerKeystrokeListener * method implementation */ static void -impl_generate_key_event (PortableServer_Servant servant, - const CORBA_long keycode, - const Accessibility_KeySynthType synth_type, - CORBA_Environment *ev) +impl_generate_keyboard_event (PortableServer_Servant servant, + const CORBA_long keycode, + const CORBA_char *keystring, + const Accessibility_KeySynthType synth_type, + CORBA_Environment *ev) { - long key_synth_code; + long key_synth_code; #ifdef SPI_DEBUG - fprintf (stderr, "synthesizing keystroke %ld, type %d\n", (long) keycode, (int) synth_type); + fprintf (stderr, "synthesizing keystroke %ld, type %d\n", (long) keycode, (int) synth_type); #endif - /* TODO: hide/wrap/remove X dependency */ + /* TODO: hide/wrap/remove X dependency */ - /* TODO: be accessX-savvy so that keyrelease occurs after sufficient timeout */ + /* TODO: be accessX-savvy so that keyrelease occurs after sufficient timeout */ - /* - * TODO: when initializing, query for XTest extension before using, - * and fall back to XSendEvent() if XTest is not available. - */ + /* + * TODO: when initializing, query for XTest extension before using, + * and fall back to XSendEvent() if XTest is not available. + */ + + /* TODO: implement keystring mode also */ - switch (synth_type) - { - case Accessibility_KEY_PRESS: - XTestFakeKeyEvent (spi_get_display (), (unsigned int) keycode, True, CurrentTime); - break; - case Accessibility_KEY_PRESSRELEASE: - XTestFakeKeyEvent (spi_get_display (), (unsigned int) keycode, True, CurrentTime); - case Accessibility_KEY_RELEASE: - XTestFakeKeyEvent (spi_get_display (), (unsigned int) keycode, False, CurrentTime); - break; - case Accessibility_KEY_SYM: - key_synth_code = keycode_for_keysym (keycode); - XTestFakeKeyEvent (spi_get_display (), (unsigned int) key_synth_code, True, CurrentTime); - XTestFakeKeyEvent (spi_get_display (), (unsigned int) key_synth_code, False, CurrentTime); - break; - } + switch (synth_type) + { + case Accessibility_KEY_PRESS: + XTestFakeKeyEvent (spi_get_display (), (unsigned int) keycode, True, CurrentTime); + break; + case Accessibility_KEY_PRESSRELEASE: + XTestFakeKeyEvent (spi_get_display (), (unsigned int) keycode, True, CurrentTime); + case Accessibility_KEY_RELEASE: + XTestFakeKeyEvent (spi_get_display (), (unsigned int) keycode, False, CurrentTime); + break; + case Accessibility_KEY_SYM: + key_synth_code = keycode_for_keysym (keycode); + XTestFakeKeyEvent (spi_get_display (), (unsigned int) key_synth_code, True, CurrentTime); + XTestFakeKeyEvent (spi_get_display (), (unsigned int) key_synth_code, False, CurrentTime); + break; + } } /* Accessibility::DeviceEventController::generateMouseEvent */ @@ -806,7 +809,7 @@ spi_device_event_controller_class_init (SpiDeviceEventControllerClass *klass) epv->registerKeystrokeListener = impl_register_keystroke_listener; epv->deregisterKeystrokeListener = impl_deregister_keystroke_listener; /* epv->registerMouseListener = impl_register_mouse_listener; */ - epv->generateKeyEvent = impl_generate_key_event; + epv->generateKeyboardEvent = impl_generate_keyboard_event; epv->generateMouseEvent = impl_generate_mouse_event; epv->notifyListenersSync = impl_notify_listeners_sync; epv->notifyListenersAsync = impl_notify_listeners_async; diff --git a/test/keysynth-demo.c b/test/keysynth-demo.c index e43b710..20d2a88 100644 --- a/test/keysynth-demo.c +++ b/test/keysynth-demo.c @@ -359,6 +359,7 @@ synth_keycode (GtkButton *button, KeyCode *keycode) static KeyCode shift_keycode = 0; if (!shift_keycode) shift_keycode = XKeysymToKeycode(GDK_DISPLAY(), (KeySym) 0xFFE1); /* Note: in a real onscreen keyboard shift keycode should not be hard-coded! */ + if (*keycode) { if (*keycode == CAPSLOCK_KEYCODE) @@ -367,13 +368,14 @@ synth_keycode (GtkButton *button, KeyCode *keycode) label_buttons (caps_lock || shift_latched); } if (shift_latched) - SPI_generateKeyEvent (shift_keycode, SPI_KEY_PRESS); - - SPI_generateKeyEvent ((long) *keycode, SPI_KEY_PRESSRELEASE); + SPI_generateKeyboardEvent (shift_keycode, NULL, SPI_KEY_PRESS); + + g_print ("generating key %d\n", (int) *keycode); + SPI_generateKeyboardEvent ((long) *keycode, NULL, SPI_KEY_PRESSRELEASE); if (shift_latched) { - SPI_generateKeyEvent (shift_keycode, SPI_KEY_RELEASE); + SPI_generateKeyboardEvent (shift_keycode, NULL, SPI_KEY_RELEASE); toggle_shift_latch (button); } } @@ -501,7 +503,7 @@ main (int argc, char **argv) &switch_set, SPI_KEYMASK_UNMODIFIED, (unsigned long) ( SPI_KEY_PRESSED | SPI_KEY_RELEASED ), - SPI_KEYLISTENER_CANCONSUME); + SPI_KEYLISTENER_NOSYNC); SPI_event_main (); -- 2.7.4