GNOME Bugzilla – Bug 585421
All menu items have space for icons
Last modified: 2009-11-27 20:53:59 UTC
All menu items in all menus have reserved space for icons. This produces various ugly effects in menus where this is not desired (see the attachment for an example). This is a regression in Gtk+ 2.16. In 2.14, things just worked: menus with icons/radios/checks have the space for them, other menus did not.
Created attachment 136322 [details] screenshot Don't mind the black stripe, that's some screenshotting artefact. Compared to previous Gtk+ versions, there is also some weird wasted space on the right side of the menu, though that's something one could perhaps live on.
Created attachment 136699 [details] [review] patch Patch that removes the misfeature, reverting behaviour to 2.14.
Created attachment 137130 [details] screenshot The original screenshot is rather tame. Normal menus look just weird in 2.16, but multicolumn menus of small items became really ugly and rather unusable, as demonstrated by this screenshot.
I was finally able to find bug 322934 that introduced this misfeature (git is queer, I wonder how to get the list of commits to a single file from it -- a trivial operation with svn). Reopening that...
I've now excluded comboboxes and tabular menus from the toggle size enforcing.
So, how do I make a single-column menu tabular? The first posted example still looks bad. Its menu entries will never have any icons as they already have images so they do not need the space. These images cannot be GtkImageMenuItem icons because such icons are forced to take the same space vertically as horizontally (since Gtk+ 2.4) which would look extremely ugly. Two examples where the new behaviour is unwanted have been found. Are you sure that no third one exists? Or that it cannot exists outside Gtk+ core? Please permit applications to disable the wasted space. I cannot fork GtkMenu since it is too hardwired in other places in Gtk+ and there are too many internal calls involved for an outside implementation to be a first-class citizen.
I'm still considering making no-toggle-space a regular menu property.
But that will be a 2.18 only api addition. For 2.16, what you can do as a workaround is to connect to toggle-size-request on the menuitems, and set the value to 1. That will have almost the same effect. Nobody will notice the 1 extra pixel...
(In reply to comment #7) > I'm still considering making no-toggle-space a regular menu property. I can write the patch if it helps. Although implementation is the easy part here, this is primarily a matter of policy. Thanks for the workaround hint.
(In reply to comment #9) > I can write the patch if it helps. Seems you were faster.
Seems we forgot to close this...