mirror of
https://github.com/labwc/labwc.git
synced 2025-11-01 22:58:47 -04:00
menu: improve algorithm for menu placement with xdg-positioner
This commit delegates the calculation for menu position into wlroots utilities for xdg_positioner. Notable functional changes are: - Slide the menu to fit in the output when it's opened out of the output (e.g. top-left window menu is opened when the window is overflowing to the left), rather than not updating the menu at all. - The horizontal alignment of menus is now determined based on the size of each (sub)menu alone rather than the total width of entire menu tree. This means submenus can now overlap with is parents, but this is no longer a problem since we recently added support for menu borders. - Fixed that pipemenus always follow the alignment of its parent even when it overflows from the output.
This commit is contained in:
parent
08de4f3d6b
commit
40c7350064
2 changed files with 59 additions and 92 deletions
|
|
@ -12,14 +12,6 @@ struct wlr_scene_tree;
|
|||
struct wlr_scene_node;
|
||||
struct scaled_font_buffer;
|
||||
|
||||
enum menu_align {
|
||||
LAB_MENU_OPEN_AUTO = 0,
|
||||
LAB_MENU_OPEN_LEFT = 1 << 0,
|
||||
LAB_MENU_OPEN_RIGHT = 1 << 1,
|
||||
LAB_MENU_OPEN_TOP = 1 << 2,
|
||||
LAB_MENU_OPEN_BOTTOM = 1 << 3,
|
||||
};
|
||||
|
||||
enum menuitem_type {
|
||||
LAB_MENU_ITEM = 0,
|
||||
LAB_MENU_SEPARATOR_LINE,
|
||||
|
|
@ -63,7 +55,7 @@ struct menu {
|
|||
} selection;
|
||||
struct wlr_scene_tree *scene_tree;
|
||||
bool is_pipemenu;
|
||||
enum menu_align align;
|
||||
bool align_left;
|
||||
|
||||
/* Used to match a window-menu to the view that triggered it. */
|
||||
struct view *triggered_by_view; /* may be NULL */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue