2022-02-21 03:18:38 +01:00
|
|
|
// SPDX-License-Identifier: GPL-2.0-only
|
|
|
|
|
|
|
|
|
|
#include <assert.h>
|
|
|
|
|
#include <wlr/types/wlr_scene.h>
|
2023-01-31 03:35:13 +01:00
|
|
|
#include "common/scene-helpers.h"
|
2022-02-21 03:18:38 +01:00
|
|
|
|
|
|
|
|
struct wlr_scene_rect *
|
|
|
|
|
lab_wlr_scene_get_rect(struct wlr_scene_node *node)
|
|
|
|
|
{
|
|
|
|
|
assert(node->type == WLR_SCENE_NODE_RECT);
|
|
|
|
|
return (struct wlr_scene_rect *)node;
|
|
|
|
|
}
|
2022-05-26 00:39:04 +02:00
|
|
|
|
2022-06-05 17:12:55 +02:00
|
|
|
struct wlr_scene_tree *
|
|
|
|
|
lab_scene_tree_from_node(struct wlr_scene_node *node)
|
|
|
|
|
{
|
|
|
|
|
assert(node->type == WLR_SCENE_NODE_TREE);
|
|
|
|
|
return (struct wlr_scene_tree *)node;
|
|
|
|
|
}
|
|
|
|
|
|
2022-05-26 00:39:04 +02:00
|
|
|
struct wlr_surface *
|
|
|
|
|
lab_wlr_surface_from_node(struct wlr_scene_node *node)
|
|
|
|
|
{
|
|
|
|
|
struct wlr_scene_buffer *buffer;
|
|
|
|
|
struct wlr_scene_surface *scene_surface;
|
|
|
|
|
|
|
|
|
|
if (node && node->type == WLR_SCENE_NODE_BUFFER) {
|
|
|
|
|
buffer = wlr_scene_buffer_from_node(node);
|
2023-02-07 14:28:40 -05:00
|
|
|
scene_surface = wlr_scene_surface_try_from_buffer(buffer);
|
2022-05-26 00:39:04 +02:00
|
|
|
if (scene_surface) {
|
|
|
|
|
return scene_surface->surface;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
2022-04-26 23:56:27 +02:00
|
|
|
|
|
|
|
|
struct wlr_scene_node *
|
|
|
|
|
lab_wlr_scene_get_prev_node(struct wlr_scene_node *node)
|
|
|
|
|
{
|
|
|
|
|
assert(node);
|
|
|
|
|
struct wlr_scene_node *prev;
|
|
|
|
|
prev = wl_container_of(node->link.prev, node, link);
|
|
|
|
|
if (&prev->link == &node->parent->children) {
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
return prev;
|
|
|
|
|
}
|