mirror of
https://github.com/hyprwm/wlroots-hyprland.git
synced 2024-11-26 06:35:58 +01:00
for_each_surface: only iterate mapped surfaces
These functions are used mostly for rendering, where including unmapped surfaces is undesired. This is a breaking change. However, few to no usages will have to be updated.
This commit is contained in:
parent
dc3d1530bf
commit
893434b2d4
6 changed files with 25 additions and 12 deletions
|
@ -143,7 +143,10 @@ bool wlr_surface_is_layer_surface(struct wlr_surface *surface);
|
||||||
struct wlr_layer_surface_v1 *wlr_layer_surface_v1_from_wlr_surface(
|
struct wlr_layer_surface_v1 *wlr_layer_surface_v1_from_wlr_surface(
|
||||||
struct wlr_surface *surface);
|
struct wlr_surface *surface);
|
||||||
|
|
||||||
/* Calls the iterator function for each sub-surface and popup of this surface */
|
/**
|
||||||
|
* Calls the iterator function for each mapped sub-surface and popup of this
|
||||||
|
* surface (whether or not this surface is mapped).
|
||||||
|
*/
|
||||||
void wlr_layer_surface_v1_for_each_surface(struct wlr_layer_surface_v1 *surface,
|
void wlr_layer_surface_v1_for_each_surface(struct wlr_layer_surface_v1 *surface,
|
||||||
wlr_surface_iterator_func_t iterator, void *user_data);
|
wlr_surface_iterator_func_t iterator, void *user_data);
|
||||||
|
|
||||||
|
|
|
@ -264,9 +264,9 @@ void wlr_surface_get_extends(struct wlr_surface *surface, struct wlr_box *box);
|
||||||
struct wlr_surface *wlr_surface_from_resource(struct wl_resource *resource);
|
struct wlr_surface *wlr_surface_from_resource(struct wl_resource *resource);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Call `iterator` on each surface in the surface tree, with the surface's
|
* Call `iterator` on each mapped surface in the surface tree (whether or not
|
||||||
* position relative to the root surface. The function is called from root to
|
* this surface is mapped), with the surface's position relative to the root
|
||||||
* leaves (in rendering order).
|
* surface. The function is called from root to leaves (in rendering order).
|
||||||
*/
|
*/
|
||||||
void wlr_surface_for_each_surface(struct wlr_surface *surface,
|
void wlr_surface_for_each_surface(struct wlr_surface *surface,
|
||||||
wlr_surface_iterator_func_t iterator, void *user_data);
|
wlr_surface_iterator_func_t iterator, void *user_data);
|
||||||
|
|
|
@ -413,17 +413,19 @@ void wlr_xdg_surface_get_geometry(struct wlr_xdg_surface *surface,
|
||||||
struct wlr_box *box);
|
struct wlr_box *box);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Call `iterator` on each surface and popup in the xdg-surface tree, with the
|
* Call `iterator` on each mapped surface and popup in the xdg-surface tree
|
||||||
* surface's position relative to the root xdg-surface. The function is called
|
* (whether or not this xdg-surface is mapped), with the surface's position
|
||||||
* from root to leaves (in rendering order).
|
* 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,
|
void wlr_xdg_surface_for_each_surface(struct wlr_xdg_surface *surface,
|
||||||
wlr_surface_iterator_func_t iterator, void *user_data);
|
wlr_surface_iterator_func_t iterator, void *user_data);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Call `iterator` on each popup's surface and popup's subsurface in the
|
* Call `iterator` on each mapped popup's surface and popup's subsurface in the
|
||||||
* xdg-surface tree, with the surfaces's position relative to the root
|
* xdg-surface tree (whether or not this xdg-surface is mapped), with the
|
||||||
* xdg-surface. The function is called from root to leaves (in rendering order).
|
* surfaces's position relative to the root xdg-surface. The function is called
|
||||||
|
* from root to leaves (in rendering order).
|
||||||
*/
|
*/
|
||||||
void wlr_xdg_surface_for_each_popup_surface(struct wlr_xdg_surface *surface,
|
void wlr_xdg_surface_for_each_popup_surface(struct wlr_xdg_surface *surface,
|
||||||
wlr_surface_iterator_func_t iterator, void *user_data);
|
wlr_surface_iterator_func_t iterator, void *user_data);
|
||||||
|
|
|
@ -506,7 +506,7 @@ void wlr_layer_surface_v1_for_each_popup_surface(struct wlr_layer_surface_v1 *su
|
||||||
struct wlr_xdg_popup *popup_state;
|
struct wlr_xdg_popup *popup_state;
|
||||||
wl_list_for_each(popup_state, &surface->popups, link) {
|
wl_list_for_each(popup_state, &surface->popups, link) {
|
||||||
struct wlr_xdg_surface *popup = popup_state->base;
|
struct wlr_xdg_surface *popup = popup_state->base;
|
||||||
if (!popup->configured) {
|
if (!popup->configured || !popup->mapped) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1331,6 +1331,10 @@ static void surface_for_each_surface(struct wlr_surface *surface, int x, int y,
|
||||||
wlr_surface_iterator_func_t iterator, void *user_data) {
|
wlr_surface_iterator_func_t iterator, void *user_data) {
|
||||||
struct wlr_subsurface *subsurface;
|
struct wlr_subsurface *subsurface;
|
||||||
wl_list_for_each(subsurface, &surface->current.subsurfaces_below, current.link) {
|
wl_list_for_each(subsurface, &surface->current.subsurfaces_below, current.link) {
|
||||||
|
if (!subsurface->mapped) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
struct wlr_subsurface_parent_state *state = &subsurface->current;
|
struct wlr_subsurface_parent_state *state = &subsurface->current;
|
||||||
int sx = state->x;
|
int sx = state->x;
|
||||||
int sy = state->y;
|
int sy = state->y;
|
||||||
|
@ -1342,6 +1346,10 @@ static void surface_for_each_surface(struct wlr_surface *surface, int x, int y,
|
||||||
iterator(surface, x, y, user_data);
|
iterator(surface, x, y, user_data);
|
||||||
|
|
||||||
wl_list_for_each(subsurface, &surface->current.subsurfaces_above, current.link) {
|
wl_list_for_each(subsurface, &surface->current.subsurfaces_above, current.link) {
|
||||||
|
if (!subsurface->mapped) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
struct wlr_subsurface_parent_state *state = &subsurface->current;
|
struct wlr_subsurface_parent_state *state = &subsurface->current;
|
||||||
int sx = state->x;
|
int sx = state->x;
|
||||||
int sy = state->y;
|
int sy = state->y;
|
||||||
|
|
|
@ -583,7 +583,7 @@ static void xdg_surface_for_each_popup_surface(struct wlr_xdg_surface *surface,
|
||||||
struct wlr_xdg_popup *popup_state;
|
struct wlr_xdg_popup *popup_state;
|
||||||
wl_list_for_each(popup_state, &surface->popups, link) {
|
wl_list_for_each(popup_state, &surface->popups, link) {
|
||||||
struct wlr_xdg_surface *popup = popup_state->base;
|
struct wlr_xdg_surface *popup = popup_state->base;
|
||||||
if (!popup->configured) {
|
if (!popup->configured || !popup->mapped) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue