Use wlr_surface_point_accepts_input

master
Drew DeVault 7 years ago
parent 4b0fcde778
commit 212b503992

@ -30,16 +30,8 @@ static struct wlr_surface *layer_surface_at(struct sway_output *output,
sway_layer->layer_surface->surface; sway_layer->layer_surface->surface;
double _sx = ox - sway_layer->geo.x; double _sx = ox - sway_layer->geo.x;
double _sy = oy - sway_layer->geo.y; double _sy = oy - sway_layer->geo.y;
struct wlr_box box = {
.x = sway_layer->geo.x,
.y = sway_layer->geo.y,
.width = wlr_surface->current->width,
.height = wlr_surface->current->height,
};
// TODO: Test popups/subsurfaces // TODO: Test popups/subsurfaces
if (wlr_box_contains_point(&box, ox, oy) && if (wlr_surface_point_accepts_input(wlr_surface, _sx, _sy)) {
pixman_region32_contains_point(
&wlr_surface->current->input, _sx, _sy, NULL)) {
*sx = _sx; *sx = _sx;
*sy = _sy; *sy = _sy;
return wlr_surface; return wlr_surface;

@ -290,8 +290,6 @@ struct sway_container *container_at(struct sway_container *parent,
double oy = ly - output_box->y; double oy = ly - output_box->y;
double view_sx = ox - swayc->x; double view_sx = ox - swayc->x;
double view_sy = oy - swayc->y; double view_sy = oy - swayc->y;
int width = swayc->sway_view->surface->current->width;
int height = swayc->sway_view->surface->current->height;
switch (sview->type) { switch (sview->type) {
case SWAY_WL_SHELL_VIEW: case SWAY_WL_SHELL_VIEW:
@ -333,11 +331,8 @@ struct sway_container *container_at(struct sway_container *parent,
return swayc; return swayc;
} }
if (view_sx > 0 && view_sx < width && if (wlr_surface_point_accepts_input(
view_sy > 0 && view_sy < height && sview->surface, view_sx, view_sy)) {
pixman_region32_contains_point(
&sview->surface->current->input,
view_sx, view_sy, NULL)) {
*sx = view_sx; *sx = view_sx;
*sy = view_sy; *sy = view_sy;
*surface = swayc->sway_view->surface; *surface = swayc->sway_view->surface;

Loading…
Cancel
Save