aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorDrew DeVault <sir@cmpwn.com>2018-04-05 23:06:29 -0400
committerGitHub <noreply@github.com>2018-04-05 23:06:29 -0400
commitae4cef9e4189bddee5c7d8bd0e0e99c0bed43ea5 (patch)
tree4d9b3e4056835b52e219166d287a374a7a2049ad /include
parent87eb10c84978cbd684e6df2024bcbf33a4db515e (diff)
parent285cf12e37bac8bb15498c132095e98aa29deb93 (diff)
Merge pull request #825 from emersion/surface-iterators
Add surface iterators
Diffstat (limited to 'include')
-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