mirror of
https://github.com/brl/mutter.git
synced 2024-12-25 12:32:05 +00:00
clutter: Honor pick vmethod rectangle during region caching
We retrieve the picked actor's allocation for figuring out the pick cache clear area, but don't take into account that the pick vmethod might have returned a different area for it. Make sure to honor that rectangle, as that is what is accounted as the input region. Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2135 Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2283>
This commit is contained in:
parent
dcba417b8a
commit
13c77c55e8
@ -453,8 +453,8 @@ get_verts_rectangle (graphene_point3d_t verts[4],
|
||||
|
||||
static void
|
||||
calculate_clear_area (ClutterPickStack *pick_stack,
|
||||
PickRecord *pick_rec,
|
||||
int elem,
|
||||
ClutterActor *actor,
|
||||
cairo_region_t **clear_area)
|
||||
{
|
||||
cairo_region_t *area = NULL;
|
||||
@ -462,7 +462,7 @@ calculate_clear_area (ClutterPickStack *pick_stack,
|
||||
cairo_rectangle_int_t rect;
|
||||
int i;
|
||||
|
||||
clutter_actor_get_abs_allocation_vertices (actor,
|
||||
clutter_actor_get_abs_allocation_vertices (pick_rec->actor,
|
||||
(graphene_point3d_t *) &verts);
|
||||
if (!get_verts_rectangle (verts, &rect))
|
||||
{
|
||||
@ -471,6 +471,13 @@ calculate_clear_area (ClutterPickStack *pick_stack,
|
||||
return;
|
||||
}
|
||||
|
||||
rect.x += ceil (pick_rec->base.rect.x1);
|
||||
rect.y += ceil (pick_rec->base.rect.y1);
|
||||
rect.width =
|
||||
MIN (rect.width, floor (pick_rec->base.rect.x2 - pick_rec->base.rect.x1));
|
||||
rect.height =
|
||||
MIN (rect.height, floor (pick_rec->base.rect.y2 - pick_rec->base.rect.y1));
|
||||
|
||||
area = cairo_region_create_rectangle (&rect);
|
||||
|
||||
for (i = elem + 1; i < pick_stack->vertices_stack->len; i++)
|
||||
@ -521,7 +528,7 @@ clutter_pick_stack_search_actor (ClutterPickStack *pick_stack,
|
||||
ray_intersects_record (pick_stack, rec, point, ray))
|
||||
{
|
||||
if (clear_area)
|
||||
calculate_clear_area (pick_stack, i, rec->actor, clear_area);
|
||||
calculate_clear_area (pick_stack, rec, i, clear_area);
|
||||
return rec->actor;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user