backends/native: Allow infinitely small pointer constraint regions
The small catch is that MtkRegion (and pixman regions) "optimize away" 0-size rectangles, so a 0-sized region will always be seen as having a 0,0 origin. We don't want that, so transfer the origin separately from the region. While at it, make the Wayland pointer lock use one such 0-size region, to avoid the 1x1px wiggle room that it currently has (accounting for subpixel motion). Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3420>
This commit is contained in:

committed by
Robert Mader

parent
c931ed0d81
commit
07d24fe502
@ -48,6 +48,7 @@ struct _MetaPointerConstraint
|
||||
{
|
||||
GObject parent_instance;
|
||||
MtkRegion *region;
|
||||
graphene_point_t origin;
|
||||
double min_edge_distance;
|
||||
};
|
||||
|
||||
@ -81,21 +82,27 @@ meta_pointer_constraint_class_init (MetaPointerConstraintClass *klass)
|
||||
|
||||
|
||||
MetaPointerConstraint *
|
||||
meta_pointer_constraint_new (const MtkRegion *region,
|
||||
double min_edge_distance)
|
||||
meta_pointer_constraint_new (const MtkRegion *region,
|
||||
graphene_point_t origin,
|
||||
double min_edge_distance)
|
||||
{
|
||||
MetaPointerConstraint *constraint;
|
||||
|
||||
constraint = g_object_new (META_TYPE_POINTER_CONSTRAINT, NULL);
|
||||
constraint->region = mtk_region_copy (region);
|
||||
constraint->origin = origin;
|
||||
constraint->min_edge_distance = min_edge_distance;
|
||||
|
||||
return constraint;
|
||||
}
|
||||
|
||||
MtkRegion *
|
||||
meta_pointer_constraint_get_region (MetaPointerConstraint *constraint)
|
||||
meta_pointer_constraint_get_region (MetaPointerConstraint *constraint,
|
||||
graphene_point_t *origin)
|
||||
{
|
||||
if (origin)
|
||||
*origin = constraint->origin;
|
||||
|
||||
return constraint->region;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user