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:
Carlos Garnacho
2023-11-17 18:15:27 +01:00
committed by Robert Mader
parent c931ed0d81
commit 07d24fe502
7 changed files with 47 additions and 15 deletions

View File

@ -32,10 +32,12 @@ G_BEGIN_DECLS
G_DECLARE_FINAL_TYPE (MetaPointerConstraint, meta_pointer_constraint,
META, POINTER_CONSTRAINT, GObject);
MetaPointerConstraint * meta_pointer_constraint_new (const MtkRegion *region,
double min_edge_distance);
MetaPointerConstraint * meta_pointer_constraint_new (const MtkRegion *region,
graphene_point_t origin,
double min_edge_distance);
MtkRegion * meta_pointer_constraint_get_region (MetaPointerConstraint *constraint);
MtkRegion * meta_pointer_constraint_get_region (MetaPointerConstraint *constraint,
graphene_point_t *origin);
double meta_pointer_constraint_get_min_edge_distance (MetaPointerConstraint *constraint);