make menus optionally vertically centered, and enable by default, see bug #2746
This commit is contained in:
parent
27ebf0f331
commit
56c548b203
5 changed files with 28 additions and 7 deletions
|
@ -373,6 +373,7 @@
|
|||
<warpPointer>yes</warpPointer>
|
||||
<xorStyle>yes</xorStyle>
|
||||
<hideDelay>250</hideDelay>
|
||||
<middle>yes</middle>
|
||||
<submenuShowDelay>0</submenuShowDelay>
|
||||
<desktopMenuIcons>yes</desktopMenuIcons>
|
||||
<!-- -->
|
||||
|
|
|
@ -205,6 +205,7 @@
|
|||
<xs:element minOccurs="0" name="warpPointer" type="ob:bool"/>
|
||||
<xs:element minOccurs="0" name="xorStyle" type="ob:bool"/>
|
||||
<xs:element minOccurs="0" name="hideDelay" type="xs:integer"/>
|
||||
<xs:element minOccurs="0" name="middle" type="ob:bool"/>
|
||||
<xs:element minOccurs="0" name="submenuShowDelay" type="xs:integer"/>
|
||||
<xs:element minOccurs="0" name="desktopMenuIcons" type="ob:bool"/>
|
||||
</xs:sequence>
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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 */
|
||||
|
|
|
@ -629,6 +629,16 @@ gboolean menu_frame_show(ObMenuFrame *self, ObMenuFrame *parent)
|
|||
|
||||
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);
|
||||
|
||||
XMapWindow(ob_display, self->window);
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue