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 Desktop
Packages, 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

Status in The Application Menu:
  Invalid
Status in Unity:
  Invalid
Status in Unity 2D:
  Invalid
Status in “appmenu-gtk” package in Ubuntu:
  Invalid
Status in “gtk+3.0” package in Ubuntu:
  In Progress
Status in “unity” package in Ubuntu:
  Invalid
Status in “unity-2d” package in Ubuntu:
  Fix Released
Status in “appmenu-gtk” source package in Oneiric:
  Invalid
Status in “gtk+3.0” source package in Oneiric:
  In Progress
Status in “unity” source package in Oneiric:
  Invalid
Status in “unity-2d” source package in Oneiric:
  Fix Released

Bug description:
  When using the global app menu, Ctrl and Alt key bindings do not work
  in oneiric in some programs (they worked fine in natty and earlier).
  Reproducer:

   * Install and run "gtimelog"
   * Type "Arrived" [Enter] into the input box on the bottom edge to see 
something in the main window
   * Alt+1 and Alt+2 usually toggle between group and list view, but does 
nothing
   * Ctrl+E is supposed to open an editor with current 
~/.gtimelog/gtimelog.txt, but does nothing
   * Ctrl+Q is supposed to quit, but does nothing

  None of the keybindings work. They do work if you start

    UBUNTU_MENUPROXY=0 gtimelog

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

-- 
Mailing list: https://launchpad.net/~desktop-packages
Post to     : desktop-packages@lists.launchpad.net
Unsubscribe : https://launchpad.net/~desktop-packages
More help   : https://help.launchpad.net/ListHelp

Reply via email to