Re: [g-a-devel]Atk text interface for Stock Ticker applet



Bill Haneman wrote:
...

(sorry to reply to my own email, but to add to what I said
eariler and answer your question, here goes)

> > I am confused for which widget I have to implement
> > AtkText interface.

The AtkObject which should implement AtkText is, as I 
understand it, the AtkObject corresponding to
the drawing area.  Since I don't think the 
GtkFrame in the gle output does much, I would suggest that
this AtkObject be a child of the same container that
encloses the two GtkButtons.

It appears to me that the Stock Ticker Applet
may not be using custom widgets 'per se' but instead
constructing its UI from standard components.  In this
case you either must change one of more of those
components (as appropriate) to be 'custom' widget
subclasses, so that you can override get_accessible
(or create a factory), or you need a different approach 
to associating an AtkObject with the widget.

Rather than overriding virtual methods, there is another
approach that would work, though it's not documented 
and depends on the implementation details of 
get_accessible.  I am a little unsure therefore of
its suitability, but it's easy enough:

immediately after creating the widget whose AtkObject
you wish to specify, you must:

call g_object_get_qdata with the appropriate
quark value (see gtkwidget.c's implementation of
gtk_widget_get_accessible) to see if an AtkObject is 
already associated with the widget.  If so, you probably 
want to free/unref that object, and then create a 
new AtkObject which meets your needs (i.e. an appropriate
custom subtype of AtkObject) and call g_object_set_qdata
to associate it with the widget.  Subsequent calls to
gtk_widget_get_accessible will return the AtkObject instance
you have specified, rather than an AtkObject from the
normal factory.

Of course this means that an AtkObject for the widget
in question will be created whether accessibility is
used or not, but for individual widgets like this it's
probably not a significant performance/memory consideration,
and any calls to atk_object_set_name, etc. would have
instantiated a similar AtkObject anyhow.

Hope that helps...

-Bill

> > The problem if I implement AtkText for a subclass of
> > GtkDrawingArea is that ferret traverses the object
> > hierarchy only till PanelApplet. Is there any reason why
> > the _button_watcher routine in ferret does not get called
> > for all the objects in the hierarchy?
> 
> Ferret is not the "last word" in tools, it could use
> substantial improvements.
> 
> If you use "follow mouse" then you are listening to
> two kinds of events, GtkWidget:button-press-event, and
> GtkWidget:enter_notify_event.  You won't get an enter_notify_event
> for something that isn't a GtkWidget.  As for the button
> press event, if you look at the code you see that the source of the
> event must be a GtkWidget's AtkObject, not another
> child AtkObject.  From there the code checks to see if the
> 'source' AtkObject is a container, in which case it calls
> atk_object_ref_accessible_at_point.
> 
> So for this to work, the containing AtkObject must override
> get_n_children, ref_child, ref_child_at_point, etc.  Once
> that is done, the atk_object_ref_accessible_at_point call
> in the button_watcher code should return the appropriate
> AtkObject for the GtkDrawingArea.
> 
> Regards,
> 
> Bill
>



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