rootston: fix view_at

This commit is contained in:
emersion 2018-04-04 17:16:35 -04:00
parent d16127b3cb
commit 1a8b24bdd2
No known key found for this signature in database
GPG key ID: 0FDE7BE0E88F5E48
3 changed files with 10 additions and 9 deletions

View file

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

View file

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

View file

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