mirror of
https://github.com/labwc/labwc.git
synced 2025-11-02 09:01:47 -05:00
node.c: add helpers for returning structs from node data
Support returning the following structs: - view from LAB_NODE_DESC_VIEW or LAB_NODE_DESC_XDG_POPUP - lab_layer_surface form LAB_NODE_DESC_LAYER_SURFACE - lab_layer_popup from LAB_NODE_DESC_LAYER_POPUP
This commit is contained in:
parent
30298228e3
commit
b4cbc20e8c
3 changed files with 66 additions and 13 deletions
|
|
@ -3,12 +3,16 @@
|
|||
#define __LABWC_NODE_DESCRIPTOR_H
|
||||
#include <wlr/types/wlr_scene.h>
|
||||
|
||||
struct view;
|
||||
struct lab_layer_surface;
|
||||
struct lab_layer_popup;
|
||||
|
||||
enum node_descriptor_type {
|
||||
LAB_NODE_DESC_NODE = 0,
|
||||
LAB_NODE_DESC_VIEW, /* *data --> struct view */
|
||||
LAB_NODE_DESC_XDG_POPUP, /* *data --> struct view */
|
||||
LAB_NODE_DESC_LAYER_SURFACE, /* *data --> struct lab_layer_surface */
|
||||
LAB_NODE_DESC_LAYER_POPUP, /* *data --> struct lab_layer_popup */
|
||||
LAB_NODE_DESC_VIEW,
|
||||
LAB_NODE_DESC_XDG_POPUP,
|
||||
LAB_NODE_DESC_LAYER_SURFACE,
|
||||
LAB_NODE_DESC_LAYER_POPUP,
|
||||
};
|
||||
|
||||
struct node_descriptor {
|
||||
|
|
@ -17,7 +21,37 @@ struct node_descriptor {
|
|||
struct wl_listener destroy;
|
||||
};
|
||||
|
||||
void node_descriptor_create(struct wlr_scene_node *node,
|
||||
/**
|
||||
* node_descriptor_create - create node descriptor for wlr_scene_node user_data
|
||||
* @scene_node: wlr_scene_node to attached node_descriptor to
|
||||
* @type: node descriptor type
|
||||
* @data: struct to point to as follows:
|
||||
* - LAB_NODE_DESC_VIEW struct view
|
||||
* - LAB_NODE_DESC_XDG_POPUP struct view
|
||||
* - LAB_NODE_DESC_LAYER_SURFACE struct lab_layer_surface
|
||||
* - LAB_NODE_DESC_LAYER_POPUP struct lab_layer_popup
|
||||
*/
|
||||
void node_descriptor_create(struct wlr_scene_node *scene_node,
|
||||
enum node_descriptor_type type, void *data);
|
||||
|
||||
/**
|
||||
* node_view_from_node - return view struct from node
|
||||
* @node_descriptor: node_descriptor from which to return data
|
||||
*/
|
||||
struct view *node_view_from_node(struct node_descriptor *node_descriptor);
|
||||
|
||||
/**
|
||||
* node_lab_surface_from_node - return lab_layer_surface struct from node
|
||||
* @node_descriptor: node_descriptor from which to return data
|
||||
*/
|
||||
struct lab_layer_surface *node_layer_surface_from_node(
|
||||
struct node_descriptor *node_descriptor);
|
||||
|
||||
/**
|
||||
* node_layer_popup_from_node - return lab_layer_popup struct from node
|
||||
* @node_descriptor: node_descriptor from which to return data
|
||||
*/
|
||||
struct lab_layer_popup *node_layer_popup_from_node(
|
||||
struct node_descriptor *node_descriptor);
|
||||
|
||||
#endif /* __LABWC_NODE_DESCRIPTOR_H */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue