diff --git a/include/wlr/types/wlr_surface.h b/include/wlr/types/wlr_surface.h index f33ac5b1..ae3ae80f 100644 --- a/include/wlr/types/wlr_surface.h +++ b/include/wlr/types/wlr_surface.h @@ -233,7 +233,8 @@ bool wlr_surface_point_accepts_input(struct wlr_surface *surface, double sx, double sy); /** - * Find a surface in this surface's tree that accepts input events at the given + * Find a surface in this surface's tree that accepts input events and has all + * parents mapped (except this surface, which can be unmapped) at the given * surface-local coordinates. Returns the surface and coordinates in the leaf * surface coordinate system or NULL if no surface is found at that location. */ diff --git a/types/wlr_layer_shell_v1.c b/types/wlr_layer_shell_v1.c index a79cc956..82894c87 100644 --- a/types/wlr_layer_shell_v1.c +++ b/types/wlr_layer_shell_v1.c @@ -541,6 +541,9 @@ struct wlr_surface *wlr_layer_surface_v1_popup_surface_at( 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->mapped) { + continue; + } double popup_sx = popup_state->geometry.x - popup->current.geometry.x; double popup_sy = popup_state->geometry.y - popup->current.geometry.y; diff --git a/types/wlr_surface.c b/types/wlr_surface.c index f481155a..ffc77547 100644 --- a/types/wlr_surface.c +++ b/types/wlr_surface.c @@ -1204,6 +1204,10 @@ struct wlr_surface *wlr_surface_surface_at(struct wlr_surface *surface, struct wlr_subsurface *subsurface; wl_list_for_each_reverse(subsurface, &surface->current.subsurfaces_above, current.link) { + if (!subsurface->mapped) { + continue; + } + double _sub_x = subsurface->current.x; double _sub_y = subsurface->current.y; struct wlr_surface *sub = wlr_surface_surface_at(subsurface->surface, @@ -1225,6 +1229,10 @@ struct wlr_surface *wlr_surface_surface_at(struct wlr_surface *surface, wl_list_for_each_reverse(subsurface, &surface->current.subsurfaces_below, current.link) { + if (!subsurface->mapped) { + continue; + } + double _sub_x = subsurface->current.x; double _sub_y = subsurface->current.y; struct wlr_surface *sub = wlr_surface_surface_at(subsurface->surface, diff --git a/types/xdg_shell/wlr_xdg_surface.c b/types/xdg_shell/wlr_xdg_surface.c index d020e53d..519dad52 100644 --- a/types/xdg_shell/wlr_xdg_surface.c +++ b/types/xdg_shell/wlr_xdg_surface.c @@ -549,6 +549,9 @@ struct wlr_surface *wlr_xdg_surface_popup_surface_at( 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->mapped) { + continue; + } double popup_sx, popup_sy; wlr_xdg_popup_get_position(popup_state, &popup_sx, &popup_sy);