From a48a149c6145592395dc3647b4b86da67f33f70d Mon Sep 17 00:00:00 2001 From: Carlos Garnacho Date: Mon, 17 Jun 2024 20:33:37 +0200 Subject: [PATCH] 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: --- src/backends/meta-viewport-info.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/backends/meta-viewport-info.c b/src/backends/meta-viewport-info.c index 0e7c0a2b9..37481bf47 100644 --- a/src/backends/meta-viewport-info.c +++ b/src/backends/meta-viewport-info.c @@ -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; }