[g-a-devel]at-spi patch (bugfixes and extended events)



Hi:

I attach a patch for at-spi to add support for extended events (and test
the "text" context additions for a representative example,
"text-changed" events).  It also expands the available unimplemented
interface slots, in preparation for ABI freeze this week.  (Thanks to
Micheal for suggestions and debugging assistance in preparing this
patch).

I intend to commit this patch on Tuesday unless there are significant
issues raised.  Comments and corrections, as always, are welcome.

It's another big one; but I anticipate that future patches will be much
smaller in scope and size.

-Bill


Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/at-spi/ChangeLog,v
retrieving revision 1.257
diff -u -r1.257 ChangeLog
--- ChangeLog	17 Nov 2002 13:53:53 -0000	1.257
+++ ChangeLog	18 Nov 2002 19:23:46 -0000
@@ -1,3 +1,132 @@
+2002-11-17 Bill Haneman <bill haneman sun com>
+
+	* configure.in:
+	Revved to 1.1.4, interface-age=4, binary-age=4.
+
+	* idl/Accessibility_Action.idl:
+	* idl/Accessibility_Component.idl:
+	* idl/Accessibility_Desktop.idl:
+	* idl/Accessibility_Event.idl:
+	* idl/Accessibility_Hyperlink.idl:
+	* idl/Accessibility_Image.idl:
+	* idl/Accessibility_Relation.idl:
+	* idl/Accessibility_Selection.idl:
+	* idl/Accessibility_State.idl:
+	* idl/Accessibility_Value.idl:
+	Updated unimplemented slot count to minimum of
+	four for all interfaces, for ABI freeze. 
+
+	* idl/Accessibility_EditableText.idl:
+	* idl/Accessibility_Text.idl:
+	* idl/Accessibility_Registry.idl:
+	Updated unimplemented slot count to six
+	(eight for DeviceEventController), 
+	for ABI freeze. 
+
+	* idl/Accessibility_Table.idl:
+	Updated unimplemented slot count to eight,
+	for ABI freeze. 
+
+	* idl/Accessibility_Event.idl:
+	Added CORBA_any "any_data" member to Event struct.
+
+	* idl/Accessibility_Event.idl:
+	Added CORBA_any "any_data" member to Event struct.
+
+	* atk-bridge/bridge.c:
+	(statics):
+	atk_signal_text_changed, atk_signal_child_changed,
+	signal ids queried from gtype system.
+	(AtkBridgeEventContextType): New enum.
+	(AtkBridgeEventContextData): New struct.
+	(AtkBridgeEventContext): New struct.
+	(atk_bridge_init_event_type_consts):
+	New method, initializes type contants for comparison 
+	prior to emit_eventv.
+	(atk_bridge_event_context_init): New method,
+	initializes a CORBA_any from an AtkBridgeEventContext.
+	(atk_bridge_focus_tracker): Call spi_init_any_nil to
+	initialize the event.any_data struct.
+	(spi_atk_bridge_event_context_create): New method,
+	creates an AtkBridgeEventContext from signal/event info.
+	(spi_atk_bridge_event_context_free): New method.
+	(spi_atk_emit_eventv): Changed to take an 
+	AtkBridgeEventContext parameter. We now initialize
+	the event.any_data member prior to notifying the 
+	Registry, via the AtkBridgeEventContext.
+	(spi_atk_bridge_property_event_listener):
+	(spi_atk_bridge_state_event_listener):
+	Match emit_eventv signature.
+	(spi_atk_bridge_object_event_listener):
+	Match emit_eventv signature, and create an
+	event context from the event details.
+	Free the event context afterwards.
+	(spi_atk_bridge_window_event_listener):
+	Create an event context, pass it to the
+	emit_eventv call.
+	
+	* cspi/spi_event.c:
+	(AccessibleEvent_getContextString):
+	(AccessibleEvent_getContextObject):
+	New methods, allow query of AccessibleEvent objects
+	for more context details (via the "any_data" member 
+	of the Event struct, above).
+	
+	* cspi/spi.h:
+	Definitions for AccessibleEvent_getContextString
+	and AccessibleEvent_getContextObject.
+
+	* cspi/spi_listener.h:
+	(InternalEvent): New struct.
+
+	* cspi/spi_event.c:
+	(AccessibleEvent_getContextString):
+	(AccessibleEvent_getContextObject):
+	Implementations of new methods, for obtaining
+	additional context information from some event types.
+
+	* cspi/spi_registry.c:
+	(SPI_registerGlobalEventListener):
+	Added mention of active-descendant-changed event in docs.
+
+	* cspi/cspi-bonobo-listener.c:
+	(cspi_event):
+	Marshal the any into the AccessibleEvent via
+	InternalEvent.
+	
+	* libspi/spi-private.h:
+	#include <orbit/orbit.h>
+	(spi_init_any_nil):
+	(spi_init_any_string):
+	(spi_init_any_object):
+	New convenience function declarations.
+
+	* libspi/util.c:
+	(spi_init_any_nil):
+	(spi_init_any_string):
+	(spi_init_any_object):
+	New convenience function implementations.
+
+	* registryd/deviceeventcontroller.c:
+	(spi_poll_dec_mouse_moved):
+	(spi_device_event_controller_forward_mous_event):
+	Initialize any_data member of event.
+	(spi_deregister_controller_device_listener):
+	Fix incorrect param pass which was preventing deregistration.
+
+	* registryd/registry.c:
+	(desktop_add_application):
+	(desktop_remove_application):
+	Add object data to event's any_data before dispatch.
+	(parse_event_type):
+	Fix for error messages from GAIL.
+	
+	* test/event-listener-test.c:
+	Test new ContextString and "any_data" API:
+	(report_text_event): New method query and output context string.
+	(main): register a new text listener with report_text_event
+	callback.
+
 2002-11-17  Bill Haneman <bill haneman sun com>
 
 	* configure.in:
