mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2025-11-24 06:59:45 -05:00
scene: add wlr_scene_node_toggle
This allows compositors to easily enable or disable a scene-graph node. This can be used to show/hide a surface when the xdg_surface is mapped/unmapped.
This commit is contained in:
parent
c41bd320be
commit
86e9309808
2 changed files with 15 additions and 0 deletions
|
|
@ -21,6 +21,7 @@ static struct wlr_scene_surface *scene_surface_from_node(
|
|||
static void scene_node_state_init(struct wlr_scene_node_state *state) {
|
||||
wl_list_init(&state->children);
|
||||
wl_list_init(&state->link);
|
||||
state->enabled = true;
|
||||
}
|
||||
|
||||
static void scene_node_state_finish(struct wlr_scene_node_state *state) {
|
||||
|
|
@ -108,6 +109,10 @@ struct wlr_scene_surface *wlr_scene_surface_create(struct wlr_scene_node *parent
|
|||
return scene_surface;
|
||||
}
|
||||
|
||||
void wlr_scene_node_set_enabled(struct wlr_scene_node *node, bool enabled) {
|
||||
node->state.enabled = enabled;
|
||||
}
|
||||
|
||||
void wlr_scene_node_set_position(struct wlr_scene_node *node, int x, int y) {
|
||||
node->state.x = x;
|
||||
node->state.y = y;
|
||||
|
|
@ -132,6 +137,10 @@ void wlr_scene_node_place_below(struct wlr_scene_node *node,
|
|||
static void scene_node_for_each_surface(struct wlr_scene_node *node,
|
||||
int lx, int ly, wlr_surface_iterator_func_t user_iterator,
|
||||
void *user_data) {
|
||||
if (!node->state.enabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
lx += node->state.x;
|
||||
ly += node->state.y;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue