Comment 10 for bug 743265

Revision history for this message
Jacob Nevins (0jacobnk-ulp) wrote : Re: when using unity, the cities menu is not shown

I ran Natty (11.04) off a LiveCD with Unity and experimented with the packaged Freeciv (2.2.4).

It's not as bad as my experience with Maverick in comment #9. The main game menu bar was always accessible in the appmenu area, regardless of whether I had one of the other tabs with menubars open or not. (Note that the menu bar doesn't show until you mouse over it's area or press F10 -- it doesn't seem very discoverable -- but that seems to be by design and other apps behave the same.) Otherwise the experience was the same as reported by Xavier Bassery. Unlike Maverick, the non-main menubars never appeared in the

I've been advised that the appmenu implementation changed significantly between Maverick and Natty, so I'm going to ignore the Maverick behaviour for now and focus on Natty.

Still, it's sufficient to make the game unplayable. The following are items I've noticed that are not accessible in Unity:
* Main window, Nations tab: Diplomacy/Intelligence/Display/AI menubar.
** This is particularly serious, as this Diplomacy menu is the only way to initiate and break treaties with other nations.
** Various new users have complained to us (upstream) and in forums that they can't work out how to do diplomacy with other nations. I saw such a complaint in the Ubuntu Software Center reviews when I was doing this test. I wonder if this Ubuntu-specific issue is the root cause of these reports?
* Diplomacy dialog, "Add Clause..." buttons.
** You can see this despite the previous issue, when other nations (such as AI) initiate diplomacy with you.
* Main window, Cities tab: Production/Governor/Sell/Select/Display.
* City dialog, Production tab: "Add Global Worklist".

Trying to diagnose the issue:

My understanding of this app-menu-hiding-thing is that there are three important components (correct me if wrong):
* appmenu-gtk, which hooks into individual Gtk applications (via the environment variable UBUNTU_MENUPROXY=libappmenu.so), finds out what menubars exist, and suppresses their display in the local application;
* indicator-appmenu, which is the global widget that lives on the top of the desktop and displays the menu instead;
* dbusmenu, which is the conduit for information about the menus; appmenu-gtk (and other proxies) write to it, indicator-appmenu reads from it.

I'm not finding a lot of documentation of all this infrastructure, however (grumble). I've been pointed to a few morsels of information about debugging this stuff at https://wiki.ubuntu.com/DesktopExperienceTeam/ApplicationMenu .

I tried the "dbusmenu-dumper" diagnostic step described there. But the JSON output only ever contained items from Freeciv's main game menu, regardless of whether secondary menubars were trying to be displayed. (I've got a copy if it's of interest.) I'm not sure what this is telling me, but what I see in the file seems to correspond to what indicator-appmenu is displaying, and doesn't give me any clues as to the whereabouts of my missing menubars, so it doesn't seem very interesting.

Other diagnostics:
* "UBUNTU_MENUPROXY= freeciv" behaves as per comment #7, but is a bit of a sledgehammer.
* "APPMENU_DISPLAY_BOTH=1 freeciv" behaves as expected for the main menu (two menu bars). Interestingly, the secondary menubars are still suppressed by default, but as soon as I click on the app's main menu bar, the secondary ones magically appear.

The most fruitful avenue of investigation looks to be appmenu-gtk, as it's clearly responsible for suppressing the menubars, and the evidence suggests that it may be doing so without passing them on to anything else. (If so, that would seem like a bug in appmenu-gtk to me!)
* The developer page is https://launchpad.net/appmenu-gtk
* All the action appears to be in http://bazaar.launchpad.net/~canonical-dx-team/appmenu-gtk/trunk/view/head:/src/bridge.c

I don't fully understand what's going in in here, but it looks like it's looking for any widgets matching GTK_IS_MENU_BAR() and GTK_IS_MENU(), and perhaps ignoring GTK_IS_TEAROFF_MENU_ITEM(). I didn't see any obvious way in which it was trying to distinguish "main" menu bars from non-"main" ones (but I could easily have missed something).

There also seems to be a blacklist of hardcoded application names to ignore -- another sledgehammer, if we need it.

One interesting thing I saw was it looking for a property called a "ubuntu-no-proxy". Perhaps this would let us override appmenu-gtk's interest in our secondary menubars? I wasn't sure because I saw words like "toplevel", so feared this was another sledgehammer. I haven't experimented with recompiling Freeciv with such a property set on various strategic widgets yet. (I'd rather not have to litter upstream source with workarounds for distro peculiarities, but...)

(Help from someone who understands Unity/appmenu would be very welcome at this point...)