mirror of
https://github.com/hyprwm/wlroots-hyprland.git
synced 2024-11-29 07:55:59 +01:00
scene: assert that node != sibling in place above/below
Currently these functions remove the node from the scene if the sibling argument is the same node as the node. To prevent confusion when misusing this API, assert that the nodes are distinct and document this.
This commit is contained in:
parent
dc22a06184
commit
2a8d385386
2 changed files with 4 additions and 0 deletions
|
@ -129,11 +129,13 @@ void wlr_scene_node_set_enabled(struct wlr_scene_node *node, bool enabled);
|
||||||
void wlr_scene_node_set_position(struct wlr_scene_node *node, int x, int y);
|
void wlr_scene_node_set_position(struct wlr_scene_node *node, int x, int y);
|
||||||
/**
|
/**
|
||||||
* Move the node right above the specified sibling.
|
* Move the node right above the specified sibling.
|
||||||
|
* Asserts that node and sibling are distinct and share the same parent.
|
||||||
*/
|
*/
|
||||||
void wlr_scene_node_place_above(struct wlr_scene_node *node,
|
void wlr_scene_node_place_above(struct wlr_scene_node *node,
|
||||||
struct wlr_scene_node *sibling);
|
struct wlr_scene_node *sibling);
|
||||||
/**
|
/**
|
||||||
* Move the node right below the specified sibling.
|
* Move the node right below the specified sibling.
|
||||||
|
* Asserts that node and sibling are distinct and share the same parent.
|
||||||
*/
|
*/
|
||||||
void wlr_scene_node_place_below(struct wlr_scene_node *node,
|
void wlr_scene_node_place_below(struct wlr_scene_node *node,
|
||||||
struct wlr_scene_node *sibling);
|
struct wlr_scene_node *sibling);
|
||||||
|
|
|
@ -440,6 +440,7 @@ void wlr_scene_node_set_position(struct wlr_scene_node *node, int x, int y) {
|
||||||
|
|
||||||
void wlr_scene_node_place_above(struct wlr_scene_node *node,
|
void wlr_scene_node_place_above(struct wlr_scene_node *node,
|
||||||
struct wlr_scene_node *sibling) {
|
struct wlr_scene_node *sibling) {
|
||||||
|
assert(node != sibling);
|
||||||
assert(node->parent == sibling->parent);
|
assert(node->parent == sibling->parent);
|
||||||
|
|
||||||
if (node->state.link.prev == &sibling->state.link) {
|
if (node->state.link.prev == &sibling->state.link) {
|
||||||
|
@ -455,6 +456,7 @@ void wlr_scene_node_place_above(struct wlr_scene_node *node,
|
||||||
|
|
||||||
void wlr_scene_node_place_below(struct wlr_scene_node *node,
|
void wlr_scene_node_place_below(struct wlr_scene_node *node,
|
||||||
struct wlr_scene_node *sibling) {
|
struct wlr_scene_node *sibling) {
|
||||||
|
assert(node != sibling);
|
||||||
assert(node->parent == sibling->parent);
|
assert(node->parent == sibling->parent);
|
||||||
|
|
||||||
if (node->state.link.next == &sibling->state.link) {
|
if (node->state.link.next == &sibling->state.link) {
|
||||||
|
|
Loading…
Reference in a new issue