@@ -40,9 +169,6 @@
 	
 	* idl/Accessibility_Event.idl:
 	Added two more empty slots to EventListener (for a total of four).
-
-	* idl/Accessibility_Accessible.idl:
-	Added four empty slots to Accessible interface.
 
 	* idl/Accessibility_Accessible.idl:
 	Added four empty slots to Accessible interface.
Index: atk-bridge/bridge.c
===================================================================
RCS file: /cvs/gnome/at-spi/atk-bridge/bridge.c,v
retrieving revision 1.47
diff -u -r1.47 bridge.c
--- atk-bridge/bridge.c	15 Nov 2002 09:27:05 -0000	1.47
+++ atk-bridge/bridge.c	18 Nov 2002 19:23:47 -0000
@@ -43,6 +43,50 @@
 static gboolean registry_died = FALSE;
 static guint toplevel_handler;
 
+/* NOT YET USED
+   static GQuark atk_quark_property_changed_name;
+   static GQuark atk_quark_property_changed_description;
+   static GQuark atk_quark_property_changed_parent;
+   static GQuark atk_quark_property_changed_role;
+   static GQuark atk_quark_property_changed_table_caption;
+   static GQuark atk_quark_property_changed_table_column_description;
+   static GQuark atk_quark_property_changed_table_row_description;
+   static guint atk_signal_property_changed;
+*/
+
+static guint atk_signal_text_changed;
+static guint atk_signal_child_changed;
+
+/* NOT YET USED
+   static guint atk_signal_text_selection_changed;
+   static guint atk_signal_active_descendant_changed;
+   static guint atk_signal_row_reordered;
+   static guint atk_signal_row_inserted;
+   static guint atk_signal_row_deleted;
+   static guint atk_signal_column_reordered;
+   static guint atk_signal_column_inserted;
+   static guint atk_signal_column_deleted;
+*/
+
+#define ATK_BRIDGE_RESERVED_CONTEXT_SIZE 16
+
+typedef enum {
+  ATK_BRIDGE_CONTEXT_TYPE_NONE = 0,
+  ATK_BRIDGE_CONTEXT_TYPE_STRING,
+  ATK_BRIDGE_CONTEXT_TYPE_OBJECT
+} AtkBridgeEventContextType;
+
+typedef union {
+  gchar       *string;
+  AtkObject   *object;
+  gpointer    *foo;
+} AtkBridgeEventContextData;
+
+typedef struct {
+  AtkBridgeEventContextType _type;
+  AtkBridgeEventContextData _data;
+} AtkBridgeEventContext;
+
 static Accessibility_Registry spi_atk_bridge_get_registry (void);
 static void     spi_atk_bridge_do_registration         (void);
 static void     spi_atk_bridge_toplevel_added          (AtkObject             *object,
@@ -90,6 +134,15 @@
 extern void gnome_accessibility_module_init     (void);
 extern void gnome_accessibility_module_shutdown (void);
 
+static void
+atk_bridge_init_event_type_consts ()
+{
+  atk_signal_child_changed = g_signal_lookup ("child_changed", 
+					      ATK_TYPE_OBJECT);
+  atk_signal_text_changed = g_signal_lookup ("text_changed", 
+					     ATK_TYPE_TEXT);
+}
+
 static int
 atk_bridge_init (gint *argc, gchar **argv[])
 {
@@ -122,6 +175,8 @@
     {
       spi_atk_bridge_do_registration ();
     }
+ 
+  atk_bridge_init_event_type_consts ();
 
   return 0;
 }
@@ -371,6 +426,32 @@
 }
 
 static void
+atk_bridge_event_context_init (CORBA_any *any, 
+			       AtkBridgeEventContext *ctx)
+{
+  SpiAccessible *accessible;
+  if (ctx) 
+    {
+      switch (ctx->_type) 
+	{
+	case ATK_BRIDGE_CONTEXT_TYPE_OBJECT:
+	  accessible = spi_accessible_new (ctx->_data.object);    
+	  spi_init_any_object (any, BONOBO_OBJREF (accessible));
+	  break;
+	case ATK_BRIDGE_CONTEXT_TYPE_STRING:
+	  spi_init_any_string (any, &ctx->_data.string);
+	  break;
+	default:
+	  spi_init_any_nil (any); 
+	} 
+    }
+  else
+    {
+      spi_init_any_nil (any); 
+    }
+} 
+
+static void
 spi_atk_bridge_focus_tracker (AtkObject *object)
 {
   SpiAccessible *source;
@@ -382,7 +463,7 @@
   e.source = BONOBO_OBJREF (source);
   e.detail1 = 0;
   e.detail2 = 0;
-
+  spi_init_any_nil (&e.any_data);
   Accessibility_Registry_notifyEvent (spi_atk_bridge_get_registry (), &e, &ev);
   if (BONOBO_EX (&ev)) registry_died = TRUE;
   
@@ -391,10 +472,48 @@
   CORBA_exception_free (&ev);
 }
 
+static
+AtkBridgeEventContext *
+spi_atk_bridge_event_context_create (GObject *gobject, 
+				     long detail1, 
+				     long detail2, 
+				     GSignalQuery *signal_query, 
+				     const gchar *detail)
+{
+  AtkBridgeEventContext *ctx = g_new0 (AtkBridgeEventContext, 1);
+  if (signal_query->signal_id == atk_signal_child_changed) 
+    {  
+      ctx->_type = ATK_BRIDGE_CONTEXT_TYPE_OBJECT;
+      ctx->_data.object = atk_object_ref_accessible_child (ATK_OBJECT (gobject),
+							   (gint) detail1);
+    }
+  else if (signal_query->signal_id == atk_signal_text_changed)
+    {
+      ctx->_type = ATK_BRIDGE_CONTEXT_TYPE_STRING;
+      ctx->_data.string = atk_text_get_text (ATK_TEXT (gobject),
+					     (gint) detail1,
+					     (gint) detail1+detail2);
+    }
+  else
+    {
+      ctx->_type = ATK_BRIDGE_CONTEXT_TYPE_NONE;
+    }
+  return ctx;
+}
+
+static void
+spi_atk_bridge_event_context_free (AtkBridgeEventContext *ctx)
+{
+  if (ctx->_type == ATK_BRIDGE_CONTEXT_TYPE_OBJECT)
+    g_object_unref (ctx->_data.object);
+  g_free (ctx);
+}
+
 static void
