GNOME Bugzilla – Bug 78949
Bookmark menu items vanish when I "add bookmarks" repeatedly
Last modified: 2011-02-04 16:11:52 UTC
Gnome 2.0 was built on the 15h April from CVS. Description: I keep doing "Bookmarks" -> "Add Bookmarks" in the main nautilus window a couple of times (3-4 times), *in quick succession* (this is important). At one point, the built-in and custom bookmark items are not visible in the 'Bookmarks' menu. All the items become visible, when I place the mouse cursor on some other menu (say the 'Help') and then come back to the bookmarks menu.
Edge case but should be fixed, I guess.
Louie: still seeing this problem :/
I also see this with other popup menus, like over files. Looks like a Bonobo issue.
Looks like a Gtk+ problem to me, the items are there but not visible. Most likely gtk+ doesn't re-size the popup correctly if items are added after it's popped up. Will isolate.
Bug easy to repeat, ~certainly a Gtk+ bug. Gtk+ seems to have some odd macro: 'MENU_NEEDS_RESIZE' (gtkmenu.c), that sets a flag that appears not to be used; ( also set to 0 in gtkmenushell.c ). Either way, you can see that there are partially occluded menu items in what used to be the vpadding at the bottom of the popup window by giving them focus. The problem is that we popup a menu, and continue building it's contents - and it appears not to get re-sized correctly to reflect the new contents.
Stand-alone test case much appreciated.
Hardly difficult to construct one; presumably the aforementioned cruft needs fixing / removing as well. Trivial gtk-demo patch attached; if you click on the menu, you will not notice the items being added; the popup is not re-sized correctly. If you tear off the menu you will see them (& scroll bar etc.).
Created attachment 9319 [details] [review] gtk-demo patch to demonstrate the problem.
OK, looking at this this is a pretty fringe case :-). If it's typical to pop up the menu again before the bookmark is added, I think we need some speed work here. Making menus resize dynamically requires some fairly major surgery to the menu code, so is going to be a GTK+ HEAD only change. I'm going to attach: a) A standalone dynamic-menu-changing torture case. (based on Michael's patch but considerably extentended.) b) A patch that implements dynamic menu resizing. (Against GTK+ stable; will take a small amount of adjustment for GTK+ HEAD.) If someone wants to gives the patch some testing, I would appreciate it. I'll put it into CVS on Monday. If we want this for GNOME 2.0.1, you'll need to attack it from the nautilus side.
Created attachment 9671 [details] [review] Patch for gtkmenu.c
Created attachment 9672 [details] Torture test for patch
Owen: I tested the above patch and it enables the dynamic resizing of menus. It fixes the reported problem of nautilus-bookmark menu being truncated by enabling the dynamic growth of bookmark menu. I have regenerated this patch against latest GTK+ HEAD and am attaching the same here.
Created attachment 9703 [details] [review] Patch (gtkmenu.c) regenerated against CVS Head.
One for sun-patches then, libbonoboui relies on the fact that a container can be updated dynamically, it puts no constraint on the user as to when they can / cannot merge / remove UI Xml descriptions, nor is there the semantic information available to know when they have 'finished' building a menu and now it's ok to pop it up. So - it's really not possible to work around although it's _possible_ that we might hack around the specific case that's come to light in nautilus, it would be extremely unwise.
Applied. Many thanks for the testing. Fri Aug 2 18:00:46 2002 Owen Taylor <otaylor@redhat.com> * gtk/gtkmenu.c: Fix menus resizing dynamically while they are popped up or torn off. (#78949)
Verified fixed. Closing. Thanks.