mirror of
https://github.com/labwc/labwc.git
synced 2025-11-05 13:29:58 -05:00
Convert menu to node_descriptors
This commit is contained in:
parent
eb7645d0e0
commit
8444ba4075
6 changed files with 75 additions and 68 deletions
|
|
@ -23,6 +23,7 @@ struct menu_scene {
|
|||
|
||||
struct menuitem {
|
||||
struct wl_list actions;
|
||||
struct menu *parent;
|
||||
struct menu *submenu;
|
||||
struct menu_scene normal;
|
||||
struct menu_scene selected;
|
||||
|
|
@ -75,15 +76,19 @@ void menu_open(struct menu *menu, int x, int y);
|
|||
* - handles hover effects
|
||||
* - may open/close submenus
|
||||
*/
|
||||
void menu_process_cursor_motion(struct menu *menu, struct wlr_scene_node *node);
|
||||
void menu_process_cursor_motion(struct wlr_scene_node *node);
|
||||
|
||||
/**
|
||||
* menu_call_actions - call actions associated with a menu entry
|
||||
* menu_call_actions - call actions associated with a menu node
|
||||
*
|
||||
* If actions are found, server->menu_current will be closed and set to NULL
|
||||
* Returns true if handled
|
||||
* If menuitem connected to @node does not just open a submenu:
|
||||
* - associated actions will be called
|
||||
* - server->menu_current will be closed
|
||||
* - server->menu_current will be set to NULL
|
||||
*
|
||||
* Returns true if actions have actually been executed
|
||||
*/
|
||||
bool menu_call_actions(struct menu *menu, struct wlr_scene_node *node);
|
||||
bool menu_call_actions(struct wlr_scene_node *node);
|
||||
|
||||
/* menu_close - close menu */
|
||||
void menu_close(struct menu *menu);
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@
|
|||
struct view;
|
||||
struct lab_layer_surface;
|
||||
struct lab_layer_popup;
|
||||
struct menuitem;
|
||||
|
||||
enum node_descriptor_type {
|
||||
LAB_NODE_DESC_NODE = 0,
|
||||
|
|
@ -13,6 +14,7 @@ enum node_descriptor_type {
|
|||
LAB_NODE_DESC_XDG_POPUP,
|
||||
LAB_NODE_DESC_LAYER_SURFACE,
|
||||
LAB_NODE_DESC_LAYER_POPUP,
|
||||
LAB_NODE_DESC_MENUITEM,
|
||||
};
|
||||
|
||||
struct node_descriptor {
|
||||
|
|
@ -54,4 +56,11 @@ struct lab_layer_surface *node_layer_surface_from_node(
|
|||
struct lab_layer_popup *node_layer_popup_from_node(
|
||||
struct wlr_scene_node *wlr_scene_node);
|
||||
|
||||
/**
|
||||
* node_menuitem_from_node - return menuitem struct from node
|
||||
* @wlr_scene_node: wlr_scene_node from which to return data
|
||||
*/
|
||||
struct menuitem *node_menuitem_from_node(
|
||||
struct wlr_scene_node *wlr_scene_node);
|
||||
|
||||
#endif /* __LABWC_NODE_DESCRIPTOR_H */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue