mirror of
https://github.com/swaywm/sway.git
synced 2024-11-24 08:51:27 +00:00
scene_descriptor: Add scene_descriptor_reassign
Same as the assign variant, but lets us mutate an existing descriptor if it exists instead of asserting.
This commit is contained in:
parent
93961e988b
commit
bdcffbd611
|
@ -32,6 +32,9 @@ enum sway_scene_descriptor_type {
|
||||||
bool scene_descriptor_assign(struct wlr_scene_node *node,
|
bool scene_descriptor_assign(struct wlr_scene_node *node,
|
||||||
enum sway_scene_descriptor_type type, void *data);
|
enum sway_scene_descriptor_type type, void *data);
|
||||||
|
|
||||||
|
bool scene_descriptor_reassign(struct wlr_scene_node *node,
|
||||||
|
enum sway_scene_descriptor_type type, void *data);
|
||||||
|
|
||||||
void *scene_descriptor_try_get(struct wlr_scene_node *node,
|
void *scene_descriptor_try_get(struct wlr_scene_node *node,
|
||||||
enum sway_scene_descriptor_type type);
|
enum sway_scene_descriptor_type type);
|
||||||
|
|
||||||
|
|
|
@ -89,3 +89,14 @@ bool scene_descriptor_assign(struct wlr_scene_node *node,
|
||||||
desc->data = data;
|
desc->data = data;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool scene_descriptor_reassign(struct wlr_scene_node *node,
|
||||||
|
enum sway_scene_descriptor_type type, void *data) {
|
||||||
|
struct scene_descriptor *desc = scene_node_get_descriptor(node, type);
|
||||||
|
if (desc) {
|
||||||
|
desc->data = data;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return scene_descriptor_assign(node, type, data);
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue