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:
tiosgz 2021-09-25 16:40:12 +00:00 committed by Simon Ser
parent dc3d1530bf
commit 893434b2d4
6 changed files with 25 additions and 12 deletions

View file

@ -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;
wl_list_for_each(popup_state, &surface->popups, link) {
struct wlr_xdg_surface *popup = popup_state->base;
if (!popup->configured) {
if (!popup->configured || !popup->mapped) {
continue;
}

View file

@ -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) {
struct wlr_subsurface *subsurface;
wl_list_for_each(subsurface, &surface->current.subsurfaces_below, current.link) {
if (!subsurface->mapped) {
continue;
}
struct wlr_subsurface_parent_state *state = &subsurface->current;
int sx = state->x;
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);
wl_list_for_each(subsurface, &surface->current.subsurfaces_above, current.link) {
if (!subsurface->mapped) {
continue;
}
struct wlr_subsurface_parent_state *state = &subsurface->current;
int sx = state->x;
int sy = state->y;

View file

@ -583,7 +583,7 @@ static void xdg_surface_for_each_popup_surface(struct wlr_xdg_surface *surface,
struct wlr_xdg_popup *popup_state;
wl_list_for_each(popup_state, &surface->popups, link) {
struct wlr_xdg_surface *popup = popup_state->base;
if (!popup->configured) {
if (!popup->configured || !popup->mapped) {
continue;
}