GNOME Bugzilla – Bug 488694
[a11y] Several calculator buttons don't speak correctly with Orca.
Last modified: 2007-10-23 14:55:41 UTC
This is with the new version of gcalctool in SVN trunk that using Glade. Several of the buttons (like, change sign, division, multiplication and subtraction) do not speak their "name" correctly. This appears to also be a problem with the calculator in the gnome-2-20 branch. They need to have good accessible names, not unicode characters.
In the "old" gtk.c code, there used to be a routine called set_accessible_name() (called from make_but_panel) that set the accessible name for each button. It's unclear what the "new" equivalent of this is. A quick test of trying to set the accessible names of the multiplication button to "Multiply" in the Glade file didn't work.
Rich, I hoped you'd be able to help with this one. There were two a11y things I wasn't sure about when converting: - is gtk_widget_set_name() used in a11y? - I set all the accessibility strings to be the same as it was as far as I can tell (see the <accessibility> tags in the .glade) but I don't know how to test them.
I can certainly help with this one. We should need any special code in gtk.c anymore for this; we should be able to adjust lines in the Glade file (the Name: lines of the widgets under the wheelchair icon in Glade). I tried this over the weekend, and it didn't seem to work. I need to dig deeper. Testing would be done by running Orca and seeing what it speaks/brailles. Again, I can help with that.
To answer your question in the code: gtk_widget_set_name(X->display_item, "displayitem"); // FIXME: Is this necessary? Yes it is. The Orca script for gcalctool specifically looks for that name in order to be able to speak the result of a calculation when the user presses Return. -- In the gnome-2-20 gcalctool, there used to be a button structure that looked like: struct button { char *str; /* Button display string. */ char *hstr; /* Button help string. */ char *astr; /* AccessibleName string (if tooltip not useful) */ guint mods[MAXEXTRAS]; /* Keyboard modifiers (Shift, Ctrl, ...). */ guint value[MAXEXTRAS]; /* Button keyboard equivalents. */ char func_char; /* Unique function string character. */ enum menu_type mtype; /* Type of popup menu (if any). */ void (*func)(); /* Function to obey on button press. */ char *symname; /* Expression function name */ enum button_flags flags; /* Misc flags */ }; It now looks like: struct button { char *symname; /* Expression function name */ guint mods[MAXEXTRAS]; /* Keyboard modifiers (Shift, Ctrl, ...). */ guint value[MAXEXTRAS]; /* Button keyboard equivalents. */ char func_char; /* Unique function string character. */ void (*func)(); /* Function to obey on button press. */ enum button_flags flags; /* Misc flags */ }; In gtk.c for gnome-2-20 gcalctool, setting the accessible name was done with: static void set_accessible_name(GtkWidget *widget, struct button button) { AtkObject *access_object = gtk_widget_get_accessible(widget); atk_object_set_name(access_object, (button.astr == NULL) ? button.hstr : button.astr); } The closest commented out code I can find in the current gcalctool gtk.c is: //AtkObject *access_object = gtk_widget_get_accessible(widget); //atk_object_set_name(access_object, //(button.astr == NULL) ? button.hstr : button.astr); We will need to go through the gcalctool gnome-2-20 calctool.c buttons entries, and for each one where the astr value wasn't NULL, we will need to set that as the accessible name in the Glade file for that button. The next comment will work out what those names were.
Well I take it back. It's pretty much every one of them. I'll work out a Glade patch and attach it. Probably will take a couple of hours.
Created attachment 97676 [details] [review] Fix for the problem. Seems to work nicely. Patch committed to SVN trunk. Closing as FIXED.
I see what I did here... I set the accessible_description not the accessible_name. The accessible_descriptions should match exactly what the atk_object_set_name() call did (even though the ones using the hstr didn't seem appropriate with the shortcut key in them). We should probably remove all the accessible_description fields now.
> We should probably remove all the > accessible_description fields now. Okay. That seems reasonable. I'll look at that tomorrow (unless you beat me to it ;-) ).
Created attachment 97734 [details] [review] Remove the accessible descriptions. Also adjusted the "shift left" and "shift right" entries (they were reversed). Patch committed.