After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 654630 - accessibility needs updating to work with gtk 3.1 refactor
accessibility needs updating to work with gtk 3.1 refactor
Status: RESOLVED FIXED
Product: vte
Classification: Core
Component: general
unspecified
Other Linux
: Normal normal
: ---
Assigned To: VTE Maintainers
VTE Maintainers
Depends on:
Blocks:
 
 
Reported: 2011-07-14 16:44 UTC by Mike Gorse
Modified: 2014-04-22 17:20 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Proposed patch. (20.09 KB, patch)
2011-07-20 15:40 UTC, Mike Gorse
needs-work Details | Review
Updated patch. (22.67 KB, patch)
2011-08-16 21:18 UTC, Mike Gorse
committed Details | Review

Description Mike Gorse 2011-07-14 16:44:44 UTC
Accessibility has been refactored somewhat in the latest gtk--the accessibility classes are now inside gtk rather than being in a separate gtk module, and linking atk types to gtk types now works differently, so that the code to fetch the GtkWidget accessible type no longer works.

I talked with Benjamin Otte on IRC, since the gtk a11y headers are not currently installed.  He said that ideally they would be exported but that they won't be in the short term because they need more clean-up before he is happy with them.  So for now we might want to derive directly from GTK_TYPE_ACCESSIBLE (which would require replicating some of the GailWidget/GtkWidgetAccessible code).
Comment 1 Matthias Clasen 2011-07-15 11:15:17 UTC
I've added some documentation here:

http://git.gnome.org/browse/gtk+/commit/?id=3cc22eed44b519c23fba2e2d32314c56d17c1b7b
Comment 2 Mike Gorse 2011-07-18 15:37:08 UTC
(In reply to comment #1)
> I've added some documentation here:
> 
> http://git.gnome.org/browse/gtk+/commit/?id=3cc22eed44b519c23fba2e2d32314c56d17c1b7b

Is there a reason not to allow third-party widgets to derive from the GtkWidgetAccessible and related classes, other than that the headers should be cleaned up and so aren't currently public?  I'm working on a patch for vte to derive the terminal accessible directly from GtkAccessible, in the interest of ensuring that it doesn't break for 3.2, so I need to paste a significant amount of code from gtkwidgetaccessible.c to compute the stateset, notify when it gains focus, handle the widget being destroyed, etc.  (VteTerminalAccessible already implements most of AtkComponent, so grab_focus is the only vfunc I have to copy for it.)  It isn't ideal in the long term if ATK implementations for custom widgets will need to do this; for one thing, if the behavior of GtkWidgetAccessible changes, then atk implementations of third-party widgets deriving from it may need to be maintained in parallel, and the general behavior is different from that of gtk widgets, where creating a custom widget will have the new widget inherit all of the behavior of the parent widget except where it is changed.
Comment 3 Mike Gorse 2011-07-20 15:40:57 UTC
Created attachment 192313 [details] [review]
Proposed patch.

Tested with gtk+ master and 2.22.1 (are we still supporting GTK 2?)

I've noted in comments where vfuncs are copied/adapted from gtk+.
Comment 4 Luke Yelavich 2011-08-12 01:55:55 UTC
I thought I'd commented on this bug already, but obviously didn't. This patch is working for me, patch applies cleanly against vte 0.28.1 in Ubuntu oneiric, and haven't experienced any regressions with a11y and vte.

I'd like to apply this patch against Ubuntu's vte package, however official upstream endorcement would make it easier for this patch to be used without question.
Comment 5 Christian Persch 2011-08-16 17:41:33 UTC
Review of attachment 192313 [details] [review]:

::: src/vte.c
@@ +11450,3 @@
 
+static gboolean
+gtk_includes_a11y_refactor (void)

I don't like this. We can just drop gtk2 support (just do it in configure for now; it's already completely gone on vte-next) and depend on gtk 3.1.x.

::: src/vteaccess.c
@@ +806,3 @@
+	gboolean value;
+
+	if (g_strcmp0 (pspec->name, "has-focus") == 0)

pspect->name is never NULL, so just strcmp().

@@ +862,3 @@
 	ATK_OBJECT_CLASS (vte_terminal_accessible_parent_class)->initialize (obj, data);
 
+#if GTK_CHECK_VERSION (2, 22, 0)

Just drop gtk2.

@@ +932,3 @@
+	g_signal_connect_after (terminal, "focus-in-event", G_CALLBACK (focus_cb), NULL);
+	g_signal_connect_after (terminal, "focus-out-event", G_CALLBACK (focus_cb), NULL);
+  g_signal_connect (terminal, "notify", G_CALLBACK (notify_cb), NULL);

Wrong indentation.

@@ +2200,3 @@
+		gtk_widget_get_allocation (viewport, &viewport_allocation);
+
+#if GTK_CHECK_VERSION (3, 0, 0)

Same.
Comment 6 Mike Gorse 2011-08-16 20:20:24 UTC
(In reply to comment #5)

Thanks for the review.

> @@ +932,3 @@
> +    g_signal_connect_after (terminal, "focus-in-event", G_CALLBACK (focus_cb),
> NULL);
> +    g_signal_connect_after (terminal, "focus-out-event", G_CALLBACK
> (focus_cb), NULL);
> +  g_signal_connect (terminal, "notify", G_CALLBACK (notify_cb), NULL);
> 
> Wrong indentation.

It doesn't look as though any one style is used consistently throughout the code, so you'll need to tell me what would be "right."
Comment 7 Christian Persch 2011-08-16 20:29:17 UTC
The lines just before that are indented 8 spaces or 1 tab, while the new line is 2 spaces. Just go with 8 spaces.
Comment 8 Mike Gorse 2011-08-16 21:18:07 UTC
Created attachment 193993 [details] [review]
Updated patch.

Fixes some indentation, and removes some gtk version checks.
Also remove GTK 2 support from configure.in and the Makefile (so we now have
an unused python directory in the repository, although I haven't removed it).
Comment 9 Christian Persch 2011-08-16 21:21:36 UTC
Hmm. I just thought you'd do

-     2.0|3.0) ;;
+     3.0) ;;

in configure and leave all the other stuff in there... but this is ok as well.

Please commit to the vte-0-28 branch ONLY (and keep this bug open, since this will need to be adapted to vte-next).
Comment 10 Christian Persch 2011-08-16 21:52:30 UTC
Actually, commit to the vte-0-30 branch which I'll now cut.
Comment 11 Mike Gorse 2011-08-17 16:37:09 UTC
(In reply to comment #9)
> Hmm. I just thought you'd do
> 
> -     2.0|3.0) ;;
> +     3.0) ;;
> 
> in configure and leave all the other stuff in there... but this is ok as well.

I'd assumed you'd wanted it gone, and I've surely broken GTK 2 support with that commit, but, anyway, I've committed the patch into vte-0-30 (but not to master).
Comment 12 Christian Persch 2014-04-22 17:20:07 UTC
That's on master now too.