GNOME Bugzilla – Bug 110775
Removing the space between menu items in menu bar
Last modified: 2011-02-04 16:16:03 UTC
Gtk+ has some weird spacing between every menu item in a menu bar, as shown on the following screenshot: http://home.quicknet.nl/qn/prive/rm.vaneijbergen/mitem-spc-before.png (where the white rectangle shows the space between the 2 items) This feels quite icky, doesn't look really nice and it makes the menu bar feel more like it's patched together instead of being a 'complete' widget. So I would like to propose to remove this space (currently hardcoded to 3 pixels wide on each side of an item) and add it into the menu (bar) item itself instead, like shown in this screenshot: http://home.quicknet.nl/qn/prive/rm.vaneijbergen/mitem-spc-after.png This makes that the selection of a menu item jumps straight from one to the other item, instead of waiting until the mouse pointer is 6 pixels further on the menu bar. I'm attaching a quick patch that modifies GtkMenubar and GtkMenuItem to do what I described above. This patch, however, is not meant to be applied (not yet, at least) and uses the hardcoded value of 3 to add the space on both sides of a menu item (and accidentily adds that to normal menu items as well, shouldn't happen of course). The patch is hacky because I need this (previously hardcoded) value not only in GtkMenuItem but in GtkMenubar as well. Would it be acceptable to use a new (style) property for a final patch (and at the same time getting access to that value in both GtkMenuItem and GtkMenubar)?
Created attachment 15717 [details] [review] The patch
I think the change probably makes sense * Are you proposing addng the space on the left as well? If not, the menu items need to know where in their menu they are drawing * It's probably cleanest to do the change as: - Remove BORDER_SPACING from GtkMenuBar entirely - Add an extra-horizontal-padding style property to GTK+ that gets added on both sides if submenu_placement is GTK_TOP_BOTTOM. Probably still the same thing if you don't want the padding on the extreme left/right ... you just need to make the GtkMenuItem figure out where in the menu bar it is. (get the parent, make sure it is a GtkMenuShell, find itself in menu_shell->children)
Yes, I'm proposing to add the space on the left as well (think it looks better that way) New patch with horizontal padding available in a few days.. (probably by Saturday or so)
My patch from bug 96236 adds among other things a new GtkMenuItem::horizontal-padding style property.
Can't we just remove CHILD_SPACING? I don't really think it's necessary to add extra space around menu items.
Created attachment 17962 [details] [review] Patch to remove child spacing
*** Bug 118360 has been marked as a duplicate of this bug. ***
Created attachment 24630 [details] [review] New patch that keeps that space between items
Thu Feb 26 23:26:00 2004 Soeren Sandmann <sandmann@daimi.au.dk> * gtk/gtkstatusbar.c (set_grip_cursor): New function. Use resize cursors for resize grips. (Bug #129621) * gtk/gtktoolbar.c (gtk_toolbar_get_relief_style): Documentation fix - patch by Torsten Schoenfeld. * gtk/gtkmenubar.c (gtk_menu_bar_size_request): don't request space between the items. (Bug #110775) * gtk/gtkrc.c (_gtk_rc_init): Provide extra horizontal padding inside menu items that are inside a menu bar. (Bug #110775) * configure.in (HAVE_XCURSOR): Make XCurosr part of GDK_EXTRA_, not GDK_PACKAGES, to prevent applications from getting linked to it (Bug #119804) * gtk/gtkmenubar.c (gtk_menu_bar_size_allocate): Put the vertical ipadding inside the item. (Bug #61843)