aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/wlr/types/wlr_surface.h2
-rw-r--r--rootston/desktop.c2
-rw-r--r--types/wlr_surface.c15
3 files changed, 10 insertions, 9 deletions
diff --git a/include/wlr/types/wlr_surface.h b/include/wlr/types/wlr_surface.h
index 6ece247a..380e5e03 100644
--- a/include/wlr/types/wlr_surface.h
+++ b/include/wlr/types/wlr_surface.h
@@ -128,7 +128,7 @@ struct wlr_surface *wlr_surface_get_root_surface(struct wlr_surface *surface);
/**
* Check if the surface accepts input events at the given surface-local
- * coordinates.
+ * coordinates. Does not check the surface's subsurfaces.
*/
bool wlr_surface_point_accepts_input(struct wlr_surface *surface,
double sx, double sy);
diff --git a/rootston/desktop.c b/rootston/desktop.c
index 60426474..cfeb809b 100644
--- a/rootston/desktop.c
+++ b/rootston/desktop.c
@@ -608,7 +608,7 @@ static bool view_at(struct roots_view *view, double lx, double ly,
double _sx, _sy;
struct wlr_surface *_surface = wlr_surface_surface_at(view->wlr_surface,
view_sx, view_sy, &_sx, &_sy);
- if (surface != NULL) {
+ if (_surface != NULL) {
*sx = _sx;
*sy = _sy;
*surface = _surface;
diff --git a/types/wlr_surface.c b/types/wlr_surface.c
index ddcf86f8..4d2a20e7 100644
--- a/types/wlr_surface.c
+++ b/types/wlr_surface.c
@@ -137,6 +137,7 @@ static void surface_set_input_region(struct wl_client *client,
pixman_region32_t *region = wlr_region_from_resource(region_resource);
pixman_region32_copy(&surface->pending->input, region);
} else {
+ pixman_region32_fini(&surface->pending->input);
pixman_region32_init_rect(&surface->pending->input,
INT32_MIN, INT32_MIN, UINT32_MAX, UINT32_MAX);
}
@@ -879,6 +880,13 @@ struct wlr_surface *wlr_surface_get_root_surface(struct wlr_surface *surface) {
return NULL;
}
+bool wlr_surface_point_accepts_input(struct wlr_surface *surface,
+ double sx, double sy) {
+ return sx >= 0 && sx <= surface->current->width &&
+ sy >= 0 && sy <= surface->current->height &&
+ pixman_region32_contains_point(&surface->current->input, sx, sy, NULL);
+}
+
struct wlr_surface *wlr_surface_surface_at(struct wlr_surface *surface,
double sx, double sy, double *sub_x, double *sub_y) {
struct wlr_subsurface *subsurface;
@@ -943,10 +951,3 @@ void wlr_surface_set_role_committed(struct wlr_surface *surface,
surface->role_committed = role_committed;
surface->role_data = role_data;
}
-
-bool wlr_surface_point_accepts_input(struct wlr_surface *surface,
- double sx, double sy) {
- return sx >= 0 && sx <= surface->current->width &&
- sy >= 0 && sy <= surface->current->height &&
- pixman_region32_contains_point(&surface->current->input, sx, sy, NULL);
-}