mirror of
https://github.com/labwc/labwc.git
synced 2025-10-29 05:40:24 -04:00
menu: overlap submenus by menu.border.width
This follows Openbox's behavior that aligns the first item of a submenu with its parent item
This commit is contained in:
parent
da418f9720
commit
d70040c750
1 changed files with 8 additions and 4 deletions
|
|
@ -819,7 +819,9 @@ parse_xml(const char *filename, struct server *server)
|
|||
static int
|
||||
menu_get_full_width(struct menu *menu)
|
||||
{
|
||||
int width = menu->size.width - menu->server->theme->menu_overlap_x;
|
||||
struct theme *theme = menu->server->theme;
|
||||
int width = menu->size.width - theme->menu_overlap_x
|
||||
- theme->menu_border_width;
|
||||
int child_width;
|
||||
int max_child_width = 0;
|
||||
struct menuitem *item;
|
||||
|
|
@ -849,9 +851,11 @@ get_submenu_position(struct menuitem *item, enum menu_align align)
|
|||
pos.y = menu->scene_tree->node.y;
|
||||
|
||||
if (align & LAB_MENU_OPEN_RIGHT) {
|
||||
pos.x += menu->size.width - theme->menu_overlap_x;
|
||||
pos.x += menu->size.width - theme->menu_overlap_x
|
||||
- theme->menu_border_width;
|
||||
}
|
||||
pos.y += item->tree->node.y - theme->menu_overlap_y;
|
||||
pos.y += item->tree->node.y - theme->menu_overlap_y
|
||||
- theme->menu_border_width;
|
||||
return pos;
|
||||
}
|
||||
|
||||
|
|
@ -894,7 +898,7 @@ menu_configure(struct menu *menu, int lx, int ly, enum menu_align align)
|
|||
}
|
||||
|
||||
if (align & LAB_MENU_OPEN_LEFT) {
|
||||
lx -= menu->size.width - theme->menu_overlap_x;
|
||||
lx -= menu->size.width - theme->menu_overlap_x - theme->menu_border_width;
|
||||
}
|
||||
if (align & LAB_MENU_OPEN_TOP) {
|
||||
ly -= menu->size.height;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue