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 474575 - Accelerator information missing on sliders and combo boxes
Accelerator information missing on sliders and combo boxes
Status: RESOLVED FIXED
Product: atk
Classification: Platform
Component: gail
unspecified
Other Linux
: Urgent normal
: ---
Assigned To: LiYan.Zhang
Li Yuan
Depends on:
Blocks: 468098
 
 
Reported: 2007-09-07 14:55 UTC by Willie Walker
Modified: 2007-10-12 14:30 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Add the function of get keybinding to combo box (4.96 KB, text/plain)
2007-09-26 09:42 UTC, LiYan.Zhang
  Details
To make a modificaiton on the patch above (4.53 KB, patch)
2007-09-27 07:46 UTC, LiYan.Zhang
none Details | Review
Add the function of get keybinding to sliders (8.18 KB, patch)
2007-10-09 03:10 UTC, LiYan.Zhang
none Details | Review
Add the function of get keybinding to sliders_new (8.18 KB, patch)
2007-10-09 06:29 UTC, LiYan.Zhang
committed Details | Review
Add the function of get keybinding to combo box_new (4.20 KB, patch)
2007-10-12 06:17 UTC, LiYan.Zhang
committed Details | Review

Description Willie Walker 2007-09-07 14:55:16 UTC
Combo boxes and sliders don't seem to offer their keybindings (e.g., their mnemonics).  It would be ideal if they were consistent with the rest of the
toolkit.  It seems like it should be easy to fix: gailbutton.c and
gailentry.c seem to have example code that could be used.
Comment 1 Li Yuan 2007-09-10 07:27:42 UTC
Hi Will,

sliders means gtkoptionmenu?
Comment 2 Willie Walker 2007-09-10 13:39:00 UTC
Hi Li:

There are things exposed to Orca with a role of slider.  When I grep the gail sources for slider, I see the following:

wwalker@server:~/gail/trunk/gail$ grep -i slider *.c
gailrange.c:  obj->role = ATK_ROLE_SLIDER;

