aboutsummaryrefslogtreecommitdiff
path: root/include/wlr
diff options
context:
space:
mode:
authoremersion <contact@emersion.fr>2018-04-04 20:10:47 -0400
committeremersion <contact@emersion.fr>2018-04-05 14:18:17 -0400
commit4a9a9eae9ad92810079a963c6ef0de13db039546 (patch)
treecd5bdfaaefbc3acc93b61e49193e0416ad743e69 /include/wlr
parent19b576734e75d65ed6e28b13131f20f6444cba48 (diff)
Add surface iterators
Diffstat (limited to 'include/wlr')
-rw-r--r--include/wlr/types/wlr_surface.h12
-rw-r--r--include/wlr/types/wlr_wl_shell.h8
-rw-r--r--include/wlr/types/wlr_xdg_shell.h8
-rw-r--r--include/wlr/types/wlr_xdg_shell_v6.h8
4 files changed, 36 insertions, 0 deletions
diff --git a/include/wlr/types/wlr_surface.h b/include/wlr/types/wlr_surface.h
index 380e5e03..62f03e37 100644
--- a/include/wlr/types/wlr_surface.h
+++ b/include/wlr/types/wlr_surface.h
@@ -93,9 +93,13 @@ struct wlr_surface {
// wlr_subsurface::parent_pending_link
struct wl_list subsurface_pending_list;
+
void *data;
};
+typedef void (*wlr_surface_iterator_func_t)(struct wlr_surface *surface,
+ int sx, int sy, void *data);
+
struct wlr_renderer;
struct wlr_surface *wlr_surface_create(struct wl_resource *res,
struct wlr_renderer *renderer);
@@ -160,4 +164,12 @@ void wlr_surface_set_role_committed(struct wlr_surface *surface,
struct wlr_surface *wlr_surface_from_resource(struct wl_resource *resource);
+/**
+ * Call `iterator` on each surface in the surface tree, with the surface's
+ * positon relative to the root surface. The function is called from root to
+ * leaves (in rendering order).
+ */
+void wlr_surface_for_each_surface(struct wlr_surface *surface,
+ wlr_surface_iterator_func_t iterator, void *user_data);
+
#endif
diff --git a/include/wlr/types/wlr_wl_shell.h b/include/wlr/types/wlr_wl_shell.h
index 89e950c9..1b38b2e3 100644
--- a/include/wlr/types/wlr_wl_shell.h
+++ b/include/wlr/types/wlr_wl_shell.h
@@ -155,4 +155,12 @@ bool wlr_surface_is_wl_shell_surface(struct wlr_surface *surface);
struct wlr_wl_surface *wlr_wl_shell_surface_from_wlr_surface(
struct wlr_surface *surface);
+/**
+ * Call `iterator` on each surface in the shell surface tree, with the surface's
+ * positon relative to the root xdg-surface. The function is called from root to
+ * leaves (in rendering order).
+ */
+void wlr_wl_shell_surface_for_each_surface(struct wlr_wl_shell_surface *surface,
+ wlr_surface_iterator_func_t iterator, void *user_data);
+
#endif
diff --git a/include/wlr/types/wlr_xdg_shell.h b/include/wlr/types/wlr_xdg_shell.h
index 29b54dba..faf398a7 100644
--- a/include/wlr/types/wlr_xdg_shell.h
+++ b/include/wlr/types/wlr_xdg_shell.h
@@ -234,4 +234,12 @@ bool wlr_surface_is_xdg_surface(struct wlr_surface *surface);
struct wlr_xdg_surface *wlr_xdg_surface_from_wlr_surface(
struct wlr_surface *surface);
+/**
+ * Call `iterator` on each surface in the xdg-surface tree, with the surface's
+ * positon relative to the root xdg-surface. The function is called from root to
+ * leaves (in rendering order).
+ */
+void wlr_xdg_surface_for_each_surface(struct wlr_xdg_surface *surface,
+ wlr_surface_iterator_func_t iterator, void *user_data);
+
#endif
diff --git a/include/wlr/types/wlr_xdg_shell_v6.h b/include/wlr/types/wlr_xdg_shell_v6.h
index b646f3fe..337d96ab 100644
--- a/include/wlr/types/wlr_xdg_shell_v6.h
+++ b/include/wlr/types/wlr_xdg_shell_v6.h
@@ -294,4 +294,12 @@ bool wlr_surface_is_xdg_surface_v6(struct wlr_surface *surface);
struct wlr_xdg_surface_v6 *wlr_xdg_surface_v6_from_wlr_surface(
struct wlr_surface *surface);
+/**
+ * Call `iterator` on each surface in the xdg-surface tree, with the surface's
+ * positon relative to the root xdg-surface. The function is called from root to
+ * leaves (in rendering order).
+ */
+void wlr_xdg_surface_v6_for_each_surface(struct wlr_xdg_surface_v6 *surface,
+ wlr_surface_iterator_func_t iterator, void *user_data);
+
#endif