-spi_atk_emit_eventv (GObject      *gobject,
-		     unsigned long detail1,
-		     unsigned long detail2,
+spi_atk_emit_eventv (GObject               *gobject,
+		     unsigned long          detail1,
+		     unsigned long          detail2,
+		     AtkBridgeEventContext *context,
 		     const char   *format, ...)
 {
   va_list             args;
@@ -431,15 +550,16 @@
       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
-
+      CORBA_exception_init (&ev);
+      atk_bridge_event_context_init (&e.any_data, context); 
       Accessibility_Registry_notifyEvent (spi_atk_bridge_get_registry (), &e, &ev);
+      /* I haven't freed any_data._value when it's a char*, does it leak ? */
 #ifdef SPI_BRIDGE_DEBUG
       if (ev._major != CORBA_NO_EXCEPTION)
 	      g_warning ("error emitting event %s, (%d) %s",
@@ -487,7 +607,8 @@
   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);
+  spi_atk_emit_eventv (gobject, 0, 0, NULL,
+		       "object:property-change:%s", values->property_name);
 
   return TRUE;
 }
@@ -520,6 +641,7 @@
   spi_atk_emit_eventv (gobject, 
 		       detail1,
 		       0,
+		       NULL,
 		       type);
   g_free (property_name);
   g_free (type);
@@ -623,6 +745,7 @@
   GSignalQuery signal_query;
   const gchar *name;
   const gchar *detail;
+  AtkBridgeEventContext *ctx = NULL;
   
   gint detail1 = 0, detail2 = 0;
 #ifdef SPI_BRIDGE_DEBUG
@@ -650,11 +773,22 @@
     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);
-  
+
+  /* build some event context data, depending on the type */
+  ctx = spi_atk_bridge_event_context_create (gobject, 
+					     detail1, detail2, 
+					     &signal_query, 
+					     detail);
+
   if (detail)
-    spi_atk_emit_eventv (gobject, detail1, detail2, "object:%s:%s", name, detail);
+    spi_atk_emit_eventv (gobject, detail1, detail2, ctx,
+			 "object:%s:%s", name, detail);
   else
-    spi_atk_emit_eventv (gobject, detail1, detail2, "object:%s", name);
+    spi_atk_emit_eventv (gobject, detail1, detail2, ctx,
+			 "object:%s", name);
+
+  if (ctx) 
+    spi_atk_bridge_event_context_free (ctx);
 
   return TRUE;
 }
@@ -667,9 +801,11 @@
 {
   GObject *gobject;
   GSignalQuery signal_query;
-  const gchar *name;
+  AtkBridgeEventContext ctx;
+
+  const gchar *name, *s;
 #ifdef SPI_BRIDGE_DEBUG
-  const gchar *s, *s2;
+  const gchar *s2;
 #endif
   
   g_signal_query (signal_hint->signal_id, &signal_query);
@@ -682,9 +818,14 @@
   fprintf (stderr, "Received signal %s:%s from object %s (gail %s)\n",
 	   g_type_name (signal_query.itype), name, s ? s : "<NULL>" , s2);
 #endif
-
+  
   gobject = g_value_get_object (param_values + 0);
-  spi_atk_emit_eventv (gobject, 0, 0, "window:%s", name);
-
+  ctx._type = ATK_BRIDGE_CONTEXT_TYPE_STRING;
+  s = atk_object_get_name (ATK_OBJECT (gobject));
+  ctx._data.string = (gchar *) s;
+  /* cast from const silences compiler */
+  
+  spi_atk_emit_eventv (gobject, 0, 0, &ctx, "window:%s", name);
+  /* don't free the context, it's on the stack */
   return TRUE;
 }
Index: cspi/spi-listener.h
===================================================================
RCS file: /cvs/gnome/at-spi/cspi/spi-listener.h,v
retrieving revision 1.19
diff -u -r1.19 spi-listener.h
--- cspi/spi-listener.h	17 Nov 2002 13:53:54 -0000	1.19
+++ cspi/spi-listener.h	18 Nov 2002 19:23:47 -0000
@@ -39,6 +39,14 @@
   long         detail1;
   long         detail2;
 } AccessibleEvent;
+  
+/* 
+ * For internal use by CSPI implementation only
+ */
+typedef struct {
+  AccessibleEvent event;
+  void           *data; 
+} InternalEvent;
 
 typedef enum {
   SPI_KEY_PRESSED  = 1<<0,
Index: cspi/spi.h
===================================================================
RCS file: /cvs/gnome/at-spi/cspi/spi.h,v
retrieving revision 1.50
diff -u -r1.50 spi.h
--- cspi/spi.h	17 Nov 2002 13:53:54 -0000	1.50
+++ cspi/spi.h	18 Nov 2002 19:23:47 -0000
@@ -27,7 +27,7 @@
 #include <cspi/spi-impl.h>
 /*
  * Definitions for AccessibleRole, AccessibleState,
- * AccessibleEvent, and event listeners.
+ * and event listeners.
  */
 #include <cspi/spi-roletypes.h>
 #include <cspi/spi-statetypes.h>
@@ -787,6 +787,14 @@
 double     AccessibleValue_getMaximumValue (AccessibleValue *obj);
 SPIBoolean AccessibleValue_setCurrentValue (AccessibleValue *obj,
 					    double           newValue);
+
+/*
+ * Prototypes for accessor functions, to obtain context
+ * information for accessible events.
+ */
+
+char*        AccessibleEvent_getContextString (const AccessibleEvent *e);
+Accessible * AccessibleEvent_getContextObject (const AccessibleEvent *e);
 
 /* Misc methods */
 void SPI_freeString (char *s);
Index: cspi/spi_event.c
===================================================================
RCS file: /cvs/gnome/at-spi/cspi/spi_event.c,v
retrieving revision 1.21
diff -u -r1.21 spi_event.c
--- cspi/spi_event.c	17 Nov 2002 13:53:54 -0000	1.21
+++ cspi/spi_event.c	18 Nov 2002 19:23:47 -0000
@@ -326,3 +326,75 @@
 {
   cspi_device_listener_unref (listener);
 }
+
+/**
+ * AccessibleEvent_getContextString:
+ * @event: a pointer to the #AccessibleEvent being queried.
+ *
+ * Queries an #AccessibleEvent for a string whose meaning depends
+ *         on the event's context, that is, the event type and details.
+ *         Not all events have context strings, in which case this 
+ *         query returns NULL.  
+ *         Context strings may be returned by:
+ *         object:text-changed events, 
+ *         in which case they represent the text inserted or deleted;
+ *         window: events, in which case they indicate the window title,
+ *         or other events.
+ *
+ * Returns: the context string for the event, or %NULL if
+ *          there is no context string for the event.
+ **/
+char *
+AccessibleEvent_getContextString (const AccessibleEvent *e)
+{
+  InternalEvent *foo = (InternalEvent *) e;
+  CORBA_any *any;
+  g_return_val_if_fail (foo, NULL);
+  g_return_val_if_fail (foo->data, NULL);
+  any = (CORBA_any *) foo->data;
+  if (CORBA_TypeCode_equivalent (any->_type, TC_CORBA_string, NULL)) 
+    {
+      return * (char **) any->_value;
+    } 
+  else 
+    {
+#ifdef EVENT_CONTEXT_DEBUG
+      fprintf (stderr, "requested string, TC is not TC_CORBA_string! (%u)\n",
+	       (unsigned) any->_type);
+#endif
+      return NULL;
+    }
+}
+
+/**
+ * AccessibleEvent_getContextObject:
+ * @event: a pointer to the #AccessibleEvent being queried.
+ *
+ * Queries an #AccessibleEvent for an #Accessible whose meaning depends
+ *         on the event's context, that is, the event type and details.
+ *         Not all events have context strings, in which case this 
+ *         query returns NULL.  
+ *         Context #Accessible objects may be returned by, for instance:
+ *         object:child-changed events, 
+ *         in which case they represent the child added or deleted.
+ *         Note that context #Accessibles are not guaranteed to outlive
+ *         event delivery, in which case this call may return %NULL
+ *         even if the object existed at the time of dispatch.
+ *
+ * Returns: the context #Accessible for the event, or %NULL if
+ *          there is no context #Accessible object for the event.
+ **/
+Accessible *
+AccessibleEvent_getContextObject (const AccessibleEvent *e)
+{
+  InternalEvent *foo = (InternalEvent *) e;
+  CORBA_any *any;
+  g_return_val_if_fail (foo, NULL);
+  g_return_val_if_fail (foo->data, NULL);
+  any = (CORBA_any *) foo->data;
+  if (any->_type == TC_CORBA_Object) 
+    return cspi_object_add (* (CORBA_Object *) any->_value);
+  else 
+    return NULL;
+}
+
Index: cspi/spi_registry.c
===================================================================
RCS file: /cvs/gnome/at-spi/cspi/spi_registry.c,v
retrieving revision 1.42
diff -u -r1.42 spi_registry.c
--- cspi/spi_registry.c	17 Nov 2002 13:53:54 -0000	1.42
+++ cspi/spi_registry.c	18 Nov 2002 19:23:48 -0000
@@ -70,6 +70,7 @@
  *            object:column-reordered
  *            object:column-deleted
  *            object:model-changed
+ *            object:active-descendant-changed
  *
  *  (window events)
  *
@@ -545,6 +546,7 @@
   Accessibility_ControllerEventMask   controller_event_mask;
   Accessibility_DeviceEventController device_event_controller;
   Accessibility_EventTypeSeq       event_types;
+  Accessibility_EventType          event_type_buff[2];
 
   if (!listener)
     {
@@ -556,7 +558,7 @@
 
   cspi_return_val_if_ev ("getting keystroke listener", FALSE);
 
-  event_types._buffer = Accessibility_EventTypeSeq_allocbuf (2);
+  event_types._buffer = event_type_buff;
   event_types._length = 2;
   event_types._buffer[0] = Accessibility_BUTTON_PRESSED_EVENT;
   event_types._buffer[1] = Accessibility_BUTTON_RELEASED_EVENT;
Index: cspi/bonobo/cspi-bonobo-listener.c
===================================================================
RCS file: /cvs/gnome/at-spi/cspi/bonobo/cspi-bonobo-listener.c,v
retrieving revision 1.16
diff -u -r1.16 cspi-bonobo-listener.c
--- cspi/bonobo/cspi-bonobo-listener.c	17 Nov 2002 13:53:54 -0000	1.16
+++ cspi/bonobo/cspi-bonobo-listener.c	18 Nov 2002 19:23:48 -0000
@@ -91,20 +91,21 @@
 {
   GList *l;
   CSpiEventListener *clistener = (CSpiEventListener *) listener;
-  AccessibleEvent    aevent;
+  InternalEvent      aevent;
   Accessible        *source = cspi_object_borrow (event->source);
   
-  aevent.type    = event->type;
-  aevent.source  = source;
-  aevent.detail1 = event->detail1;
-  aevent.detail2 = event->detail2;
+  aevent.event.type    = event->type;
+  aevent.event.source  = source;
+  aevent.event.detail1 = event->detail1;
+  aevent.event.detail2 = event->detail2;
+  aevent.data          = &event->any_data;
 
   /* 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);
+      /* cast hides our private stuff from client handlers */
+      eh->cb.event ((AccessibleEvent *) &aevent, eh->user_data);
     }
 
   cspi_object_return (source);
Index: idl/Accessibility_Action.idl
===================================================================
RCS file: /cvs/gnome/at-spi/idl/Accessibility_Action.idl,v
retrieving revision 1.7
diff -u -r1.7 Accessibility_Action.idl
--- idl/Accessibility_Action.idl	1 Jan 2002 22:35:29 -0000	1.7
+++ idl/Accessibility_Action.idl	18 Nov 2002 19:23:48 -0000
@@ -84,6 +84,8 @@
      */
     void unImplemented ();
     void unImplemented2 ();
+    void unImplemented3 ();
+    void unImplemented4 ();
   };
 };
 
Index: idl/Accessibility_Component.idl
===================================================================
RCS file: /cvs/gnome/at-spi/idl/Accessibility_Component.idl,v
retrieving revision 1.9
diff -u -r1.9 Accessibility_Component.idl
--- idl/Accessibility_Component.idl	9 Sep 2002 11:11:41 -0000	1.9
+++ idl/Accessibility_Component.idl	18 Nov 2002 19:23:48 -0000
@@ -56,5 +56,7 @@
 	 */
 	void unImplemented ();
 	void unImplemented2 ();
+	void unImplemented3 ();
+	void unImplemented4 ();
   };
 };
Index: idl/Accessibility_Desktop.idl
===================================================================
RCS file: /cvs/gnome/at-spi/idl/Accessibility_Desktop.idl,v
retrieving revision 1.7
diff -u -r1.7 Accessibility_Desktop.idl
--- idl/Accessibility_Desktop.idl	17 Nov 2002 13:53:55 -0000	1.7
+++ idl/Accessibility_Desktop.idl	18 Nov 2002 19:23:48 -0000
@@ -39,6 +39,8 @@
 	   */
 	  void unImplemented_ ();
 	  void unImplemented2_ ();
+	  void unImplemented3_ ();
+	  void unImplemented4_ ();
   };
 };
 
Index: idl/Accessibility_EditableText.idl
===================================================================
RCS file: /cvs/gnome/at-spi/idl/Accessibility_EditableText.idl,v
retrieving revision 1.4
diff -u -r1.4 Accessibility_EditableText.idl
--- idl/Accessibility_EditableText.idl	15 Apr 2002 16:03:21 -0000	1.4
+++ idl/Accessibility_EditableText.idl	18 Nov 2002 19:23:48 -0000
@@ -34,13 +34,17 @@
     boolean deleteText (in long startPos, in long endPos);
     boolean pasteText (in long position);
     /**
-     * unImplemented5:
+     * unImplemented7:
      *
      * placeholders for future expansion. Note that these are named
      * 'unimplemented5 and unimplemented6' to avoid conflict with 
      * placeholders from Accessibility::Text.
      */
-    void unImplemented5 ();
-    void unImplemented6 ();
+    void unImplemented7 ();
+    void unImplemented8 ();
+    void unImplemented9 ();
+    void unImplemented10 ();
+    void unImplemented11 ();
+    void unImplemented12 ();
   };
 };
Index: idl/Accessibility_Event.idl
===================================================================
RCS file: /cvs/gnome/at-spi/idl/Accessibility_Event.idl,v
retrieving revision 1.10
diff -u -r1.10 Accessibility_Event.idl
--- idl/Accessibility_Event.idl	17 Nov 2002 13:53:55 -0000	1.10
+++ idl/Accessibility_Event.idl	18 Nov 2002 19:23:49 -0000
@@ -34,6 +34,7 @@
     Accessible source;
     long       detail1;
     long       detail2;
+    any        any_data;
   };
 
   interface EventListener : Bonobo::Unknown {
Index: idl/Accessibility_Hyperlink.idl
===================================================================
RCS file: /cvs/gnome/at-spi/idl/Accessibility_Hyperlink.idl,v
retrieving revision 1.7
diff -u -r1.7 Accessibility_Hyperlink.idl
--- idl/Accessibility_Hyperlink.idl	1 Jan 2002 22:35:29 -0000	1.7
+++ idl/Accessibility_Hyperlink.idl	18 Nov 2002 19:23:49 -0000
@@ -38,5 +38,7 @@
      */
     void unImplemented ();
     void unImplemented2 ();
+    void unImplemented3 ();
+    void unImplemented4 ();
   };
 };
Index: idl/Accessibility_Image.idl
===================================================================
RCS file: /cvs/gnome/at-spi/idl/Accessibility_Image.idl,v
retrieving revision 1.7
diff -u -r1.7 Accessibility_Image.idl
--- idl/Accessibility_Image.idl	1 Jan 2002 22:35:29 -0000	1.7
+++ idl/Accessibility_Image.idl	18 Nov 2002 19:23:49 -0000
@@ -34,5 +34,7 @@
      */
     void unImplemented ();
     void unImplemented2 ();
+    void unImplemented3 ();
+    void unImplemented4 ();
   };
 };
Index: idl/Accessibility_Registry.idl
===================================================================
RCS file: /cvs/gnome/at-spi/idl/Accessibility_Registry.idl,v
retrieving revision 1.20
diff -u -r1.20 Accessibility_Registry.idl
--- idl/Accessibility_Registry.idl	17 Nov 2002 13:53:55 -0000	1.20
+++ idl/Accessibility_Registry.idl	18 Nov 2002 19:23:49 -0000
@@ -151,6 +151,10 @@
 	 */
 	void unImplemented ();
 	void unImplemented2 ();
+	void unImplemented3 ();
+	void unImplemented4 ();
+	void unImplemented5 ();
+	void unImplemented6 ();
     };
 
   /* Deprecated, DO NOT USE! */
@@ -220,6 +224,10 @@
         void    unImplemented_2_ ();
         void    unImplemented_3_ ();
         void    unImplemented_4_ ();
+        void    unImplemented_5_ ();
+        void    unImplemented_6_ ();
+        void    unImplemented_7_ ();
+        void    unImplemented_8_ ();
   };
 
   interface DeviceEventController : Bonobo::Unknown {
@@ -342,6 +350,8 @@
 	  */
 	 void unImplemented ();
 	 void unImplemented2 ();
+	 void unImplemented3 ();
+	 void unImplemented4 ();
     }; 
 };
 
Index: idl/Accessibility_Relation.idl
===================================================================
RCS file: /cvs/gnome/at-spi/idl/Accessibility_Relation.idl,v
retrieving revision 1.8
diff -u -r1.8 Accessibility_Relation.idl
--- idl/Accessibility_Relation.idl	15 Nov 2002 15:58:10 -0000	1.8
+++ idl/Accessibility_Relation.idl	18 Nov 2002 19:23:49 -0000
@@ -55,6 +55,8 @@
     /* placeholders for future expansion */
     void unImplemented ();
     void unImplemented2 ();
+    void unImplemented3 ();
+    void unImplemented4 ();
   };
 };
 
Index: idl/Accessibility_Selection.idl
===================================================================
RCS file: /cvs/gnome/at-spi/idl/Accessibility_Selection.idl,v
retrieving revision 1.6
diff -u -r1.6 Accessibility_Selection.idl
--- idl/Accessibility_Selection.idl	15 Apr 2002 16:03:21 -0000	1.6
+++ idl/Accessibility_Selection.idl	18 Nov 2002 19:23:49 -0000
@@ -40,5 +40,7 @@
      */
     void unImplemented ();
     void unImplemented2 ();
+    void unImplemented3 ();
+    void unImplemented4 ();
   };
 };
Index: idl/Accessibility_State.idl
===================================================================
RCS file: /cvs/gnome/at-spi/idl/Accessibility_State.idl,v
retrieving revision 1.9
diff -u -r1.9 Accessibility_State.idl
--- idl/Accessibility_State.idl	15 Nov 2002 15:58:10 -0000	1.9
+++ idl/Accessibility_State.idl	18 Nov 2002 19:23:49 -0000
@@ -140,6 +140,8 @@
      */
     void unImplemented ();
     void unImplemented2 ();
+    void unImplemented3 ();
+    void unImplemented4 ();
   };
 };
 
Index: idl/Accessibility_Table.idl
===================================================================
RCS file: /cvs/gnome/at-spi/idl/Accessibility_Table.idl,v
retrieving revision 1.6
diff -u -r1.6 Accessibility_Table.idl
--- idl/Accessibility_Table.idl	15 Apr 2002 11:25:11 -0000	1.6
+++ idl/Accessibility_Table.idl	18 Nov 2002 19:23:49 -0000
@@ -62,5 +62,9 @@
     void unImplemented2 ();
     void unImplemented3 ();
     void unImplemented4 ();
+    void unImplemented5 ();
+    void unImplemented6 ();
+    void unImplemented7 ();
+    void unImplemented8 ();
   };
 };
Index: idl/Accessibility_Text.idl
===================================================================
RCS file: /cvs/gnome/at-spi/idl/Accessibility_Text.idl,v
retrieving revision 1.7
diff -u -r1.7 Accessibility_Text.idl
--- idl/Accessibility_Text.idl	1 Jan 2002 22:35:30 -0000	1.7
+++ idl/Accessibility_Text.idl	18 Nov 2002 19:23:49 -0000
@@ -64,5 +64,7 @@
     void unImplemented2 ();
     void unImplemented3 ();
     void unImplemented4 ();
+    void unImplemented5 ();
+    void unImplemented6 ();
   };
 };
Index: idl/Accessibility_Value.idl
===================================================================
RCS file: /cvs/gnome/at-spi/idl/Accessibility_Value.idl,v
retrieving revision 1.6
diff -u -r1.6 Accessibility_Value.idl
--- idl/Accessibility_Value.idl	1 Jan 2002 22:35:30 -0000	1.6
+++ idl/Accessibility_Value.idl	18 Nov 2002 19:23:49 -0000
@@ -35,5 +35,7 @@
      */
     void unImplemented ();
     void unImplemented2 ();
+    void unImplemented3 ();
+    void unImplemented4 ();
   };
 };
Index: libspi/spi-private.h
===================================================================
RCS file: /cvs/gnome/at-spi/libspi/spi-private.h,v
retrieving revision 1.4
diff -u -r1.4 spi-private.h
--- libspi/spi-private.h	13 Sep 2002 13:09:01 -0000	1.4
+++ libspi/spi-private.h	18 Nov 2002 19:23:50 -0000
@@ -25,6 +25,7 @@
 #define SPI_PRIVATE_H_
 
 #include <glib/glist.h>
+#include <orbit/orbit.h>
 
 G_BEGIN_DECLS
 
@@ -40,6 +41,9 @@
 void spi_re_entrant_list_foreach     (GList         **list,
 				      SpiReEntrantFn  func,
 				      gpointer        user_data);
+void spi_init_any_nil                (CORBA_any *any);
+void spi_init_any_string             (CORBA_any *any, char **string);
+void spi_init_any_object             (CORBA_any *any, CORBA_Object o);
 
 G_END_DECLS
 
