From nobody Sat Nov 23 20:02:59 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass header.i=@intel.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1730772740; cv=none; d=zohomail.com; s=zohoarc; b=jrnEfpPc4Aea1fgqUa7krtJRiChooiCoBIGJsp+Dx9SHCXcWeOjAk+BfgiO7kYW6TUcR2TY5wNNW/OfZNYjCWQ+6zPwKsEtIx6QqwVWkOKMRztId97logOuQ6nPBIxHDi7SbxCtDe8szHSe1I3bLn3TbPxPqPgTdRRKkoiL33b0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1730772740; h=Content-Type:Content-Transfer-Encoding:Date:Date:From:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To:Cc; bh=n2L42JIBfUy/ooMlcP8Ubew5xLOH51TXghM9DBD1IFQ=; b=dqK91RiPzArCjwqsED6tGuT0jy5zSrZAjHkyuoTQVQ/LCzdtGXdN4rq5nW6JRuunbBmJ0MsOUeh3sQPzJvBwoWSHwe4CNSpp6eawAM2KZIbhv+luC9z3Cnx7/lXWs4XDdlvlHhlCrHwFacyy5m5lB4g3DR9N3gwcXUghdAQ2WUc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=@intel.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1730772740315320.982953071599; Mon, 4 Nov 2024 18:12:20 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t892k-0000au-IL; Mon, 04 Nov 2024 21:11:42 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1t892h-0000aU-V1 for qemu-devel@nongnu.org; Mon, 04 Nov 2024 21:11:40 -0500 Received: from mgamail.intel.com ([198.175.65.17]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1t892e-0000aZ-4f for qemu-devel@nongnu.org; Mon, 04 Nov 2024 21:11:39 -0500 Received: from fmviesa008.fm.intel.com ([10.60.135.148]) by orvoesa109.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Nov 2024 18:11:31 -0800 Received: from dongwonk-z390-aorus-ultra.fm.intel.com ([10.105.129.124]) by fmviesa008.fm.intel.com with ESMTP; 04 Nov 2024 18:11:32 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1730772696; x=1762308696; h=from:to:subject:date:message-id:mime-version: content-transfer-encoding; bh=FGLY++qk3h6l1yvhDRbUMzqAFGoYNV6mNXSuhxvTMVM=; b=nPbvR2OSWs4FvuCj8KbKgRxmJvgsUqkus04lvA98aOBJzRot7b3M9OGz rLOeob7c+Z0RW3TJ+v8qPd63hVsUzArZHHOxWh3c/6v2zzsHHWFAzvtno 6saOcmIfuddOLTcfbcsHeQg8ODGMqVAOhuIHaOS5+vlETlRymkMXigcQf +7ns4bExgliZt41Fb5sd8pAo66YjUJyYRG5FNBaSXeKrInYX1Hq8yoZjk yLhkVIDpL6/bJn9/fIZpTBE5sEOHwO5lnCbfpfbaGPmp/RZwpXaCSS9UJ 487RV8t1dcrTs69fg5csTtIlZwcIgsuaYonAr78wpkz+ozb4i7/T0hBs2 g==; X-CSE-ConnectionGUID: uDJ+v+DZSxuY5CdMUuF3zw== X-CSE-MsgGUID: E/O+Aj95SA2jTyz0HXh2hQ== X-IronPort-AV: E=McAfee;i="6700,10204,11246"; a="30613131" X-IronPort-AV: E=Sophos;i="6.11,258,1725346800"; d="scan'208";a="30613131" X-CSE-ConnectionGUID: tXQUA1CvSn2zp93F1Anu5w== X-CSE-MsgGUID: y6v8JBRDQMq4FKHgs95nuw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.11,258,1725346800"; d="scan'208";a="83950167" From: dongwon.kim@intel.com To: qemu-devel@nongnu.org Subject: [PATCH] ui/gtk: Consider the scaling factor when getting the root coordinates Date: Mon, 4 Nov 2024 18:09:29 -0800 Message-Id: <20241105020929.3982540-1-dongwon.kim@intel.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=198.175.65.17; envelope-from=dongwon.kim@intel.com; helo=mgamail.intel.com X-Spam_score_int: -46 X-Spam_score: -4.7 X-Spam_bar: ---- X-Spam_report: (-4.7 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.34, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @intel.com) X-ZM-MESSAGEID: 1730772742755116600 From: Vivek Kasireddy Since gdk_window_get_root_coords() expects a position within the window, we need to translate Guest's cooridinates to window local coordinates by multiplying them with the scaling factor. Cc: Marc-Andr=C3=A9 Lureau Signed-off-by: Vivek Kasireddy Signed-off-by: Dongwon Kim --- ui/gtk.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ui/gtk.c b/ui/gtk.c index 8e14c2ac81..5009db59eb 100644 --- a/ui/gtk.c +++ b/ui/gtk.c @@ -459,7 +459,8 @@ static void gd_mouse_set(DisplayChangeListener *dcl, =20 dpy =3D gtk_widget_get_display(vc->gfx.drawing_area); gdk_window_get_root_coords(gtk_widget_get_window(vc->gfx.drawing_area), - x, y, &x_root, &y_root); + x * vc->gfx.scale_x, y * vc->gfx.scale_y, + &x_root, &y_root); gdk_device_warp(gd_get_pointer(dpy), gtk_widget_get_screen(vc->gfx.drawing_area), x_root, y_root); --=20 2.34.1