From nobody Mon Feb 9 07:06:32 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1685280084; cv=none; d=zohomail.com; s=zohoarc; b=dsOMFLwTu7BnFe7l5OvjKDkieumX/8PscRLBSX7uztNxzCkl22NM46Vz/KPa6YFkRxM4/F4ERbFxj2sjZfQhiBbD8h/FS/QBHcPaM5nrCRyX6boy231FU0DFbApotZeQnwcROcXXfFICwKT97JnqJNB/AW7goksohXr3TbL/cQQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1685280084; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=Z+yBun4joz8CpCnJWZkJ8wIlZdHmkizuP4CqdvuOigY=; b=VO177nnc5ZtyuGWGa+tBpikWHLECXaIyOhmJYFBdgZ5rjYIMuglUh2yao9C22uVidvXv3sFxlI81t6CU3xwHXb+kxUos8qs5EPDXwuD6HBpyM0eeOaiBnGOSt9JFCkOFFKLRBCnXjPx98yEXnouRNcMY3jj7WK7jvU/YMCKewig= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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 1685280084152150.5422548640961; Sun, 28 May 2023 06:21:24 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q3GK8-0007Xv-Pg; Sun, 28 May 2023 09:20:41 -0400 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 1q3GK2-0007Up-HW for qemu-devel@nongnu.org; Sun, 28 May 2023 09:20:34 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q3GK0-000810-0m for qemu-devel@nongnu.org; Sun, 28 May 2023 09:20:33 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-288-I0xSZq8rOwuFmVM8Mw2jYQ-1; Sun, 28 May 2023 09:20:26 -0400 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 1CE8A101A52C; Sun, 28 May 2023 13:20:26 +0000 (UTC) Received: from localhost (unknown [10.39.208.19]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1837E492B00; Sun, 28 May 2023 13:20:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1685280029; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Z+yBun4joz8CpCnJWZkJ8wIlZdHmkizuP4CqdvuOigY=; b=g5WZHev6p7GZlKYoqV65SafYZNZqCdSTYPAr63nWCmsCyuzvfbEg2hW+qdW1qjg1b9Z0BK /Y+u/Z6/iERb+kMWsy1gIXPskQiqqOpiKRg3GIT3SH9+Aw8Z+dhO+j3NoH7CTm9Q1iaZ6B 5ln4n1tF5jm8k5gv41RbJWh1uh5gryw= X-MC-Unique: I0xSZq8rOwuFmVM8Mw2jYQ-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: Markus Armbruster , berrange@redhat.com, Eric Blake , Stefan Weil , Gerd Hoffmann , Paolo Bonzini , Pavel Dovgalyuk , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , "Michael S. Tsirkin" , Erico Nunes Subject: [PULL 01/19] ui/gtk: fix passing y0_top parameter to scanout Date: Sun, 28 May 2023 17:19:58 +0400 Message-Id: <20230528132016.3218152-2-marcandre.lureau@redhat.com> In-Reply-To: <20230528132016.3218152-1-marcandre.lureau@redhat.com> References: <20230528132016.3218152-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 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=170.10.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -22 X-Spam_score: -2.3 X-Spam_bar: -- X-Spam_report: (-2.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.164, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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 @redhat.com) X-ZM-MESSAGEID: 1685280085090100001 From: Erico Nunes The dmabuf->y0_top flag is passed to .dpy_gl_scanout_dmabuf(), however in the gtk ui both implementations dropped it when doing the next scanout_texture call. Fixes flipped linux console using vhost-user-gpu with the gtk ui display. Signed-off-by: Erico Nunes Reviewed-by: Marc-Andr=C3=A9 Lureau Message-Id: <20230220175605.43759-1-ernunes@redhat.com> --- ui/gtk-egl.c | 2 +- ui/gtk-gl-area.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ui/gtk-egl.c b/ui/gtk-egl.c index e84431790c..557668e418 100644 --- a/ui/gtk-egl.c +++ b/ui/gtk-egl.c @@ -256,7 +256,7 @@ void gd_egl_scanout_dmabuf(DisplayChangeListener *dcl, } =20 gd_egl_scanout_texture(dcl, dmabuf->texture, - false, dmabuf->width, dmabuf->height, + dmabuf->y0_top, dmabuf->width, dmabuf->height, 0, 0, dmabuf->width, dmabuf->height); =20 if (dmabuf->allow_fences) { diff --git a/ui/gtk-gl-area.c b/ui/gtk-gl-area.c index 7696df1f6b..c384a1516b 100644 --- a/ui/gtk-gl-area.c +++ b/ui/gtk-gl-area.c @@ -298,7 +298,7 @@ void gd_gl_area_scanout_dmabuf(DisplayChangeListener *d= cl, } =20 gd_gl_area_scanout_texture(dcl, dmabuf->texture, - false, dmabuf->width, dmabuf->height, + dmabuf->y0_top, dmabuf->width, dmabuf->heig= ht, 0, 0, dmabuf->width, dmabuf->height); =20 if (dmabuf->allow_fences) { --=20 2.40.1 From nobody Mon Feb 9 07:06:32 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1685280141; cv=none; d=zohomail.com; s=zohoarc; b=XFoCeGTw6fInGYK3aKMYyGijS2L+/zYou+hooBPa01+cAjHuW6zcWmE+5q8tP+/k8jhTYb4Z8UNld4KtPq8ghxinyS5oVI6LOdn7g2kf3HwklPLplfZZcYqbNBWrUUVLmmx4yyUsQ63AiT+qrRNU4orQrrD0bv130OMzSd/QT8U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1685280141; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=kke7rQY8s24qM2xyZRFwGmKKtirgo13/d7bLGdp+4QE=; b=MIsPXsFeoX94Hq4WAP6Gd+JZg+w7+v2hLKSI6WQwdM7NWaOlzOp8/2DSo5xB6SrZVMmhUAUWVtosviFdOD1IRayrja2H0lHEkR3fg0D05rJTs13NqrYMRbW89E/32doqpIfDh0qpldC961yozxu6/v8JyX3R6ieqMdZGHTQzqnQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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 1685280141925992.2232125921483; Sun, 28 May 2023 06:22:21 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q3GKD-0007aX-6q; Sun, 28 May 2023 09:20:45 -0400 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 1q3GK6-0007XH-Rm for qemu-devel@nongnu.org; Sun, 28 May 2023 09:20:38 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q3GK4-000826-Pq for qemu-devel@nongnu.org; Sun, 28 May 2023 09:20:38 -0400 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-43-OJQ9Pt9gMNOyWLVrw7MubQ-1; Sun, 28 May 2023 09:20:30 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 37FF33C01C29; Sun, 28 May 2023 13:20:30 +0000 (UTC) Received: from localhost (unknown [10.39.208.19]) by smtp.corp.redhat.com (Postfix) with ESMTP id 31F1120296C6; Sun, 28 May 2023 13:20:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1685280034; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=kke7rQY8s24qM2xyZRFwGmKKtirgo13/d7bLGdp+4QE=; b=NAAWMvXIybjtN5Qk7Mkuj1cVdyUMgP4/zn9bPIPTQ/z2k6iegGrrqzWPFeDq5VBB6IvHNt QMJinCmhBhlD8k/uPvHWj9JSRHzhOK+NM71q1wkjlX6oNnBbiX73AahflNarynOJcplq1+ rcRYHcHNBcDN0HRDXwlr4u28ojtLpwg= X-MC-Unique: OJQ9Pt9gMNOyWLVrw7MubQ-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: Markus Armbruster , berrange@redhat.com, Eric Blake , Stefan Weil , Gerd Hoffmann , Paolo Bonzini , Pavel Dovgalyuk , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , "Michael S. Tsirkin" , Erico Nunes Subject: [PULL 02/19] ui/gtk: use widget size for cursor motion event Date: Sun, 28 May 2023 17:19:59 +0400 Message-Id: <20230528132016.3218152-3-marcandre.lureau@redhat.com> In-Reply-To: <20230528132016.3218152-1-marcandre.lureau@redhat.com> References: <20230528132016.3218152-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.4 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=170.10.129.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -22 X-Spam_score: -2.3 X-Spam_bar: -- X-Spam_report: (-2.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.164, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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 @redhat.com) X-ZM-MESSAGEID: 1685280142630100001 From: Erico Nunes The gd_motion_event size has some calculations for the cursor position, which also take into account things like different size of the framebuffer compared to the window size. The use of window size makes things more difficult though, as at least in the case of Wayland includes the size of ui elements like a menu bar at the top of the window. This leads to a wrong position calculation by a few pixels. Fix it by using the size of the widget, which already returns the size of the actual space to render the framebuffer. Signed-off-by: Erico Nunes Reviewed-by: Marc-Andr=C3=A9 Lureau Acked-by: Vivek Kasireddy Message-Id: <20230320160856.364319-1-ernunes@redhat.com> --- ui/gtk.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/ui/gtk.c b/ui/gtk.c index f16e0f8dee..0a9f24ee0a 100644 --- a/ui/gtk.c +++ b/ui/gtk.c @@ -869,7 +869,6 @@ static gboolean gd_motion_event(GtkWidget *widget, GdkE= ventMotion *motion, { VirtualConsole *vc =3D opaque; GtkDisplayState *s =3D vc->s; - GdkWindow *window; int x, y; int mx, my; int fbh, fbw; @@ -882,10 +881,9 @@ static gboolean gd_motion_event(GtkWidget *widget, Gdk= EventMotion *motion, fbw =3D surface_width(vc->gfx.ds) * vc->gfx.scale_x; fbh =3D surface_height(vc->gfx.ds) * vc->gfx.scale_y; =20 - window =3D gtk_widget_get_window(vc->gfx.drawing_area); - ww =3D gdk_window_get_width(window); - wh =3D gdk_window_get_height(window); - ws =3D gdk_window_get_scale_factor(window); + ww =3D gtk_widget_get_allocated_width(widget); + wh =3D gtk_widget_get_allocated_height(widget); + ws =3D gtk_widget_get_scale_factor(widget); =20 mx =3D my =3D 0; if (ww > fbw) { --=20 2.40.1 From nobody Mon Feb 9 07:06:32 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1685280084; cv=none; d=zohomail.com; s=zohoarc; b=Frd/gqVxYSrEt5B1/AOpG2nT/27GzfVzqWuR0HuyjzTZ4zGOcqWjZTIklp6zYUUx1gxbJYop7ToJRsV7ah9UFodWc6ZC+Omp9zRyjLCrWOWUy7tx+E3uPxfSZY8fCsVd23OTm8YDaiWOH0qMYy5ntB6RIiiZ7sFrLlhHIYqr8mo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1685280084; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=xeB0i35BJVHLQClnr5fhag95I05kqA8k4ibHNET9Ee0=; b=M93yl+Wov7XqsSoLI06n1rSMRpp7Wuiz77G2fSJolcgpoAJpubqGu8r9l69mSVkdrptUiyfe49Y52uzQPQ+wsPOfMAkN0lncPulV/aSbdT+qyuP/CBR3hiZBGLm2aC59xQtRIe7rpBd652npO/uigN8EAgCXmVMOLc0Eq9IV0io= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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 1685280084157404.077280535138; Sun, 28 May 2023 06:21:24 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q3GKC-0007Zb-IY; Sun, 28 May 2023 09:20:44 -0400 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 1q3GK6-0007XI-U5 for qemu-devel@nongnu.org; Sun, 28 May 2023 09:20:38 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q3GK5-00082p-F6 for qemu-devel@nongnu.org; Sun, 28 May 2023 09:20:38 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-191-Cu3cHspBNSSi07BCrDGsMA-1; Sun, 28 May 2023 09:20:34 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 4F951811E78; Sun, 28 May 2023 13:20:34 +0000 (UTC) Received: from localhost (unknown [10.39.208.19]) by smtp.corp.redhat.com (Postfix) with ESMTP id 63194112132C; Sun, 28 May 2023 13:20:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1685280036; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=xeB0i35BJVHLQClnr5fhag95I05kqA8k4ibHNET9Ee0=; b=PuIbkZnqMOyy3TFUwmMfIkLomFWu4vfEvkG/cqW6OcvwJAGrRCk5Ho/AMpPdrXQ3u4ZVmg cJc10j6jjR1ZdKzc2StPuUd+QNCyp1/OgLHvJSX5QpR5cJDEFZQJLdDNnGiNnMAYVyyE9D 258r20V8o0/DyWac2A/hD6b5ylqSicQ= X-MC-Unique: Cu3cHspBNSSi07BCrDGsMA-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: Markus Armbruster , berrange@redhat.com, Eric Blake , Stefan Weil , Gerd Hoffmann , Paolo Bonzini , Pavel Dovgalyuk , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , "Michael S. Tsirkin" , Erico Nunes Subject: [PULL 03/19] ui/gtk-egl: fix scaling for cursor position in scanout mode Date: Sun, 28 May 2023 17:20:00 +0400 Message-Id: <20230528132016.3218152-4-marcandre.lureau@redhat.com> In-Reply-To: <20230528132016.3218152-1-marcandre.lureau@redhat.com> References: <20230528132016.3218152-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.3 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=170.10.129.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -22 X-Spam_score: -2.3 X-Spam_bar: -- X-Spam_report: (-2.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.164, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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 @redhat.com) X-ZM-MESSAGEID: 1685280085680100008 From: Erico Nunes vc->gfx.w and vc->gfx.h are not updated appropriately in this code path, which leads to a different scaling factor for rendering the cursor on some edge cases (e.g. the focus has left and re-entered the gtk window). This can be reproduced using vhost-user-gpu with the gtk ui on the x11 backend. Use the surface dimensions which are already updated accordingly. Signed-off-by: Erico Nunes Acked-by: Marc-Andr=C3=A9 Lureau Message-Id: <20230320160856.364319-2-ernunes@redhat.com> --- ui/gtk-egl.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ui/gtk-egl.c b/ui/gtk-egl.c index 557668e418..19130041bc 100644 --- a/ui/gtk-egl.c +++ b/ui/gtk-egl.c @@ -88,8 +88,8 @@ void gd_egl_draw(VirtualConsole *vc) #endif gd_egl_scanout_flush(&vc->gfx.dcl, 0, 0, vc->gfx.w, vc->gfx.h); =20 - vc->gfx.scale_x =3D (double)ww / vc->gfx.w; - vc->gfx.scale_y =3D (double)wh / vc->gfx.h; + vc->gfx.scale_x =3D (double)ww / surface_width(vc->gfx.ds); + vc->gfx.scale_y =3D (double)wh / surface_height(vc->gfx.ds); =20 glFlush(); #ifdef CONFIG_GBM --=20 2.40.1 From nobody Mon Feb 9 07:06:32 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1685280089; cv=none; d=zohomail.com; s=zohoarc; b=R1L9Yqmpd+a7dlmW3EKOmgWSMhWjLoor9fwcPztgdoXWE7ciHtWeVGe+C3/aQBI7DK93kCtK7Kcg6vqAVHrLmYmQO+PM1+p0MzOcXkgaCDrSBNeStMmsDCUh6/0/FbudguztG2aahBKzf3Rg6kmeBuZHGtkkyRXigWWW0I0gMx0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1685280089; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=CpvPBcShRkyJ+2h3vZMKhYnEn+ZEWfxFamhs6fV9SZY=; b=UYs4wzscfPwbb30uR/yQX0gY1kz+Y5mmVeLwzTiwIZksjLLgaM41g3SA618I5FiBjp38P6Lu4MNfvP4MXeWuW1VxzovY05d2xPproRtZ9SlFZPy8ovOctQm7L2Wy+TSqNXe1eUqHX3b23YsYZY5DmKLjuIz/dlZj9yCaEByvmfA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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 1685280089318435.57794689497166; Sun, 28 May 2023 06:21:29 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q3GKF-0007b7-Qc; Sun, 28 May 2023 09:20:47 -0400 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 1q3GKC-0007aO-2n for qemu-devel@nongnu.org; Sun, 28 May 2023 09:20:44 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q3GKA-00084N-6t for qemu-devel@nongnu.org; Sun, 28 May 2023 09:20:43 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-671-a6gDMBKZO5C2L6777HESNA-1; Sun, 28 May 2023 09:20:38 -0400 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id C9AD9800BFF; Sun, 28 May 2023 13:20:37 +0000 (UTC) Received: from localhost (unknown [10.39.208.19]) by smtp.corp.redhat.com (Postfix) with ESMTP id 110B0492B0A; Sun, 28 May 2023 13:20:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1685280041; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=CpvPBcShRkyJ+2h3vZMKhYnEn+ZEWfxFamhs6fV9SZY=; b=Ga8YceF/vUoI8beUqH8lc+24pWgMdas/KXhbDkrdpzn0lAzWUrbzcf8e2O1NE8LImWw6P6 Lp8QNjt3JiYWAYlw4tVUSmCG8Sy5xTWLqaYApFmYqEE4D7Zzw9dNO1LppFkLZnqOeQLwGF EFHq8IGgjsL4iAaJTzXq1AI/u6hhjIw= X-MC-Unique: a6gDMBKZO5C2L6777HESNA-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: Markus Armbruster , berrange@redhat.com, Eric Blake , Stefan Weil , Gerd Hoffmann , Paolo Bonzini , Pavel Dovgalyuk , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , "Michael S. Tsirkin" Subject: [PULL 04/19] ui/sdl2: fix surface_gl_update_texture: Assertion 'gls' failed Date: Sun, 28 May 2023 17:20:01 +0400 Message-Id: <20230528132016.3218152-5-marcandre.lureau@redhat.com> In-Reply-To: <20230528132016.3218152-1-marcandre.lureau@redhat.com> References: <20230528132016.3218152-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.10 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=170.10.129.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -22 X-Spam_score: -2.3 X-Spam_bar: -- X-Spam_report: (-2.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.164, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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 @redhat.com) X-ZM-MESSAGEID: 1685280091317100002 From: Marc-Andr=C3=A9 Lureau Before sdl2_gl_update() is called, sdl2_gl_switch() may decide to destroy the console window and its associated shaders. Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1644 Fixes: c84ab0a500a8 ("ui/console: optionally update after gfx switch") Signed-off-by: Marc-Andr=C3=A9 Lureau Tested-by: Bin Meng Message-Id: <20230511074217.4171842-1-marcandre.lureau@redhat.com> --- ui/sdl2-gl.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ui/sdl2-gl.c b/ui/sdl2-gl.c index 39cab8cde7..bbfa70eac3 100644 --- a/ui/sdl2-gl.c +++ b/ui/sdl2-gl.c @@ -67,6 +67,10 @@ void sdl2_gl_update(DisplayChangeListener *dcl, =20 assert(scon->opengl); =20 + if (!scon->real_window) { + return; + } + SDL_GL_MakeCurrent(scon->real_window, scon->winctx); surface_gl_update_texture(scon->gls, scon->surface, x, y, w, h); scon->updates++; --=20 2.40.1 From nobody Mon Feb 9 07:06:32 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1685280102; cv=none; d=zohomail.com; s=zohoarc; b=QAIU5mTZxGjE/kDXkTI1Izt4tk/L7QsBh+uOyXQBriJQVs3OXwFOV8anN8Kuz8ENbBSiHZCzh3dGhPfiz2xpPrSv2dCWhqLJxLHmjUn112YNFvrDCS79ORe59GkdBHsp+1/8p5kcNdBVg35kINA3tBmjaA15ZtLhItSzjcRA1Ek= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1685280102; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=Rwa4w3lHrxjFcXn2rIPSMTl2Jjhngi5lCJQjzwXfN8I=; b=bnwSY0ynx/fd9GJz/8D6ssisjdOvqwoqnITLTl2jyur96gP6ysRRR2S4H8G9izW0i3vCb8bAn00jkJ8MWONBgCeZtz7zIjUT+bLQv7lTIiMISFwcKvYLmJYcwGKMrGXCG0likM2lj5D/1h4DDQkKnv7IMmDH4eGG7m0J5xxVyeU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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 1685280102392357.00983977090254; Sun, 28 May 2023 06:21:42 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q3GKI-0007bq-Hm; Sun, 28 May 2023 09:20:50 -0400 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 1q3GKG-0007bS-Ud for qemu-devel@nongnu.org; Sun, 28 May 2023 09:20:48 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q3GKF-00085p-HN for qemu-devel@nongnu.org; Sun, 28 May 2023 09:20:48 -0400 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-501-oLOMCpaPOkaE3lSTD3_Z_g-1; Sun, 28 May 2023 09:20:42 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 6841C1C0514E; Sun, 28 May 2023 13:20:42 +0000 (UTC) Received: from localhost (unknown [10.39.208.19]) by smtp.corp.redhat.com (Postfix) with ESMTP id 038F52166B2B; Sun, 28 May 2023 13:20:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1685280046; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Rwa4w3lHrxjFcXn2rIPSMTl2Jjhngi5lCJQjzwXfN8I=; b=ZflFLj+dKiNC9ZKxIc/uz/K1eenMDOmu/Tk/qdLamyTW2XChdti6od9RBrpM1RMPtj86IH pyOvUcID6H9J3xDkgBcSDUAF9Oc0Sfz1fx+sUA3w952q4YG95wtOkct0UVPPCWN03IC2OB TQM6Y52B/3byVFK8wwST7Fo6Hl84SSE= X-MC-Unique: oLOMCpaPOkaE3lSTD3_Z_g-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: Markus Armbruster , berrange@redhat.com, Eric Blake , Stefan Weil , Gerd Hoffmann , Paolo Bonzini , Pavel Dovgalyuk , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , "Michael S. Tsirkin" Subject: [PULL 05/19] ui/dbus: fix compilation when GBM && !OPENGL Date: Sun, 28 May 2023 17:20:02 +0400 Message-Id: <20230528132016.3218152-6-marcandre.lureau@redhat.com> In-Reply-To: <20230528132016.3218152-1-marcandre.lureau@redhat.com> References: <20230528132016.3218152-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 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=170.10.129.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -22 X-Spam_score: -2.3 X-Spam_bar: -- X-Spam_report: (-2.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.164, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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 @redhat.com) X-ZM-MESSAGEID: 1685280102744100001 From: Marc-Andr=C3=A9 Lureau commit 4814d3cbf ("ui/dbus: restrict opengl to gbm-enabled config") assumes that whenever GBM is available, OpenGL is. This is not always the case, let's further restrict opengl-related paths and fix some compilation issues. Signed-off-by: Marc-Andr=C3=A9 Lureau Message-Id: <20230515132348.1024663-1-marcandre.lureau@redhat.com> --- ui/dbus-listener.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/ui/dbus-listener.c b/ui/dbus-listener.c index 911acdc529..defe2220c0 100644 --- a/ui/dbus-listener.c +++ b/ui/dbus-listener.c @@ -50,7 +50,7 @@ struct _DBusDisplayListener { =20 G_DEFINE_TYPE(DBusDisplayListener, dbus_display_listener, G_TYPE_OBJECT) =20 -#ifdef CONFIG_GBM +#if defined(CONFIG_OPENGL) && defined(CONFIG_GBM) static void dbus_update_gl_cb(GObject *source_object, GAsyncResult *res, gpointer user_data) @@ -239,7 +239,7 @@ static void dbus_refresh(DisplayChangeListener *dcl) graphic_hw_update(dcl->con); } =20 -#ifdef CONFIG_GBM +#if defined(CONFIG_OPENGL) && defined(CONFIG_GBM) static void dbus_gl_gfx_update(DisplayChangeListener *dcl, int x, int y, int w, int h) { @@ -302,7 +302,7 @@ static void dbus_gfx_update(DisplayChangeListener *dcl, DBUS_DEFAULT_TIMEOUT, NULL, NULL, NULL); } =20 -#ifdef CONFIG_GBM +#if defined(CONFIG_OPENGL) && defined(CONFIG_GBM) static void dbus_gl_gfx_switch(DisplayChangeListener *dcl, struct DisplaySurface *new_surface) { @@ -369,7 +369,7 @@ static void dbus_cursor_define(DisplayChangeListener *d= cl, NULL); } =20 -#ifdef CONFIG_GBM +#if defined(CONFIG_OPENGL) && defined(CONFIG_GBM) const DisplayChangeListenerOps dbus_gl_dcl_ops =3D { .dpy_name =3D "dbus-gl", .dpy_gfx_update =3D dbus_gl_gfx_update, @@ -417,7 +417,7 @@ dbus_display_listener_constructed(GObject *object) DBusDisplayListener *ddl =3D DBUS_DISPLAY_LISTENER(object); =20 ddl->dcl.ops =3D &dbus_dcl_ops; -#ifdef CONFIG_GBM +#if defined(CONFIG_OPENGL) && defined(CONFIG_GBM) if (display_opengl) { ddl->dcl.ops =3D &dbus_gl_dcl_ops; } --=20 2.40.1 From nobody Mon Feb 9 07:06:32 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1685280158; cv=none; d=zohomail.com; s=zohoarc; b=MGpxsp2f3Zbax+meObUlmfzPKfrcDrqHBEnEGP1JLvGILnOnOqF7ENQsuTe8/P7BsF+3hqg5lmazBSrmwQrsYV6evy3zXKbxV4sQrH9aMN4KVZ+yHbsh/BPA56IPCbf8aKLzhCKuHZsf83t8ymQ7EO6eVMCoR7VEn8SF8D7DoSE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1685280158; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=NUFG6LpDTdzMtRwgpzbhoUfL9DwDLFUSWHTITN63a7s=; b=E5+fT9ex8yoPvdx4pSpkE6fl2/q4pSrsLp5DGaedA5hlSvhm6EXUeXGRKfS6ZcF8GjpAexLZQ2N0dRyNxR8utnPkVfaCUKyUkDeyrZHjzfcu3lGOTkXFjb02c2yXc2Lb4bLlGTkMFf3sKC/xbHYB494iV5IEg95I3HVz23sB+j8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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 1685280158194979.678219145688; Sun, 28 May 2023 06:22:38 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q3GKO-0007c8-28; Sun, 28 May 2023 09:20:56 -0400 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 1q3GKK-0007bv-R9 for qemu-devel@nongnu.org; Sun, 28 May 2023 09:20:52 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q3GKJ-00086J-Am for qemu-devel@nongnu.org; Sun, 28 May 2023 09:20:52 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-269-LMdQ1GMiPHu5cUDBdDIz4Q-1; Sun, 28 May 2023 09:20:46 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 6673D85A5A8; Sun, 28 May 2023 13:20:46 +0000 (UTC) Received: from localhost (unknown [10.39.208.19]) by smtp.corp.redhat.com (Postfix) with ESMTP id 587B72166B2B; Sun, 28 May 2023 13:20:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1685280050; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=NUFG6LpDTdzMtRwgpzbhoUfL9DwDLFUSWHTITN63a7s=; b=JhnHqY4fIdFIzCvelZ06d16Qcz0Cwt0+bykBPeM9422h0tOi4Skfbsen2NE/H4ZsjG57Dh 6sMg5grpV4VyaliDOdj3gb08j5fYm1vUEal7c6/QL6J3Bhei1sTMr0wuooyGtjk14n5tno cpRRNlHS9AU5P5l9Og6pC6FhQQfNS+8= X-MC-Unique: LMdQ1GMiPHu5cUDBdDIz4Q-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: Markus Armbruster , berrange@redhat.com, Eric Blake , Stefan Weil , Gerd Hoffmann , Paolo Bonzini , Pavel Dovgalyuk , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , "Michael S. Tsirkin" Subject: [PULL 06/19] win32: wrap socket close() with an exception handler Date: Sun, 28 May 2023 17:20:03 +0400 Message-Id: <20230528132016.3218152-7-marcandre.lureau@redhat.com> In-Reply-To: <20230528132016.3218152-1-marcandre.lureau@redhat.com> References: <20230528132016.3218152-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 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=170.10.129.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -22 X-Spam_score: -2.3 X-Spam_bar: -- X-Spam_report: (-2.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.164, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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 @redhat.com) X-ZM-MESSAGEID: 1685280158644100001 From: Marc-Andr=C3=A9 Lureau Since commit abe34282 ("win32: avoid mixing SOCKET and file descriptor space"), we set HANDLE_FLAG_PROTECT_FROM_CLOSE on the socket FD, to prevent closing the HANDLE with CloseHandle. This raises an exception which under gdb is fatal, and qemu exits. Let's catch the expected error instead. Note: this appears to work, but the mingw64 macro is not well documented or tested, and it's not obvious how it is meant to be used. Signed-off-by: Marc-Andr=C3=A9 Lureau Message-Id: <20230515132440.1025315-1-marcandre.lureau@redhat.com> --- include/sysemu/os-win32.h | 4 ++++ util/oslib-win32.c | 23 +++++++++++++++++------ 2 files changed, 21 insertions(+), 6 deletions(-) diff --git a/include/sysemu/os-win32.h b/include/sysemu/os-win32.h index 15c296e0eb..65f6c9ea57 100644 --- a/include/sysemu/os-win32.h +++ b/include/sysemu/os-win32.h @@ -259,6 +259,10 @@ ssize_t qemu_recv_wrap(int sockfd, void *buf, size_t l= en, int flags); ssize_t qemu_recvfrom_wrap(int sockfd, void *buf, size_t len, int flags, struct sockaddr *addr, socklen_t *addrlen); =20 +EXCEPTION_DISPOSITION +win32_close_exception_handler(struct _EXCEPTION_RECORD*, void*, + struct _CONTEXT*, void*); + #ifdef __cplusplus } #endif diff --git a/util/oslib-win32.c b/util/oslib-win32.c index a98638729a..fafbab80b4 100644 --- a/util/oslib-win32.c +++ b/util/oslib-win32.c @@ -479,6 +479,13 @@ int qemu_bind_wrap(int sockfd, const struct sockaddr *= addr, return ret; } =20 +EXCEPTION_DISPOSITION +win32_close_exception_handler(struct _EXCEPTION_RECORD*, + void*, struct _CONTEXT*, void*) +{ + return EXCEPTION_EXECUTE_HANDLER; +} + #undef close int qemu_close_socket_osfhandle(int fd) { @@ -504,12 +511,16 @@ int qemu_close_socket_osfhandle(int fd) return -1; } =20 - /* - * close() returns EBADF since we PROTECT_FROM_CLOSE the underlying ha= ndle, - * but the FD is actually freed - */ - if (close(fd) < 0 && errno !=3D EBADF) { - return -1; + __try1(win32_close_exception_handler) { + /* + * close() returns EBADF since we PROTECT_FROM_CLOSE the underlying + * handle, but the FD is actually freed + */ + if (close(fd) < 0 && errno !=3D EBADF) { + return -1; + } + } + __except1 { } =20 if (!SetHandleInformation((HANDLE)s, flags, flags)) { --=20 2.40.1 From nobody Mon Feb 9 07:06:32 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1685280121; cv=none; d=zohomail.com; s=zohoarc; b=js4zTd77xDCP559fhw9mAt/p2YNrkfYaLwjfyuZqUc/iDkG/2kHnpr1NS/40BfnBVYAwKaxDNydSE6RL2KySZTDl02F9coUqFCv0ArVisQSVMgHOB2hnltJWODWBh+sRspc23kvWYcIRDUn6UOIKcEnWU+byqUmm/48qLIrYZdY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1685280121; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=q+4nntFbj+DnqKjIgDmv5udlf8A6d/kiRFUMpQUjEsA=; b=N74tm2iKmFLUxdVHFIeQy5xI3n9CbiSwbo0oGUMW90j7JmN39huXNpvEawGBrFrEOo4MgqjcbMy09SlLQumV3sLIKFNgnC5SKGUsfAJzVyCylxinMJhlWFA2e0MXa6NUl2E1cAz69AOc3DLIN23PvP/hi3XH5OyXHgkVQdqkQ58= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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 1685280121723838.5759469593195; Sun, 28 May 2023 06:22:01 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q3GKT-0007d4-B4; Sun, 28 May 2023 09:21:01 -0400 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 1q3GKQ-0007cm-4c for qemu-devel@nongnu.org; Sun, 28 May 2023 09:20:58 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q3GKO-00086y-Ir for qemu-devel@nongnu.org; Sun, 28 May 2023 09:20:57 -0400 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-391-cQunC0MxOB-HICUEd-jg8g-1; Sun, 28 May 2023 09:20:50 -0400 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 4F7873804065; Sun, 28 May 2023 13:20:50 +0000 (UTC) Received: from localhost (unknown [10.39.208.19]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8A5DA492B00; Sun, 28 May 2023 13:20:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1685280056; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=q+4nntFbj+DnqKjIgDmv5udlf8A6d/kiRFUMpQUjEsA=; b=SkPyfZ1J1clVIzp9hSgqdZPAZD9oTe76twRphXh7NyKG+qMyPfo6aqO1IYZQlVxrKdS7++ f996JmQLSDK2VSqZGCQbzKDbA5EuQCr434o1L9SQK+mDYH1ctm7MRRIM5YK3/+ekIR0fyX Qv4RtfeuMiQOitB6zpcOjQ6vF0jiRsU= X-MC-Unique: cQunC0MxOB-HICUEd-jg8g-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: Markus Armbruster , berrange@redhat.com, Eric Blake , Stefan Weil , Gerd Hoffmann , Paolo Bonzini , Pavel Dovgalyuk , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , "Michael S. Tsirkin" Subject: [PULL 07/19] virtio-gpu: add a FIXME for virtio_gpu_load() Date: Sun, 28 May 2023 17:20:04 +0400 Message-Id: <20230528132016.3218152-8-marcandre.lureau@redhat.com> In-Reply-To: <20230528132016.3218152-1-marcandre.lureau@redhat.com> References: <20230528132016.3218152-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 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=170.10.129.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -22 X-Spam_score: -2.3 X-Spam_bar: -- X-Spam_report: (-2.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.164, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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 @redhat.com) X-ZM-MESSAGEID: 1685280123318100007 From: Marc-Andr=C3=A9 Lureau It looks like the virtio_gpu_load() does not compute and set the offset, the same way virtio_gpu_set_scanout() does. This probably results in incorrect display until the scanout/framebuffer is updated again, I guess we should fix it, although I haven't checked this yet. Signed-off-by: Marc-Andr=C3=A9 Lureau Message-Id: <20230515132518.1025853-1-marcandre.lureau@redhat.com> --- hw/display/virtio-gpu.c | 1 + 1 file changed, 1 insertion(+) diff --git a/hw/display/virtio-gpu.c b/hw/display/virtio-gpu.c index 66ac9b6cc5..66cddd94d9 100644 --- a/hw/display/virtio-gpu.c +++ b/hw/display/virtio-gpu.c @@ -1289,6 +1289,7 @@ static int virtio_gpu_load(QEMUFile *f, void *opaque,= size_t size, /* load & apply scanout state */ vmstate_load_state(f, &vmstate_virtio_gpu_scanouts, g, 1); for (i =3D 0; i < g->parent_obj.conf.max_outputs; i++) { + /* FIXME: should take scanout.r.{x,y} into account */ scanout =3D &g->parent_obj.scanout[i]; if (!scanout->resource_id) { continue; --=20 2.40.1 From nobody Mon Feb 9 07:06:32 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1685280189; cv=none; d=zohomail.com; s=zohoarc; b=ctXpCH+Uyy1/sLjhPB/o6admc3Fed4P0Bv4xUZA8aaKTdblFSCSLzLwB3bJelaLGcBJlYJqEleSYDtHHoDiHqKtjBUR5CmYY9VKozOaairCKrLll+QmPyGw73rK3Ugu4nG826hK5ZcwkwYQ6LOmwOi/wBi9rnbJrwm7RbgG2wYo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1685280189; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=aoDa1mSPerZwu4c22Z0q+qqy26TE+0upPMC+3Wk3FlU=; b=AwzBQuyO37QUtcIuKTI6x815719obh28IvnzoiSiOx3hwp9yiNnClOsSh5cxZWau/8FcCnK3CqHZt/NAdcQ+UQrzPREYk70zPEyS7aeYX1FWiKvzdzPtmQoMJ1V+Sa99XkgyjYA1t6xTWgRmbAgf4X5rox2nqrH+c1Cb19cP+bk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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 1685280189211228.014136868616; Sun, 28 May 2023 06:23:09 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q3GKV-0007db-5N; Sun, 28 May 2023 09:21:03 -0400 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 1q3GKT-0007dH-62 for qemu-devel@nongnu.org; Sun, 28 May 2023 09:21:01 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q3GKR-00087T-Ji for qemu-devel@nongnu.org; Sun, 28 May 2023 09:21:00 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-138-iPPopdYbPu-mEZClbMv94w-1; Sun, 28 May 2023 09:20:54 -0400 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 473318007D9; Sun, 28 May 2023 13:20:54 +0000 (UTC) Received: from localhost (unknown [10.39.208.19]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5C66548205E; Sun, 28 May 2023 13:20:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1685280058; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=aoDa1mSPerZwu4c22Z0q+qqy26TE+0upPMC+3Wk3FlU=; b=GB1sXrudszXmOOPuegVZe10lYNjOiYHH7PKpUJxm12pJ072jZclp5MzsWS5P9kLKSdSHlr lMUmI4sn0APZ3x3W9bz0j0msAFSs/TcV7CpfG7bm8zHrQjxy/xhqV/n1d0Li4wxyQRPx4V UCFTSMi7iApNPaT07+tN9Gy8I91OA3s= X-MC-Unique: iPPopdYbPu-mEZClbMv94w-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: Markus Armbruster , berrange@redhat.com, Eric Blake , Stefan Weil , Gerd Hoffmann , Paolo Bonzini , Pavel Dovgalyuk , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , "Michael S. Tsirkin" Subject: [PULL 08/19] gtk: add gl-area support on win32 Date: Sun, 28 May 2023 17:20:05 +0400 Message-Id: <20230528132016.3218152-9-marcandre.lureau@redhat.com> In-Reply-To: <20230528132016.3218152-1-marcandre.lureau@redhat.com> References: <20230528132016.3218152-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 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=170.10.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -22 X-Spam_score: -2.3 X-Spam_bar: -- X-Spam_report: (-2.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.164, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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 @redhat.com) X-ZM-MESSAGEID: 1685280189575100005 From: Marc-Andr=C3=A9 Lureau On Windows, we don't use the low-level GBM/EGL helpers (no dmabuf etc), we can turn on GL area support for the rest of rendering. (fwiw, GDK backend may be either WGL or EGL) Signed-off-by: Marc-Andr=C3=A9 Lureau Tested-by: Bernhard Beschow Message-Id: <20230515132527.1026064-1-marcandre.lureau@redhat.com> --- ui/gtk.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/ui/gtk.c b/ui/gtk.c index 0a9f24ee0a..2b7268124f 100644 --- a/ui/gtk.c +++ b/ui/gtk.c @@ -2443,6 +2443,12 @@ static void early_gtk_display_init(DisplayOptions *o= pts) gtk_use_gl_area =3D true; gtk_gl_area_init(); } else +#endif +#if defined(GDK_WINDOWING_WIN32) + if (GDK_IS_WIN32_DISPLAY(gdk_display_get_default())) { + gtk_use_gl_area =3D true; + gtk_gl_area_init(); + } else #endif { #ifdef CONFIG_X11 --=20 2.40.1 From nobody Mon Feb 9 07:06:32 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1685280203; cv=none; d=zohomail.com; s=zohoarc; b=IXhbpTvoBT98fUiTalNNOgyRm1tDDz2ECai4fXLNyid7nfKAZicUJJjp/18jy3vGD/88c0CU38+2xlOPyta0+SwAhASU8LpYSRd9LV0UQirKefMsxX+Jk+/GMvZp7qZ8mYl7bd6XpcK/Z42YMpkP8LJeLZRmAEonS9lCSF8V/p4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1685280203; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=+83Gk38iR1YLnw0eyUn4q8QcszZ9vJaxzUVdy2DVMuc=; b=gSm8bMcprEm9CrUjPzKwpNdgR9kozAgkqgXuve5Ub+Z+co9vSp4nozkomGlKiq1qipX0Wpa5yjdSfAdfI2WAmNSW/ybVi2n2vL4+9uDaQ199DCqFjKmRldWWj+3iIlET7pl1JckWHjcTZ1Dd9Xps8An3gI3FyUNMeHC64TPYJAw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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 1685280203660708.4648405228597; Sun, 28 May 2023 06:23:23 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q3GKZ-0007eB-0i; Sun, 28 May 2023 09:21:07 -0400 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 1q3GKX-0007e1-6G for qemu-devel@nongnu.org; Sun, 28 May 2023 09:21:05 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q3GKV-00087w-O7 for qemu-devel@nongnu.org; Sun, 28 May 2023 09:21:04 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-137-dBNcUPDONoi-iv4sB2xJuw-1; Sun, 28 May 2023 09:20:59 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id DE4ED101A590; Sun, 28 May 2023 13:20:58 +0000 (UTC) Received: from localhost (unknown [10.39.208.19]) by smtp.corp.redhat.com (Postfix) with ESMTP id 987C953BB; Sun, 28 May 2023 13:20:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1685280063; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=+83Gk38iR1YLnw0eyUn4q8QcszZ9vJaxzUVdy2DVMuc=; b=LzIsPj/Pkd6SF9aOT5iQY2m8HlISMRJmzorZClZMdEp939mTFBUjsixQY+suauBxYx3Ztt 5u+UrVNdDbXOHsXbhvgT9h9Ci9mS9m0CabW5iq9x14I455n88L3SHKJaUb1V3lrxAQQFc5 wDsY64U6DuG0TJI0Xs0wne+2AjejYNI= X-MC-Unique: dBNcUPDONoi-iv4sB2xJuw-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: Markus Armbruster , berrange@redhat.com, Eric Blake , Stefan Weil , Gerd Hoffmann , Paolo Bonzini , Pavel Dovgalyuk , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , "Michael S. Tsirkin" Subject: [PULL 09/19] ui/dbus: add a FIXME about texture/dmabuf scanout handling Date: Sun, 28 May 2023 17:20:06 +0400 Message-Id: <20230528132016.3218152-10-marcandre.lureau@redhat.com> In-Reply-To: <20230528132016.3218152-1-marcandre.lureau@redhat.com> References: <20230528132016.3218152-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 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=170.10.129.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -22 X-Spam_score: -2.3 X-Spam_bar: -- X-Spam_report: (-2.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.164, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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 @redhat.com) X-ZM-MESSAGEID: 1685280205315100002 From: Marc-Andr=C3=A9 Lureau Except SDL, display backends seem to fail at handing full scanout geometry correctly. It would need some test/reproducer to actually check it. In the meantime, fill some missing fields, and leave a FIXME. Signed-off-by: Marc-Andr=C3=A9 Lureau Message-Id: <20230515132537.1026310-1-marcandre.lureau@redhat.com> --- ui/dbus-listener.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ui/dbus-listener.c b/ui/dbus-listener.c index defe2220c0..23034eebf9 100644 --- a/ui/dbus-listener.c +++ b/ui/dbus-listener.c @@ -102,6 +102,7 @@ static void dbus_scanout_dmabuf(DisplayChangeListener *= dcl, return; } =20 + /* FIXME: add missing x/y/w/h support */ qemu_dbus_display1_listener_call_scanout_dmabuf( ddl->proxy, g_variant_new_handle(0), @@ -129,6 +130,10 @@ static void dbus_scanout_texture(DisplayChangeListener= *dcl, .width =3D backing_width, .height =3D backing_height, .y0_top =3D backing_y_0_top, + .x =3D x, + .y =3D y, + .scanout_width =3D w, + .scanout_height =3D h, }; =20 assert(tex_id); --=20 2.40.1 From nobody Mon Feb 9 07:06:32 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1685280158; cv=none; d=zohomail.com; s=zohoarc; b=SvUXUy6ZRDoMFsQWmfqZ3PxehpvYBw4bVq2adVJDYotqbOrNEgzT+dFsTLnsutnqMoyTNiCStI4uLGCTBNW9ErNlD4qvjAEDFuqkM3N8X0V5up0oN2V2AVAsfHbQwJsEsSc1b0fz2N33JXtKK40l/2DP6d4y9eouUofEPnCsRDc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1685280158; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=Bz22H6ZR4142YlRYjoFS1c7Izh1s8T/qijFNB7pwtOM=; b=nj4fdAVxKiJhjPJenZ7LEYxw2beZMrZQJ0Vss902+yl5qkMbk4AHJ4HzeTkbH1v53/n6jAGQ7HjtAjLTXDsiso7LVpujePX4K+3fpqPyGz73rXIZ0K0rf8SGTGyJC6r5arO/F4oPxaoQqxNv62ZCmq7cPmPgZYk544AxEftBn1k= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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 1685280158361499.1167793445252; Sun, 28 May 2023 06:22:38 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q3GKc-0007el-2r; Sun, 28 May 2023 09:21:10 -0400 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 1q3GKa-0007ec-Pn for qemu-devel@nongnu.org; Sun, 28 May 2023 09:21:08 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q3GKZ-00088H-FL for qemu-devel@nongnu.org; Sun, 28 May 2023 09:21:08 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-144-eCg8WT7MPZ-blEDbaQBiFw-1; Sun, 28 May 2023 09:21:03 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 22181101A531; Sun, 28 May 2023 13:21:03 +0000 (UTC) Received: from localhost (unknown [10.39.208.19]) by smtp.corp.redhat.com (Postfix) with ESMTP id 25DD120296C6; Sun, 28 May 2023 13:21:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1685280066; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Bz22H6ZR4142YlRYjoFS1c7Izh1s8T/qijFNB7pwtOM=; b=Xcmyeac2qghm3GpZlJLRwzTLz/BmsCH7Q9WDnxJ/jH74CXErJqOnl7DxNDaCIy5UNXk8CO sGaP121o/bDbQ1VWOhf2TKEx3lXTk+bNFJ5ddJXSDsLw0fT9lEYbnwKZGr0epcEWOwwV3M lswHfXxUDcsAyzVNQU/OASrkZPUk7x0= X-MC-Unique: eCg8WT7MPZ-blEDbaQBiFw-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: Markus Armbruster , berrange@redhat.com, Eric Blake , Stefan Weil , Gerd Hoffmann , Paolo Bonzini , Pavel Dovgalyuk , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , "Michael S. Tsirkin" , Bernhard Beschow Subject: [PULL 10/19] ui/sdl2: Grab Alt+Tab also in fullscreen mode Date: Sun, 28 May 2023 17:20:07 +0400 Message-Id: <20230528132016.3218152-11-marcandre.lureau@redhat.com> In-Reply-To: <20230528132016.3218152-1-marcandre.lureau@redhat.com> References: <20230528132016.3218152-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.4 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=170.10.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -22 X-Spam_score: -2.3 X-Spam_bar: -- X-Spam_report: (-2.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.164, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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 @redhat.com) X-ZM-MESSAGEID: 1685280158650100002 From: Bernhard Beschow By default, SDL grabs Alt+Tab only in non-fullscreen mode. This causes Alt+= Tab to switch tasks on the host rather than in the VM in fullscreen mode while = it switches tasks in non-fullscreen mode in the VM. Fix this confusing behavior by grabbing Alt+Tab in fullscreen mode, always causing tasks to be switched= in the VM. Signed-off-by: Bernhard Beschow Reviewed-by: Volker R=C3=BCmelin Message-Id: <20230417192139.43263-2-shentey@gmail.com> --- ui/sdl2.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ui/sdl2.c b/ui/sdl2.c index b12dec4caf..8af8b89f1d 100644 --- a/ui/sdl2.c +++ b/ui/sdl2.c @@ -856,6 +856,9 @@ static void sdl2_display_init(DisplayState *ds, Display= Options *o) SDL_SetHint(SDL_HINT_VIDEO_X11_NET_WM_BYPASS_COMPOSITOR, "0"); #endif SDL_SetHint(SDL_HINT_GRAB_KEYBOARD, "1"); +#ifdef SDL_HINT_ALLOW_ALT_TAB_WHILE_GRABBED + SDL_SetHint(SDL_HINT_ALLOW_ALT_TAB_WHILE_GRABBED, "0"); +#endif memset(&info, 0, sizeof(info)); SDL_VERSION(&info.version); =20 --=20 2.40.1 From nobody Mon Feb 9 07:06:32 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1685280125; cv=none; d=zohomail.com; s=zohoarc; b=jLHdzVobWQ8akFTn5AVZkBAn+BIqpBWGbzH5RQpxc9tBwZYI8Dx8p9+tkk9l7JVf5GIuwJoYTXNGsgvDapvWYTwS1HRGnC5h6gM+ZV7GJixoJSgEILr0HagRbizf4hShbqxJyn7tcbEhCgxjMVorsJbIO3Uhd+p2fQYqa+gR4Ew= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1685280125; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=QMwj99xTxQrSNB8mKEJ9TYHETUWnLVAEoCZwixpO26I=; b=gHn/r+BvagDB/GGKpUtWdh/X09h3IPgcKTbiFhPHW1dnfaAGp+p2UX89zslSduWHVLPhqStlCErGyqgsTChsNWKF7J9Hi7M392d6tsg4IH2rbLmBb/E6XPlLSz4LUF9ab5HuTm+orzUpkSkfkDS2BhRdulFzSgKyyj3Stcj0mGw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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 1685280125823720.7258950730617; Sun, 28 May 2023 06:22:05 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q3GKe-0007zE-TN; Sun, 28 May 2023 09:21:12 -0400 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 1q3GKc-0007kV-Pz for qemu-devel@nongnu.org; Sun, 28 May 2023 09:21:10 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q3GKb-00088W-BV for qemu-devel@nongnu.org; Sun, 28 May 2023 09:21:10 -0400 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-297-mWRAw3T3Onu0NudonQUyOw-1; Sun, 28 May 2023 09:21:07 -0400 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 2DB5F29AA384; Sun, 28 May 2023 13:21:07 +0000 (UTC) Received: from localhost (unknown [10.39.208.19]) by smtp.corp.redhat.com (Postfix) with ESMTP id 69F1E492B0A; Sun, 28 May 2023 13:21:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1685280068; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=QMwj99xTxQrSNB8mKEJ9TYHETUWnLVAEoCZwixpO26I=; b=fwj7HjMhHNmGTH2EcJ/ovCFB49rb7ZgTm6x8sz9eEbvdt9lahwaVMnZco6ZyRkxSxKHs9+ QUVVbdABzUDfhV8irG3RFguJSC/SvazYbcAQmNgN/lA+RJP3fBM/jl7/H8HirHpAYKhmfs 00Oa6e8NrAgX2QkLFbCIkdzj5NH1Fko= X-MC-Unique: mWRAw3T3Onu0NudonQUyOw-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: Markus Armbruster , berrange@redhat.com, Eric Blake , Stefan Weil , Gerd Hoffmann , Paolo Bonzini , Pavel Dovgalyuk , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , "Michael S. Tsirkin" , Bernhard Beschow Subject: [PULL 11/19] ui/sdl2: Grab Alt+F4 also under Windows Date: Sun, 28 May 2023 17:20:08 +0400 Message-Id: <20230528132016.3218152-12-marcandre.lureau@redhat.com> In-Reply-To: <20230528132016.3218152-1-marcandre.lureau@redhat.com> References: <20230528132016.3218152-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.10 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=170.10.129.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -22 X-Spam_score: -2.3 X-Spam_bar: -- X-Spam_report: (-2.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.164, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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 @redhat.com) X-ZM-MESSAGEID: 1685280126534100001 From: Bernhard Beschow SDL doesn't grab Alt+F4 under Windows by default. Pressing Alt+F4 thus clos= es the VM immediately without confirmation, possibly leading to data loss. Fix this by always grabbing Alt+F4 on Windows hosts, too. Signed-off-by: Bernhard Beschow Reviewed-by: Volker R=C3=BCmelin Message-Id: <20230417192139.43263-3-shentey@gmail.com> --- ui/sdl2.c | 1 + 1 file changed, 1 insertion(+) diff --git a/ui/sdl2.c b/ui/sdl2.c index 8af8b89f1d..00aadfae37 100644 --- a/ui/sdl2.c +++ b/ui/sdl2.c @@ -859,6 +859,7 @@ static void sdl2_display_init(DisplayState *ds, Display= Options *o) #ifdef SDL_HINT_ALLOW_ALT_TAB_WHILE_GRABBED SDL_SetHint(SDL_HINT_ALLOW_ALT_TAB_WHILE_GRABBED, "0"); #endif + SDL_SetHint(SDL_HINT_WINDOWS_NO_CLOSE_ON_ALT_F4, "1"); memset(&info, 0, sizeof(info)); SDL_VERSION(&info.version); =20 --=20 2.40.1 From nobody Mon Feb 9 07:06:32 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1685280108; cv=none; d=zohomail.com; s=zohoarc; b=JLH/PnuuNabwyifelguh96ztpQu/1iEJtR+eyxWjDnGm2bNZ/+CATLOTUIDVMVIhkmEkh9/f1LV1b2HkE9y8l+NvWyUs3K6EpN2nYnOSWS3cnS6MG02QA9Err6ZLZMEKYi4JrBZ+icoJ+VMQTl0gmWcQzclclt7khCvjQmiilKQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1685280108; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=6VmGs16g4aCjuhlM/61mP+IiKbSVpFIz0LJWayBAaXQ=; b=RvNwY5jBGZfxT3xM5ERwuQtTibpMND2TXGGo4wlH9T8CttAneoYwWUykTX6Q36I5kh9UrFjboppOdnYa70mMibZ6oqg4drHoTROj4Xr1qetjVgGZT6A2qV3c1jjTTgj0RhN+s9s7HWy8SR8QWYIYqZs5Klm9RCdPTIcwlwCT248= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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 1685280108036861.9336393779662; Sun, 28 May 2023 06:21:48 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q3GKk-0008Bx-Ux; Sun, 28 May 2023 09:21:19 -0400 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 1q3GKj-00089D-2m for qemu-devel@nongnu.org; Sun, 28 May 2023 09:21:17 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q3GKh-0008CJ-GC for qemu-devel@nongnu.org; Sun, 28 May 2023 09:21:16 -0400 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-489-RrlowcgwPTCwyCfrpJzTJQ-1; Sun, 28 May 2023 09:21:11 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 2F8AF1C0514E; Sun, 28 May 2023 13:21:11 +0000 (UTC) Received: from localhost (unknown [10.39.208.19]) by smtp.corp.redhat.com (Postfix) with ESMTP id 29108112132C; Sun, 28 May 2023 13:21:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1685280074; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=6VmGs16g4aCjuhlM/61mP+IiKbSVpFIz0LJWayBAaXQ=; b=fd/lPPiDDBwa28dQbYSso5lvbHDIa3V5EaJIlKYwvCBQUIm8Wwun091/pmXQiRqs+zjsQr f37sSBT8ho3HwFkujoj3/nmzpsqPVpug3TCCJ1TMZ4UPrM7F7Io+JpmGICivSOM7fsHsL3 hd2iUvprlDRVX75vvsRZ83MR3mly6GE= X-MC-Unique: RrlowcgwPTCwyCfrpJzTJQ-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: Markus Armbruster , berrange@redhat.com, Eric Blake , Stefan Weil , Gerd Hoffmann , Paolo Bonzini , Pavel Dovgalyuk , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , "Michael S. Tsirkin" , =?UTF-8?q?Volker=20R=C3=BCmelin?= Subject: [PULL 12/19] ui/sdl2: disable SDL_HINT_GRAB_KEYBOARD on Windows Date: Sun, 28 May 2023 17:20:09 +0400 Message-Id: <20230528132016.3218152-13-marcandre.lureau@redhat.com> In-Reply-To: <20230528132016.3218152-1-marcandre.lureau@redhat.com> References: <20230528132016.3218152-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.3 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=170.10.129.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -22 X-Spam_score: -2.3 X-Spam_bar: -- X-Spam_report: (-2.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.164, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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 @redhat.com) X-ZM-MESSAGEID: 1685280108803100001 From: Volker R=C3=BCmelin Windows sends an extra left control key up/down input event for every right alt key up/down input event for keyboards with international layout. Since commit 830473455f ("ui/sdl2: fix handling of AltGr key on Windows") QEMU uses a Windows low level keyboard hook procedure to reliably filter out the special left control key and to grab the keyboard on Windows. The SDL2 version 2.0.16 introduced its own Windows low level keyboard hook procedure to grab the keyboard. Windows calls this callback before the QEMU keyboard hook procedure. This disables the special left control key filter when the keyboard is grabbed. To fix the problem, disable the SDL2 Windows low level keyboard hook procedure. Reported-by: Bernhard Beschow Signed-off-by: Volker R=C3=BCmelin Reviewed-by: Thomas Huth Tested-by: Bernhard Beschow Message-Id: <20230418062823.5683-1-vr_qemu@t-online.de> --- ui/sdl2.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ui/sdl2.c b/ui/sdl2.c index 00aadfae37..9d703200bf 100644 --- a/ui/sdl2.c +++ b/ui/sdl2.c @@ -855,7 +855,10 @@ static void sdl2_display_init(DisplayState *ds, Displa= yOptions *o) #ifdef SDL_HINT_VIDEO_X11_NET_WM_BYPASS_COMPOSITOR /* only available since= SDL 2.0.8 */ SDL_SetHint(SDL_HINT_VIDEO_X11_NET_WM_BYPASS_COMPOSITOR, "0"); #endif +#ifndef CONFIG_WIN32 + /* QEMU uses its own low level keyboard hook procecure on Windows */ SDL_SetHint(SDL_HINT_GRAB_KEYBOARD, "1"); +#endif #ifdef SDL_HINT_ALLOW_ALT_TAB_WHILE_GRABBED SDL_SetHint(SDL_HINT_ALLOW_ALT_TAB_WHILE_GRABBED, "0"); #endif --=20 2.40.1 From nobody Mon Feb 9 07:06:32 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1685280142; cv=none; d=zohomail.com; s=zohoarc; b=AQes7fvmxW5gR6o6rvUpW/ysKEuyUnh4Vib2R1meV83YCfir8IjMDHxDf/2Q8b+C3w1xJPi/bHZ9qZnV5rLXcHNrU7jWktluntkvLG6HthKEAYpF31pqZyKqfvWPutgkwcYdAclKIhkAurwCAT46qEf3SdvdveyGF2Iid1WXYxE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1685280142; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=yRgd2WXcnIcnRx9qqnV/t9M2085ej0NQRFuRwFwUoqU=; b=LpUvx4wwNKajrh89ES6Dq9hc66KqOtlNvfdizMUO/NZQZAUD6Ayx+vvzIpuYAwgPYV/WlXgo+gNrAa7UiN3ZVoeiXvHtjjCbi5JSiDW+z3FwDVdSKBmQR1cPmvWMlcErIopo9OO7RwemjyTau48KjfoojJUXhvtDNMPHCj92Jy8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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 1685280142240959.8165463409252; Sun, 28 May 2023 06:22:22 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q3GKp-0008Ic-OF; Sun, 28 May 2023 09:21:23 -0400 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 1q3GKo-0008Cr-A7 for qemu-devel@nongnu.org; Sun, 28 May 2023 09:21:22 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q3GKm-0008Fd-Pa for qemu-devel@nongnu.org; Sun, 28 May 2023 09:21:22 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-551-bioQ2JOMNm6GiU5av0perQ-1; Sun, 28 May 2023 09:21:15 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 01512800B2A; Sun, 28 May 2023 13:21:15 +0000 (UTC) Received: from localhost (unknown [10.39.208.19]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4630C53BB; Sun, 28 May 2023 13:21:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1685280080; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=yRgd2WXcnIcnRx9qqnV/t9M2085ej0NQRFuRwFwUoqU=; b=eWp9OfLI9MaF+0O1z6WarSEtsfoT2DG5D7xFvZrmSJW6sBk8psGweqmmF9YIscae4oGVYI ojjdrGbgci4gcJLr/C3pIPrDzZrBVysdjmkjLknIb2XncXRSI9GSnwPFGiskOLrt9W93hs yyrBUM13UW2fXyBj7Z0o/MQwqjMXtJQ= X-MC-Unique: bioQ2JOMNm6GiU5av0perQ-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: Markus Armbruster , berrange@redhat.com, Eric Blake , Stefan Weil , Gerd Hoffmann , Paolo Bonzini , Pavel Dovgalyuk , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , "Michael S. Tsirkin" , Mauro Matteo Cascella Subject: [PULL 13/19] ui/cursor: make width/height unsigned 16-bit integer Date: Sun, 28 May 2023 17:20:10 +0400 Message-Id: <20230528132016.3218152-14-marcandre.lureau@redhat.com> In-Reply-To: <20230528132016.3218152-1-marcandre.lureau@redhat.com> References: <20230528132016.3218152-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 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=170.10.129.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -22 X-Spam_score: -2.3 X-Spam_bar: -- X-Spam_report: (-2.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.164, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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 @redhat.com) X-ZM-MESSAGEID: 1685280143289100005 From: Mauro Matteo Cascella Although not actually exploitable at the moment, a negative width/height could make datasize wrap around and potentially lead to buffer overflow. Since there is no reason a negative width/height is ever appropriate, modify QEMUCursor struct and cursor_alloc prototype to accept uint16_t. This protects us against accidentally introducing future bugs. Signed-off-by: Mauro Matteo Cascella Reported-by: Jacek Halon Reported-by: Yair Mizrahi Reported-by: Elsayed El-Refa'ei Reviewed-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Daniel P. Berrang=C3=A9 Message-Id: <20230523163023.608121-1-mcascell@redhat.com> --- include/ui/console.h | 4 ++-- ui/cursor.c | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/include/ui/console.h b/include/ui/console.h index 2a8fab091f..ae5ec466c1 100644 --- a/include/ui/console.h +++ b/include/ui/console.h @@ -144,13 +144,13 @@ typedef struct QemuUIInfo { =20 /* cursor data format is 32bit RGBA */ typedef struct QEMUCursor { - int width, height; + uint16_t width, height; int hot_x, hot_y; int refcount; uint32_t data[]; } QEMUCursor; =20 -QEMUCursor *cursor_alloc(int width, int height); +QEMUCursor *cursor_alloc(uint16_t width, uint16_t height); QEMUCursor *cursor_ref(QEMUCursor *c); void cursor_unref(QEMUCursor *c); QEMUCursor *cursor_builtin_hidden(void); diff --git a/ui/cursor.c b/ui/cursor.c index 6fe67990e2..29717b3ecb 100644 --- a/ui/cursor.c +++ b/ui/cursor.c @@ -90,11 +90,12 @@ QEMUCursor *cursor_builtin_left_ptr(void) return cursor_parse_xpm(cursor_left_ptr_xpm); } =20 -QEMUCursor *cursor_alloc(int width, int height) +QEMUCursor *cursor_alloc(uint16_t width, uint16_t height) { QEMUCursor *c; size_t datasize =3D width * height * sizeof(uint32_t); =20 + /* Modern physical hardware typically uses 512x512 sprites */ if (width > 512 || height > 512) { return NULL; } --=20 2.40.1 From nobody Mon Feb 9 07:06:32 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1685280107; cv=none; d=zohomail.com; s=zohoarc; b=dOMuFQaW1huEUnWLnyPNt1qhGzvImMjO8QXy3Q7F0m//KwamianeN6D0ux+EteF5VK+1mVkg1gsEJSFCtM3UnGvWbu/cbAs7c8QLApWIjxYi3EpLuTGNl3qJal2ATzK/+H5GJKgckYV+KzBV/6AbLZVsTF9Jc1wCXhlaO6H1Ur0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1685280107; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=cZ1o91VFe2jeLlbLXsmNGS8Iude2vfiSWmMIlYVb6Lg=; b=GWXfy1GaiYF9yFz/J9uJoDYy6qT0kwzrq0OVwJo0TNyExdsjf97Qycn7+Rt2EpEAgr88I+x04SscH6jtqJL3kjIl40nNMTKeR1rKftrfM1VZMRcFg09LULKCPkucXbMjapv5Nzgl+S9wV24taDqwlxYcbknAygc5ftElx+M/Ync= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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 1685280107740867.1841732597529; Sun, 28 May 2023 06:21:47 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q3GKs-0008NQ-PA; Sun, 28 May 2023 09:21:26 -0400 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 1q3GKq-0008LI-Nn for qemu-devel@nongnu.org; Sun, 28 May 2023 09:21:24 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q3GKp-0008Fy-45 for qemu-devel@nongnu.org; Sun, 28 May 2023 09:21:24 -0400 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-590-ZfKvrCKVP9CTDEXbcYL4LQ-1; Sun, 28 May 2023 09:21:19 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id D999829AA384; Sun, 28 May 2023 13:21:18 +0000 (UTC) Received: from localhost (unknown [10.39.208.19]) by smtp.corp.redhat.com (Postfix) with ESMTP id DB2B22166B2B; Sun, 28 May 2023 13:21:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1685280082; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=cZ1o91VFe2jeLlbLXsmNGS8Iude2vfiSWmMIlYVb6Lg=; b=KkBOj41XQFih7TTfG7CCNoSiuxq+qNd6dNVFwR9Jtep4jNxl5bDIEKvuDUqLrHjxzJIXqM WD+7DwJzjinn5UO2gSbe4kDA01oDlNp9ZxWtO0IqpLHWs8eXqB9I+E2Sztxilj3DDXJC+T vV+90fNT7qdA/+0ftWoIrCyxqgfeJSs= X-MC-Unique: ZfKvrCKVP9CTDEXbcYL4LQ-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: Markus Armbruster , berrange@redhat.com, Eric Blake , Stefan Weil , Gerd Hoffmann , Paolo Bonzini , Pavel Dovgalyuk , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , "Michael S. Tsirkin" , Sergio Lopez Subject: [PULL 14/19] virtio-input: generalize virtio_input_key_config() Date: Sun, 28 May 2023 17:20:11 +0400 Message-Id: <20230528132016.3218152-15-marcandre.lureau@redhat.com> In-Reply-To: <20230528132016.3218152-1-marcandre.lureau@redhat.com> References: <20230528132016.3218152-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 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=170.10.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -22 X-Spam_score: -2.3 X-Spam_bar: -- X-Spam_report: (-2.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.164, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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 @redhat.com) X-ZM-MESSAGEID: 1685280109178100003 From: Sergio Lopez As there are other bitmap-based config properties that need to be dealt in a similar fashion as VIRTIO_INPUT_CFG_EV_BITS, generalize the function to receive select and subsel as arguments, and rename it to virtio_input_extend_config() Signed-off-by: Sergio Lopez Reviewed-by: Marc-Andr=C3=A9 Lureau Message-Id: <20230526112925.38794-2-slp@redhat.com> --- hw/input/virtio-input-hid.c | 38 ++++++++++++++++++++----------------- 1 file changed, 21 insertions(+), 17 deletions(-) diff --git a/hw/input/virtio-input-hid.c b/hw/input/virtio-input-hid.c index a7a244a95d..d28dab69ba 100644 --- a/hw/input/virtio-input-hid.c +++ b/hw/input/virtio-input-hid.c @@ -44,30 +44,31 @@ static const unsigned short axismap_abs[INPUT_AXIS__MAX= ] =3D { =20 /* ----------------------------------------------------------------- */ =20 -static void virtio_input_key_config(VirtIOInput *vinput, - const unsigned short *keymap, - size_t mapsize) +static void virtio_input_extend_config(VirtIOInput *vinput, + const unsigned short *map, + size_t mapsize, + uint8_t select, uint8_t subsel) { - virtio_input_config keys; + virtio_input_config ext; int i, bit, byte, bmax =3D 0; =20 - memset(&keys, 0, sizeof(keys)); + memset(&ext, 0, sizeof(ext)); for (i =3D 0; i < mapsize; i++) { - bit =3D keymap[i]; + bit =3D map[i]; if (!bit) { continue; } byte =3D bit / 8; bit =3D bit % 8; - keys.u.bitmap[byte] |=3D (1 << bit); + ext.u.bitmap[byte] |=3D (1 << bit); if (bmax < byte+1) { bmax =3D byte+1; } } - keys.select =3D VIRTIO_INPUT_CFG_EV_BITS; - keys.subsel =3D EV_KEY; - keys.size =3D bmax; - virtio_input_add_config(vinput, &keys); + ext.select =3D select; + ext.subsel =3D subsel; + ext.size =3D bmax; + virtio_input_add_config(vinput, &ext); } =20 static void virtio_input_handle_event(DeviceState *dev, QemuConsole *src, @@ -281,8 +282,9 @@ static void virtio_keyboard_init(Object *obj) =20 vhid->handler =3D &virtio_keyboard_handler; virtio_input_init_config(vinput, virtio_keyboard_config); - virtio_input_key_config(vinput, qemu_input_map_qcode_to_linux, - qemu_input_map_qcode_to_linux_len); + virtio_input_extend_config(vinput, qemu_input_map_qcode_to_linux, + qemu_input_map_qcode_to_linux_len, + VIRTIO_INPUT_CFG_EV_BITS, EV_KEY); } =20 static const TypeInfo virtio_keyboard_info =3D { @@ -373,8 +375,9 @@ static void virtio_mouse_init(Object *obj) virtio_input_init_config(vinput, vhid->wheel_axis ? virtio_mouse_config_v2 : virtio_mouse_config_v1); - virtio_input_key_config(vinput, keymap_button, - ARRAY_SIZE(keymap_button)); + virtio_input_extend_config(vinput, keymap_button, + ARRAY_SIZE(keymap_button), + VIRTIO_INPUT_CFG_EV_BITS, EV_KEY); } =20 static const TypeInfo virtio_mouse_info =3D { @@ -497,8 +500,9 @@ static void virtio_tablet_init(Object *obj) virtio_input_init_config(vinput, vhid->wheel_axis ? virtio_tablet_config_v2 : virtio_tablet_config_v1); - virtio_input_key_config(vinput, keymap_button, - ARRAY_SIZE(keymap_button)); + virtio_input_extend_config(vinput, keymap_button, + ARRAY_SIZE(keymap_button), + VIRTIO_INPUT_CFG_EV_BITS, EV_KEY); } =20 static const TypeInfo virtio_tablet_info =3D { --=20 2.40.1 From nobody Mon Feb 9 07:06:32 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1685280188; cv=none; d=zohomail.com; s=zohoarc; b=OVJW3/o/hN533BTb6Wy4mSeaZuTu/XWLOK0XdAPkDZ9tK8YePFz27jG1v+tgITM2kCnaHeaUjNxAbpwwygCbSpIx0p5Yo51egm4iJzFJGmI1WCEXxBqzpuTE9/9hgrCDclDGXN8T4U6iYpSRdY5VVfX8lqrSfTMiVG+BNA8RCS8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1685280188; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=5nllr13g5KC+bhfc4tzi0xHvcEUdSzwg7eGQUYy+8T4=; b=UgRaCBc8imCNth+5DwKQ/fx7ry2prUaVqb8V/yJGyYMJRNZnArGdKUrfPYv/JpN+r23kR8ZV8443MkDtqtCSSHXYZBf6B0SI6SHPjJPUUMidNT+AzRMNwGT/in5maHXvrU3SZj+1KXjIpkFp4TyxGPgwcgHZ6c3Rq6kSimVfyZQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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 1685280188390368.0478414481388; Sun, 28 May 2023 06:23:08 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q3GKy-0008Ru-AG; Sun, 28 May 2023 09:21:32 -0400 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 1q3GKw-0008R1-16 for qemu-devel@nongnu.org; Sun, 28 May 2023 09:21:30 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q3GKu-0008Gs-4p for qemu-devel@nongnu.org; Sun, 28 May 2023 09:21:29 -0400 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-653-uxwbEMgoPs2GWvvKQx8U5Q-1; Sun, 28 May 2023 09:21:23 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 45D7929AA384; Sun, 28 May 2023 13:21:23 +0000 (UTC) Received: from localhost (unknown [10.39.208.19]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0625F112132C; Sun, 28 May 2023 13:21:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1685280087; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=5nllr13g5KC+bhfc4tzi0xHvcEUdSzwg7eGQUYy+8T4=; b=cwEhq89iHpxrPGtsYvD6VdyMJMrA+6QWteN/iiQRyBfSv3QpoD7sfrAnhU/9BZbdLq71GY lCYwURzNsx+239ISaJcfFijKxfxoztB9qPufA42A1A9o6CGTTVsxQM17cxE1mraPEG3AS3 OkhamKmjQwGDSPMI0uCqzNKSUMp+BFA= X-MC-Unique: uxwbEMgoPs2GWvvKQx8U5Q-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: Markus Armbruster , berrange@redhat.com, Eric Blake , Stefan Weil , Gerd Hoffmann , Paolo Bonzini , Pavel Dovgalyuk , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , "Michael S. Tsirkin" , Sergio Lopez Subject: [PULL 15/19] ui: add the infrastructure to support MT events Date: Sun, 28 May 2023 17:20:12 +0400 Message-Id: <20230528132016.3218152-16-marcandre.lureau@redhat.com> In-Reply-To: <20230528132016.3218152-1-marcandre.lureau@redhat.com> References: <20230528132016.3218152-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.3 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=170.10.129.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -22 X-Spam_score: -2.3 X-Spam_bar: -- X-Spam_report: (-2.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.164, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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 @redhat.com) X-ZM-MESSAGEID: 1685280189217100001 From: Sergio Lopez Add the required infrastructure to support generating multitouch events. Signed-off-by: Sergio Lopez Reviewed-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Markus Armbruster Message-Id: <20230526112925.38794-3-slp@redhat.com> --- qapi/ui.json | 68 +++++++++++++++++++++++++++++++++++++------ include/ui/input.h | 3 ++ replay/replay-input.c | 18 ++++++++++++ ui/input.c | 6 ++++ ui/trace-events | 1 + 5 files changed, 87 insertions(+), 9 deletions(-) diff --git a/qapi/ui.json b/qapi/ui.json index d51e34049c..2755395483 100644 --- a/qapi/ui.json +++ b/qapi/ui.json @@ -1055,11 +1055,13 @@ # # @extra: rear side button of a 5-button mouse (since 2.9) # +# @touch: screen contact on a multi-touch device (since 8.1) +# # Since: 2.0 ## { 'enum' : 'InputButton', 'data' : [ 'left', 'middle', 'right', 'wheel-up', 'wheel-down', 'side', - 'extra', 'wheel-left', 'wheel-right' ] } + 'extra', 'wheel-left', 'wheel-right', 'touch' ] } =20 ## # @InputAxis: @@ -1071,6 +1073,17 @@ { 'enum' : 'InputAxis', 'data' : [ 'x', 'y' ] } =20 +## +# @InputMultiTouchType: +# +# Type of a multi-touch event. +# +# Since: 8.1 +## +{ 'enum' : 'InputMultiTouchType', + 'data' : [ 'begin', 'update', 'end', 'cancel', 'data' ] } + + ## # @InputKeyEvent: # @@ -1117,13 +1130,46 @@ 'data' : { 'axis' : 'InputAxis', 'value' : 'int' } } =20 +## +# @InputMultiTouchEvent: +# +# MultiTouch input event. +# +# @slot: Which slot has generated the event. +# +# @tracking-id: ID to correlate this event with previously generated +# events. +# +# @axis: Which axis is referenced by @value. +# +# @value: Contact position. +# +# Since: 8.1 +## +{ 'struct' : 'InputMultiTouchEvent', + 'data' : { 'type' : 'InputMultiTouchType', + 'slot' : 'int', + 'tracking-id': 'int', + 'axis' : 'InputAxis', + 'value' : 'int' } } + ## # @InputEventKind: # +# @key: a keyboard input event +# +# @btn: a pointer button input event +# +# @rel: a relative pointer motion input event +# +# @abs: an absolute pointer motion input event +# +# @mtt: a multi-touch input event +# # Since: 2.0 ## { 'enum': 'InputEventKind', - 'data': [ 'key', 'btn', 'rel', 'abs' ] } + 'data': [ 'key', 'btn', 'rel', 'abs', 'mtt' ] } =20 ## # @InputKeyEventWrapper: @@ -1149,17 +1195,20 @@ { 'struct': 'InputMoveEventWrapper', 'data': { 'data': 'InputMoveEvent' } } =20 +## +# @InputMultiTouchEventWrapper: +# +# Since: 8.1 +## +{ 'struct': 'InputMultiTouchEventWrapper', + 'data': { 'data': 'InputMultiTouchEvent' } } + ## # @InputEvent: # # Input event union. # -# @type: the input type, one of: -# -# - 'key': Input event of Keyboard -# - 'btn': Input event of pointer buttons -# - 'rel': Input event of relative pointer motion -# - 'abs': Input event of absolute pointer motion +# @type: the type of input event # # Since: 2.0 ## @@ -1169,7 +1218,8 @@ 'data' : { 'key' : 'InputKeyEventWrapper', 'btn' : 'InputBtnEventWrapper', 'rel' : 'InputMoveEventWrapper', - 'abs' : 'InputMoveEventWrapper' } } + 'abs' : 'InputMoveEventWrapper', + 'mtt' : 'InputMultiTouchEventWrapper' } } =20 ## # @input-send-event: diff --git a/include/ui/input.h b/include/ui/input.h index c86219a1c1..2a3dffd417 100644 --- a/include/ui/input.h +++ b/include/ui/input.h @@ -8,9 +8,12 @@ #define INPUT_EVENT_MASK_BTN (1<type); =20 switch (evt->type) { @@ -58,6 +59,14 @@ void replay_save_input_event(InputEvent *evt) replay_put_dword(move->axis); replay_put_qword(move->value); break; + case INPUT_EVENT_KIND_MTT: + mtt =3D evt->u.mtt.data; + replay_put_dword(mtt->type); + replay_put_qword(mtt->slot); + replay_put_qword(mtt->tracking_id); + replay_put_dword(mtt->axis); + replay_put_qword(mtt->value); + break; case INPUT_EVENT_KIND__MAX: /* keep gcc happy */ break; @@ -73,6 +82,7 @@ InputEvent *replay_read_input_event(void) InputBtnEvent btn; InputMoveEvent rel; InputMoveEvent abs; + InputMultiTouchEvent mtt; =20 evt.type =3D replay_get_dword(); switch (evt.type) { @@ -109,6 +119,14 @@ InputEvent *replay_read_input_event(void) evt.u.abs.data->axis =3D (InputAxis)replay_get_dword(); evt.u.abs.data->value =3D replay_get_qword(); break; + case INPUT_EVENT_KIND_MTT: + evt.u.mtt.data =3D &mtt; + evt.u.mtt.data->type =3D (InputMultiTouchType)replay_get_dword(); + evt.u.mtt.data->slot =3D replay_get_qword(); + evt.u.mtt.data->tracking_id =3D replay_get_qword(); + evt.u.mtt.data->axis =3D (InputAxis)replay_get_dword(); + evt.u.mtt.data->value =3D replay_get_qword(); + break; case INPUT_EVENT_KIND__MAX: /* keep gcc happy */ break; diff --git a/ui/input.c b/ui/input.c index f2d1e7a3a7..fc75f1353c 100644 --- a/ui/input.c +++ b/ui/input.c @@ -212,6 +212,7 @@ static void qemu_input_event_trace(QemuConsole *src, In= putEvent *evt) InputKeyEvent *key; InputBtnEvent *btn; InputMoveEvent *move; + InputMultiTouchEvent *mtt; =20 if (src) { idx =3D qemu_console_get_index(src); @@ -250,6 +251,11 @@ static void qemu_input_event_trace(QemuConsole *src, I= nputEvent *evt) name =3D InputAxis_str(move->axis); trace_input_event_abs(idx, name, move->value); break; + case INPUT_EVENT_KIND_MTT: + mtt =3D evt->u.mtt.data; + name =3D InputAxis_str(mtt->axis); + trace_input_event_mtt(idx, name, mtt->value); + break; case INPUT_EVENT_KIND__MAX: /* keep gcc happy */ break; diff --git a/ui/trace-events b/ui/trace-events index 977577fbba..6747361745 100644 --- a/ui/trace-events +++ b/ui/trace-events @@ -90,6 +90,7 @@ input_event_key_qcode(int conidx, const char *qcode, bool= down) "con %d, key qco input_event_btn(int conidx, const char *btn, bool down) "con %d, button %s= , down %d" input_event_rel(int conidx, const char *axis, int value) "con %d, axis %s,= value %d" input_event_abs(int conidx, const char *axis, int value) "con %d, axis %s,= value 0x%x" +input_event_mtt(int conidx, const char *axis, int value) "con %d, axis %s,= value 0x%x" input_event_sync(void) "" input_mouse_mode(int absolute) "absolute %d" =20 --=20 2.40.1 From nobody Mon Feb 9 07:06:32 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1685280164; cv=none; d=zohomail.com; s=zohoarc; b=HooiEErvKkgu7L2v+nLXlGvgMEkBYPeY7anAUs/+r9XWQjbydEO7ozOfBWWEcqzEhimudvzjR21TGogS4T6rWWf3zFziI+X8giP9DWroimDfuui46BGtPJCYRWp1B8StgS3J4IWsmtcitLD5EuB5dkxTiVeXSrKNIaBEMxzEHPM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1685280164; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=4dV3uCuICXPpvzod5GSQRboZxKikJYvjpmzAFN1tGNg=; b=h7LQLXI7gDs09x+eTLBPkxAr/telTTgdJGKeBA7OP/NLtpkwXzJv3G/tmVzObOi/aU/yVk20bwaFB8N+vX/jFezFfb6hZM62nl6TFWjTN8SFksbDQV9YzMejEwqd/alLNiFziLyQ72BkpevEXqZg0KwZe0oK039F3DpT4Ywfvj0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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 1685280164684122.07491027853973; Sun, 28 May 2023 06:22:44 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q3GL0-00008Q-G9; Sun, 28 May 2023 09:21:34 -0400 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 1q3GKy-0008Rp-5l for qemu-devel@nongnu.org; Sun, 28 May 2023 09:21:32 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q3GKw-0008Hm-8N for qemu-devel@nongnu.org; Sun, 28 May 2023 09:21:31 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-592-15C7jPzYO3iUnFx0p8WCoA-1; Sun, 28 May 2023 09:21:28 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id E3AC285A5A8; Sun, 28 May 2023 13:21:27 +0000 (UTC) Received: from localhost (unknown [10.39.208.19]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4EE7A112132C; Sun, 28 May 2023 13:21:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1685280089; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=4dV3uCuICXPpvzod5GSQRboZxKikJYvjpmzAFN1tGNg=; b=eyxdi7iO86QfAnhIgcK/vS2XLCZMeprSWZMA44GVpOdpUKQZy+QoFHHi6/Ac4wWZBTg3Us aGxdnDyJ/fLpDmm8vxCgj1eQH+0ZmWQLS6/E37xD6Up6iztQfpY68OcVCJsd2q3cnFb3Aj BbHvH0vCyQ1fFQZAiHm8TQ93R3T7938= X-MC-Unique: 15C7jPzYO3iUnFx0p8WCoA-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: Markus Armbruster , berrange@redhat.com, Eric Blake , Stefan Weil , Gerd Hoffmann , Paolo Bonzini , Pavel Dovgalyuk , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , "Michael S. Tsirkin" , Sergio Lopez Subject: [PULL 16/19] virtio-input: add a virtio-mulitouch device Date: Sun, 28 May 2023 17:20:13 +0400 Message-Id: <20230528132016.3218152-17-marcandre.lureau@redhat.com> In-Reply-To: <20230528132016.3218152-1-marcandre.lureau@redhat.com> References: <20230528132016.3218152-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.3 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=170.10.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -22 X-Spam_score: -2.3 X-Spam_bar: -- X-Spam_report: (-2.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.164, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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 @redhat.com) X-ZM-MESSAGEID: 1685280165121100001 From: Sergio Lopez Add a virtio-multitouch device to the family of devices emulated by virtio-input implementing the Multi-touch protocol as descripted here: https://www.kernel.org/doc/html/latest/input/multi-touch-protocol.html?high= light=3Dmulti+touch This patch just add the device itself, without connecting it to any backends. The following patches will add a PCI-based multitouch device, some helpers in "ui" and will enable the GTK3 backend to transpose multi-touch events from the host to the guest. Signed-off-by: Sergio Lopez Reviewed-by: Marc-Andr=C3=A9 Lureau Message-Id: <20230526112925.38794-4-slp@redhat.com> --- include/hw/virtio/virtio-input.h | 9 +-- hw/input/virtio-input-hid.c | 118 ++++++++++++++++++++++++++++++- 2 files changed, 120 insertions(+), 7 deletions(-) diff --git a/include/hw/virtio/virtio-input.h b/include/hw/virtio/virtio-in= put.h index f2da63d309..08f1591424 100644 --- a/include/hw/virtio/virtio-input.h +++ b/include/hw/virtio/virtio-input.h @@ -24,10 +24,11 @@ OBJECT_DECLARE_TYPE(VirtIOInput, VirtIOInputClass, #define VIRTIO_INPUT_GET_PARENT_CLASS(obj) \ OBJECT_GET_PARENT_CLASS(obj, TYPE_VIRTIO_INPUT) =20 -#define TYPE_VIRTIO_INPUT_HID "virtio-input-hid-device" -#define TYPE_VIRTIO_KEYBOARD "virtio-keyboard-device" -#define TYPE_VIRTIO_MOUSE "virtio-mouse-device" -#define TYPE_VIRTIO_TABLET "virtio-tablet-device" +#define TYPE_VIRTIO_INPUT_HID "virtio-input-hid-device" +#define TYPE_VIRTIO_KEYBOARD "virtio-keyboard-device" +#define TYPE_VIRTIO_MOUSE "virtio-mouse-device" +#define TYPE_VIRTIO_TABLET "virtio-tablet-device" +#define TYPE_VIRTIO_MULTITOUCH "virtio-multitouch-device" =20 OBJECT_DECLARE_SIMPLE_TYPE(VirtIOInputHID, VIRTIO_INPUT_HID) #define VIRTIO_INPUT_HID_GET_PARENT_CLASS(obj) \ diff --git a/hw/input/virtio-input-hid.c b/hw/input/virtio-input-hid.c index d28dab69ba..7053ad72d4 100644 --- a/hw/input/virtio-input-hid.c +++ b/hw/input/virtio-input-hid.c @@ -16,9 +16,10 @@ =20 #include "standard-headers/linux/input.h" =20 -#define VIRTIO_ID_NAME_KEYBOARD "QEMU Virtio Keyboard" -#define VIRTIO_ID_NAME_MOUSE "QEMU Virtio Mouse" -#define VIRTIO_ID_NAME_TABLET "QEMU Virtio Tablet" +#define VIRTIO_ID_NAME_KEYBOARD "QEMU Virtio Keyboard" +#define VIRTIO_ID_NAME_MOUSE "QEMU Virtio Mouse" +#define VIRTIO_ID_NAME_TABLET "QEMU Virtio Tablet" +#define VIRTIO_ID_NAME_MULTITOUCH "QEMU Virtio MultiTouch" =20 /* ----------------------------------------------------------------- */ =20 @@ -30,6 +31,7 @@ static const unsigned short keymap_button[INPUT_BUTTON__M= AX] =3D { [INPUT_BUTTON_WHEEL_DOWN] =3D BTN_GEAR_DOWN, [INPUT_BUTTON_SIDE] =3D BTN_SIDE, [INPUT_BUTTON_EXTRA] =3D BTN_EXTRA, + [INPUT_BUTTON_TOUCH] =3D BTN_TOUCH, }; =20 static const unsigned short axismap_rel[INPUT_AXIS__MAX] =3D { @@ -42,6 +44,11 @@ static const unsigned short axismap_abs[INPUT_AXIS__MAX]= =3D { [INPUT_AXIS_Y] =3D ABS_Y, }; =20 +static const unsigned short axismap_tch[INPUT_AXIS__MAX] =3D { + [INPUT_AXIS_X] =3D ABS_MT_POSITION_X, + [INPUT_AXIS_Y] =3D ABS_MT_POSITION_Y, +}; + /* ----------------------------------------------------------------- */ =20 static void virtio_input_extend_config(VirtIOInput *vinput, @@ -81,6 +88,7 @@ static void virtio_input_handle_event(DeviceState *dev, Q= emuConsole *src, InputKeyEvent *key; InputMoveEvent *move; InputBtnEvent *btn; + InputMultiTouchEvent *mtt; =20 switch (evt->type) { case INPUT_EVENT_KIND_KEY: @@ -137,6 +145,24 @@ static void virtio_input_handle_event(DeviceState *dev= , QemuConsole *src, event.value =3D cpu_to_le32(move->value); virtio_input_send(vinput, &event); break; + case INPUT_EVENT_KIND_MTT: + mtt =3D evt->u.mtt.data; + if (mtt->type =3D=3D INPUT_MULTI_TOUCH_TYPE_DATA) { + event.type =3D cpu_to_le16(EV_ABS); + event.code =3D cpu_to_le16(axismap_tch[mtt->axis]); + event.value =3D cpu_to_le32(mtt->value); + virtio_input_send(vinput, &event); + } else { + event.type =3D cpu_to_le16(EV_ABS); + event.code =3D cpu_to_le16(ABS_MT_SLOT); + event.value =3D cpu_to_le32(mtt->slot); + virtio_input_send(vinput, &event); + event.type =3D cpu_to_le16(EV_ABS); + event.code =3D cpu_to_le16(ABS_MT_TRACKING_ID); + event.value =3D cpu_to_le32(mtt->tracking_id); + virtio_input_send(vinput, &event); + } + break; default: /* keep gcc happy */ break; @@ -515,12 +541,98 @@ static const TypeInfo virtio_tablet_info =3D { =20 /* ----------------------------------------------------------------- */ =20 +static QemuInputHandler virtio_multitouch_handler =3D { + .name =3D VIRTIO_ID_NAME_MULTITOUCH, + .mask =3D INPUT_EVENT_MASK_BTN | INPUT_EVENT_MASK_MTT, + .event =3D virtio_input_handle_event, + .sync =3D virtio_input_handle_sync, +}; + +static struct virtio_input_config virtio_multitouch_config[] =3D { + { + .select =3D VIRTIO_INPUT_CFG_ID_NAME, + .size =3D sizeof(VIRTIO_ID_NAME_MULTITOUCH), + .u.string =3D VIRTIO_ID_NAME_MULTITOUCH, + },{ + .select =3D VIRTIO_INPUT_CFG_ID_DEVIDS, + .size =3D sizeof(struct virtio_input_devids), + .u.ids =3D { + .bustype =3D const_le16(BUS_VIRTUAL), + .vendor =3D const_le16(0x0627), /* same we use for usb hid de= vices */ + .product =3D const_le16(0x0003), + .version =3D const_le16(0x0001), + }, + },{ + .select =3D VIRTIO_INPUT_CFG_ABS_INFO, + .subsel =3D ABS_MT_SLOT, + .size =3D sizeof(virtio_input_absinfo), + .u.abs.min =3D const_le32(INPUT_EVENT_SLOTS_MIN), + .u.abs.max =3D const_le32(INPUT_EVENT_SLOTS_MAX), + },{ + .select =3D VIRTIO_INPUT_CFG_ABS_INFO, + .subsel =3D ABS_MT_TRACKING_ID, + .size =3D sizeof(virtio_input_absinfo), + .u.abs.min =3D const_le32(INPUT_EVENT_SLOTS_MIN), + .u.abs.max =3D const_le32(INPUT_EVENT_SLOTS_MAX), + },{ + .select =3D VIRTIO_INPUT_CFG_ABS_INFO, + .subsel =3D ABS_MT_POSITION_X, + .size =3D sizeof(virtio_input_absinfo), + .u.abs.min =3D const_le32(INPUT_EVENT_ABS_MIN), + .u.abs.max =3D const_le32(INPUT_EVENT_ABS_MAX), + },{ + .select =3D VIRTIO_INPUT_CFG_ABS_INFO, + .subsel =3D ABS_MT_POSITION_Y, + .size =3D sizeof(virtio_input_absinfo), + .u.abs.min =3D const_le32(INPUT_EVENT_ABS_MIN), + .u.abs.max =3D const_le32(INPUT_EVENT_ABS_MAX), + }, + { /* end of list */ }, +}; + +static void virtio_multitouch_init(Object *obj) +{ + VirtIOInputHID *vhid =3D VIRTIO_INPUT_HID(obj); + VirtIOInput *vinput =3D VIRTIO_INPUT(obj); + unsigned short abs_props[] =3D { + INPUT_PROP_DIRECT, + }; + unsigned short abs_bits[] =3D { + ABS_MT_SLOT, + ABS_MT_TRACKING_ID, + ABS_MT_POSITION_X, + ABS_MT_POSITION_Y, + }; + + vhid->handler =3D &virtio_multitouch_handler; + virtio_input_init_config(vinput, virtio_multitouch_config); + virtio_input_extend_config(vinput, keymap_button, + ARRAY_SIZE(keymap_button), + VIRTIO_INPUT_CFG_EV_BITS, EV_KEY); + virtio_input_extend_config(vinput, abs_props, + ARRAY_SIZE(abs_props), + VIRTIO_INPUT_CFG_PROP_BITS, 0); + virtio_input_extend_config(vinput, abs_bits, + ARRAY_SIZE(abs_bits), + VIRTIO_INPUT_CFG_EV_BITS, EV_ABS); +} + +static const TypeInfo virtio_multitouch_info =3D { + .name =3D TYPE_VIRTIO_MULTITOUCH, + .parent =3D TYPE_VIRTIO_INPUT_HID, + .instance_size =3D sizeof(VirtIOInputHID), + .instance_init =3D virtio_multitouch_init, +}; + +/* ----------------------------------------------------------------- */ + static void virtio_register_types(void) { type_register_static(&virtio_input_hid_info); type_register_static(&virtio_keyboard_info); type_register_static(&virtio_mouse_info); type_register_static(&virtio_tablet_info); + type_register_static(&virtio_multitouch_info); } =20 type_init(virtio_register_types) --=20 2.40.1 From nobody Mon Feb 9 07:06:32 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1685280195; cv=none; d=zohomail.com; s=zohoarc; b=jhoDlHGaduRUSKu0p1Gyd6T/93zA8rpReMbt2rtnfiaRy4mRAnQRMWZmt3FafayTuGpXjORgW4bhD3rxIBHRr/E5C3D8ZRV6LUfgK22cPMUEpREmsK31MPx4FjLK0h891DYZ/Z+NAcjfOafgVgOlhOoa8Gi9Zklh3yvdCxRpQOY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1685280195; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=HgTsG3H8WXNj2yhkjmMhgawp1vfYqsJbnxDReRjTWIU=; b=J5m3j0W+5Pslj0UUzo3wqBoz/z3obBn6/IxMLkgKuS4LUlD3TYivlf1mgPbM3KtM1Y72C9Y02IgRgLBhGpelZdm+23svdpRwsGIqxvIfTwtqofq54iZwipIksrCkfhbNQMqrzaHDxf4t/OD8hCk4HBLuVbbNlM0DhbN6qXhChlQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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 1685280195471339.54492714064315; Sun, 28 May 2023 06:23:15 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q3GL6-0000c1-GH; Sun, 28 May 2023 09:21:40 -0400 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 1q3GL4-0000RZ-8Y for qemu-devel@nongnu.org; Sun, 28 May 2023 09:21:38 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q3GL2-0008JX-LS for qemu-devel@nongnu.org; Sun, 28 May 2023 09:21:38 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-201-IHNZrIoUOPCH7jPP4Q5WTw-1; Sun, 28 May 2023 09:21:32 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 0F7E4185A78B; Sun, 28 May 2023 13:21:32 +0000 (UTC) Received: from localhost (unknown [10.39.208.19]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2D97040C6CCC; Sun, 28 May 2023 13:21:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1685280095; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=HgTsG3H8WXNj2yhkjmMhgawp1vfYqsJbnxDReRjTWIU=; b=Z1JUkYRiLHx8QwA1X8a21CCoyqpgnSQ4iOFDx1zaIKC0i2ioBy/PhIsmb4Iy+SyXDcmNPd E0/am+DjM4hSQ8mDSuaBkbdVm7NEW/Ecs3nInFzWt/4r5HPLpse4kuqEvsMfJXFC+taIbO sfNeYa31+gAeUDdDH1Hyq+OD26kJL7M= X-MC-Unique: IHNZrIoUOPCH7jPP4Q5WTw-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: Markus Armbruster , berrange@redhat.com, Eric Blake , Stefan Weil , Gerd Hoffmann , Paolo Bonzini , Pavel Dovgalyuk , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , "Michael S. Tsirkin" , Sergio Lopez Subject: [PULL 17/19] virtio-input-pci: add virtio-multitouch-pci Date: Sun, 28 May 2023 17:20:14 +0400 Message-Id: <20230528132016.3218152-18-marcandre.lureau@redhat.com> In-Reply-To: <20230528132016.3218152-1-marcandre.lureau@redhat.com> References: <20230528132016.3218152-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 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=170.10.129.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -22 X-Spam_score: -2.3 X-Spam_bar: -- X-Spam_report: (-2.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.164, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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 @redhat.com) X-ZM-MESSAGEID: 1685280196909100001 From: Sergio Lopez Add virtio-multitouch-pci, a Multitouch-capable input device, to the list of devices that can be provided by virtio-input-pci. Signed-off-by: Sergio Lopez Reviewed-by: Marc-Andr=C3=A9 Lureau Message-Id: <20230526112925.38794-5-slp@redhat.com> --- hw/virtio/virtio-input-pci.c | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/hw/virtio/virtio-input-pci.c b/hw/virtio/virtio-input-pci.c index a9d0992389..a53edf46c4 100644 --- a/hw/virtio/virtio-input-pci.c +++ b/hw/virtio/virtio-input-pci.c @@ -25,10 +25,11 @@ struct VirtIOInputPCI { VirtIOInput vdev; }; =20 -#define TYPE_VIRTIO_INPUT_HID_PCI "virtio-input-hid-pci" -#define TYPE_VIRTIO_KEYBOARD_PCI "virtio-keyboard-pci" -#define TYPE_VIRTIO_MOUSE_PCI "virtio-mouse-pci" -#define TYPE_VIRTIO_TABLET_PCI "virtio-tablet-pci" +#define TYPE_VIRTIO_INPUT_HID_PCI "virtio-input-hid-pci" +#define TYPE_VIRTIO_KEYBOARD_PCI "virtio-keyboard-pci" +#define TYPE_VIRTIO_MOUSE_PCI "virtio-mouse-pci" +#define TYPE_VIRTIO_TABLET_PCI "virtio-tablet-pci" +#define TYPE_VIRTIO_MULTITOUCH_PCI "virtio-multitouch-pci" OBJECT_DECLARE_SIMPLE_TYPE(VirtIOInputHIDPCI, VIRTIO_INPUT_HID_PCI) =20 struct VirtIOInputHIDPCI { @@ -102,6 +103,14 @@ static void virtio_tablet_initfn(Object *obj) TYPE_VIRTIO_TABLET); } =20 +static void virtio_multitouch_initfn(Object *obj) +{ + VirtIOInputHIDPCI *dev =3D VIRTIO_INPUT_HID_PCI(obj); + + virtio_instance_init_common(obj, &dev->vdev, sizeof(dev->vdev), + TYPE_VIRTIO_MULTITOUCH); +} + static const TypeInfo virtio_input_pci_info =3D { .name =3D TYPE_VIRTIO_INPUT_PCI, .parent =3D TYPE_VIRTIO_PCI, @@ -140,6 +149,13 @@ static const VirtioPCIDeviceTypeInfo virtio_tablet_pci= _info =3D { .instance_init =3D virtio_tablet_initfn, }; =20 +static const VirtioPCIDeviceTypeInfo virtio_multitouch_pci_info =3D { + .generic_name =3D TYPE_VIRTIO_MULTITOUCH_PCI, + .parent =3D TYPE_VIRTIO_INPUT_HID_PCI, + .instance_size =3D sizeof(VirtIOInputHIDPCI), + .instance_init =3D virtio_multitouch_initfn, +}; + static void virtio_pci_input_register(void) { /* Base types: */ @@ -150,6 +166,7 @@ static void virtio_pci_input_register(void) virtio_pci_types_register(&virtio_keyboard_pci_info); virtio_pci_types_register(&virtio_mouse_pci_info); virtio_pci_types_register(&virtio_tablet_pci_info); + virtio_pci_types_register(&virtio_multitouch_pci_info); } =20 type_init(virtio_pci_input_register) --=20 2.40.1 From nobody Mon Feb 9 07:06:32 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1685280169; cv=none; d=zohomail.com; s=zohoarc; b=Me4IeiSxBi3tiE9nPZzHKbrjqLxWXlu5EAsdDLjIMsfSqgAYpMD74L9LMxHF07nvgUbV+FbRlj7oIH1LM58vfUFBXKSLjzeewL7lxuEpcZO2xfRVtx0JJt57KncteoGj6Rwy2gUWJjnqaZFl1JBRuYIut9zOoKXIYpuyNO5MuNI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1685280169; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=6SWC9t6O/Sc5V5cSODqnjYGoUV3KqFL5ECgzo41W9aY=; b=S+D3E0MMtipjwGuXI3oJKKwQvhThBYN0E2cpxGZuuRNGdbPC5HZwYQH3gwm0XFmU40/gSyv4JRK7EDHFrwE89Mm6XhZrBPwuHqtzpjeCMVr1F8EFPRwB+H8+5cagJX8Qmmu5RkdaSJQMbn2rQJPhIIcwVER6NOe0a0y+KFgmp7c= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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 168528016929526.43641792075107; Sun, 28 May 2023 06:22:49 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q3GL9-0000rc-7Q; Sun, 28 May 2023 09:21:43 -0400 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 1q3GL7-0000hJ-N4 for qemu-devel@nongnu.org; Sun, 28 May 2023 09:21:41 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q3GL6-0008K3-44 for qemu-devel@nongnu.org; Sun, 28 May 2023 09:21:41 -0400 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-378-Sm5UPGDPN9200CBCuMn8SA-1; Sun, 28 May 2023 09:21:36 -0400 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id ED80629ABA0F; Sun, 28 May 2023 13:21:35 +0000 (UTC) Received: from localhost (unknown [10.39.208.19]) by smtp.corp.redhat.com (Postfix) with ESMTP id E5DE5492B00; Sun, 28 May 2023 13:21:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1685280099; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=6SWC9t6O/Sc5V5cSODqnjYGoUV3KqFL5ECgzo41W9aY=; b=HtAK5iHAZvnwGCdGW1S3YZjaPIeUxjk5SkWrJaE06OP6qo+TNo32Qh72IaU9OIuDWqSHbu cA5RcrffQlRHNUAnUN6s0iHJariiUfJ0GetOkQAPVnboZGZ2mC3hxB8DhgW5prhmvjxDgU LWM/KbaDrHA9yje1VP5Nw+0h6xHSL9U= X-MC-Unique: Sm5UPGDPN9200CBCuMn8SA-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: Markus Armbruster , berrange@redhat.com, Eric Blake , Stefan Weil , Gerd Hoffmann , Paolo Bonzini , Pavel Dovgalyuk , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , "Michael S. Tsirkin" , Sergio Lopez Subject: [PULL 18/19] ui: add helpers for virtio-multitouch events Date: Sun, 28 May 2023 17:20:15 +0400 Message-Id: <20230528132016.3218152-19-marcandre.lureau@redhat.com> In-Reply-To: <20230528132016.3218152-1-marcandre.lureau@redhat.com> References: <20230528132016.3218152-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 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=170.10.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -22 X-Spam_score: -2.3 X-Spam_bar: -- X-Spam_report: (-2.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.164, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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 @redhat.com) X-ZM-MESSAGEID: 1685280171098100003 From: Sergio Lopez Add helpers for generating Multi-touch events from the UI backends that can be sent to the guest through a virtio-multitouch device. Signed-off-by: Sergio Lopez Reviewed-by: Marc-Andr=C3=A9 Lureau Message-Id: <20230526112925.38794-6-slp@redhat.com> --- include/ui/input.h | 5 +++++ ui/input.c | 36 ++++++++++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+) diff --git a/include/ui/input.h b/include/ui/input.h index 2a3dffd417..c29a730a71 100644 --- a/include/ui/input.h +++ b/include/ui/input.h @@ -64,6 +64,11 @@ int qemu_input_scale_axis(int value, void qemu_input_queue_rel(QemuConsole *src, InputAxis axis, int value); void qemu_input_queue_abs(QemuConsole *src, InputAxis axis, int value, int min_in, int max_in); +void qemu_input_queue_mtt(QemuConsole *src, InputMultiTouchType type, int = slot, + int tracking_id); +void qemu_input_queue_mtt_abs(QemuConsole *src, InputAxis axis, int value, + int min_in, int max_in, + int slot, int tracking_id); =20 void qemu_input_check_mode_change(void); void qemu_add_mouse_mode_change_notifier(Notifier *notify); diff --git a/ui/input.c b/ui/input.c index fc75f1353c..1aad64b07c 100644 --- a/ui/input.c +++ b/ui/input.c @@ -547,6 +547,42 @@ void qemu_input_queue_abs(QemuConsole *src, InputAxis = axis, int value, qemu_input_event_send(src, &evt); } =20 +void qemu_input_queue_mtt(QemuConsole *src, InputMultiTouchType type, + int slot, int tracking_id) +{ + InputMultiTouchEvent mtt =3D { + .type =3D type, + .slot =3D slot, + .tracking_id =3D tracking_id, + }; + InputEvent evt =3D { + .type =3D INPUT_EVENT_KIND_MTT, + .u.mtt.data =3D &mtt, + }; + + qemu_input_event_send(src, &evt); +} + +void qemu_input_queue_mtt_abs(QemuConsole *src, InputAxis axis, int value, + int min_in, int max_in, int slot, int tracki= ng_id) +{ + InputMultiTouchEvent mtt =3D { + .type =3D INPUT_MULTI_TOUCH_TYPE_DATA, + .slot =3D slot, + .tracking_id =3D tracking_id, + .axis =3D axis, + .value =3D qemu_input_scale_axis(value, min_in, max_in, + INPUT_EVENT_ABS_MIN, + INPUT_EVENT_ABS_MAX), + }; + InputEvent evt =3D { + .type =3D INPUT_EVENT_KIND_MTT, + .u.mtt.data =3D &mtt, + }; + + qemu_input_event_send(src, &evt); +} + void qemu_input_check_mode_change(void) { static int current_is_absolute; --=20 2.40.1 From nobody Mon Feb 9 07:06:32 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1685280119; cv=none; d=zohomail.com; s=zohoarc; b=TMzpF3rRcC89hsDc5xmACcAhiOgyVUu32Yy+NCjmEM9u+xmirmpBmn0rVl7UKqWkNfJIkeBPg9Yvb87zyvxCmgKS4MJDx42xxs7IxZMh07UWJUZ6M9RA+OR8vM5JgLC6Jn5GquVMZrbUcG0Pq60qu1fIUAYx78TmA5em1B6ipPM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1685280119; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=Uifq9/hStfYF2JjYnG0Cit5tGfRXOCmXnT2IfX361G8=; b=doMyU3XPwIPVY8Ks01cj9tTvDYrLVqdD/D6ZrOv8yvf+vcsNEbfBqWHJ34uq/EzAUGW6D7YgWIjZRsd332fYcmGENQbeDX2zQ1xFIE7jEEVKbSaVBeP8tEr55w2MsKIoqfwVUK7GgviJSq9HSLhz4aaVoqehZiGKlShQY3eF2/0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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 1685280119433995.4125514937161; Sun, 28 May 2023 06:21:59 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q3GLE-0001W0-L7; Sun, 28 May 2023 09:21:48 -0400 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 1q3GLC-0001Eg-Kf for qemu-devel@nongnu.org; Sun, 28 May 2023 09:21:46 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q3GLA-0008Kl-KO for qemu-devel@nongnu.org; Sun, 28 May 2023 09:21:46 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-447-DWap3mEYMwe_zPJy8xPTtQ-1; Sun, 28 May 2023 09:21:40 -0400 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 5F846185A78E; Sun, 28 May 2023 13:21:40 +0000 (UTC) Received: from localhost (unknown [10.39.208.19]) by smtp.corp.redhat.com (Postfix) with ESMTP id 057F4492B0A; Sun, 28 May 2023 13:21:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1685280104; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Uifq9/hStfYF2JjYnG0Cit5tGfRXOCmXnT2IfX361G8=; b=NRAvcT30i4/bubxGM7H7s6LR2BNoF9hEGifgg+MdAeO9GxvsypsZ7M0pYPM7Q30z97F/m/ AjtwZJD1u7tpSppEleyOjbMjuBMB+hj46VO8LLOTe5VHV2KfCsYLzNO0sSvW+x5UkFElfM RzmTH/Oc5zdkRneV8WC3y6DPLzJIstc= X-MC-Unique: DWap3mEYMwe_zPJy8xPTtQ-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: Markus Armbruster , berrange@redhat.com, Eric Blake , Stefan Weil , Gerd Hoffmann , Paolo Bonzini , Pavel Dovgalyuk , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , "Michael S. Tsirkin" , Sergio Lopez Subject: [PULL 19/19] ui/gtk: enable backend to send multi-touch events Date: Sun, 28 May 2023 17:20:16 +0400 Message-Id: <20230528132016.3218152-20-marcandre.lureau@redhat.com> In-Reply-To: <20230528132016.3218152-1-marcandre.lureau@redhat.com> References: <20230528132016.3218152-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.10 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=170.10.129.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -22 X-Spam_score: -2.3 X-Spam_bar: -- X-Spam_report: (-2.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.164, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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 @redhat.com) X-ZM-MESSAGEID: 1685280120551100001 From: Sergio Lopez GTK3 provides the infrastructure to receive and process multi-touch events through the "touch-event" signal and the GdkEventTouch type. Make use of it to transpose events from the host to the guest. This allows users of machines with hardware capable of receiving multi-touch events to run guests that can also receive those events and interpret them as gestures, when appropriate. An example of this in action can be seen here: https://fosstodon.org/@slp/109545849296546767 Signed-off-by: Sergio Lopez Reviewed-by: Marc-Andr=C3=A9 Lureau Message-Id: <20230526112925.38794-7-slp@redhat.com> --- ui/gtk.c | 92 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 92 insertions(+) diff --git a/ui/gtk.c b/ui/gtk.c index 2b7268124f..e50f950f2b 100644 --- a/ui/gtk.c +++ b/ui/gtk.c @@ -130,6 +130,13 @@ typedef struct VCChardev VCChardev; DECLARE_INSTANCE_CHECKER(VCChardev, VC_CHARDEV, TYPE_CHARDEV_VC) =20 +struct touch_slot { + int x; + int y; + int tracking_id; +}; +static struct touch_slot touch_slots[INPUT_EVENT_SLOTS_MAX]; + bool gtk_use_gl_area; =20 static void gd_grab_pointer(VirtualConsole *vc, const char *reason); @@ -1057,6 +1064,82 @@ static gboolean gd_scroll_event(GtkWidget *widget, G= dkEventScroll *scroll, } =20 =20 +static gboolean gd_touch_event(GtkWidget *widget, GdkEventTouch *touch, + void *opaque) +{ + VirtualConsole *vc =3D opaque; + struct touch_slot *slot; + uint64_t num_slot =3D GPOINTER_TO_UINT(touch->sequence); + bool needs_sync =3D false; + int update; + int type =3D -1; + int i; + + if (num_slot >=3D INPUT_EVENT_SLOTS_MAX) { + warn_report("gtk: unexpected touch slot number: % " PRId64" >=3D %= d\n", + num_slot, INPUT_EVENT_SLOTS_MAX); + return FALSE; + } + + slot =3D &touch_slots[num_slot]; + slot->x =3D touch->x; + slot->y =3D touch->y; + + switch (touch->type) { + case GDK_TOUCH_BEGIN: + type =3D INPUT_MULTI_TOUCH_TYPE_BEGIN; + slot->tracking_id =3D num_slot; + break; + case GDK_TOUCH_UPDATE: + type =3D INPUT_MULTI_TOUCH_TYPE_UPDATE; + break; + case GDK_TOUCH_END: + case GDK_TOUCH_CANCEL: + type =3D INPUT_MULTI_TOUCH_TYPE_END; + break; + default: + warn_report("gtk: unexpected touch event type\n"); + } + + for (i =3D 0; i < INPUT_EVENT_SLOTS_MAX; ++i) { + if (i =3D=3D num_slot) { + update =3D type; + } else { + update =3D INPUT_MULTI_TOUCH_TYPE_UPDATE; + } + + slot =3D &touch_slots[i]; + + if (slot->tracking_id =3D=3D -1) { + continue; + } + + if (update =3D=3D INPUT_MULTI_TOUCH_TYPE_END) { + slot->tracking_id =3D -1; + qemu_input_queue_mtt(vc->gfx.dcl.con, update, i, slot->trackin= g_id); + needs_sync =3D true; + } else { + qemu_input_queue_mtt(vc->gfx.dcl.con, update, i, slot->trackin= g_id); + qemu_input_queue_btn(vc->gfx.dcl.con, INPUT_BUTTON_TOUCH, true= ); + qemu_input_queue_mtt_abs(vc->gfx.dcl.con, + INPUT_AXIS_X, (int) slot->x, + 0, surface_width(vc->gfx.ds), + i, slot->tracking_id); + qemu_input_queue_mtt_abs(vc->gfx.dcl.con, + INPUT_AXIS_Y, (int) slot->y, + 0, surface_height(vc->gfx.ds), + i, slot->tracking_id); + needs_sync =3D true; + } + } + + if (needs_sync) { + qemu_input_event_sync(); + } + + return TRUE; +} + static const guint16 *gd_get_keymap(size_t *maplen) { GdkDisplay *dpy =3D gdk_display_get_default(); @@ -1978,6 +2061,8 @@ static void gd_connect_vc_gfx_signals(VirtualConsole = *vc) G_CALLBACK(gd_key_event), vc); g_signal_connect(vc->gfx.drawing_area, "key-release-event", G_CALLBACK(gd_key_event), vc); + g_signal_connect(vc->gfx.drawing_area, "touch-event", + G_CALLBACK(gd_touch_event), vc); =20 g_signal_connect(vc->gfx.drawing_area, "enter-notify-event", G_CALLBACK(gd_enter_event), vc); @@ -2087,6 +2172,7 @@ static GSList *gd_vc_gfx_init(GtkDisplayState *s, Vir= tualConsole *vc, GSList *group, GtkWidget *view_menu) { bool zoom_to_fit =3D false; + int i; =20 vc->label =3D qemu_console_get_label(con); vc->s =3D s; @@ -2134,6 +2220,7 @@ static GSList *gd_vc_gfx_init(GtkDisplayState *s, Vir= tualConsole *vc, GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_BUTTON_MOTION_MASK | + GDK_TOUCH_MASK | GDK_ENTER_NOTIFY_MASK | GDK_LEAVE_NOTIFY_MASK | GDK_SCROLL_MASK | @@ -2169,6 +2256,11 @@ static GSList *gd_vc_gfx_init(GtkDisplayState *s, Vi= rtualConsole *vc, s->free_scale =3D true; } =20 + for (i =3D 0; i < INPUT_EVENT_SLOTS_MAX; i++) { + struct touch_slot *slot =3D &touch_slots[i]; + slot->tracking_id =3D -1; + } + return group; } =20 --=20 2.40.1