GNOME Bugzilla – Bug 96557
Add style properties for submenu offsets
Last modified: 2011-02-04 16:16:03 UTC
The distance that submenus are offset from the menu item in the parent horizontally and vertically probably be a configurable properties. The default vertical offset should also almost certainly be smaller than it is now (right now it is 0.25 of the menu item height; I don't think supporting a menu-item-height-relative offset like this is really necessary) See bug 51042 and http://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=66259.
I am attaching a patch that adds these two properties. Note that menus in the gnome menu panel that are too tall for the screen, are not affected by this patch. This probably has to do with the function panel_make_sure_menu_within_screen (GtkMenu *menu) in gnome-panel/menu.c writing another function into menu->position_func. I haven't investigated further than that. The horizontal_offset is measured in pixels from the edge of the parent menu; the vertical_offset is measured in pixels from the top edge of the parent menu item. The default values for the h- and v-offset are -2 and -3 respectively. With the default theme this positions submenus so that the bevels just overlap and so that the blue selections match up if the items have the same height.
Created attachment 18186 [details] [review] patch
Looks good to me. My only question is whether the value '0' for vertical-offset should mean that the menu items are aligned. The current '0' seems to be a bit meaningless, if you have to use '-3' to get alignment.
You are probably right. Here is a new patch.
Created attachment 18246 [details] [review] new patch
Looks fine to me
Sun Jul 13 01:37:51 2003 Soeren Sandmann <sandmann@daimi.au.dk> * gtk/gtkmenu.c (gtk_menu_class_init): new properties "horizontal-offset" and "vertical-offset" that determines the position of the menu when it is a submenu. * gtk/gtkmenuitem.c (gtk_menu_item_position_menu): position submenus according to new vertical- and horizontal-offset properties.