Add node-descriptor for wlr_scene_nodes

Support identification of wlr_scene_node role to enable simplification
of codebase including the avoidance of iterating over lists of
layer-surface, menuitems, and so on.

Use node-descriptors for xdg toplevels and popups
This commit is contained in:
Johan Malm 2022-02-25 22:31:24 +00:00
parent 4c981b845f
commit 2891ff245e
7 changed files with 92 additions and 6 deletions

23
include/node-descriptor.h Normal file
View file

@ -0,0 +1,23 @@
/* SPDX-License-Identifier: GPL-2.0-only */
#ifndef __LABWC_NODE_DESCRIPTOR_H
#define __LABWC_NODE_DESCRIPTOR_H
#include <wlr/types/wlr_scene.h>
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 */
};
struct node_descriptor {
enum node_descriptor_type type;
void *data;
struct wl_listener destroy;
};
void node_descriptor_create(struct wlr_scene_node *node,
enum node_descriptor_type type, void *data);
#endif /* __LABWC_NODE_DESCRIPTOR_H */