Re: [g-a-devel]active-descendant-changed signal and at-spi



On Thu, 2002-12-05 at 11:14, Padraig O'Briain wrote:
> I have started trying to add support for active-descendant-changed in the bridge 
> and I have hit a problem.
> 
> The any_data field in Accessibility_Event is a CORBA_any and the function 
> spi_init_any_object() returns a CORBA_any for a CORBA_object. I have an 
> AtkObject. I can create an SpiAccessible from it but how do I get a 
> CORBA_object?

Padraig:

spi_init_any_object returns null; but of course it does 'return' a
CORBA_Any in an 'inout' param, so to speak.  Since an SpiAccessible is
an instance of BonoboObject, you can use BONOBO_OBJREF () for this.
Of course the usual concerns about duplicating refs before marshalling
them via CORBA apply.

I should have you look at my current patch for cspi's (now private)
method cspi_internal_event_get_object () to make sure everything adds up
in this context.  At the moment it uses a 
borrow-ref-return sequence to ensure that the "Accessible *" (pointer to
a corba object reference) which it returns is either live or a NULL
pointer (if the object in question is dead by the time it's
demarshalled).  However this patch requires that cspi_dup_ref passes the
cspi_ev() environment variable to the bonobo_object_dup_ref() call
rather than the current NULL pointer, so I wanted to get Michael's
opinion before going further with this patch.

regards,

Bill

(patch attached)




> Padraig
> 
> > > The only interesting thing in the active-descendant-changed signal is the 
> object 
> > > which is the new active descendant.
> > > 
> > > Do I need to call BONOBO_OBJECT_REF (spi_accessible_new()) on it and stick 
> it 
> > > into the any_data field?
> > 
> > If you did, you of course would need to unref it again after the event
> > emission since at the moment listeners are not guaranteed to do the
> > unref (and it would be more traffic over the wire anyway).  
> > 
> > You will note that at the moment the code to do this lives in
> > spi_atk_signal_emit_event (and, in turn, in spi_init_any_object () which
> > it calls); there's some commented-out stuff for the child-changed
> > signal, and presumably we'd need to add code to handle the
> > active-descendant-changed signal as well.  As Michael has pointed out
> > recently, the existing code is not the correct way of doing this (see
> > below), which is the main reason the implementation is commented out
> > until somebody has time to do this thoughtfully and properly.
> > 
> > For the cases where the Any contains an object reference I think we
> > should not take ownership of the reference or increment it; this has the
> > disadvantage that the listener must make sure the object is still alive
> > before using the reference, but the advantage of preventing leaks and
> > extra CORBA traffic if the listening client doesn't choose to use the
> > reference.
> > 
> > In the meantime if you just add the signal listener, we can handle the
> > any_data initialization in the emission handler (above), just as we
> > intend to for child-changed events once we get spi_init_any_object()
> > fixed.
> > 
> > -Bill
> > 
> > > Padraig
> > > 
> > > > Subject: Re: [g-a-devel]active-descendant-changed signal and at-spi
> > > > To: "Padraig O'Briain" <Padraig Obriain Sun COM>
> > > > Cc: accessibility mailing list <gnome-accessibility-devel gnome org>
> > > > Mime-Version: 1.0
> > > > Content-Transfer-Encoding: 7bit
> > > > 
> > > > Hi Padraig,
> > > > 
> > > > On Wed, 2002-11-27 at 11:48, Padraig O'Briain wrote:
> > > > > I am trying to figure out what needs to change in at-spi to support 
> > > > > active-descendant-changed signal.
> > > > > 
> > > > > It looks like a signal handler for it needs to be added to the bridge.
> > > > 
> > > > 	Quite.
> > > > 
> > > > > What should happen when the signal is emitted?
> > > > 
> > > > 	You get to make up some string name for it; ram whatever detail you
> > > > think is useful into the event structure; and do an emitv of some sort
> > > > in the handler.
> > > > 
> > > > 	HTH,
> > > > 
> > > > 		Michael.
> > > > 
> > > > -- 
> > > >  mmeeks gnu org  <><, Pseudo Engineer, itinerant idiot
> > > > 
> > > 
> > > _______________________________________________
> > > Gnome-accessibility-devel mailing list
> > > Gnome-accessibility-devel gnome org
> > > http://mail.gnome.org/mailman/listinfo/gnome-accessibility-devel
> > 
> > 
> > _______________________________________________
> > Gnome-accessibility-devel mailing list
> > Gnome-accessibility-devel gnome org
> > http://mail.gnome.org/mailman/listinfo/gnome-accessibility-devel
> 

Index: cspi/spi_event.c
===================================================================
RCS file: /cvs/gnome/at-spi/cspi/spi_event.c,v
retrieving revision 1.25
diff -u -r1.25 spi_event.c
--- cspi/spi_event.c	22 Nov 2002 14:54:59 -0000	1.25
+++ cspi/spi_event.c	5 Dec 2002 12:39:19 -0000
@@ -352,11 +352,19 @@
 cspi_internal_event_get_object (const InternalEvent *e)
 {
   CORBA_any *any;
+  Accessible *accessible;
   g_return_val_if_fail (e, NULL);
   g_return_val_if_fail (e->data, NULL);
   any = (CORBA_any *) e->data;
   if (any->_type == TC_CORBA_Object) 
-    return cspi_object_add (* (CORBA_Object *) any->_value);
+    {
+      accessible = cspi_object_borrow (* (CORBA_Object *) any->_value);
+      cspi_object_ref (accessible->objref);
+      cspi_object_return (accessible->objref);
+      if (cspi_exception ()) 
+	accessible = NULL;
+      return accessible;
+    }
   else 
     return NULL;
 }
Index: cspi/bonobo/cspi-bonobo.c
===================================================================
RCS file: /cvs/gnome/at-spi/cspi/bonobo/cspi-bonobo.c,v
retrieving revision 1.7
diff -u -r1.7 cspi-bonobo.c
--- cspi/bonobo/cspi-bonobo.c	13 Sep 2002 13:08:59 -0000	1.7
+++ cspi/bonobo/cspi-bonobo.c	5 Dec 2002 12:39:20 -0000
@@ -29,7 +29,7 @@
 CORBA_Object
 cspi_dup_ref (CORBA_Object object)
 {
-  return bonobo_object_dup_ref (object, NULL);
+  return bonobo_object_dup_ref (object, cspi_ev ());
 }
 
 void


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