surface_at: check if surfaces are mapped

This commit is contained in:
tiosgz 2021-09-28 10:51:10 +00:00 committed by Simon Ser
parent 893434b2d4
commit ce66244fd2
4 changed files with 16 additions and 1 deletions

View file

@ -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.
*/

View file

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

View file

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

View file

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