From 2b4919bf938e481b8db283d935a028e5ed55138d Mon Sep 17 00:00:00 2001 From: Jeroen Wijenbergh Date: Sun, 12 May 2024 14:14:59 +0200 Subject: [PATCH] Wlroots Scene: Add wlr_scene_subsurface_tree_set_clip --- wlroots/ffi_build.py | 3 +++ wlroots/wlr_types/scene.py | 11 +++++++++++ 2 files changed, 14 insertions(+) diff --git a/wlroots/ffi_build.py b/wlroots/ffi_build.py index 08795e46..8a0a0747 100644 --- a/wlroots/ffi_build.py +++ b/wlroots/ffi_build.py @@ -1898,6 +1898,9 @@ def has_xwayland() -> bool: struct wlr_scene_tree *wlr_scene_subsurface_tree_create( struct wlr_scene_tree *parent, struct wlr_surface *surface); +void wlr_scene_subsurface_tree_set_clip(struct wlr_scene_node *node, + struct wlr_box *clip); + struct wlr_scene_tree *wlr_scene_xdg_surface_create( struct wlr_scene_tree *parent, struct wlr_xdg_surface *xdg_surface); diff --git a/wlroots/wlr_types/scene.py b/wlroots/wlr_types/scene.py index 5a5da120..9e73a524 100644 --- a/wlroots/wlr_types/scene.py +++ b/wlroots/wlr_types/scene.py @@ -288,6 +288,17 @@ def for_each_buffer( self._ptr, lib.buffer_iterator_callback, handle ) + def subsurface_tree_set_clip(self, clip: Box | None): + """ + Sets a cropping region for any subsurface trees that are children of this scene node. + + A None value will disable clipping + """ + clip_ptr = ffi.NULL + if clip is not None: + clip_ptr = clip._ptr + lib.wlr_scene_subsurface_tree_set_clip(self._ptr, clip_ptr) + class SceneSurface(Ptr): def __init__(self, ptr) -> None: