scene: Add scaling factor to nodes

This adds a scaling factor that can be used for resizing any type of node and
its contents. This is very convenient for animations and previews (e.g. alt-tab
windows switching menus).
This commit is contained in:
Andri Yngvason 2025-06-01 21:35:01 +00:00
parent 6c78225160
commit 5a068b5de6
2 changed files with 68 additions and 9 deletions

View file

@ -66,6 +66,7 @@ struct wlr_scene_node {
bool enabled;
int x, y; // relative to parent
double scale;
struct {
struct wl_signal destroy;
@ -284,6 +285,11 @@ void wlr_scene_node_set_enabled(struct wlr_scene_node *node, bool enabled);
* Set the position of the node relative to its parent.
*/
void wlr_scene_node_set_position(struct wlr_scene_node *node, int x, int y);
/**
* Set the scaling factor of the node. This scales the node's children
* accordingly.
*/
void wlr_scene_node_set_scale(struct wlr_scene_node *node, double scale);
/**
* Move the node right above the specified sibling.
* Asserts that node and sibling are distinct and share the same parent.