From nobody Thu Nov 6 10:31:26 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1540979129285638.9274850480757; Wed, 31 Oct 2018 02:45:29 -0700 (PDT) Received: from localhost ([::1]:58259 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gHn44-0000oL-Ac for importer@patchew.org; Wed, 31 Oct 2018 05:45:28 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60660) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gHjwt-0000Jd-Pf for qemu-devel@nongnu.org; Wed, 31 Oct 2018 02:25:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gHjwp-0001rB-VD for qemu-devel@nongnu.org; Wed, 31 Oct 2018 02:25:51 -0400 Received: from ms11p00im-qufv17100101.me.com ([17.58.37.19]:47626) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gHjwn-0001mO-TA for qemu-devel@nongnu.org; Wed, 31 Oct 2018 02:25:47 -0400 Received: from process-dkim-sign-daemon.ms11p00im-qufv17100101.me.com by ms11p00im-qufv17100101.me.com (Oracle Communications Messaging Server 8.0.2.2.20180531 64bit (built May 31 2018)) id <0PHG003009HOT900@ms11p00im-qufv17100101.me.com> for qemu-devel@nongnu.org; Wed, 31 Oct 2018 06:25:29 +0000 (GMT) Received: from localhost (pv33p36im-webms003.me.com [17.142.221.25]) by ms11p00im-qufv17100101.me.com (Oracle Communications Messaging Server 8.0.2.2.20180531 64bit (built May 31 2018)) with ESMTP id <0PHG002YS9UESR20@ms11p00im-qufv17100101.me.com>; Wed, 31 Oct 2018 06:25:29 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=icloud.com; s=04042017; t=1540967129; bh=xwzuGh1hHSkZ6VszEvKEffCCB7B4ln9UJJoKux97M7M=; h=To:From:Subject:Date:Message-id:Content-type:MIME-version; b=DF+aIX7f+o8lrCVyRM9IvWqoOeuApFcZ1Pjotlw89FSzyj7/T8pLIyyCo5zgqVkYE tWcJ6kkBQT/TBPfWT+PtexMq9nZs368MA2dY8OAjB1AOVpo8OWmLLMDm5zbafFdJiL PK+Diu+fmioD4ai8uvreozWpVn9ihc5tqxF50iAeopyOrmxsYkOF+aDGdoBulm1ikn jDJhfwNbrs8Nbb3yAmcF1JLAU5cKkVHCfyBsd5qp8D4uv7Ku+LUP/6ZgJXdW1nLPek Stt4cCAm2bs2jqPzNhB0ZIsSgG2AKO+u5qq7fZyjBHosava9NGAT2Tv7WJ4wl0g2hM hrm69J+z9YXUg== X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1011 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1807170000 definitions=main-1810310054 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2018-10-31_02:,, signatures=0 To: qemu-devel@nongnu.org Date: Wed, 31 Oct 2018 06:24:56 +0000 (GMT) X-Mailer: iCloud MailClient1820Project45 MailServer1820B52.10000-1820B-0-fc60f9b2d839 Message-id: MIME-version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 17.58.37.19 X-Mailman-Approved-At: Wed, 31 Oct 2018 05:44:14 -0400 Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.21 Subject: [Qemu-devel] =?utf-8?q?=5BPATCH=5D_gtk=3A_Fix_mouse_offset_in_sca?= =?utf-8?q?led_gtk-gl_display_for_VFIO/iGVT-g_DMA_Buf_mode?= X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Chen Zhang via Qemu-devel Reply-To: Chen Zhang Cc: Gerd Hoffmann Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8"; format="flowed" The issue was reported as in=C2=A0https://bugs.launchpad.net/qemu/+bug/1793= 859 When an OpenGL accelerated GTK window is used for iGVT-g DMA Buf device, window scaling would cause guest cursor to move in undesirable velocity. To fix this usability issue, the gtk mouse motion events was modified to scale the position of event to match the coordinates=C2=A0of the scaled GL surface. Signed-off-by: Chen Zhang --- =C2=A0ui/gtk-egl.c | 10 +++++++--- =C2=A0ui/gtk.c =C2=A0 =C2=A0 | 19 +++++++++++++------ =C2=A02 files changed, 20 insertions(+), 9 deletions(-) diff --git a/ui/gtk-egl.c b/ui/gtk-egl.c index a77c25b..824beed 100644 --- a/ui/gtk-egl.c +++ b/ui/gtk-egl.c @@ -231,9 +231,13 @@ void gd_egl_cursor_position(DisplayChangeListener *dcl, =C2=A0=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 uint32_t pos_x, uint32_t pos_y) =C2=A0{ =C2=A0=C2=A0 =C2=A0 VirtualConsole *vc =3D container_of(dcl, VirtualConsole= , gfx.dcl); - -=C2=A0 =C2=A0 vc->gfx.cursor_x =3D pos_x; -=C2=A0 =C2=A0 vc->gfx.cursor_y =3D pos_y; +=C2=A0 =C2=A0 uint32_t sw =3D surface_width(vc->gfx.ds); +=C2=A0 =C2=A0 uint32_t sh =3D surface_height(vc->gfx.ds); +=C2=A0 =C2=A0 GdkWindow *window =3D gtk_widget_get_window(vc->gfx.drawing_= area); +=C2=A0 =C2=A0 uint32_t ww =3D gdk_window_get_width(window); +=C2=A0 =C2=A0 uint32_t wh =3D gdk_window_get_height(window); +=C2=A0 =C2=A0 vc->gfx.cursor_x =3D pos_x * ww / sw; +=C2=A0 =C2=A0 vc->gfx.cursor_y =3D pos_y * wh / sh; =C2=A0} =C2=A0 =C2=A0void gd_egl_release_dmabuf(DisplayChangeListener *dcl, diff --git a/ui/gtk.c b/ui/gtk.c index 579990b..41c82e5 100644 --- a/ui/gtk.c +++ b/ui/gtk.c @@ -875,20 +875,27 @@ static gboolean gd_motion_event(GtkWidget *widget, Gd= kEventMotion *motion, =C2=A0=C2=A0 =C2=A0 x =3D (motion->x - mx) / vc->gfx.scale_x; =C2=A0=C2=A0 =C2=A0 y =3D (motion->y - my) / vc->gfx.scale_y; =C2=A0 +=C2=A0 =C2=A0 bool scaled =3D display_opengl && !gtk_use_gl_area && s->fre= e_scale; =C2=A0=C2=A0 =C2=A0 if (qemu_input_is_absolute()) { +=C2=A0 =C2=A0 =C2=A0 =C2=A0 int max_w =3D scaled ? ww : surface_width(vc->= gfx.ds); +=C2=A0 =C2=A0 =C2=A0 =C2=A0 int max_h =3D scaled ? wh : surface_height(vc-= >gfx.ds); =C2=A0=C2=A0 =C2=A0 =C2=A0 =C2=A0 if (x < 0 || y < 0 || -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 x >=3D surface_width(vc->gfx.ds)= || -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 y >=3D surface_height(vc->gfx.ds= )) { +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 x >=3D max_w || +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 y >=3D max_h) { =C2=A0=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 return TRUE; =C2=A0=C2=A0 =C2=A0 =C2=A0 =C2=A0 } =C2=A0=C2=A0 =C2=A0 =C2=A0 =C2=A0 qemu_input_queue_abs(vc->gfx.dcl.con, INP= UT_AXIS_X, x, - =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 0, surface_width(vc->gfx.ds)); + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 0, max_w); =C2=A0=C2=A0 =C2=A0 =C2=A0 =C2=A0 qemu_input_queue_abs(vc->gfx.dcl.con, INP= UT_AXIS_Y, y, - =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 0, surface_height(vc->gfx.ds)); + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 0, max_h); =C2=A0=C2=A0 =C2=A0 =C2=A0 =C2=A0 qemu_input_event_sync(); =C2=A0=C2=A0 =C2=A0 } else if (s->last_set && s->ptr_owner =3D=3D vc) { -=C2=A0 =C2=A0 =C2=A0 =C2=A0 qemu_input_queue_rel(vc->gfx.dcl.con, INPUT_AX= IS_X, x - s->last_x); -=C2=A0 =C2=A0 =C2=A0 =C2=A0 qemu_input_queue_rel(vc->gfx.dcl.con, INPUT_AX= IS_Y, y - s->last_y); +=C2=A0 =C2=A0 =C2=A0 =C2=A0 int diff_x =3D scaled +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ? (x - s->last_x) * surface_widt= h(vc->gfx.ds) / ww : (x - s->last_x); +=C2=A0 =C2=A0 =C2=A0 =C2=A0 int diff_y =3D scaled +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ? (y - s->last_y) * surface_heig= ht(vc->gfx.ds) / wh : (y - s->last_y); +=C2=A0 =C2=A0 =C2=A0 =C2=A0 qemu_input_queue_rel(vc->gfx.dcl.con, INPUT_AX= IS_X, diff_x); +=C2=A0 =C2=A0 =C2=A0 =C2=A0 qemu_input_queue_rel(vc->gfx.dcl.con, INPUT_AX= IS_Y, diff_y); =C2=A0=C2=A0 =C2=A0 =C2=A0 =C2=A0 qemu_input_event_sync(); =C2=A0=C2=A0 =C2=A0 } =C2=A0=C2=A0 =C2=A0 s->last_x =3D x; --=C2=A0 2.7.4