Merge pull request #825 from emersion/surface-iterators

Add surface iterators
This commit is contained in:
Drew DeVault 2018-04-05 23:06:29 -04:00 committed by GitHub
commit ae4cef9e41
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 303 additions and 158 deletions

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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