From: Mikael Magnusson Date: Wed, 2 Aug 2006 17:25:32 +0000 (+0000) Subject: make menus optionally vertically centered, and enable by default, see bug #2746 X-Git-Url: https://git.brokenzipper.com/gitweb?a=commitdiff_plain;h=56c548b203d9f089637d587dd9953f268cd28c90;p=chaz%2Fopenbox make menus optionally vertically centered, and enable by default, see bug #2746 --- diff --git a/data/rc.xml.in b/data/rc.xml.in index 238bfd52..3593f9f6 100644 --- a/data/rc.xml.in +++ b/data/rc.xml.in @@ -373,6 +373,7 @@ yes yes 250 + yes 0 yes diff --git a/data/rc.xsd b/data/rc.xsd index 9f548313..018d6a26 100644 --- a/data/rc.xsd +++ b/data/rc.xsd @@ -205,6 +205,7 @@ + diff --git a/openbox/config.c b/openbox/config.c index 574d13ee..d986ac1b 100644 --- a/openbox/config.c +++ b/openbox/config.c @@ -72,14 +72,14 @@ gint config_mouse_dclicktime; gboolean config_menu_warppointer; gboolean config_menu_xorstyle; guint config_menu_hide_delay; +gboolean config_menu_middle; guint config_submenu_show_delay; gboolean config_menu_client_list_icons; GSList *config_menu_files; -gint config_resist_win; -gint config_resist_edge; - +gint config_resist_win; +gint config_resist_edge; gboolean config_resist_layers_below; GSList *config_per_app_settings; @@ -596,6 +596,8 @@ static void parse_menu(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node, config_menu_xorstyle = parse_bool(doc, n); if ((n = parse_find_node("hideDelay", node))) config_menu_hide_delay = parse_int(doc, n); + if ((n = parse_find_node("middle", node))) + config_menu_middle = parse_bool(doc, n); if ((n = parse_find_node("submenuShowDelay", node))) config_submenu_show_delay = parse_int(doc, n); if ((n = parse_find_node("desktopMenuIcons", node))) @@ -793,6 +795,7 @@ void config_startup(ObParseInst *i) config_menu_warppointer = TRUE; config_menu_xorstyle = TRUE; config_menu_hide_delay = 250; + config_menu_middle = TRUE; config_submenu_show_delay = 0; config_menu_client_list_icons = TRUE; config_menu_files = NULL; diff --git a/openbox/config.h b/openbox/config.h index 29f8d081..e68bc12e 100644 --- a/openbox/config.h +++ b/openbox/config.h @@ -122,6 +122,8 @@ extern gboolean config_menu_warppointer; extern gboolean config_menu_xorstyle; /*! delay for hiding menu when opening */ extern guint config_menu_hide_delay; +/*! Center menus vertically about the parent entry */ +extern gboolean config_menu_middle; /*! delay before opening a submenu */ extern guint config_submenu_show_delay; /*! show icons in client_list_menu */ diff --git a/openbox/menuframe.c b/openbox/menuframe.c index 99b7dcee..120f4c38 100644 --- a/openbox/menuframe.c +++ b/openbox/menuframe.c @@ -628,6 +628,16 @@ gboolean menu_frame_show(ObMenuFrame *self, ObMenuFrame *parent) menu_frame_update(self); menu_frame_visible = g_list_prepend(menu_frame_visible, self); + + if (config_menu_middle) { + if (self->parent) + menu_frame_move(self, self->area.x, self->area.y + - self->area.height/2 + + self->item_h/2); + else if (self->show_title) + menu_frame_move(self, self->area.x - self->area.width/2, + self->area.y - self->title_h*3/4); + } menu_frame_move_on_screen(self); @@ -780,10 +790,14 @@ void menu_entry_frame_show_submenu(ObMenuEntryFrame *self) f = menu_frame_new(self->entry->data.submenu.submenu, self->frame->client); menu_frame_move(f, - self->frame->area.x + self->frame->area.width - - ob_rr_theme->menu_overlap - ob_rr_theme->bwidth, - self->frame->area.y + self->frame->title_h + - self->area.y + ob_rr_theme->menu_overlap); + self->frame->area.x + + self->frame->area.width + - ob_rr_theme->menu_overlap + - ob_rr_theme->bwidth, + self->frame->area.y + + self->frame->title_h + + self->area.y + + (config_menu_middle ? 1 : ob_rr_theme->menu_overlap)); menu_frame_show(f, self->frame); }