From nobody Tue May 7 22:39:48 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 16304168863401.4741448833309505; Tue, 31 Aug 2021 06:34:46 -0700 (PDT) Received: from localhost ([::1]:38280 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mL3uX-0000iX-2r for importer@patchew.org; Tue, 31 Aug 2021 09:34:45 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51206) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mL3rr-0006MI-4P for qemu-devel@nongnu.org; Tue, 31 Aug 2021 09:31:59 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:43614) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mL3rp-0007RT-GR for qemu-devel@nongnu.org; Tue, 31 Aug 2021 09:31:58 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-592-g3kNGxnKMh-HN7GScD98pg-1; Tue, 31 Aug 2021 09:31:55 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 695CE18C8C01; Tue, 31 Aug 2021 13:31:54 +0000 (UTC) Received: from localhost (unknown [10.39.208.23]) by smtp.corp.redhat.com (Postfix) with ESMTP id EB03E27CA9; Tue, 31 Aug 2021 13:31:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1630416716; 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=8iyQdbKPtl6IYBU4dPSoGEkMBEUdWgZkrhhac8hkhqM=; b=WRl/I5Na8PAtmFDlOMD6oz8Ze0YIk5cruOZiF3qpEpcaHCa+U0MvpgyeBBKgORgTDvcTFZ b4FVF7F5W9Quro1p8Oop3ksFUtdpmwucwluvVhlBM6ltBkglLRupMYZYDdiok7W61YUKb5 uWaAZFngSTyWijbC2vJR2W8fkCuIsRA= X-MC-Unique: g3kNGxnKMh-HN7GScD98pg-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Subject: [PULL 01/18] ui/vdagent: fix leak on error path Date: Tue, 31 Aug 2021 17:31:15 +0400 Message-Id: <20210831133132.1697228-2-marcandre.lureau@redhat.com> In-Reply-To: <20210831133132.1697228-1-marcandre.lureau@redhat.com> References: <20210831133132.1697228-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=marcandre.lureau@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -31 X-Spam_score: -3.2 X-Spam_bar: --- X-Spam_report: (-3.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.391, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Gerd Hoffmann , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1630416888531100001 From: Marc-Andr=C3=A9 Lureau "info" was leaked when more than 10 entries. Signed-off-by: Marc-Andr=C3=A9 Lureau Message-Id: <20210805135715.857938-2-marcandre.lureau@redhat.com> Reviewed-by: Philippe Mathieu-Daud=C3=A9 Acked-by: Gerd Hoffmann --- include/ui/clipboard.h | 2 ++ ui/vdagent.c | 4 +--- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/include/ui/clipboard.h b/include/ui/clipboard.h index b45b984c9f..eb789a285a 100644 --- a/include/ui/clipboard.h +++ b/include/ui/clipboard.h @@ -190,4 +190,6 @@ void qemu_clipboard_set_data(QemuClipboardPeer *peer, const void *data, bool update); =20 +G_DEFINE_AUTOPTR_CLEANUP_FUNC(QemuClipboardInfo, qemu_clipboard_info_unref) + #endif /* QEMU_CLIPBOARD_H */ diff --git a/ui/vdagent.c b/ui/vdagent.c index a253a8fe63..f6ef8d1993 100644 --- a/ui/vdagent.c +++ b/ui/vdagent.c @@ -438,7 +438,7 @@ static void vdagent_chr_recv_clipboard(VDAgentChardev *= vd, VDAgentMessage *msg) uint8_t s =3D VD_AGENT_CLIPBOARD_SELECTION_CLIPBOARD; uint32_t size =3D msg->size; void *data =3D msg->data; - QemuClipboardInfo *info; + g_autoptr(QemuClipboardInfo) info =3D NULL; QemuClipboardType type; =20 if (have_selection(vd)) { @@ -477,7 +477,6 @@ static void vdagent_chr_recv_clipboard(VDAgentChardev *= vd, VDAgentMessage *msg) size -=3D sizeof(uint32_t); } qemu_clipboard_update(info); - qemu_clipboard_info_unref(info); break; case VD_AGENT_CLIPBOARD_REQUEST: if (size < sizeof(uint32_t)) { @@ -523,7 +522,6 @@ static void vdagent_chr_recv_clipboard(VDAgentChardev *= vd, VDAgentMessage *msg) /* set empty clipboard info */ info =3D qemu_clipboard_info_new(NULL, s); qemu_clipboard_update(info); - qemu_clipboard_info_unref(info); } break; } --=20 2.33.0.rc2 From nobody Tue May 7 22:39:48 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1630416891534403.91636552228; Tue, 31 Aug 2021 06:34:51 -0700 (PDT) Received: from localhost ([::1]:38758 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mL3uc-00012J-9W for importer@patchew.org; Tue, 31 Aug 2021 09:34:50 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51278) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mL3s7-0006ji-IK for qemu-devel@nongnu.org; Tue, 31 Aug 2021 09:32:17 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:59101) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mL3s4-0007dc-5x for qemu-devel@nongnu.org; Tue, 31 Aug 2021 09:32:15 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-602-uYvRe_wnN1m58A3_rlEoTg-1; Tue, 31 Aug 2021 09:32:09 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 39C9B18C8C01; Tue, 31 Aug 2021 13:32:08 +0000 (UTC) Received: from localhost (unknown [10.39.208.23]) by smtp.corp.redhat.com (Postfix) with ESMTP id E8A2860C9F; Tue, 31 Aug 2021 13:31:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1630416731; 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=M4cgnhKzw8WbBrMqoydM9+eXmCAaeLfq8wC83hfzUP0=; b=SPE+H3JCumqBq089eLTsuxtODcR7S+Ky3oNnnrMN//JD81P6850dTApFXs8bcXmfS5WD0P nA9D/nLAZu98p3p9we4Yh3mQp9xJogRqZBdkckUNobf/C86NKwrXuTdpHrysMvXwZwe19n wBRxbBPQm6sWxwI+H5zLOjG9P3n8M9Q= X-MC-Unique: uYvRe_wnN1m58A3_rlEoTg-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Subject: [PULL 02/18] ui/vdagent: remove copy-pasta comment Date: Tue, 31 Aug 2021 17:31:16 +0400 Message-Id: <20210831133132.1697228-3-marcandre.lureau@redhat.com> In-Reply-To: <20210831133132.1697228-1-marcandre.lureau@redhat.com> References: <20210831133132.1697228-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=marcandre.lureau@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -31 X-Spam_score: -3.2 X-Spam_bar: --- X-Spam_report: (-3.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.391, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Gerd Hoffmann , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1630416893059100003 From: Marc-Andr=C3=A9 Lureau Signed-off-by: Marc-Andr=C3=A9 Lureau Message-Id: <20210805135715.857938-3-marcandre.lureau@redhat.com> Acked-by: Gerd Hoffmann --- ui/vdagent.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui/vdagent.c b/ui/vdagent.c index f6ef8d1993..5ae5734c81 100644 --- a/ui/vdagent.c +++ b/ui/vdagent.c @@ -516,7 +516,7 @@ static void vdagent_chr_recv_clipboard(VDAgentChardev *= vd, VDAgentMessage *msg) qemu_clipboard_set_data(&vd->cbpeer, vd->cbinfo[s], type, size, data, true); break; - case VD_AGENT_CLIPBOARD_RELEASE: /* data */ + case VD_AGENT_CLIPBOARD_RELEASE: if (vd->cbinfo[s] && vd->cbinfo[s]->owner =3D=3D &vd->cbpeer) { /* set empty clipboard info */ --=20 2.33.0.rc2 From nobody Tue May 7 22:39:48 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1630417066719123.81957923576931; Tue, 31 Aug 2021 06:37:46 -0700 (PDT) Received: from localhost ([::1]:47250 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mL3xR-0007Ky-Ed for importer@patchew.org; Tue, 31 Aug 2021 09:37:45 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51348) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mL3sM-0006tT-Oq for qemu-devel@nongnu.org; Tue, 31 Aug 2021 09:32:30 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:22925) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mL3sK-0007r2-GD for qemu-devel@nongnu.org; Tue, 31 Aug 2021 09:32:30 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-501-HuHpFRlWOyOJNsd9VG3rmA-1; Tue, 31 Aug 2021 09:32:22 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id AC4FD93925; Tue, 31 Aug 2021 13:32:21 +0000 (UTC) Received: from localhost (unknown [10.39.208.23]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2D0AE5D9D5; Tue, 31 Aug 2021 13:32:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1630416746; 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=TW5SagUdJKUkeOkATE/Dc0P9w3z5eJ8OtRnDDMO7Css=; b=R3zizQlqzCxi7FZAv5yxEmOvEwjOD08nNMmUBT5gUvLmQ4X/dcW8WAoDeyHLrxQKHJirTp zykMo1iDEdAMXd9NEKnCeIzBOzyabcwwDTjdfHUm77Dm25GT6JpuOS3AwQcg83h3jTtikM 61GWJXHd0NcM5cKiUEykBj0wZiqx3S4= X-MC-Unique: HuHpFRlWOyOJNsd9VG3rmA-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Subject: [PULL 03/18] ui/gtk-clipboard: use existing macros Date: Tue, 31 Aug 2021 17:31:17 +0400 Message-Id: <20210831133132.1697228-4-marcandre.lureau@redhat.com> In-Reply-To: <20210831133132.1697228-1-marcandre.lureau@redhat.com> References: <20210831133132.1697228-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=marcandre.lureau@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=216.205.24.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -31 X-Spam_score: -3.2 X-Spam_bar: --- X-Spam_report: (-3.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.391, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Gerd Hoffmann , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1630417068729100001 From: Marc-Andr=C3=A9 Lureau Hardcoding strings is error prone, use dedicated macros instead. Signed-off-by: Marc-Andr=C3=A9 Lureau Message-Id: <20210805135715.857938-4-marcandre.lureau@redhat.com> Acked-by: Gerd Hoffmann --- ui/gtk-clipboard.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ui/gtk-clipboard.c b/ui/gtk-clipboard.c index bff28d2030..5e817ae55c 100644 --- a/ui/gtk-clipboard.c +++ b/ui/gtk-clipboard.c @@ -177,11 +177,11 @@ void gd_clipboard_init(GtkDisplayState *gd) qemu_clipboard_peer_register(&gd->cbpeer); =20 gd->gtkcb[QEMU_CLIPBOARD_SELECTION_CLIPBOARD] =3D - gtk_clipboard_get(gdk_atom_intern("CLIPBOARD", FALSE)); + gtk_clipboard_get(GDK_SELECTION_CLIPBOARD); gd->gtkcb[QEMU_CLIPBOARD_SELECTION_PRIMARY] =3D - gtk_clipboard_get(gdk_atom_intern("PRIMARY", FALSE)); + gtk_clipboard_get(GDK_SELECTION_PRIMARY); gd->gtkcb[QEMU_CLIPBOARD_SELECTION_SECONDARY] =3D - gtk_clipboard_get(gdk_atom_intern("SECONDARY", FALSE)); + gtk_clipboard_get(GDK_SELECTION_SECONDARY); =20 g_signal_connect(gd->gtkcb[QEMU_CLIPBOARD_SELECTION_CLIPBOARD], "owner-change", G_CALLBACK(gd_owner_change), gd); --=20 2.33.0.rc2 From nobody Tue May 7 22:39:48 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1630417577508320.0911455422864; Tue, 31 Aug 2021 06:46:17 -0700 (PDT) Received: from localhost ([::1]:39384 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mL45g-0004AN-F2 for importer@patchew.org; Tue, 31 Aug 2021 09:46:16 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51374) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mL3sX-00071V-Kr for qemu-devel@nongnu.org; Tue, 31 Aug 2021 09:32:42 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:53412) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mL3sW-0007yV-7f for qemu-devel@nongnu.org; Tue, 31 Aug 2021 09:32:41 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-559-3Cmfa6GRNn-3odRxsBJO8Q-1; Tue, 31 Aug 2021 09:32:35 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id EE1CF1008074; Tue, 31 Aug 2021 13:32:34 +0000 (UTC) Received: from localhost (unknown [10.39.208.23]) by smtp.corp.redhat.com (Postfix) with ESMTP id AC4436B542; Tue, 31 Aug 2021 13:32:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1630416758; 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=kx2cVdFAXRh8QdtbrceSJw90oRrTN4gunj9QFTypHoo=; b=htxeUcHSTilUUKoV+AqnbT8R3JQ1fH29a41HdQpvpdTKhEwMhPCwqgl9tz/l1AHrnKwvvo QS7JZQJug0ENO9cn8rgsZixwEKlPZOnNXaAoIu32qH6cFz58bkxgb5kUwmgaTDJyEyMl64 04KK61fc79RCEppydE0hanETba7w5eU= X-MC-Unique: 3Cmfa6GRNn-3odRxsBJO8Q-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Subject: [PULL 04/18] ui/gtk-clipboard: fix clipboard enum typo Date: Tue, 31 Aug 2021 17:31:18 +0400 Message-Id: <20210831133132.1697228-5-marcandre.lureau@redhat.com> In-Reply-To: <20210831133132.1697228-1-marcandre.lureau@redhat.com> References: <20210831133132.1697228-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=marcandre.lureau@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=216.205.24.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -31 X-Spam_score: -3.2 X-Spam_bar: --- X-Spam_report: (-3.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.391, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Gerd Hoffmann , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1630417578854100001 From: Marc-Andr=C3=A9 Lureau Signed-off-by: Marc-Andr=C3=A9 Lureau Message-Id: <20210805135715.857938-5-marcandre.lureau@redhat.com> Acked-by: Gerd Hoffmann --- ui/gtk-clipboard.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui/gtk-clipboard.c b/ui/gtk-clipboard.c index 5e817ae55c..2c78de9500 100644 --- a/ui/gtk-clipboard.c +++ b/ui/gtk-clipboard.c @@ -155,7 +155,7 @@ static void gd_owner_change(GtkClipboard *clipboard, =20 =20 switch (event->owner_change.reason) { - case GDK_SETTING_ACTION_NEW: + case GDK_OWNER_CHANGE_NEW_OWNER: info =3D qemu_clipboard_info_new(&gd->cbpeer, s); if (gtk_clipboard_wait_is_text_available(clipboard)) { info->types[QEMU_CLIPBOARD_TYPE_TEXT].available =3D true; --=20 2.33.0.rc2 From nobody Tue May 7 22:39:48 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 16304172982991007.8718319177435; Tue, 31 Aug 2021 06:41:38 -0700 (PDT) Received: from localhost ([::1]:56374 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mL41A-00051Z-KU for importer@patchew.org; Tue, 31 Aug 2021 09:41:36 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51464) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mL3sm-0007E9-8c for qemu-devel@nongnu.org; Tue, 31 Aug 2021 09:32:56 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:32684) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mL3sk-00088N-KC for qemu-devel@nongnu.org; Tue, 31 Aug 2021 09:32:56 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-582-aY5oKLXvNHOxf2lCv8ifaA-1; Tue, 31 Aug 2021 09:32:52 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 94CF387D543; Tue, 31 Aug 2021 13:32:51 +0000 (UTC) Received: from localhost (unknown [10.39.208.23]) by smtp.corp.redhat.com (Postfix) with ESMTP id C26B75D9D5; Tue, 31 Aug 2021 13:32:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1630416774; 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=Uk6YCdYR8bdLVMYXZoRpgt/qDJKOLfAhcn7qVyWL8I4=; b=VnERJVrZmz6sJDYODgn/a7B5DQR7iZFF7YiPnLz01WwJQpbfKv/r9L2julAfbchwxlW30f IX2lMX+Y9GRUHl36nVZ9T52Mc+cKsaYXzzd5uEDoR4lDQ65NpaRHlT9tHL8q3FTxJbQ4bv n1MlAnSR5Sdvo8BdqcmSWR4o1KuY7V0= X-MC-Unique: aY5oKLXvNHOxf2lCv8ifaA-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Subject: [PULL 05/18] ui/clipboard: add helper to retrieve current clipboard Date: Tue, 31 Aug 2021 17:31:19 +0400 Message-Id: <20210831133132.1697228-6-marcandre.lureau@redhat.com> In-Reply-To: <20210831133132.1697228-1-marcandre.lureau@redhat.com> References: <20210831133132.1697228-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=marcandre.lureau@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -31 X-Spam_score: -3.2 X-Spam_bar: --- X-Spam_report: (-3.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.391, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Gerd Hoffmann , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1630417299730100001 From: Marc-Andr=C3=A9 Lureau Signed-off-by: Marc-Andr=C3=A9 Lureau Message-Id: <20210805135715.857938-6-marcandre.lureau@redhat.com> Acked-by: Gerd Hoffmann --- include/ui/clipboard.h | 9 +++++++++ ui/clipboard.c | 15 +++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/include/ui/clipboard.h b/include/ui/clipboard.h index eb789a285a..e9fcb15c66 100644 --- a/include/ui/clipboard.h +++ b/include/ui/clipboard.h @@ -109,6 +109,15 @@ void qemu_clipboard_peer_register(QemuClipboardPeer *p= eer); */ void qemu_clipboard_peer_unregister(QemuClipboardPeer *peer); =20 +/** + * qemu_clipboard_info + * + * @selection: clipboard selection. + * + * Return the current clipboard data & owner informations. + */ +QemuClipboardInfo *qemu_clipboard_info(QemuClipboardSelection selection); + /** * qemu_clipboard_info_new * diff --git a/ui/clipboard.c b/ui/clipboard.c index 3525b30178..56c14509fe 100644 --- a/ui/clipboard.c +++ b/ui/clipboard.c @@ -4,6 +4,8 @@ static NotifierList clipboard_notifiers =3D NOTIFIER_LIST_INITIALIZER(clipboard_notifiers); =20 +static QemuClipboardInfo *cbinfo[QEMU_CLIPBOARD_SELECTION__COUNT]; + void qemu_clipboard_peer_register(QemuClipboardPeer *peer) { notifier_list_add(&clipboard_notifiers, &peer->update); @@ -16,7 +18,20 @@ void qemu_clipboard_peer_unregister(QemuClipboardPeer *p= eer) =20 void qemu_clipboard_update(QemuClipboardInfo *info) { + g_autoptr(QemuClipboardInfo) old =3D NULL; + assert(info->selection < QEMU_CLIPBOARD_SELECTION__COUNT); + notifier_list_notify(&clipboard_notifiers, info); + + old =3D cbinfo[info->selection]; + cbinfo[info->selection] =3D qemu_clipboard_info_ref(info); +} + +QemuClipboardInfo *qemu_clipboard_info(QemuClipboardSelection selection) +{ + assert(selection < QEMU_CLIPBOARD_SELECTION__COUNT); + + return cbinfo[selection]; } =20 QemuClipboardInfo *qemu_clipboard_info_new(QemuClipboardPeer *owner, --=20 2.33.0.rc2 From nobody Tue May 7 22:39:48 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1630417532976822.9419259518104; Tue, 31 Aug 2021 06:45:32 -0700 (PDT) Received: from localhost ([::1]:36844 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mL44x-0002TX-6Q for importer@patchew.org; Tue, 31 Aug 2021 09:45:31 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51540) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mL3t3-0007Xj-00 for qemu-devel@nongnu.org; Tue, 31 Aug 2021 09:33:13 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:30505) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mL3sy-0008KO-Uk for qemu-devel@nongnu.org; Tue, 31 Aug 2021 09:33:11 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-366-Pf5FFBM2P96UBHoxJ-xgjQ-1; Tue, 31 Aug 2021 09:33:05 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 4AC13801B3D; Tue, 31 Aug 2021 13:33:04 +0000 (UTC) Received: from localhost (unknown [10.39.208.23]) by smtp.corp.redhat.com (Postfix) with ESMTP id AB7F717AC5; Tue, 31 Aug 2021 13:32:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1630416788; 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=0AXICmCAm3aBtr0qv5FYqzEIAs5oFc4NF43IRHXFgZc=; b=BXp1jQAQbgxFsCEJBowEZlt0vw9CW1ESUG++SgfJcoJFBVqCwJGo9HpvVTwm2QLH5ceTP8 nfFP8Giy7mCkFeoU69cEaTbitZ+GM3EucEtp0EAwQxCtn9ggR9jgpbWSCZHO6sUuXCOVh6 fhSkRvWAft93e69aAlcftq2EPe0g5nM= X-MC-Unique: Pf5FFBM2P96UBHoxJ-xgjQ-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Subject: [PULL 06/18] ui/clipboard: add qemu_clipboard_peer_owns() helper Date: Tue, 31 Aug 2021 17:31:20 +0400 Message-Id: <20210831133132.1697228-7-marcandre.lureau@redhat.com> In-Reply-To: <20210831133132.1697228-1-marcandre.lureau@redhat.com> References: <20210831133132.1697228-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=marcandre.lureau@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -31 X-Spam_score: -3.2 X-Spam_bar: --- X-Spam_report: (-3.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.391, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Gerd Hoffmann , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1630417534028100001 From: Marc-Andr=C3=A9 Lureau Signed-off-by: Marc-Andr=C3=A9 Lureau Message-Id: <20210805135715.857938-7-marcandre.lureau@redhat.com> Acked-by: Gerd Hoffmann --- include/ui/clipboard.h | 11 +++++++++++ ui/clipboard.c | 8 ++++++++ 2 files changed, 19 insertions(+) diff --git a/include/ui/clipboard.h b/include/ui/clipboard.h index e9fcb15c66..25e0b470c8 100644 --- a/include/ui/clipboard.h +++ b/include/ui/clipboard.h @@ -109,6 +109,17 @@ void qemu_clipboard_peer_register(QemuClipboardPeer *p= eer); */ void qemu_clipboard_peer_unregister(QemuClipboardPeer *peer); =20 +/** + * qemu_clipboard_peer_owns + * + * @peer: peer information. + * @selection: clipboard selection. + * + * Return TRUE if the peer owns the clipboard. + */ +bool qemu_clipboard_peer_owns(QemuClipboardPeer *peer, + QemuClipboardSelection selection); + /** * qemu_clipboard_info * diff --git a/ui/clipboard.c b/ui/clipboard.c index 56c14509fe..490c3220f4 100644 --- a/ui/clipboard.c +++ b/ui/clipboard.c @@ -16,6 +16,14 @@ void qemu_clipboard_peer_unregister(QemuClipboardPeer *p= eer) notifier_remove(&peer->update); } =20 +bool qemu_clipboard_peer_owns(QemuClipboardPeer *peer, + QemuClipboardSelection selection) +{ + QemuClipboardInfo *info =3D qemu_clipboard_info(selection); + + return info && info->owner =3D=3D peer; +} + void qemu_clipboard_update(QemuClipboardInfo *info) { g_autoptr(QemuClipboardInfo) old =3D NULL; --=20 2.33.0.rc2 From nobody Tue May 7 22:39:48 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1630417768264615.4262465563785; Tue, 31 Aug 2021 06:49:28 -0700 (PDT) Received: from localhost ([::1]:47798 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mL48l-0001VL-95 for importer@patchew.org; Tue, 31 Aug 2021 09:49:27 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51554) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mL3t6-0007aO-Oc for qemu-devel@nongnu.org; Tue, 31 Aug 2021 09:33:17 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:44417) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mL3t3-0008O2-4x for qemu-devel@nongnu.org; Tue, 31 Aug 2021 09:33:15 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-222-0vugUB67NSuJ1cy8Sm-0ZQ-1; Tue, 31 Aug 2021 09:33:10 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id D16D51008064; Tue, 31 Aug 2021 13:33:09 +0000 (UTC) Received: from localhost (unknown [10.39.208.23]) by smtp.corp.redhat.com (Postfix) with ESMTP id C04F360843; Tue, 31 Aug 2021 13:33:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1630416792; 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=8z/vKQsMvxJ4ZTnrygwQxlWtswzP4nK726lFacQO3p8=; b=Nqnphl/oO4NgepzPckC3aZ2n4knAbx30uJyDXBolIGPN7oxlFBbQdc0IdNlGldPZ4xGOVz EDlRo/NfIl7f6rq4YUSUhAUdhJepJxfmYWiXY0kCjAa/G52KBkTocLnD+iVT10HpPt6Cod QmIm+HMF/9h46hE3Z+ANdvppIwDqiyQ= X-MC-Unique: 0vugUB67NSuJ1cy8Sm-0ZQ-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Subject: [PULL 07/18] ui/clipboard: add qemu_clipboard_peer_release() helper Date: Tue, 31 Aug 2021 17:31:21 +0400 Message-Id: <20210831133132.1697228-8-marcandre.lureau@redhat.com> In-Reply-To: <20210831133132.1697228-1-marcandre.lureau@redhat.com> References: <20210831133132.1697228-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=marcandre.lureau@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -31 X-Spam_score: -3.2 X-Spam_bar: --- X-Spam_report: (-3.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.391, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Gerd Hoffmann , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1630417769031100001 From: Marc-Andr=C3=A9 Lureau Signed-off-by: Marc-Andr=C3=A9 Lureau Message-Id: <20210805135715.857938-8-marcandre.lureau@redhat.com> Acked-by: Gerd Hoffmann --- include/ui/clipboard.h | 11 +++++++++++ ui/clipboard.c | 12 ++++++++++++ 2 files changed, 23 insertions(+) diff --git a/include/ui/clipboard.h b/include/ui/clipboard.h index 25e0b470c8..6298986b15 100644 --- a/include/ui/clipboard.h +++ b/include/ui/clipboard.h @@ -120,6 +120,17 @@ void qemu_clipboard_peer_unregister(QemuClipboardPeer = *peer); bool qemu_clipboard_peer_owns(QemuClipboardPeer *peer, QemuClipboardSelection selection); =20 +/** + * qemu_clipboard_peer_release + * + * @peer: peer information. + * @selection: clipboard selection. + * + * If the peer owns the clipboard, release it. + */ +void qemu_clipboard_peer_release(QemuClipboardPeer *peer, + QemuClipboardSelection selection); + /** * qemu_clipboard_info * diff --git a/ui/clipboard.c b/ui/clipboard.c index 490c3220f4..c277247a7f 100644 --- a/ui/clipboard.c +++ b/ui/clipboard.c @@ -24,6 +24,18 @@ bool qemu_clipboard_peer_owns(QemuClipboardPeer *peer, return info && info->owner =3D=3D peer; } =20 +void qemu_clipboard_peer_release(QemuClipboardPeer *peer, + QemuClipboardSelection selection) +{ + g_autoptr(QemuClipboardInfo) info =3D NULL; + + if (qemu_clipboard_peer_owns(peer, selection)) { + /* set empty clipboard info */ + info =3D qemu_clipboard_info_new(NULL, selection); + qemu_clipboard_update(info); + } +} + void qemu_clipboard_update(QemuClipboardInfo *info) { g_autoptr(QemuClipboardInfo) old =3D NULL; --=20 2.33.0.rc2 From nobody Tue May 7 22:39:48 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1630417721709597.1796415371314; Tue, 31 Aug 2021 06:48:41 -0700 (PDT) Received: from localhost ([::1]:45506 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mL480-0008N9-NB for importer@patchew.org; Tue, 31 Aug 2021 09:48:40 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51636) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mL3tM-0007qc-EC for qemu-devel@nongnu.org; Tue, 31 Aug 2021 09:33:33 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:56770) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mL3tK-0000CW-7p for qemu-devel@nongnu.org; Tue, 31 Aug 2021 09:33:32 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-311-RcFTMYExOt2Krv81Sgyv5g-1; Tue, 31 Aug 2021 09:33:27 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 470439392C; Tue, 31 Aug 2021 13:33:26 +0000 (UTC) Received: from localhost (unknown [10.39.208.23]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0CF9A1007611; Tue, 31 Aug 2021 13:33:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1630416809; 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=7FJM62d6Uw2ZM6gECPMVih+rPCgHhUbkpclrREf/NQY=; b=F3wgg+Uuou2Q46eO0CSWC7OzgRRaTFs20rvz9VqV/6xPSgArnViLFgscJfmMTrgn4kYHUo gZr8R/sypYNvnUo9xmCp2u8XFEvTuqpDmEziGR0vDWNIbsQdJ66z0f7TStpMPSj6b72qzJ Oc34MFjWamF5mqxusAK4YC6LlGwizDI= X-MC-Unique: RcFTMYExOt2Krv81Sgyv5g-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Subject: [PULL 08/18] ui/clipboard: release owned grabs on unregister Date: Tue, 31 Aug 2021 17:31:22 +0400 Message-Id: <20210831133132.1697228-9-marcandre.lureau@redhat.com> In-Reply-To: <20210831133132.1697228-1-marcandre.lureau@redhat.com> References: <20210831133132.1697228-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=marcandre.lureau@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=216.205.24.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -31 X-Spam_score: -3.2 X-Spam_bar: --- X-Spam_report: (-3.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.391, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Gerd Hoffmann , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1630417723331100001 From: Marc-Andr=C3=A9 Lureau Signed-off-by: Marc-Andr=C3=A9 Lureau Message-Id: <20210805135715.857938-9-marcandre.lureau@redhat.com> Acked-by: Gerd Hoffmann --- ui/clipboard.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/ui/clipboard.c b/ui/clipboard.c index c277247a7f..d7b008d62a 100644 --- a/ui/clipboard.c +++ b/ui/clipboard.c @@ -13,6 +13,12 @@ void qemu_clipboard_peer_register(QemuClipboardPeer *pee= r) =20 void qemu_clipboard_peer_unregister(QemuClipboardPeer *peer) { + int i; + + for (i =3D 0; i < QEMU_CLIPBOARD_SELECTION__COUNT; i++) { + qemu_clipboard_peer_release(peer, i); + } + notifier_remove(&peer->update); } =20 --=20 2.33.0.rc2 From nobody Tue May 7 22:39:48 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1630417861685676.8250257491535; Tue, 31 Aug 2021 06:51:01 -0700 (PDT) Received: from localhost ([::1]:52514 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mL4AG-0004gc-GY for importer@patchew.org; Tue, 31 Aug 2021 09:51:00 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51666) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mL3tV-0007yo-B9 for qemu-devel@nongnu.org; Tue, 31 Aug 2021 09:33:41 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:42849) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mL3tT-0000Iy-RH for qemu-devel@nongnu.org; Tue, 31 Aug 2021 09:33:41 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-214-ix-tAId4OqCfUQH5gAHWpw-1; Tue, 31 Aug 2021 09:33:37 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 73E2493924; Tue, 31 Aug 2021 13:33:36 +0000 (UTC) Received: from localhost (unknown [10.39.208.23]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1D35D27CA9; Tue, 31 Aug 2021 13:33:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1630416819; 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=dWTabQ/ls9JLo6h5qMW0A0M3AbA/4ANIdUcrLedB1Wk=; b=AeYAUEG6anZVnEbC8DrHUj9/oakmS93rNOmY5eCRg25Z3TuMOzSwwsS16yI9AVs6uGEqjM VZxJ8uEv8QGQzLR56+65I3agJLkYM1jlFjxtEZtpdSSh1jTahyo8Lmnad0tAc1YolVWXzR xV2Ak+WWXF58d9FigSt1e9esrx0VmIk= X-MC-Unique: ix-tAId4OqCfUQH5gAHWpw-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Subject: [PULL 09/18] ui/vdagent: disconnect handlers and reset state on finalize Date: Tue, 31 Aug 2021 17:31:23 +0400 Message-Id: <20210831133132.1697228-10-marcandre.lureau@redhat.com> In-Reply-To: <20210831133132.1697228-1-marcandre.lureau@redhat.com> References: <20210831133132.1697228-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=marcandre.lureau@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -31 X-Spam_score: -3.2 X-Spam_bar: --- X-Spam_report: (-3.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.391, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Gerd Hoffmann , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1630417862348100001 From: Marc-Andr=C3=A9 Lureau Avoid handlers being called with dangling pointers when the object is freed. Signed-off-by: Marc-Andr=C3=A9 Lureau Message-Id: <20210805135715.857938-10-marcandre.lureau@redhat.com> Reviewed-by: Philippe Mathieu-Daud=C3=A9 Acked-by: Gerd Hoffmann --- ui/vdagent.c | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/ui/vdagent.c b/ui/vdagent.c index 5ae5734c81..1a29016e07 100644 --- a/ui/vdagent.c +++ b/ui/vdagent.c @@ -721,22 +721,26 @@ static void vdagent_chr_accept_input(Chardev *chr) vdagent_send_buf(vd); } =20 +static void vdagent_disconnect(VDAgentChardev *vd) +{ + vdagent_reset_bufs(vd); + vd->caps =3D 0; + if (vd->mouse_hs) { + qemu_input_handler_deactivate(vd->mouse_hs); + } + if (vd->cbpeer.update.notify) { + qemu_clipboard_peer_unregister(&vd->cbpeer); + memset(&vd->cbpeer, 0, sizeof(vd->cbpeer)); + } +} + static void vdagent_chr_set_fe_open(struct Chardev *chr, int fe_open) { VDAgentChardev *vd =3D QEMU_VDAGENT_CHARDEV(chr); =20 if (!fe_open) { trace_vdagent_close(); - /* reset state */ - vdagent_reset_bufs(vd); - vd->caps =3D 0; - if (vd->mouse_hs) { - qemu_input_handler_deactivate(vd->mouse_hs); - } - if (vd->cbpeer.update.notify) { - qemu_clipboard_peer_unregister(&vd->cbpeer); - memset(&vd->cbpeer, 0, sizeof(vd->cbpeer)); - } + vdagent_disconnect(vd); return; } =20 @@ -781,6 +785,7 @@ static void vdagent_chr_fini(Object *obj) { VDAgentChardev *vd =3D QEMU_VDAGENT_CHARDEV(obj); =20 + vdagent_disconnect(vd); buffer_free(&vd->outbuf); } =20 --=20 2.33.0.rc2 From nobody Tue May 7 22:39:48 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1630417566466489.9049039101192; Tue, 31 Aug 2021 06:46:06 -0700 (PDT) Received: from localhost ([::1]:38598 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mL45V-0003dk-B6 for importer@patchew.org; Tue, 31 Aug 2021 09:46:05 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51712) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mL3tf-0008Bw-Ga for qemu-devel@nongnu.org; Tue, 31 Aug 2021 09:33:52 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:34782) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mL3td-0000QD-US for qemu-devel@nongnu.org; Tue, 31 Aug 2021 09:33:51 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-562-6IWD6ifiOmWnrjGhkWIUUg-1; Tue, 31 Aug 2021 09:33:47 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 0180F101C8A8; Tue, 31 Aug 2021 13:33:47 +0000 (UTC) Received: from localhost (unknown [10.39.208.23]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2C52060CA0; Tue, 31 Aug 2021 13:33:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1630416829; 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=QSsZEHqyJNZ3RekuWiq05kepy/xm6HRNkxgrKfXM8jI=; b=WL2FUecRVnW0BlBdM/K5txXIdx2ZNhCObhA4zdka74YLfSJaPk2dzU6xNsZD68+IH3UWE4 ZzKBcJS7oiMYL2Wa6qw5a/b0lYOQEdyC1yoWuoitFfzoLVGjqtkty8/EBRLSa+TO9ucb9n vvUKzXwMtp5POOLs6TpOoBQuYVsCsco= X-MC-Unique: 6IWD6ifiOmWnrjGhkWIUUg-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Subject: [PULL 10/18] ui/vdagent: reset outbuf on disconnect Date: Tue, 31 Aug 2021 17:31:24 +0400 Message-Id: <20210831133132.1697228-11-marcandre.lureau@redhat.com> In-Reply-To: <20210831133132.1697228-1-marcandre.lureau@redhat.com> References: <20210831133132.1697228-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=marcandre.lureau@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -31 X-Spam_score: -3.2 X-Spam_bar: --- X-Spam_report: (-3.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.391, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Gerd Hoffmann , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1630417567256100001 From: Marc-Andr=C3=A9 Lureau Signed-off-by: Marc-Andr=C3=A9 Lureau Message-Id: <20210805135715.857938-11-marcandre.lureau@redhat.com> Acked-by: Gerd Hoffmann --- ui/vdagent.c | 1 + 1 file changed, 1 insertion(+) diff --git a/ui/vdagent.c b/ui/vdagent.c index 1a29016e07..3770c58b6c 100644 --- a/ui/vdagent.c +++ b/ui/vdagent.c @@ -723,6 +723,7 @@ static void vdagent_chr_accept_input(Chardev *chr) =20 static void vdagent_disconnect(VDAgentChardev *vd) { + buffer_reset(&vd->outbuf); vdagent_reset_bufs(vd); vd->caps =3D 0; if (vd->mouse_hs) { --=20 2.33.0.rc2 From nobody Tue May 7 22:39:48 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1630417080695629.2530323852885; Tue, 31 Aug 2021 06:38:00 -0700 (PDT) Received: from localhost ([::1]:48434 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mL3xe-000881-W5 for importer@patchew.org; Tue, 31 Aug 2021 09:37:59 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51756) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mL3tt-0008Go-FP for qemu-devel@nongnu.org; Tue, 31 Aug 2021 09:34:06 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:46895) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mL3tr-0000YK-J1 for qemu-devel@nongnu.org; Tue, 31 Aug 2021 09:34:05 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-505-1POO2-osNJSy6N5hBE6sPg-1; Tue, 31 Aug 2021 09:34:00 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id C4C661008066; Tue, 31 Aug 2021 13:33:59 +0000 (UTC) Received: from localhost (unknown [10.39.208.23]) by smtp.corp.redhat.com (Postfix) with ESMTP id 138525C22B; Tue, 31 Aug 2021 13:33:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1630416842; 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=XH2EqmNh7Un1m+28ixxdjXpfmYB07W/pjYIcJtkzdcA=; b=NrR2VlUn+hBz/BDqiepNH/OCk1pjJlbfpBgc27IuszPapcSQJNDIEJCfRkBaxEbTXyZcls WxSj+uWOCMMAwYdNQi6HDHLrnGGxjLcoIg4K5YPjJqcym5/0mMijGFEuwR11/MfKw9WeWA wIfRgeuf4AktmSuPTjm1YycXiPdxN6Y= X-MC-Unique: 1POO2-osNJSy6N5hBE6sPg-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Subject: [PULL 11/18] ui/vdagent: split clipboard recv message handling Date: Tue, 31 Aug 2021 17:31:25 +0400 Message-Id: <20210831133132.1697228-12-marcandre.lureau@redhat.com> In-Reply-To: <20210831133132.1697228-1-marcandre.lureau@redhat.com> References: <20210831133132.1697228-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=marcandre.lureau@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=216.205.24.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -31 X-Spam_score: -3.2 X-Spam_bar: --- X-Spam_report: (-3.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.391, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Gerd Hoffmann , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1630417082314100001 From: Marc-Andr=C3=A9 Lureau Signed-off-by: Marc-Andr=C3=A9 Lureau Message-Id: <20210805135715.857938-12-marcandre.lureau@redhat.com> Acked-by: Gerd Hoffmann --- ui/vdagent.c | 157 +++++++++++++++++++++++++++++---------------------- 1 file changed, 89 insertions(+), 68 deletions(-) diff --git a/ui/vdagent.c b/ui/vdagent.c index 3770c58b6c..362064213c 100644 --- a/ui/vdagent.c +++ b/ui/vdagent.c @@ -433,13 +433,94 @@ static void vdagent_clipboard_request(QemuClipboardIn= fo *info, vdagent_send_msg(vd, msg); } =20 +static void vdagent_clipboard_recv_grab(VDAgentChardev *vd, uint8_t s, uin= t32_t size, void *data) +{ + g_autoptr(QemuClipboardInfo) info =3D NULL; + + trace_vdagent_cb_grab_selection(GET_NAME(sel_name, s)); + info =3D qemu_clipboard_info_new(&vd->cbpeer, s); + if (size > sizeof(uint32_t) * 10) { + /* + * spice has 6 types as of 2021. Limiting to 10 entries + * so we we have some wiggle room. + */ + return; + } + while (size >=3D sizeof(uint32_t)) { + trace_vdagent_cb_grab_type(GET_NAME(type_name, *(uint32_t *)data)); + switch (*(uint32_t *)data) { + case VD_AGENT_CLIPBOARD_UTF8_TEXT: + info->types[QEMU_CLIPBOARD_TYPE_TEXT].available =3D true; + break; + default: + break; + } + data +=3D sizeof(uint32_t); + size -=3D sizeof(uint32_t); + } + qemu_clipboard_update(info); +} + +static void vdagent_clipboard_recv_request(VDAgentChardev *vd, uint8_t s, = uint32_t size, void *data) +{ + QemuClipboardType type; + + if (size < sizeof(uint32_t)) { + return; + } + switch (*(uint32_t *)data) { + case VD_AGENT_CLIPBOARD_UTF8_TEXT: + type =3D QEMU_CLIPBOARD_TYPE_TEXT; + break; + default: + return; + } + if (vd->cbinfo[s] && vd->cbinfo[s]->types[type].available && + vd->cbinfo[s]->owner !=3D &vd->cbpeer) { + if (vd->cbinfo[s]->types[type].data) { + vdagent_send_clipboard_data(vd, vd->cbinfo[s], type); + } else { + vd->cbpending[s] |=3D (1 << type); + qemu_clipboard_request(vd->cbinfo[s], type); + } + } +} + +static void vdagent_clipboard_recv_data(VDAgentChardev *vd, uint8_t s, uin= t32_t size, void *data) +{ + QemuClipboardType type; + + if (size < sizeof(uint32_t)) { + return; + } + switch (*(uint32_t *)data) { + case VD_AGENT_CLIPBOARD_UTF8_TEXT: + type =3D QEMU_CLIPBOARD_TYPE_TEXT; + break; + default: + return; + } + data +=3D 4; + size -=3D 4; + qemu_clipboard_set_data(&vd->cbpeer, vd->cbinfo[s], type, size, data, = true); +} + +static void vdagent_clipboard_recv_release(VDAgentChardev *vd, uint8_t s) +{ + g_autoptr(QemuClipboardInfo) info =3D NULL; + + if (vd->cbinfo[s] && vd->cbinfo[s]->owner =3D=3D &vd->cbpeer) { + /* set empty clipboard info */ + info =3D qemu_clipboard_info_new(NULL, s); + qemu_clipboard_update(info); + } +} + static void vdagent_chr_recv_clipboard(VDAgentChardev *vd, VDAgentMessage = *msg) { uint8_t s =3D VD_AGENT_CLIPBOARD_SELECTION_CLIPBOARD; uint32_t size =3D msg->size; void *data =3D msg->data; - g_autoptr(QemuClipboardInfo) info =3D NULL; - QemuClipboardType type; =20 if (have_selection(vd)) { if (size < 4) { @@ -455,75 +536,15 @@ static void vdagent_chr_recv_clipboard(VDAgentChardev= *vd, VDAgentMessage *msg) =20 switch (msg->type) { case VD_AGENT_CLIPBOARD_GRAB: - trace_vdagent_cb_grab_selection(GET_NAME(sel_name, s)); - info =3D qemu_clipboard_info_new(&vd->cbpeer, s); - if (size > sizeof(uint32_t) * 10) { - /* - * spice has 6 types as of 2021. Limiting to 10 entries - * so we we have some wiggle room. - */ - return; - } - while (size >=3D sizeof(uint32_t)) { - trace_vdagent_cb_grab_type(GET_NAME(type_name, *(uint32_t *)da= ta)); - switch (*(uint32_t *)data) { - case VD_AGENT_CLIPBOARD_UTF8_TEXT: - info->types[QEMU_CLIPBOARD_TYPE_TEXT].available =3D true; - break; - default: - break; - } - data +=3D sizeof(uint32_t); - size -=3D sizeof(uint32_t); - } - qemu_clipboard_update(info); - break; + return vdagent_clipboard_recv_grab(vd, s, size, data); case VD_AGENT_CLIPBOARD_REQUEST: - if (size < sizeof(uint32_t)) { - return; - } - switch (*(uint32_t *)data) { - case VD_AGENT_CLIPBOARD_UTF8_TEXT: - type =3D QEMU_CLIPBOARD_TYPE_TEXT; - break; - default: - return; - } - if (vd->cbinfo[s] && - vd->cbinfo[s]->types[type].available && - vd->cbinfo[s]->owner !=3D &vd->cbpeer) { - if (vd->cbinfo[s]->types[type].data) { - vdagent_send_clipboard_data(vd, vd->cbinfo[s], type); - } else { - vd->cbpending[s] |=3D (1 << type); - qemu_clipboard_request(vd->cbinfo[s], type); - } - } - break; + return vdagent_clipboard_recv_request(vd, s, size, data); case VD_AGENT_CLIPBOARD: /* data */ - if (size < sizeof(uint32_t)) { - return; - } - switch (*(uint32_t *)data) { - case VD_AGENT_CLIPBOARD_UTF8_TEXT: - type =3D QEMU_CLIPBOARD_TYPE_TEXT; - break; - default: - return; - } - data +=3D 4; - size -=3D 4; - qemu_clipboard_set_data(&vd->cbpeer, vd->cbinfo[s], type, - size, data, true); - break; + return vdagent_clipboard_recv_data(vd, s, size, data); case VD_AGENT_CLIPBOARD_RELEASE: - if (vd->cbinfo[s] && - vd->cbinfo[s]->owner =3D=3D &vd->cbpeer) { - /* set empty clipboard info */ - info =3D qemu_clipboard_info_new(NULL, s); - qemu_clipboard_update(info); - } - break; + return vdagent_clipboard_recv_release(vd, s); + default: + g_assert_not_reached(); } } =20 --=20 2.33.0.rc2 From nobody Tue May 7 22:39:48 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1630417897287342.6036747522662; Tue, 31 Aug 2021 06:51:37 -0700 (PDT) Received: from localhost ([::1]:54114 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mL4Aq-0005lr-BD for importer@patchew.org; Tue, 31 Aug 2021 09:51:36 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51792) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mL3u6-0000Sn-J3 for qemu-devel@nongnu.org; Tue, 31 Aug 2021 09:34:18 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:52255) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mL3u4-0000jq-Vp for qemu-devel@nongnu.org; Tue, 31 Aug 2021 09:34:18 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-525-FTvtu1gON4Ow_jgdj7VGmw-1; Tue, 31 Aug 2021 09:34:12 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id AAAC418C8C01; Tue, 31 Aug 2021 13:34:11 +0000 (UTC) Received: from localhost (unknown [10.39.208.23]) by smtp.corp.redhat.com (Postfix) with ESMTP id 73D1D5D9D5; Tue, 31 Aug 2021 13:34:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1630416856; 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=qqPT+58pnOmmaWzAwrlvirBDgNknMiRmcjA5qgc1JxA=; b=caia2erXsv/O+9cpk8abSOaTj/jmzIWVeky1r/72K89HpU1x9J7Zf96oUXPLrSRIOH56cc KPn0gFT/339jWYGc3HFbmFaX19la+D9xtegJjanLWfTqCZ8W7QkC0JxBMY1NwA6IcHVMJO oQ4FXRbukdoJoL36aIw+ZgUu0rT0uG4= X-MC-Unique: FTvtu1gON4Ow_jgdj7VGmw-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Subject: [PULL 12/18] ui/vdagent: use qemu_clipboard_peer_release helper Date: Tue, 31 Aug 2021 17:31:26 +0400 Message-Id: <20210831133132.1697228-13-marcandre.lureau@redhat.com> In-Reply-To: <20210831133132.1697228-1-marcandre.lureau@redhat.com> References: <20210831133132.1697228-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=marcandre.lureau@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=216.205.24.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -31 X-Spam_score: -3.2 X-Spam_bar: --- X-Spam_report: (-3.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.391, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Gerd Hoffmann , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1630417899537100001 From: Marc-Andr=C3=A9 Lureau Signed-off-by: Marc-Andr=C3=A9 Lureau Message-Id: <20210805135715.857938-13-marcandre.lureau@redhat.com> Acked-by: Gerd Hoffmann --- ui/vdagent.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/ui/vdagent.c b/ui/vdagent.c index 362064213c..99ba34646f 100644 --- a/ui/vdagent.c +++ b/ui/vdagent.c @@ -507,13 +507,7 @@ static void vdagent_clipboard_recv_data(VDAgentChardev= *vd, uint8_t s, uint32_t =20 static void vdagent_clipboard_recv_release(VDAgentChardev *vd, uint8_t s) { - g_autoptr(QemuClipboardInfo) info =3D NULL; - - if (vd->cbinfo[s] && vd->cbinfo[s]->owner =3D=3D &vd->cbpeer) { - /* set empty clipboard info */ - info =3D qemu_clipboard_info_new(NULL, s); - qemu_clipboard_update(info); - } + qemu_clipboard_peer_release(&vd->cbpeer, s); } =20 static void vdagent_chr_recv_clipboard(VDAgentChardev *vd, VDAgentMessage = *msg) --=20 2.33.0.rc2 From nobody Tue May 7 22:39:48 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1630417761474636.8520987632588; Tue, 31 Aug 2021 06:49:21 -0700 (PDT) Received: from localhost ([::1]:47106 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mL48e-000146-6W for importer@patchew.org; Tue, 31 Aug 2021 09:49:20 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51836) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mL3uJ-000163-BG for qemu-devel@nongnu.org; Tue, 31 Aug 2021 09:34:31 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:21318) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mL3uG-0000sn-L0 for qemu-devel@nongnu.org; Tue, 31 Aug 2021 09:34:30 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-127-86KaMqHsO_6O9y8e51EILQ-1; Tue, 31 Aug 2021 09:34:26 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 510F180198A; Tue, 31 Aug 2021 13:34:25 +0000 (UTC) Received: from localhost (unknown [10.39.208.23]) by smtp.corp.redhat.com (Postfix) with ESMTP id 30675188E4; Tue, 31 Aug 2021 13:34:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1630416868; 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=QXdK0f5Hx2rvOtBsEs5SyXcUnzlJGZ046jfsHbQFRfU=; b=YEV0+jMf2bviZdkDjy7efcTW8om7MaDR6WTH+ZFR8GUq2v8DlZphVI6c3vApSpGHEqUp0n Nn+OHfw1qcByvs+0ysvNKfn2RiQ0szVp+RkIwKK9sXl+FDA+mZqjvzgN1jhHiR+JUGR5// OBYzZiTk2cSSk4i+OxDjIBTCRgnBL9M= X-MC-Unique: 86KaMqHsO_6O9y8e51EILQ-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Subject: [PULL 13/18] ui/vdagent: use qemu_clipboard_info helper Date: Tue, 31 Aug 2021 17:31:27 +0400 Message-Id: <20210831133132.1697228-14-marcandre.lureau@redhat.com> In-Reply-To: <20210831133132.1697228-1-marcandre.lureau@redhat.com> References: <20210831133132.1697228-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=marcandre.lureau@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=216.205.24.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -31 X-Spam_score: -3.2 X-Spam_bar: --- X-Spam_report: (-3.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.391, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Gerd Hoffmann , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1630417762479100001 From: Marc-Andr=C3=A9 Lureau The clipboard unit now tracks the current clipboard grab, no need to duplicate this work. Signed-off-by: Marc-Andr=C3=A9 Lureau Message-Id: <20210805135715.857938-14-marcandre.lureau@redhat.com> Acked-by: Gerd Hoffmann --- ui/vdagent.c | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/ui/vdagent.c b/ui/vdagent.c index 99ba34646f..cd07937a4b 100644 --- a/ui/vdagent.c +++ b/ui/vdagent.c @@ -47,7 +47,6 @@ struct VDAgentChardev { =20 /* clipboard */ QemuClipboardPeer cbpeer; - QemuClipboardInfo *cbinfo[QEMU_CLIPBOARD_SELECTION__COUNT]; uint32_t cbpending[QEMU_CLIPBOARD_SELECTION__COUNT]; }; typedef struct VDAgentChardev VDAgentChardev; @@ -384,9 +383,7 @@ static void vdagent_clipboard_notify(Notifier *notifier= , void *data) QemuClipboardType type; bool self_update =3D info->owner =3D=3D &vd->cbpeer; =20 - if (info !=3D vd->cbinfo[s]) { - qemu_clipboard_info_unref(vd->cbinfo[s]); - vd->cbinfo[s] =3D qemu_clipboard_info_ref(info); + if (info !=3D qemu_clipboard_info(s)) { vd->cbpending[s] =3D 0; if (!self_update) { vdagent_send_clipboard_grab(vd, info); @@ -464,6 +461,7 @@ static void vdagent_clipboard_recv_grab(VDAgentChardev = *vd, uint8_t s, uint32_t static void vdagent_clipboard_recv_request(VDAgentChardev *vd, uint8_t s, = uint32_t size, void *data) { QemuClipboardType type; + QemuClipboardInfo *info; =20 if (size < sizeof(uint32_t)) { return; @@ -475,13 +473,14 @@ static void vdagent_clipboard_recv_request(VDAgentCha= rdev *vd, uint8_t s, uint32 default: return; } - if (vd->cbinfo[s] && vd->cbinfo[s]->types[type].available && - vd->cbinfo[s]->owner !=3D &vd->cbpeer) { - if (vd->cbinfo[s]->types[type].data) { - vdagent_send_clipboard_data(vd, vd->cbinfo[s], type); + + info =3D qemu_clipboard_info(s); + if (info && info->types[type].available && info->owner !=3D &vd->cbpee= r) { + if (info->types[type].data) { + vdagent_send_clipboard_data(vd, info, type); } else { vd->cbpending[s] |=3D (1 << type); - qemu_clipboard_request(vd->cbinfo[s], type); + qemu_clipboard_request(info, type); } } } @@ -502,7 +501,11 @@ static void vdagent_clipboard_recv_data(VDAgentChardev= *vd, uint8_t s, uint32_t } data +=3D 4; size -=3D 4; - qemu_clipboard_set_data(&vd->cbpeer, vd->cbinfo[s], type, size, data, = true); + + if (qemu_clipboard_peer_owns(&vd->cbpeer, s)) { + qemu_clipboard_set_data(&vd->cbpeer, qemu_clipboard_info(s), + type, size, data, true); + } } =20 static void vdagent_clipboard_recv_release(VDAgentChardev *vd, uint8_t s) --=20 2.33.0.rc2 From nobody Tue May 7 22:39:48 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1630418049495964.2813066182848; Tue, 31 Aug 2021 06:54:09 -0700 (PDT) Received: from localhost ([::1]:60532 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mL4DI-0001lz-6a for importer@patchew.org; Tue, 31 Aug 2021 09:54:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51902) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mL3uV-0001s5-CO for qemu-devel@nongnu.org; Tue, 31 Aug 2021 09:34:43 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:40460) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mL3uT-00011o-OG for qemu-devel@nongnu.org; Tue, 31 Aug 2021 09:34:43 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-325-_xr4zDdkM_CtM2rfjeN9Xw-1; Tue, 31 Aug 2021 09:34:39 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 7D502101C8A0; Tue, 31 Aug 2021 13:34:38 +0000 (UTC) Received: from localhost (unknown [10.39.208.23]) by smtp.corp.redhat.com (Postfix) with ESMTP id 96C342AF99; Tue, 31 Aug 2021 13:34:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1630416881; 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=zESMyLr3hPv0wQdyq+SZg6Zh+sHkBkNauAqq0Fco8+I=; b=TDw+/I7qTdSZmreTt/mQQ9/OAdCgdiN1iXcmNuaQIWcVTxT+YtOljgpsUwO/MhjTrdno4D VRaQaxIWGIvFlgRg2QjWLPvXqbZlqtQnGBwvH/pSAYARw1NE1xrbvvo5J7lAGsK77TzoRQ z7rloZ03iMRLpRHnxp5OVXVob3wXW0s= X-MC-Unique: _xr4zDdkM_CtM2rfjeN9Xw-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Subject: [PULL 14/18] ui/vdagent: send empty clipboard when unhandled Date: Tue, 31 Aug 2021 17:31:28 +0400 Message-Id: <20210831133132.1697228-15-marcandre.lureau@redhat.com> In-Reply-To: <20210831133132.1697228-1-marcandre.lureau@redhat.com> References: <20210831133132.1697228-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=marcandre.lureau@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=216.205.24.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -31 X-Spam_score: -3.2 X-Spam_bar: --- X-Spam_report: (-3.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.391, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Gerd Hoffmann , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1630418049887100003 From: Marc-Andr=C3=A9 Lureau Rather than leaving the agent timing out or hanging, reply to it with an empty result. Signed-off-by: Marc-Andr=C3=A9 Lureau Message-Id: <20210805135715.857938-15-marcandre.lureau@redhat.com> Acked-by: Gerd Hoffmann --- ui/vdagent.c | 12 ++++++++++++ ui/trace-events | 1 + 2 files changed, 13 insertions(+) diff --git a/ui/vdagent.c b/ui/vdagent.c index cd07937a4b..cd49da1ffa 100644 --- a/ui/vdagent.c +++ b/ui/vdagent.c @@ -375,6 +375,16 @@ static void vdagent_send_clipboard_data(VDAgentChardev= *vd, vdagent_send_msg(vd, msg); } =20 +static void vdagent_send_empty_clipboard_data(VDAgentChardev *vd, + QemuClipboardSelection selec= tion, + QemuClipboardType type) +{ + g_autoptr(QemuClipboardInfo) info =3D qemu_clipboard_info_new(&vd->cbp= eer, selection); + + trace_vdagent_send_empty_clipboard(); + vdagent_send_clipboard_data(vd, info, type); +} + static void vdagent_clipboard_notify(Notifier *notifier, void *data) { VDAgentChardev *vd =3D container_of(notifier, VDAgentChardev, cbpeer.u= pdate); @@ -482,6 +492,8 @@ static void vdagent_clipboard_recv_request(VDAgentChard= ev *vd, uint8_t s, uint32 vd->cbpending[s] |=3D (1 << type); qemu_clipboard_request(info, type); } + } else { + vdagent_send_empty_clipboard_data(vd, s, type); } } =20 diff --git a/ui/trace-events b/ui/trace-events index 1b5f87bc09..b9c0dd0fa1 100644 --- a/ui/trace-events +++ b/ui/trace-events @@ -129,6 +129,7 @@ xkeymap_keymap(const char *name) "keymap '%s'" vdagent_open(void) "" vdagent_close(void) "" vdagent_send(const char *name) "msg %s" +vdagent_send_empty_clipboard(void) "" vdagent_recv_chunk(uint32_t size) "size %d" vdagent_recv_msg(const char *name, uint32_t size) "msg %s, size %d" vdagent_peer_cap(const char *name) "cap %s" --=20 2.33.0.rc2 From nobody Tue May 7 22:39:48 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1630418265756526.9415906481086; Tue, 31 Aug 2021 06:57:45 -0700 (PDT) Received: from localhost ([::1]:40670 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mL4Gm-0007Ww-Lj for importer@patchew.org; Tue, 31 Aug 2021 09:57:44 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51990) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mL3um-0002tu-5w for qemu-devel@nongnu.org; Tue, 31 Aug 2021 09:35:00 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:59734) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mL3ug-0001FJ-Ra for qemu-devel@nongnu.org; Tue, 31 Aug 2021 09:34:59 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-225-pySoLIhfNHOWO4uqLA0UnA-1; Tue, 31 Aug 2021 09:34:52 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 9C44E93921; Tue, 31 Aug 2021 13:34:51 +0000 (UTC) Received: from localhost (unknown [10.39.208.23]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8FE5F5D9D5; Tue, 31 Aug 2021 13:34:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1630416894; 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=xU/VN7bvDDvNA1ji619aXXCC7BwE5g5sFdIhP7GrQQw=; b=HaS5JocK9LNbapNhTK5UiwuAjyuQsC4OeU9bdRke2B26CTn4DtaUA9CLuy/M3v4KmHOXQ8 /7tyXtrkaUqBzd2QMw5r1nWnHZnOCNtbMeKfHKgMdf4oFfadt7VEYy/IGgnsAG6/dp2vJ0 BWfz79erfOYWQsZ2JNtGHi43WZNtSJQ= X-MC-Unique: pySoLIhfNHOWO4uqLA0UnA-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Subject: [PULL 15/18] ui/gtk-clipboard: use qemu_clipboard_info helper Date: Tue, 31 Aug 2021 17:31:29 +0400 Message-Id: <20210831133132.1697228-16-marcandre.lureau@redhat.com> In-Reply-To: <20210831133132.1697228-1-marcandre.lureau@redhat.com> References: <20210831133132.1697228-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=marcandre.lureau@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=216.205.24.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -31 X-Spam_score: -3.2 X-Spam_bar: --- X-Spam_report: (-3.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.391, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Gerd Hoffmann , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1630418266874100003 From: Marc-Andr=C3=A9 Lureau Signed-off-by: Marc-Andr=C3=A9 Lureau Message-Id: <20210805135715.857938-16-marcandre.lureau@redhat.com> Acked-by: Gerd Hoffmann --- include/ui/gtk.h | 1 - ui/gtk-clipboard.c | 14 ++++++-------- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/include/ui/gtk.h b/include/ui/gtk.h index 80d6bbd9b5..7835ef1a71 100644 --- a/include/ui/gtk.h +++ b/include/ui/gtk.h @@ -143,7 +143,6 @@ struct GtkDisplayState { bool external_pause_update; =20 QemuClipboardPeer cbpeer; - QemuClipboardInfo *cbinfo[QEMU_CLIPBOARD_SELECTION__COUNT]; uint32_t cbpending[QEMU_CLIPBOARD_SELECTION__COUNT]; GtkClipboard *gtkcb[QEMU_CLIPBOARD_SELECTION__COUNT]; bool cbowner[QEMU_CLIPBOARD_SELECTION__COUNT]; diff --git a/ui/gtk-clipboard.c b/ui/gtk-clipboard.c index 2c78de9500..4e4b3c52bb 100644 --- a/ui/gtk-clipboard.c +++ b/ui/gtk-clipboard.c @@ -45,24 +45,24 @@ static void gd_clipboard_get_data(GtkClipboard *cli= pboard, GtkDisplayState *gd =3D data; QemuClipboardSelection s =3D gd_find_selection(gd, clipboard); QemuClipboardType type =3D QEMU_CLIPBOARD_TYPE_TEXT; - QemuClipboardInfo *info =3D qemu_clipboard_info_ref(gd->cbinfo[s]); + g_autoptr(QemuClipboardInfo) info =3D NULL; + + info =3D qemu_clipboard_info_ref(qemu_clipboard_info(s)); =20 qemu_clipboard_request(info, type); - while (info =3D=3D gd->cbinfo[s] && + while (info =3D=3D qemu_clipboard_info(s) && info->types[type].available && info->types[type].data =3D=3D NULL) { main_loop_wait(false); } =20 - if (info =3D=3D gd->cbinfo[s] && gd->cbowner[s]) { + if (info =3D=3D qemu_clipboard_info(s) && gd->cbowner[s]) { gtk_selection_data_set_text(selection_data, info->types[type].data, info->types[type].size); } else { /* clipboard owner changed while waiting for the data */ } - - qemu_clipboard_info_unref(info); } =20 static void gd_clipboard_clear(GtkClipboard *clipboard, @@ -81,9 +81,7 @@ static void gd_clipboard_notify(Notifier *notifier, void = *data) QemuClipboardSelection s =3D info->selection; bool self_update =3D info->owner =3D=3D &gd->cbpeer; =20 - if (info !=3D gd->cbinfo[s]) { - qemu_clipboard_info_unref(gd->cbinfo[s]); - gd->cbinfo[s] =3D qemu_clipboard_info_ref(info); + if (info !=3D qemu_clipboard_info(s)) { gd->cbpending[s] =3D 0; if (!self_update) { GtkTargetList *list; --=20 2.33.0.rc2 From nobody Tue May 7 22:39:48 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 16304180360631016.6979552778203; Tue, 31 Aug 2021 06:53:56 -0700 (PDT) Received: from localhost ([::1]:59748 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mL4D3-0001D4-Rl for importer@patchew.org; Tue, 31 Aug 2021 09:53:53 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:52040) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mL3uz-0003Z8-Q5 for qemu-devel@nongnu.org; Tue, 31 Aug 2021 09:35:13 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:55015) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mL3uu-0001TU-C8 for qemu-devel@nongnu.org; Tue, 31 Aug 2021 09:35:13 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-487-MmtpEmr1PgC7NsaZQRJ1XA-1; Tue, 31 Aug 2021 09:35:03 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id D8E2F8799F8; Tue, 31 Aug 2021 13:35:02 +0000 (UTC) Received: from localhost (unknown [10.39.208.23]) by smtp.corp.redhat.com (Postfix) with ESMTP id E313760843; Tue, 31 Aug 2021 13:34:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1630416907; 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=c5At/I/txNzW7xclKoFzy4Al3IVhoIoLeriqOBoratw=; b=S8w5T4B8Jt21rIp/HH8OdYgm0qtr7RXrhRDZMMi31xx2WaWiMabCOLxWNRJv3IReSNX4Ii 8RK62kLgeW8kGQ6BxDn/KoBk92lNXKG44HPAYkLn92wBfP9DXbDqpE4McCzS7DkP5gcWAK BjiK197nV+ObMWRb5PGo/tgoDC+eg8k= X-MC-Unique: MmtpEmr1PgC7NsaZQRJ1XA-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Subject: [PULL 16/18] ui/vdagent: send release when no clipboard owner Date: Tue, 31 Aug 2021 17:31:30 +0400 Message-Id: <20210831133132.1697228-17-marcandre.lureau@redhat.com> In-Reply-To: <20210831133132.1697228-1-marcandre.lureau@redhat.com> References: <20210831133132.1697228-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=marcandre.lureau@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=216.205.24.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -31 X-Spam_score: -3.2 X-Spam_bar: --- X-Spam_report: (-3.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.391, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Gerd Hoffmann , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1630418036951100001 From: Marc-Andr=C3=A9 Lureau Signed-off-by: Marc-Andr=C3=A9 Lureau Message-Id: <20210805135715.857938-17-marcandre.lureau@redhat.com> Acked-by: Gerd Hoffmann --- ui/vdagent.c | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/ui/vdagent.c b/ui/vdagent.c index cd49da1ffa..7d8cb963ff 100644 --- a/ui/vdagent.c +++ b/ui/vdagent.c @@ -345,6 +345,24 @@ static void vdagent_send_clipboard_grab(VDAgentChardev= *vd, vdagent_send_msg(vd, msg); } =20 +static void vdagent_send_clipboard_release(VDAgentChardev *vd, + QemuClipboardInfo *info) +{ + g_autofree VDAgentMessage *msg =3D g_malloc0(sizeof(VDAgentMessage) + + sizeof(uint32_t)); + + if (have_selection(vd)) { + uint8_t *s =3D msg->data; + *s =3D info->selection; + msg->size +=3D sizeof(uint32_t); + } else if (info->selection !=3D QEMU_CLIPBOARD_SELECTION_CLIPBOARD) { + return; + } + + msg->type =3D VD_AGENT_CLIPBOARD_RELEASE; + vdagent_send_msg(vd, msg); +} + static void vdagent_send_clipboard_data(VDAgentChardev *vd, QemuClipboardInfo *info, QemuClipboardType type) @@ -396,7 +414,11 @@ static void vdagent_clipboard_notify(Notifier *notifie= r, void *data) if (info !=3D qemu_clipboard_info(s)) { vd->cbpending[s] =3D 0; if (!self_update) { - vdagent_send_clipboard_grab(vd, info); + if (info->owner) { + vdagent_send_clipboard_grab(vd, info); + } else { + vdagent_send_clipboard_release(vd, info); + } } return; } --=20 2.33.0.rc2 From nobody Tue May 7 22:39:48 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1630418575819650.063929567252; Tue, 31 Aug 2021 07:02:55 -0700 (PDT) Received: from localhost ([::1]:49540 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mL4Lm-0005Be-8W for importer@patchew.org; Tue, 31 Aug 2021 10:02:54 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:52128) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mL3vG-0003yd-Kb for qemu-devel@nongnu.org; Tue, 31 Aug 2021 09:35:32 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:22288) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mL3v7-0001gG-C9 for qemu-devel@nongnu.org; Tue, 31 Aug 2021 09:35:28 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-441-tNIG3JHUMGyDolyyKmfJ6w-1; Tue, 31 Aug 2021 09:35:18 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id A291A18C8C06; Tue, 31 Aug 2021 13:35:17 +0000 (UTC) Received: from localhost (unknown [10.39.208.23]) by smtp.corp.redhat.com (Postfix) with ESMTP id D98E06B541; Tue, 31 Aug 2021 13:35:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1630416920; 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=YauwC51ciQWs61erMpVU6r6X1KiDF5rHsSIXWFt6gCE=; b=YLEBW4I3UNyx+80JN9gYCNf3EQHXQsgyiQ5OHt4YJilge+/4QDJOfFbRY4GgsSMDi61TVt TjsqN11OGVWEPiMk30U7Wr5jFyFMgLGfHdWzugn3slqcqiBrIP6W8uppHcRw0j7hExqqR+ T3KDW7FxfVs0L1fS/jBtFJgQBlaqHfI= X-MC-Unique: tNIG3JHUMGyDolyyKmfJ6w-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Subject: [PULL 17/18] ui/gtk-clipboard: emit release clipboard events Date: Tue, 31 Aug 2021 17:31:31 +0400 Message-Id: <20210831133132.1697228-18-marcandre.lureau@redhat.com> In-Reply-To: <20210831133132.1697228-1-marcandre.lureau@redhat.com> References: <20210831133132.1697228-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=marcandre.lureau@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=216.205.24.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -12 X-Spam_score: -1.3 X-Spam_bar: - X-Spam_report: (-1.3 / 5.0 requ) DKIMWL_WL_HIGH=-0.391, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Gerd Hoffmann , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1630418619422100001 From: Marc-Andr=C3=A9 Lureau Signed-off-by: Marc-Andr=C3=A9 Lureau Message-Id: <20210805135715.857938-18-marcandre.lureau@redhat.com> Acked-by: Gerd Hoffmann --- ui/gtk-clipboard.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ui/gtk-clipboard.c b/ui/gtk-clipboard.c index 4e4b3c52bb..35b7a2c228 100644 --- a/ui/gtk-clipboard.c +++ b/ui/gtk-clipboard.c @@ -163,6 +163,8 @@ static void gd_owner_change(GtkClipboard *clipboard, qemu_clipboard_info_unref(info); break; default: + qemu_clipboard_peer_release(&gd->cbpeer, s); + gd->cbowner[s] =3D false; break; } } --=20 2.33.0.rc2 From nobody Tue May 7 22:39:48 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1630418050164130.36262095677205; Tue, 31 Aug 2021 06:54:10 -0700 (PDT) Received: from localhost ([::1]:60638 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mL4DJ-0001r9-0n for importer@patchew.org; Tue, 31 Aug 2021 09:54:09 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:52208) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mL3vS-000416-PI for qemu-devel@nongnu.org; Tue, 31 Aug 2021 09:35:42 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:47796) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mL3vL-0001vS-QH for qemu-devel@nongnu.org; Tue, 31 Aug 2021 09:35:42 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-120-apLzckEwNbuBcmC6Oa86aA-1; Tue, 31 Aug 2021 09:35:30 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id C6B51101C8A8; Tue, 31 Aug 2021 13:35:29 +0000 (UTC) Received: from localhost (unknown [10.39.208.23]) by smtp.corp.redhat.com (Postfix) with ESMTP id A39EB5D9D5; Tue, 31 Aug 2021 13:35:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1630416932; 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=CyepSsTUTfApAnlmB7/qTyZ2OXxSOVK+tRrED4gd8g8=; b=NCL67uQ1IvVqprglZCpEYW8buvnNp3Jq/wpqTN/nYDXtezX7wHb8jX6PR7qiqvEtO2iV+x iOpczoPM/J3EyO4qZPwDTOFccPnNB5nn8Pajp0lLBS+QqaR9ZLsk+BeVp0cWthlCaO2sK/ f21711n+JD8Z/0u/0ddiX9OehbO/B/E= X-MC-Unique: apLzckEwNbuBcmC6Oa86aA-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Subject: [PULL 18/18] ui/vdagent: add a migration blocker Date: Tue, 31 Aug 2021 17:31:32 +0400 Message-Id: <20210831133132.1697228-19-marcandre.lureau@redhat.com> In-Reply-To: <20210831133132.1697228-1-marcandre.lureau@redhat.com> References: <20210831133132.1697228-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=marcandre.lureau@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -31 X-Spam_score: -3.2 X-Spam_bar: --- X-Spam_report: (-3.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.391, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Gerd Hoffmann , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1630418051986100005 From: Marc-Andr=C3=A9 Lureau The current implementation lacks migration support. After migration, vdagent support will be broken (even after a restart of the daemons). Let's try to fix it in 6.2. Signed-off-by: Marc-Andr=C3=A9 Lureau Message-Id: <20210805135715.857938-19-marcandre.lureau@redhat.com> Acked-by: Gerd Hoffmann --- ui/vdagent.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/ui/vdagent.c b/ui/vdagent.c index 7d8cb963ff..19e8fbfc96 100644 --- a/ui/vdagent.c +++ b/ui/vdagent.c @@ -6,6 +6,7 @@ #include "qemu/option.h" #include "qemu/units.h" #include "hw/qdev-core.h" +#include "migration/blocker.h" #include "ui/clipboard.h" #include "ui/console.h" #include "ui/input.h" @@ -23,6 +24,9 @@ struct VDAgentChardev { Chardev parent; =20 + /* TODO: migration isn't yet supported */ + Error *migration_blocker; + /* config */ bool mouse; bool clipboard; @@ -599,6 +603,10 @@ static void vdagent_chr_open(Chardev *chr, return; #endif =20 + if (migrate_add_blocker(vd->migration_blocker, errp) !=3D 0) { + return; + } + vd->mouse =3D VDAGENT_MOUSE_DEFAULT; if (cfg->has_mouse) { vd->mouse =3D cfg->mouse; @@ -832,14 +840,18 @@ static void vdagent_chr_init(Object *obj) VDAgentChardev *vd =3D QEMU_VDAGENT_CHARDEV(obj); =20 buffer_init(&vd->outbuf, "vdagent-outbuf"); + error_setg(&vd->migration_blocker, + "The vdagent chardev doesn't yet support migration"); } =20 static void vdagent_chr_fini(Object *obj) { VDAgentChardev *vd =3D QEMU_VDAGENT_CHARDEV(obj); =20 + migrate_del_blocker(vd->migration_blocker); vdagent_disconnect(vd); buffer_free(&vd->outbuf); + error_free(vd->migration_blocker); } =20 static const TypeInfo vdagent_chr_type_info =3D { --=20 2.33.0.rc2