1
0
Fork 0

backends: Use floating point checks in MetaViewportInfo

In these checks, it's an important detail to preserve subpixel information
in order to correctly determine whether the coordinates are inside or
outside a view.

Otherwise, small enough motion towards the left/top might get rounded
to 0, be seen as "inside the view", and the pointer coordinates be allowed
to escape the viewport constraints.

This was figured out by Pascal Nowack before me, with a difference of
minutes. Credit where credit is due.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/3530
Fixes: 6c972546f1 ("mtk: Add Rectangle.contains_point")
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3820>
This commit is contained in:
Carlos Garnacho 2024-06-17 20:33:37 +02:00
parent 32cb2ee720
commit a48a149c61

View file

@ -100,7 +100,7 @@ meta_viewport_info_get_view_at (MetaViewportInfo *viewport_info,
{
ViewInfo *info = &g_array_index (viewport_info->views, ViewInfo, i);
if (mtk_rectangle_contains_point (&info->rect, x, y))
if (mtk_rectangle_contains_pointf (&info->rect, x, y))
return i;
}