mirror of
https://github.com/labwc/labwc.git
synced 2026-03-07 04:33:54 -05: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
|
static int
|
||||||
menu_get_full_width(struct menu *menu)
|
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 child_width;
|
||||||
int max_child_width = 0;
|
int max_child_width = 0;
|
||||||
struct menuitem *item;
|
struct menuitem *item;
|
||||||
|
|
@ -849,9 +851,11 @@ get_submenu_position(struct menuitem *item, enum menu_align align)
|
||||||
pos.y = menu->scene_tree->node.y;
|
pos.y = menu->scene_tree->node.y;
|
||||||
|
|
||||||
if (align & LAB_MENU_OPEN_RIGHT) {
|
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;
|
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) {
|
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) {
|
if (align & LAB_MENU_OPEN_TOP) {
|
||||||
ly -= menu->size.height;
|
ly -= menu->size.height;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue