input: Convert weston_view_takes_input_at_point to weston_coord

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
This commit is contained in:
Derek Foreman 2023-02-06 16:05:42 -06:00 committed by Pekka Paalanen
parent c3cd8306c9
commit b6ec770595
3 changed files with 11 additions and 11 deletions

View file

@ -1981,15 +1981,18 @@ weston_compositor_get_time(struct timespec *time)
}
bool
weston_view_takes_input_at_point(struct weston_view *view, int x, int y)
weston_view_takes_input_at_point(struct weston_view *view,
struct weston_coord_surface pos)
{
assert(pos.coordinate_space_id == view->surface);
if (!pixman_region32_contains_point(&view->surface->input,
x, y, NULL))
pos.c.x, pos.c.y, NULL))
return false;
if (view->geometry.scissor_enabled &&
!pixman_region32_contains_point(&view->geometry.scissor,
x, y, NULL))
pos.c.x, pos.c.y, NULL))
return false;
return true;
@ -2015,7 +2018,7 @@ weston_compositor_pick_view(struct weston_compositor *compositor,
continue;
surf_pos = weston_coord_global_to_surface(view, pos);
if (!weston_view_takes_input_at_point(view, surf_pos.c.x, surf_pos.c.y))
if (!weston_view_takes_input_at_point(view, surf_pos))
continue;
return view;

View file

@ -1464,18 +1464,14 @@ weston_pointer_set_focus(struct weston_pointer *pointer,
if (view) {
struct weston_coord_global tmp_g;
struct weston_coord_surface surf_pos;
int ix;
int iy;
tmp_g.c = weston_coord_from_fixed(pointer->x, pointer->y);
surf_pos = weston_coord_global_to_surface(view, tmp_g);
sx = wl_fixed_from_double(surf_pos.c.x);
sy = wl_fixed_from_double(surf_pos.c.y);
ix = wl_fixed_to_int(sx);
iy = wl_fixed_to_int(sy);
if (!weston_view_takes_input_at_point(view, ix, iy))
if (!weston_view_takes_input_at_point(view, surf_pos))
weston_log("View focused with external coordinate %d, %d\n",
ix, iy);
(int)surf_pos.c.x, (int)surf_pos.c.y);
}
if ((!pointer->focus && view) ||

View file

@ -383,7 +383,8 @@ weston_view_matches_output_entirely(struct weston_view *ev,
struct weston_output *output);
bool
weston_view_takes_input_at_point(struct weston_view *view, int x, int y);
weston_view_takes_input_at_point(struct weston_view *view,
struct weston_coord_surface surf_pos);
void
weston_view_move_to_plane(struct weston_view *view,