On 14/12/17 17:57, Eric Williams wrote: > Hello, Hello,
> > I posted this on the GTK list but didn't have much success. > > I have a use case where I want to define a custom accessible type to > be used with native GTK widgets (not a custom widget). The end goal is > to be able to attach my ATK interface implementations to a native GTK > widget. > > For example: I have a GtkButton. I want to define the accessible type > for this button to be MY_ACCESSIBLE_TYPE. I see in the source code > that the accessible type for GtkButton is GTK_TYPE_BUTTON_ACCESSIBLE, > which is a subtype of GTK_TYPE_CONTAINER_ACCESSIBLE. The issue is that Gtk consider the accessible type as a class property. So for a given class, you would always receive an accessible of the same type. If you take a look to gtkwidget.c, you could see that the accessible_type is part of the GtkWidgetClassPrivate. > > I have played around with gtk_widget_class_set_accessible_type() but > haven't had much luck. The problem is that this method is called when the specific widget class is initialized. As far as I know that is done just once, so you can't set one class type and then change that. > Is there a way I can accomplish this without creating a custom widget > that sub-classes GTK_TYPE_BUTTON_ACCESSIBLE (as an example)? Don't know, but some years passed since the last time I did something on gtk accessiblity. > And if so, is there any source code I can look at to see an example? Well, don't know if really useful, but some years ago I needed to solve a similar problem on gnome-shell. As most of the UI is implemented on Javascript, I found a situation where the St (widget toolkit on gnome-shell) object functionality was re-implemented on javascript, so I needed to implement the accessible object functionality on javascript too. What I did on that case was adding a st_widget_set_accessible. This overrides the default accessible object of a given widget with the one you provide. More info here: * https://bugzilla.gnome.org/show_bug.cgi?id=648623 * https://git.gnome.org/browse/gnome-shell/commit/?id=bd28d5c48af87e34c99cf20cc18c409cca1a1080 In any case, not sure if GTK developers would be open to implement this on Gtk. Because fwiw, your issue is not related with ATK itself, but about Gtk implementation of it. BR _______________________________________________ gnome-accessibility-list mailing list gnome-accessibility-list@gnome.org https://mail.gnome.org/mailman/listinfo/gnome-accessibility-list