Skip to content
This repository has been archived by the owner on Nov 1, 2021. It is now read-only.

Commit

Permalink
Add wlr_surface_point_accepts_input
Browse files Browse the repository at this point in the history
  • Loading branch information
ddevault committed Mar 31, 2018
1 parent 2053a4c commit ac445d5
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
3 changes: 3 additions & 0 deletions include/wlr/types/wlr_surface.h
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,9 @@ struct wlr_surface *wlr_surface_get_main_surface(struct wlr_surface *surface);
struct wlr_subsurface *wlr_surface_subsurface_at(struct wlr_surface *surface,
double sx, double sy, double *sub_x, double *sub_y);

bool wlr_surface_point_accepts_input(
struct wlr_surface *surface, double sx, double sy);

void wlr_surface_send_enter(struct wlr_surface *surface,
struct wlr_output *output);

Expand Down
7 changes: 3 additions & 4 deletions rootston/desktop.c
Original file line number Diff line number Diff line change
Expand Up @@ -623,8 +623,8 @@ static bool view_at(struct roots_view *view, double lx, double ly,
}

if (wlr_box_contains_point(&box, view_sx, view_sy) &&
pixman_region32_contains_point(&view->wlr_surface->current->input,
view_sx, view_sy, NULL)) {
wlr_surface_point_accepts_input(view->wlr_surface,
view_sx, view_sy)) {
*sx = view_sx;
*sy = view_sy;
*surface = view->wlr_surface;
Expand Down Expand Up @@ -676,8 +676,7 @@ static struct wlr_surface *layer_surface_at(struct roots_output *output,
};
// TODO: Test popups/subsurfaces
if (wlr_box_contains_point(&box, ox, oy) &&
pixman_region32_contains_point(&wlr_surface->current->input,
_sx, _sy, NULL)) {
wlr_surface_point_accepts_input(wlr_surface, _sx, _sy)) {
*sx = _sx;
*sy = _sy;
return wlr_surface;
Expand Down
6 changes: 6 additions & 0 deletions types/wlr_surface.c
Original file line number Diff line number Diff line change
Expand Up @@ -952,3 +952,9 @@ 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 pixman_region32_contains_point(
&surface->current->input, sx, sy, NULL);
}

0 comments on commit ac445d5

Please sign in to comment.