From d533773cf702ac2ac9be68bb095cc1b446083dba Mon Sep 17 00:00:00 2001 From: Christian Hergert Date: Wed, 15 Feb 2023 18:02:51 -0800 Subject: [PATCH] lib: fix absolute x,y mouse position --- lib/mks-display.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/mks-display.c b/lib/mks-display.c index 788add1..1f3de00 100644 --- a/lib/mks-display.c +++ b/lib/mks-display.c @@ -390,8 +390,8 @@ mks_display_legacy_event_cb (MksDisplay *self, if (graphene_rect_contains_point (&area, &GRAPHENE_POINT_INIT (x, y))) { - double guest_x = floor (x) / area.size.width * guest_width; - double guest_y = floor (y) / area.size.height * guest_height; + double guest_x = floor (x - area.origin.x) / area.size.width * guest_width; + double guest_y = floor (y - area.origin.y) / area.size.height * guest_height; if (guest_x < 0 || guest_y < 0 || guest_x >= guest_width || guest_y >= guest_height)