aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortiosgz <alamica@protonmail.com>2021-09-28 10:51:10 +0000
committerSimon Ser <contact@emersion.fr>2021-10-02 11:38:40 +0200
commitce66244fd2fefed00094d0f1e46fff8e8660c184 (patch)
tree6126bad52dfdef3bc6500a114c240f3006c39179
parent893434b2d4d2929636189ce45ba2e04dfd73817f (diff)
surface_at: check if surfaces are mapped
-rw-r--r--include/wlr/types/wlr_surface.h3
-rw-r--r--types/wlr_layer_shell_v1.c3
-rw-r--r--types/wlr_surface.c8
-rw-r--r--types/xdg_shell/wlr_xdg_surface.c3
4 files changed, 16 insertions, 1 deletions
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);