So, I'm guessing that the range widget is what is exposing itself as a slider.  Hope this helps!
Comment 3 Li Yuan 2007-09-11 08:09:39 UTC
Oh, it's gtkrange. Do we have a use case for this? How do we set mnemonics keys on gtkrange?
Comment 4 Willie Walker 2007-09-11 11:45:54 UTC
(In reply to comment #3)
> Oh, it's gtkrange. Do we have a use case for this? How do we set mnemonics keys
> on gtkrange?

The Orca preferences GUI provides a bunch of labelled sliders on the speech preferences page.  They are set up in the orca-setup.glade file.  Here's a typical example (which uses GtkHScale, which seems to be handled by gailscale.c, which has code to treat it like a range):

			  <child>
			    <widget class="GtkLabel" id="pitchLabel">
			      <property name="visible">True</property>
			      <property name="label" translatable="yes">Pi_tch:</property>
			      <property name="use_underline">True</property>
			      <property name="use_markup">False</property>
			      <property name="justify">GTK_JUSTIFY_RIGHT</property>
			      <property name="wrap">False</property>
			      <property name="selectable">False</property>
			      <property name="xalign">1</property>
			      <property name="yalign">0.5</property>
			      <property name="xpad">3</property>
			      <property name="ypad">0</property>
			      <property name="mnemonic_widget">pitchScale</property>
			      <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
			      <property name="width_chars">-1</property>
			      <property name="single_line_mode">False</property>
			      <property name="angle">0</property>
			      <accessibility>
				<atkrelation target="pitchScale" type="label-for"/>
			      </accessibility>
			    </widget>
			    <packing>
			      <property name="left_attach">0</property>
			      <property name="right_attach">1</property>
			      <property name="top_attach">5</property>
			      <property name="bottom_attach">6</property>
			      <property name="x_options">fill</property>
			      <property name="y_options"></property>
			    </packing>
			  </child>

			  <child>
			    <widget class="GtkHScale" id="pitchScale">
			      <property name="visible">True</property>
			      <property name="can_focus">True</property>
			      <property name="draw_value">True</property>
			      <property name="value_pos">GTK_POS_RIGHT</property>
			      <property name="digits">1</property>
			      <property name="update_policy">GTK_UPDATE_CONTINUOUS</property>
			      <property name="inverted">False</property>
			      <property name="adjustment">5 0 9 0.10000000149 0 0</property>
			      <accessibility>
				<atkrelation target="pitchLabel" type="labelled-by"/>
			      </accessibility>
			      <signal name="value_changed" handler="pitchValueChanged" last_modification_time="Wed, 26 Apr 2006 18:48:18 GMT"/>
			      <accelerator key="t" modifiers="GDK_MOD1_MASK" signal="grab_focus"/>
			    </widget>
			    <packing>
			      <property name="left_attach">1</property>
			      <property name="right_attach">2</property>
			      <property name="top_attach">5</property>
			      <property name="bottom_attach">6</property>
			      <property name="x_options">fill</property>
			      <property name="y_options">fill</property>
			    </packing>
			  </child>
Comment 5 LiYan.Zhang 2007-09-26 09:42:38 UTC
Created attachment 96223 [details]
Add the function of get keybinding to combo box

The function of gail_combo_box_get_keybinding has been added to combo box.
Comment 6 Li Yuan 2007-09-27 07:12:19 UTC
Patch needs more work.


Hi Will, how does Orca get the keybindings information? Through get_keybinding in action interface, right?
Comment 7 LiYan.Zhang 2007-09-27 07:35:35 UTC
Comment on attachment 96223 [details]
Add the function of get keybinding to combo box

Index: ChangeLog
===================================================================
--- ChangeLog   (版本 1284)
+++ ChangeLog   (工作副本)
@@ -1,3 +1,8 @@
+2007-09-26  Liyan Zhang  <Li-Yan.Zhang@sun.com>
+
+       * gail/gailcombobox.c: (gail_combo_box_get_keybinding):
+       Bug #474575. Add the function of get keybinding to combo box.
+
 2007-08-07  Sunil Mohan Adapa  <sunil@atc.tcs.com>
 
        * configure.in: Added Telugu (te) to ALL_LINGUAS.
Index: gail/gailcombobox.c
===================================================================
--- gail/gailcombobox.c (版本 1284)
+++ gail/gailcombobox.c (工作副本)
@@ -18,6 +18,7 @@
  */
 
 #include <gtk/gtk.h>
+#include <gdk/gdkkeysyms.h>
 #include "gailcombobox.h"
 
 #if GTK_MINOR_VERSION > 4
@@ -46,6 +47,8 @@
 ;
 static G_CONST_RETURN gchar* gail_combo_box_get_description(AtkAction      *action,
                                                             gint           i);
+static G_CONST_RETURN gchar* gail_combo_box_get_keybinding   (AtkAction       *action,
+                                                            gint            i);
 static G_CONST_RETURN gchar* gail_combo_box_action_get_name(AtkAction      *action,
                                                             gint           i);
 static gboolean              gail_combo_box_set_description(AtkAction      *action,
@@ -137,6 +140,7 @@
 gail_combo_box_object_init (GailComboBox      *combo_box)
 {
   combo_box->press_description = NULL;
+  combo_box->press_keybinding = NULL;
   combo_box->old_selection = -1;
   combo_box->name = NULL;
   combo_box->popup_set = FALSE;
@@ -347,6 +351,7 @@
   iface->do_action = gail_combo_box_do_action;
   iface->get_n_actions = gail_combo_box_get_n_actions;
   iface->get_description = gail_combo_box_get_description;
+  iface->get_keybinding = gail_combo_box_get_keybinding;
   iface->get_name = gail_combo_box_action_get_name;
   iface->set_description = gail_combo_box_set_description;
 }
@@ -441,6 +446,60 @@
 }
 
 static G_CONST_RETURN gchar*
+gail_combo_box_get_keybinding (AtkAction *action,
+                                   gint      i)
+{
+  GailComboBox *combo_box;
+  gchar *return_value = NULL;
+  combo_box = GAIL_COMBO_BOX (action);
+  switch (i)
+  {
+     case 0:
+      {
+         GtkWidget *widget;                                                        
+         GtkWidget *label;
+         AtkRelationSet *set;
+         AtkRelation *relation;                                                             
+         GPtrArray *target;
+         gpointer target_object;
+         guint key_val;
+
+         combo_box = GAIL_COMBO_BOX (action);
+         widget = GTK_ACCESSIBLE (combo_box)->widget;
+         if (widget == NULL)
+             return NULL;
+         set = atk_object_ref_relation_set (ATK_OBJECT (action));
+         if (!set)
+             return NULL;
+         label = NULL;
+         relation = atk_relation_set_get_relation_by_type (set, ATK_RELATION_LABELLED_BY);
+         if (relation)
+         {
+            target = atk_relation_get_target (relation);
+            target_object = g_ptr_array_index (target, 0);
+            if (GTK_IS_ACCESSIBLE (target_object))
+            {
+               label = GTK_ACCESSIBLE (target_object)->widget;
+            }
+         }  
+         g_object_unref (set);
+         if (GTK_IS_LABEL (label))
+         {
+             key_val = gtk_label_get_mnemonic_keyval (GTK_LABEL (label));
+            if (key_val != GDK_VoidSymbol)
+             return_value = gtk_accelerator_name (key_val, GDK_MOD1_MASK);
+         }
+          g_free (combo_box->press_keybinding);
+          combo_box->press_keybinding = return_value;
+          break;                                                                                   
+         }                             
+    default:
+          break;
+  }
+  return return_value;
+}
+
+
+static G_CONST_RETURN gchar*
 gail_combo_box_action_get_name (AtkAction *action,
                                 gint      i)
 {
@@ -616,6 +675,7 @@
   GailComboBox *combo_box = GAIL_COMBO_BOX (object);
 
   g_free (combo_box->press_description);
+  g_free (combo_box->press_keybinding);
   g_free (combo_box->name);
   if (combo_box->action_idle_handler)
     {
Index: gail/gailcombobox.h
===================================================================
--- gail/gailcombobox.h (版本 1284)
+++ gail/gailcombobox.h (工作副本)
@@ -42,6 +42,7 @@
 {
   GailContainer parent;
 
+  gchar         *press_keybinding;
   gchar         *press_description;
   guint         action_idle_handler;
Comment 8 LiYan.Zhang 2007-09-27 07:46:37 UTC
Created attachment 96276 [details] [review]
To make a modificaiton on  the patch above

I am sorry that I have made a mistake when attaching the patch, so the modified patch has been attached again.
Comment 9 Willie Walker 2007-09-27 11:12:13 UTC
Hi Li:

To do this, Orca uses the getKeyBinding method of the Accessibility.Action specialization of an Accessible.  Hope this helps!

Will

Comment 10 Li Yuan 2007-09-27 11:17:46 UTC
Yes, thanks!

Liyan, please create action interface for Gailrange and implement get_keybindings function.
Comment 11 LiYan.Zhang 2007-10-09 03:10:35 UTC
Created attachment 96914 [details] [review]
Add the function of get keybinding to sliders

The Action Interface has been created for Gailrange and the function of get keybinding was implemented as well.
Comment 12 LiYan.Zhang 2007-10-09 06:29:31 UTC
Created attachment 96918 [details] [review]
Add the function of get keybinding to sliders_new
Comment 13 Joanmarie Diggs (IRC: joanie) 2007-10-11 15:19:46 UTC
I just tried the sliders patch and it works great.  Thanks!

When I try to apply the patch in comment #8, I get the following error:

patching file gail/gailcombobox.c
patch: **** malformed patch at line 112:  {
Comment 14 LiYan.Zhang 2007-10-12 06:17:49 UTC
Created attachment 97103 [details] [review]
Add the function of get keybinding to combo box_new
Comment 15 LiYan.Zhang 2007-10-12 07:09:13 UTC
Thank you for reminding me.

yes, there are some mistakes in the last patch in comment #8, and I have attached a new one.
This time I have tested it through gtk-demo with loading testaction.c, and it seems to work.

 If you have some suggestion, please inform me. Thank you very much! 
Comment 16 Willie Walker 2007-10-12 12:35:31 UTC
When I test the patch, the good news is that we get the accelerators (yeah!).  The bad news is that I see the following errors issued by the application that owns the components :-(.  I'll dig a little more, but I think this may require more expert help than I can provide:

/usr/lib/python2.4/vendor-packages/gtk-2.0/gtk/__init__.py:69: Warning: specified instance size for type `GailScale' is smaller than the parent type's `GailRange' instance size
  _gtk.init_check()
/usr/lib/python2.4/vendor-packages/gtk-2.0/gtk/__init__.py:69: Warning: file gtype.c: line 2308: assertion `G_TYPE_IS_INSTANTIATABLE (instance_type)' failed
  _gtk.init_check()
/usr/lib/python2.4/vendor-packages/gtk-2.0/gtk/__init__.py:69: Warning: file gtype.c: line 2244: assertion `type_name != NULL' failed
  _gtk.init_check()
/usr/lib/python2.4/vendor-packages/gtk-2.0/gtk/__init__.py:69: Warning: specified instance size for type `GailScrollbar' is smaller than the parent type's `GailRange' instance size
  _gtk.init_check()
Comment 17 Li Yuan 2007-10-12 12:56:46 UTC
I started Orca and go through the preference window (including the GtkHScale), but didn't find any warning. Do you have a script to reproduce this?
Comment 18 Willie Walker 2007-10-12 13:22:56 UTC
(In reply to comment #17)
> I started Orca and go through the preference window (including the GtkHScale),
> but didn't find any warning. Do you have a script to reproduce this?

It seems to happen with any application I start.  I'm not sure if I need to build something else (I only rebuilt/installed gail).  Should I be rebuilding/installing another component of the infrastructure?

bash-3.00$ gedit   

(gedit:1700): GLib-GObject-WARNING **: specified instance size for type `GailScale' is smaller than the parent type's `GailRange' instance size

(gedit:1700): GLib-GObject-CRITICAL **: file gtype.c: line 2308: assertion `G_TYPE_IS_INSTANTIATABLE (instance_type)' failed

(gedit:1700): GLib-GObject-CRITICAL **: file gtype.c: line 2244: assertion `type_name != NULL' failed

(gedit:1700): GLib-GObject-WARNING **: specified instance size for type `GailScrollbar' is smaller than the parent type's `GailRange' instance size

(gedit:1700): GLib-GObject-CRITICAL **: file gtype.c: line 2244: assertion `type_name != NULL' failed
Comment 19 Li Yuan 2007-10-12 13:39:42 UTC
OK, I got it on Solaris. I just found that after applied the patch and execute "make", on Solaris, only  gailrange.o is re-generated, gailscale.o and gailscrollbar.o is untouched. But on my Ubuntu box, all the three .o files are re-generated. That's why I didn't get the warnings on Linux. Seems Make on Linux found gailscale.h and gailscrollbar.h include gailrange.h and re-build gailscale and gailscrollbar automatically.  Is this a bug for Solaris' Make? 

Just make clean and make again should fix the warnings.
Comment 20 Joanmarie Diggs (IRC: joanie) 2007-10-12 13:57:12 UTC
(In reply to comment #15)
>  If you have some suggestion, please inform me. Thank you very much! 

No suggestions.  The new version seems to work quite nicely for me (tested on Ubuntu Gutsy). And thank YOU very much!  These sorts of fixes to gail make a huge difference to Orca's ability to provide compelling access.
Comment 21 Willie Walker 2007-10-12 14:13:00 UTC
> Just make clean and make again should fix the warnings.

Works wonderfully now.  Thanks for catching that.  Stupid me for not doing a make clean first.  My apologies. :-(

If you can get this in for GNOME 2.20.1, it would be awesome.  Thanks for your hard work here.
Comment 22 Li Yuan 2007-10-12 14:17:48 UTC
It's LiYuan's work :)

I will get the patch into GNOME 2.20.1.

Thanks for helping us to test the patches, Jonaie and Will!
Comment 23 Li Yuan 2007-10-12 14:30:00 UTC
Patches committed to gnome-2-20 branch and trunk.