Ok, I've made some more testing and I've also found a solution, but
before checking if that's right let's discuss a little.

Basically the issue we're always reproducing when using a gtkbuilder-based app, 
can also happening when manually programming our interface and basically when 
we're doing something like this in our menu widgets tree:
 - GtkMenubar { GtkMenuItem { GtkMenu { GtkMenuItem } } }

In this case, the inner GtkMenuItem won't be sensible to accelerators.
You can see a test example here: 
https://gist.github.com/1288553#file_badunitymenus_std.vala

GtkBuilder seems to use a structure like this one every time (and I also
guess that gcalctool uses that too), and this cause the menu items not
to be sensible to our accelerator keys.

Now, the possible solutions, everything here seems to start from 
gtkmenuitem.c's gtk_menu_item_can_activate_accel which checks if the parent 
widgets can manage an accelerator.
When using the ubuntu menubar the process stops returning false, due to the 
fact that the GtkMenuBar isn't drawn and so isn't activable according to 
gtk_widget_can_activate_accel(). So we have some possible solution:
 - In gtk_menu_item_can_activate_accel we just try to go back to all the parent 
widgets, just checking if they are sensitive
 - In gtk_menu_item_can_activate_accel we check if the parent widget is a 
GtkMenuBar and in the case, if it's sensitive we just skip it, and we pass to 
its own parent
 - override the can_activate_accel function in the class GtkMenuBar making that 
check only if the menu bar is sensitive.

The last one is of course the best one solution imho, and so I think
that's the one I'll propose as soon as I can...

I think we must definitely fix this issue, since it could happen to all
the apps not designed as we figured until now.

Finally, looking for this I also found another issue: if someone
programmatically  wants to hide a menubar, it's not possible in ubuntu.
I guess we should track the show hide/status of that widget and check
that to export the menu or not or to restore the visibility status when
the menus are shown again as standard menus.

PS: from my tests this doesn't seem to affect gtk+2.0 programs, can you
confirm this?

** Changed in: ubuntu
       Status: New => In Progress

** Changed in: ubuntu
     Assignee: (unassigned) => Marco Trevisan (Treviño) (3v1n0)

** Changed in: gtk+3.0 (Ubuntu Oneiric)
       Status: Confirmed => In Progress

** Changed in: gtk+3.0 (Ubuntu Oneiric)
     Assignee: (unassigned) => Marco Trevisan (Treviño) (3v1n0)

** Changed in: appmenu-gtk (Ubuntu Oneiric)
       Status: Triaged => Invalid

** Changed in: unity (Ubuntu Oneiric)
       Status: Triaged => Invalid

-- 
You received this bug notification because you are a member of Ubuntu
Desktop Bugs, which is subscribed to gtk+3.0 in Ubuntu.
https://bugs.launchpad.net/bugs/849732

Title:
  Control/Alt key bindings are broken in GTK 3 programs using gtkbuilder

To manage notifications about this bug go to:
https://bugs.launchpad.net/indicator-appmenu/+bug/849732/+subscriptions

-- 
desktop-bugs mailing list
desktop-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/desktop-bugs

Reply via email to