Index: libspi/util.c
===================================================================
RCS file: /cvs/gnome/at-spi/libspi/util.c,v
retrieving revision 1.4
diff -u -r1.4 util.c
--- libspi/util.c	13 Sep 2002 13:09:01 -0000	1.4
+++ libspi/util.c	18 Nov 2002 19:23:50 -0000
@@ -33,6 +33,8 @@
 
 static GSList *working_list = NULL; /* of Iteration */
 
+static char *spi_atk_bridge_null_string = "";
+
 /*
  *   deletes an element from the list - in a re-entrant
  * safe fashion; advances the element pointer to the next
@@ -101,4 +103,34 @@
 	}
 
 	working_list = g_slist_remove (working_list, &i);
+}
+
+void 
+spi_init_any_nil (CORBA_any *any)
+{
+  any->_type = TC_null;
+  any->_value = NULL;
+  any->_release = FALSE;
+}
+
+void 
+spi_init_any_object (CORBA_any *any, CORBA_Object o)
+{
+  CORBA_Environment ev;
+  CORBA_exception_init (&ev);
+  any->_type = TC_CORBA_Object;
+  any->_value = CORBA_Object_duplicate (o, &ev);
+  any->_release = FALSE;
+  CORBA_exception_free (&ev);
+}
+
+void
+spi_init_any_string (CORBA_any *any, char **string_pointer)
+{  
+  any->_type = (CORBA_TypeCode) TC_CORBA_string;
+  if (string_pointer && *string_pointer)
+    any->_value = string_pointer;
+  else
+    any->_value = &spi_atk_bridge_null_string;
+  any->_release = FALSE;
 }
Index: registryd/deviceeventcontroller.c
===================================================================
RCS file: /cvs/gnome/at-spi/registryd/deviceeventcontroller.c,v
retrieving revision 1.51
diff -u -r1.51 deviceeventcontroller.c
--- registryd/deviceeventcontroller.c	17 Nov 2002 13:53:57 -0000	1.51
+++ registryd/deviceeventcontroller.c	18 Nov 2002 19:23:51 -0000
@@ -238,18 +238,17 @@
                           mouse_e.modifiers = (CORBA_unsigned_short) 
 			                       mouse_mask_state; 
 			  mouse_e.timestamp = 0;
-			  mouse_e.event_string = CORBA_string_dup ("");
+			  mouse_e.event_string = "";
 			  mouse_e.is_text   = CORBA_FALSE;
 			  is_consumed = 
 			    spi_controller_notify_mouselisteners (controller, 
 								  &mouse_e, 
 								  &ev);
-			  CORBA_free (mouse_e.event_string);
-
 			  e.type = event_name;
 			  e.source = BONOBO_OBJREF (registry->desktop);
 			  e.detail1 = last_mouse_pos->x;
 			  e.detail2 = last_mouse_pos->y;
+			  spi_init_any_nil (&e.any_data);
 			  CORBA_exception_init (&ev);
 			  if (!is_consumed)
 			    Accessibility_Registry_notifyEvent (BONOBO_OBJREF (registry),
@@ -266,6 +265,7 @@
 		  e.source = BONOBO_OBJREF (registry->desktop);
 		  e.detail1 = mouse_mask_state;
 		  e.detail2 = mask_return;
+		  spi_init_any_nil (&e.any_data);
 		  CORBA_exception_init (&ev);
 		  Accessibility_Registry_notifyEvent (BONOBO_OBJREF (registry),
 						      &e,
@@ -284,6 +284,7 @@
 	  e.source = BONOBO_OBJREF (registry->desktop);
 	  e.detail1 = x;
 	  e.detail2 = y;
+	  spi_init_any_nil (&e.any_data);
 	  CORBA_exception_init (&ev);
 	  Accessibility_Registry_notifyEvent (BONOBO_OBJREF (registry),
 					      &e,
@@ -294,6 +295,7 @@
 	  e.source = BONOBO_OBJREF (registry->desktop);
 	  e.detail1 = x - last_mouse_pos->x;
 	  e.detail2 = y - last_mouse_pos->y;
+	  spi_init_any_nil (&e.any_data);
 	  CORBA_exception_init (&ev);
 	  last_mouse_pos->x = x;
 	  last_mouse_pos->y = y;
@@ -737,15 +739,15 @@
   mouse_e.hw_code   = button;
   mouse_e.modifiers = (CORBA_unsigned_short) xbutton_event->state;
   mouse_e.timestamp = (CORBA_unsigned_long) xbutton_event->time;
-  mouse_e.event_string = CORBA_string_dup ("");
+  mouse_e.event_string = "";
   mouse_e.is_text   = CORBA_FALSE;
   is_consumed = spi_controller_notify_mouselisteners (controller, &mouse_e, &ev);
-  CORBA_free (mouse_e.event_string);
 
   e.type = CORBA_string_dup (event_name);
   e.source = BONOBO_OBJREF (controller->registry->desktop);
   e.detail1 = last_mouse_pos->x;
   e.detail2 = last_mouse_pos->y;
+  spi_init_any_nil (&e.any_data);
   CORBA_exception_init (&ev);
   
   Accessibility_Registry_notifyEvent (BONOBO_OBJREF (controller->registry),
@@ -1412,8 +1414,13 @@
 					   DEControllerListener *listener,
 					   CORBA_Environment          *ev)
 {
+  RemoveListenerClosure  ctx;
+
+  ctx.ev = ev;
+  ctx.listener = listener;
+
   spi_re_entrant_list_foreach (&controller->mouse_listeners,
-			       remove_listener_cb, listener);
+			       remove_listener_cb, &ctx);
 }
 
 static void
Index: registryd/registry.c
===================================================================
RCS file: /cvs/gnome/at-spi/registryd/registry.c,v
retrieving revision 1.52
diff -u -r1.52 registry.c
--- registryd/registry.c	17 Nov 2002 13:53:57 -0000	1.52
+++ registryd/registry.c	18 Nov 2002 19:23:52 -0000
@@ -89,12 +89,17 @@
   BonoboObject *registry = BONOBO_OBJECT (data);
   Accessibility_Event e;
   CORBA_Environment ev;
+  Accessibility_Accessible a;
   
+  CORBA_exception_init (&ev);
   e.type = "object:children-changed:add";
   e.source = BONOBO_OBJREF (desktop);
   e.detail1 = index;
   e.detail2 = 0;
-  CORBA_exception_init (&ev);
+  a = Accessibility_Accessible_getChildAtIndex (BONOBO_OBJREF (desktop), 
+						index, &ev);
+  spi_init_any_object (&e.any_data, a);
+  Accessibility_Accessible_unref (a, &ev);
   Accessibility_Registry_notifyEvent (BONOBO_OBJREF (registry),
 				      &e, &ev);
   Accessibility_Desktop_unref (e.source, &ev);
@@ -109,13 +114,19 @@
 {
   BonoboObject *registry = BONOBO_OBJECT (data);
   Accessibility_Event e;
+  Accessibility_Accessible a;
   CORBA_Environment ev;
   
+  CORBA_exception_init (&ev);
+
   e.type = "object:children-changed:remove";
   e.source = BONOBO_OBJREF (desktop);
   e.detail1 = index;
   e.detail2 = 0;
-  CORBA_exception_init (&ev);
+  a = Accessibility_Accessible_getChildAtIndex (BONOBO_OBJREF (desktop), 
+						index, &ev);
+  spi_init_any_object (&e.any_data, a);
+  Accessibility_Accessible_unref (a, &ev);
   Accessibility_Registry_notifyEvent (BONOBO_OBJREF (registry),
 				      &e, &ev);
   Accessibility_Desktop_unref (e.source, &ev);
@@ -259,6 +270,10 @@
     {
       etype->type_cat = ETYPE_WINDOW;
     }
+  else if (!g_ascii_strncasecmp (event_name, "keyboard:", 7))
+    {
+      etype->type_cat = ETYPE_KEYBOARD;
+    }
   else
     {
       etype->type_cat = ETYPE_TOOLKIT;
@@ -575,7 +590,6 @@
 #endif
       
       ctx->e_out.source = CORBA_Object_duplicate (ctx->source, ctx->ev);
-
       if (BONOBO_EX (ctx->ev))
         {
           return SPI_RE_ENTRANT_CONTINUE;
@@ -624,11 +638,11 @@
     {
       ctx.ev = ev;
       ctx.e_out = *e;
+      CORBA_any__copy (&ctx.e_out.any_data, &e->any_data);
       ctx.source = e->source;
 
       spi_re_entrant_list_foreach (list, notify_listeners_cb, &ctx);
     }
-
 }
 
 static void
Index: test/event-listener-test.c
===================================================================
RCS file: /cvs/gnome/at-spi/test/event-listener-test.c,v
retrieving revision 1.12
diff -u -r1.12 event-listener-test.c
--- test/event-listener-test.c	17 Nov 2002 13:54:00 -0000	1.12
+++ test/event-listener-test.c	18 Nov 2002 19:23:52 -0000
@@ -29,12 +29,14 @@
 
 static void report_event  (const AccessibleEvent *event, void *user_data);
 static void report_detail_event  (const AccessibleEvent *event, void *user_data);
+static void report_text_event  (const AccessibleEvent *event, void *user_data);
 static void timing_test_event (const AccessibleEvent *event, void *user_data);
 static SPIBoolean report_mouse_event  (const AccessibleDeviceEvent *event, void *user_data);
 
 static AccessibleEventListener *generic_listener;
 static AccessibleEventListener *specific_listener;
 static AccessibleEventListener *test_listener;
+static AccessibleEventListener *text_listener;
 static AccessibleDeviceListener *mouse_device_listener;
 static gint n_elements_traversed = 0;
 static GTimer *timer;
@@ -80,12 +82,16 @@
       }
   }
 
+  fprintf (stderr, "RUNNING\n");
+
   SPI_init ();
 
   generic_listener = SPI_createAccessibleEventListener (
 	  report_event, NULL); 
   specific_listener = SPI_createAccessibleEventListener (
 	  report_detail_event, NULL); 
+  text_listener = SPI_createAccessibleEventListener (
+	  report_text_event, NULL);
   test_listener = SPI_createAccessibleEventListener (
 	  timing_test_event, NULL);
   mouse_device_listener = SPI_createAccessibleDeviceListener (
@@ -129,7 +135,7 @@
 
   SPI_registerGlobalEventListener (generic_listener,
 				   "object:text-caret-moved"); 
-  SPI_registerGlobalEventListener (generic_listener,
+  SPI_registerGlobalEventListener (text_listener,
 				   "object:text-changed"); 
   SPI_registerGlobalEventListener (generic_listener,
 				   "object:column-inserted"); 
@@ -260,6 +266,17 @@
   fprintf (stderr, "(detail) %s %s %d %d\n", event->type, s,
 	   event->detail1, event->detail2);
   if (s) SPI_freeString (s);
+}
+
+void
+report_text_event (const AccessibleEvent *event, void *user_data)
+{
+  char *s = Accessible_getName (event->source);
+  fprintf (stderr, "(detail) %s %s %d %d\n", event->type, s,
+	   event->detail1, event->detail2);
+  if (s) SPI_freeString (s);
+  s = AccessibleEvent_getContextString (event);
+  fprintf (stderr, "context string %s\n", (s) ? s : "<nil>");
 }
 
 SPIBoolean


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]