Skip to content

Commit

Permalink
Wlroots SceneTree: Add a children iterator
Browse files Browse the repository at this point in the history
  • Loading branch information
jwijenbergh committed May 12, 2024
1 parent 2b4919b commit 13a4fb3
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions wlroots/wlr_types/scene.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,15 @@
import enum
from typing import TYPE_CHECKING, Callable, TypeVar

from pywayland.utils import wl_list_for_each

from wlroots import Ptr, PtrHasData, ffi, lib
from wlroots.util.region import PixmanRegion32
from wlroots.wlr_types import OutputLayoutOutput, Surface

if TYPE_CHECKING:
from typing import Iterator

from wlroots.util.box import Box
from wlroots.util.clock import Timespec
from wlroots.wlr_types import Buffer, Output, OutputLayout
Expand Down Expand Up @@ -145,6 +149,16 @@ def subsurface_tree_create(cls, parent: SceneTree, surface: Surface) -> SceneTre
def drag_icon_create(cls, parent: SceneTree, drag_icon: DragIcon) -> SceneTree:
return SceneTree(lib.wlr_scene_drag_icon_create(parent._ptr, drag_icon._ptr))

@property
def children(self) -> Iterator[SceneNode]:
for ptr in wl_list_for_each(
"struct wlr_scene_node *",
self._ptr.children,
"link",
ffi=ffi,
):
yield SceneNode(ptr)


class SceneBuffer(Ptr):
def __init__(self, ptr) -> None:
Expand Down

0 comments on commit 13a4fb3

Please sign in to comment.