From patchwork Mon Jul 19 07:26:43 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= X-Patchwork-Id: 12384861 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 75878C12002 for ; Mon, 19 Jul 2021 07:31:46 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 1E3CD61019 for ; Mon, 19 Jul 2021 07:31:46 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1E3CD61019 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:43392 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m5Nkf-0006WU-77 for qemu-devel@archiver.kernel.org; Mon, 19 Jul 2021 03:31:45 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42170) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m5NgT-0007pP-CY for qemu-devel@nongnu.org; Mon, 19 Jul 2021 03:27:26 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:51108) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m5NgP-0001AK-Mf for qemu-devel@nongnu.org; Mon, 19 Jul 2021 03:27:25 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1626679640; 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=XYrfKnai1QVuD5mXiMbty+Pcn7ah5CGPp3cBp/runuo=; b=S6XUV4wmvjH4O1c9FPKpZqPkGeb8Zy/uudwVtPRTmonqnyA73NlAQ8pvJZ2GUkas2e3FSA 9rB4qc3kGzU1INwG8hy/t1Y9hA/ZMs4JN8Z2Wmpn4O5aEhKQJD3Ngm1Ts7vGZoFroYJs68 jS3ddtS0nAWbkiCdxVaQinF6C029Z7Y= 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-80-M-5iqq4JMZOI7gYWhlnhbw-1; Mon, 19 Jul 2021 03:27:18 -0400 X-MC-Unique: M-5iqq4JMZOI7gYWhlnhbw-1 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 365D0804300 for ; Mon, 19 Jul 2021 07:27:18 +0000 (UTC) Received: from localhost (unknown [10.36.110.20]) by smtp.corp.redhat.com (Postfix) with ESMTP id ADE3F10016F5; Mon, 19 Jul 2021 07:27:09 +0000 (UTC) From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Subject: [PATCH 01/12] ui/vdagent: fix leak on error path Date: Mon, 19 Jul 2021 11:26:43 +0400 Message-Id: <20210719072654.845901-2-marcandre.lureau@redhat.com> In-Reply-To: <20210719072654.845901-1-marcandre.lureau@redhat.com> References: <20210719072654.845901-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 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: -42 X-Spam_score: -4.3 X-Spam_bar: ---- X-Spam_report: (-4.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1.466, 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_H4=-0.01, RCVD_IN_MSPIKE_WL=-0.01, 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: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Gerd Hoffmann Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Marc-André Lureau info is leaked if more than 10 entries Signed-off-by: Marc-André Lureau --- 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); +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 = VD_AGENT_CLIPBOARD_SELECTION_CLIPBOARD; uint32_t size = msg->size; void *data = msg->data; - QemuClipboardInfo *info; + g_autoptr(QemuClipboardInfo) info = NULL; QemuClipboardType type; if (have_selection(vd)) { @@ -477,7 +477,6 @@ static void vdagent_chr_recv_clipboard(VDAgentChardev *vd, VDAgentMessage *msg) size -= 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 = qemu_clipboard_info_new(NULL, s); qemu_clipboard_update(info); - qemu_clipboard_info_unref(info); } break; } From patchwork Mon Jul 19 07:26:44 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= X-Patchwork-Id: 12384855 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 52370C12002 for ; Mon, 19 Jul 2021 07:29:09 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E5937608FE for ; Mon, 19 Jul 2021 07:29:08 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E5937608FE Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:35472 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m5Ni8-00017L-14 for qemu-devel@archiver.kernel.org; Mon, 19 Jul 2021 03:29:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42212) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m5Nge-0007rk-OP for qemu-devel@nongnu.org; Mon, 19 Jul 2021 03:27:36 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:34065) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m5Ngb-0001HY-2d for qemu-devel@nongnu.org; Mon, 19 Jul 2021 03:27:35 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1626679652; 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=mx8jYSAcWVRFFAJpXewPtch97JOy/w7Yy8S8zCtuwMA=; b=UsPQA0WozIsu0ilm5nPRWlaQaty/0+9jpWYkPbu05HvrrDDa9vLSVSHxoGZxTfSym1/zUP WcABP4iuaiZuVdnqgDrdFWJ/VwnVrWJXCFxAuvsC+nHOLaRcbyVkUpHewzEXRd/rIiaOB0 yqeLa8caRf8Lkm072bAcyuRLYiakOOY= 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-520-16n6C60DN5C1_fWQa2d4Xg-1; Mon, 19 Jul 2021 03:27:30 -0400 X-MC-Unique: 16n6C60DN5C1_fWQa2d4Xg-1 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 27B02100C610 for ; Mon, 19 Jul 2021 07:27:30 +0000 (UTC) Received: from localhost (unknown [10.36.110.20]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4B290620DE; Mon, 19 Jul 2021 07:27:21 +0000 (UTC) From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Subject: [PATCH 02/12] ui/vdagent: remove copy-pasta comment Date: Mon, 19 Jul 2021 11:26:44 +0400 Message-Id: <20210719072654.845901-3-marcandre.lureau@redhat.com> In-Reply-To: <20210719072654.845901-1-marcandre.lureau@redhat.com> References: <20210719072654.845901-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 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: -42 X-Spam_score: -4.3 X-Spam_bar: ---- X-Spam_report: (-4.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1.466, 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_H4=-0.01, RCVD_IN_MSPIKE_WL=-0.01, 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: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Gerd Hoffmann Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Marc-André Lureau Signed-off-by: Marc-André Lureau --- 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 == &vd->cbpeer) { /* set empty clipboard info */ From patchwork Mon Jul 19 07:26:45 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= X-Patchwork-Id: 12384873 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 59B62C12002 for ; Mon, 19 Jul 2021 07:33:31 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E6E3F608FE for ; Mon, 19 Jul 2021 07:33:30 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E6E3F608FE Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:51898 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m5NmM-0003lI-4Y for qemu-devel@archiver.kernel.org; Mon, 19 Jul 2021 03:33:30 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42232) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m5Ngp-000852-Cv for qemu-devel@nongnu.org; Mon, 19 Jul 2021 03:27:47 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:28189) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m5Ngn-0001UZ-VR for qemu-devel@nongnu.org; Mon, 19 Jul 2021 03:27:47 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1626679665; 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=mx0brYSsHzma4V1wWuNBs/0zjSqwvBBSSRbRBEc0nLA=; b=ESOl3dWRc+YTtYoCmzivt7vxnNQLIVc0sWeqyRHyqnV/noW9y9PjRsZSTC55iopdyhIkS9 4b8AikRjDbkQ7thGkxwjhOcXHcw1VyqmYyvFjHqJYFohJvr5riQbO4TlnjEHwbUqFfCpJT yEK57GQvWcaNyOdBaKncXGzP8lfzb9M= 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-337-eoUaC4xqMq2hiDsf32VuLQ-1; Mon, 19 Jul 2021 03:27:43 -0400 X-MC-Unique: eoUaC4xqMq2hiDsf32VuLQ-1 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 F02C2CC625 for ; Mon, 19 Jul 2021 07:27:42 +0000 (UTC) Received: from localhost (unknown [10.36.110.20]) by smtp.corp.redhat.com (Postfix) with ESMTP id BD94860918; Mon, 19 Jul 2021 07:27:34 +0000 (UTC) From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Subject: [PATCH 03/12] ui/gtk-clipboard: use existing macros Date: Mon, 19 Jul 2021 11:26:45 +0400 Message-Id: <20210719072654.845901-4-marcandre.lureau@redhat.com> In-Reply-To: <20210719072654.845901-1-marcandre.lureau@redhat.com> References: <20210719072654.845901-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 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: -42 X-Spam_score: -4.3 X-Spam_bar: ---- X-Spam_report: (-4.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1.466, 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_H4=-0.01, RCVD_IN_MSPIKE_WL=-0.01, 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: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Gerd Hoffmann Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Marc-André Lureau Rather than hardcoding strings Signed-off-by: Marc-André Lureau --- 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); gd->gtkcb[QEMU_CLIPBOARD_SELECTION_CLIPBOARD] = - gtk_clipboard_get(gdk_atom_intern("CLIPBOARD", FALSE)); + gtk_clipboard_get(GDK_SELECTION_CLIPBOARD); gd->gtkcb[QEMU_CLIPBOARD_SELECTION_PRIMARY] = - gtk_clipboard_get(gdk_atom_intern("PRIMARY", FALSE)); + gtk_clipboard_get(GDK_SELECTION_PRIMARY); gd->gtkcb[QEMU_CLIPBOARD_SELECTION_SECONDARY] = - gtk_clipboard_get(gdk_atom_intern("SECONDARY", FALSE)); + gtk_clipboard_get(GDK_SELECTION_SECONDARY); g_signal_connect(gd->gtkcb[QEMU_CLIPBOARD_SELECTION_CLIPBOARD], "owner-change", G_CALLBACK(gd_owner_change), gd); From patchwork Mon Jul 19 07:26:46 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= X-Patchwork-Id: 12384879 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6A001C636C9 for ; Mon, 19 Jul 2021 07:35:38 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 0763C61029 for ; Mon, 19 Jul 2021 07:35:38 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0763C61029 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:58250 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m5NoO-0007xf-W4 for qemu-devel@archiver.kernel.org; Mon, 19 Jul 2021 03:35:37 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42250) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m5Ngx-0008HB-O3 for qemu-devel@nongnu.org; Mon, 19 Jul 2021 03:27:55 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:34812) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m5Ngw-0001aZ-5q for qemu-devel@nongnu.org; Mon, 19 Jul 2021 03:27:55 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1626679669; 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=oWI7ipGid6vRZncqlkQ6yP8ngm2uoAwYScZaPWZX/Gs=; b=fs35oUFG69gtU7dnP43orYzTb+JpOj09BS/wqVKsFO5xkQvG26SA53bg6vqMZzTWT6hniR tkDO0sgCoTcrvCzC9MmdIqbxDD/re1rZ0Zv8WEGL+gRMuaorrgcTcT26kuvUJY4FQSu0el nHF/4CbXLd8Q+IOkVTusMnetWWPN+Hk= 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-416-o8Q8LA6WPoK4e-B1AcSqGA-1; Mon, 19 Jul 2021 03:27:48 -0400 X-MC-Unique: o8Q8LA6WPoK4e-B1AcSqGA-1 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 C763C1084F6B for ; Mon, 19 Jul 2021 07:27:47 +0000 (UTC) Received: from localhost (unknown [10.36.110.20]) by smtp.corp.redhat.com (Postfix) with ESMTP id A5C0E60916; Mon, 19 Jul 2021 07:27:46 +0000 (UTC) From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Subject: [PATCH 04/12] ui/gtk-clipboard: fix clipboard enum typo Date: Mon, 19 Jul 2021 11:26:46 +0400 Message-Id: <20210719072654.845901-5-marcandre.lureau@redhat.com> In-Reply-To: <20210719072654.845901-1-marcandre.lureau@redhat.com> References: <20210719072654.845901-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 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: -42 X-Spam_score: -4.3 X-Spam_bar: ---- X-Spam_report: (-4.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1.466, 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_H4=-0.01, RCVD_IN_MSPIKE_WL=-0.01, 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: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Gerd Hoffmann Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Marc-André Lureau Signed-off-by: Marc-André Lureau --- 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, switch (event->owner_change.reason) { - case GDK_SETTING_ACTION_NEW: + case GDK_OWNER_CHANGE_NEW_OWNER: info = qemu_clipboard_info_new(&gd->cbpeer, s); if (gtk_clipboard_wait_is_text_available(clipboard)) { info->types[QEMU_CLIPBOARD_TYPE_TEXT].available = true; From patchwork Mon Jul 19 07:26:47 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= X-Patchwork-Id: 12384857 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2693CC12002 for ; Mon, 19 Jul 2021 07:29:59 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id D7E60608FE for ; Mon, 19 Jul 2021 07:29:58 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D7E60608FE Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:37770 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m5Niw-0002fT-1I for qemu-devel@archiver.kernel.org; Mon, 19 Jul 2021 03:29:58 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42274) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m5Nh9-0000C5-2Y for qemu-devel@nongnu.org; Mon, 19 Jul 2021 03:28:07 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:29585) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m5Nh7-0001kR-K8 for qemu-devel@nongnu.org; Mon, 19 Jul 2021 03:28:06 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1626679681; 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=LcCxN767Av8hnZZxCKt8rX/rq3GEin1zUeoiL3cH15Q=; b=Of5t4A2u/aoMUrumQcWoDzxKl5grtJOWkQekGZaaMN0DEsEmyiP4FTPeOyNM1QDhJ0dFDd 1rVSqpTOBapk6+fJDvVr2TXONUZy8nyyyTf4VJgo3PriDFjqC40ey26Vbi7EtxRlAcqRIL DIhemFPhGLKnyannczOJlJah75b95oU= 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-216-qoO5LzGnMaqCTK0LdsCPvw-1; Mon, 19 Jul 2021 03:28:00 -0400 X-MC-Unique: qoO5LzGnMaqCTK0LdsCPvw-1 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 A559A100C61C for ; Mon, 19 Jul 2021 07:27:59 +0000 (UTC) Received: from localhost (unknown [10.36.110.20]) by smtp.corp.redhat.com (Postfix) with ESMTP id BB504752AB; Mon, 19 Jul 2021 07:27:51 +0000 (UTC) From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Subject: [PATCH 05/12] ui/clipboard: add helper to retrieve current clipboard Date: Mon, 19 Jul 2021 11:26:47 +0400 Message-Id: <20210719072654.845901-6-marcandre.lureau@redhat.com> In-Reply-To: <20210719072654.845901-1-marcandre.lureau@redhat.com> References: <20210719072654.845901-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 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: -42 X-Spam_score: -4.3 X-Spam_bar: ---- X-Spam_report: (-4.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1.466, 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_H4=-0.01, RCVD_IN_MSPIKE_WL=-0.01, 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: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Gerd Hoffmann Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Marc-André Lureau Signed-off-by: Marc-André Lureau --- 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 *peer); */ void qemu_clipboard_peer_unregister(QemuClipboardPeer *peer); +/** + * 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 = NOTIFIER_LIST_INITIALIZER(clipboard_notifiers); +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 *peer) void qemu_clipboard_update(QemuClipboardInfo *info) { + g_autoptr(QemuClipboardInfo) old = NULL; + assert(info->selection < QEMU_CLIPBOARD_SELECTION__COUNT); + notifier_list_notify(&clipboard_notifiers, info); + + old = cbinfo[info->selection]; + cbinfo[info->selection] = qemu_clipboard_info_ref(info); +} + +QemuClipboardInfo *qemu_clipboard_info(QemuClipboardSelection selection) +{ + assert(selection < QEMU_CLIPBOARD_SELECTION__COUNT); + + return cbinfo[selection]; } QemuClipboardInfo *qemu_clipboard_info_new(QemuClipboardPeer *owner, From patchwork Mon Jul 19 07:26:48 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= X-Patchwork-Id: 12384865 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 03A6EC636C9 for ; Mon, 19 Jul 2021 07:32:19 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id BE4D361019 for ; Mon, 19 Jul 2021 07:32:18 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org BE4D361019 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:46368 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m5NlB-0008Uh-TW for qemu-devel@archiver.kernel.org; Mon, 19 Jul 2021 03:32:17 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42314) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m5NhJ-0000ZR-VI for qemu-devel@nongnu.org; Mon, 19 Jul 2021 03:28:17 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:32486) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m5NhI-0001uI-FD for qemu-devel@nongnu.org; Mon, 19 Jul 2021 03:28:17 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1626679694; 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=dyAj/jGLa1dUp+FcXAmClOE/DH525boYanfUhAheq6c=; b=NHFKw+f8hJGTAiyORBThFApaEfrUld+jZDLeW9vRwTBGBTakryVj54uX3AjoyVXtANYcgA /mvj4YbsNtcduHaMOJO1twLTwaDVu23MU5rJR5qAnvnESliZET27/drV7Rppot9YyxXidQ lAtgmCZ2rudgi8jIYok7i/MYspoYd1Y= 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-229-0gNOfnjWOHiPwRY56J-Vzw-1; Mon, 19 Jul 2021 03:28:12 -0400 X-MC-Unique: 0gNOfnjWOHiPwRY56J-Vzw-1 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 A2312800050 for ; Mon, 19 Jul 2021 07:28:11 +0000 (UTC) Received: from localhost (unknown [10.36.110.20]) by smtp.corp.redhat.com (Postfix) with ESMTP id A61F15D6A1; Mon, 19 Jul 2021 07:28:03 +0000 (UTC) From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Subject: [PATCH 06/12] ui/clipboard: release owned grabs on unregister Date: Mon, 19 Jul 2021 11:26:48 +0400 Message-Id: <20210719072654.845901-7-marcandre.lureau@redhat.com> In-Reply-To: <20210719072654.845901-1-marcandre.lureau@redhat.com> References: <20210719072654.845901-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 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: -42 X-Spam_score: -4.3 X-Spam_bar: ---- X-Spam_report: (-4.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1.466, 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_H4=-0.01, RCVD_IN_MSPIKE_WL=-0.01, 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: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Gerd Hoffmann Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Marc-André Lureau Signed-off-by: Marc-André Lureau --- ui/clipboard.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/ui/clipboard.c b/ui/clipboard.c index 56c14509fe..a9512f01a7 100644 --- a/ui/clipboard.c +++ b/ui/clipboard.c @@ -13,6 +13,15 @@ void qemu_clipboard_peer_register(QemuClipboardPeer *peer) void qemu_clipboard_peer_unregister(QemuClipboardPeer *peer) { + int i; + + for (i = 0; i < QEMU_CLIPBOARD_SELECTION__COUNT; i++) { + if (cbinfo[i] && cbinfo[i]->owner == peer) { + /* release owned grabs */ + g_autoptr(QemuClipboardInfo) info = qemu_clipboard_info_new(NULL, i); + qemu_clipboard_update(info); + } + } notifier_remove(&peer->update); } From patchwork Mon Jul 19 07:26:49 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= X-Patchwork-Id: 12384859 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C7213C12002 for ; Mon, 19 Jul 2021 07:30:31 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 88D22608FE for ; Mon, 19 Jul 2021 07:30:31 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 88D22608FE Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:39624 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m5NjS-0003vV-MA for qemu-devel@archiver.kernel.org; Mon, 19 Jul 2021 03:30:30 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42360) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m5Nha-0001AY-4M for qemu-devel@nongnu.org; Mon, 19 Jul 2021 03:28:34 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:32466) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m5NhX-00026b-AO for qemu-devel@nongnu.org; Mon, 19 Jul 2021 03:28:33 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1626679710; 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=fuyjGOiagi3No9AY/vtRA8sF5be2g7np6Cy3NuedAZ4=; b=edNTYO/WuI3KgfFnTnLXazrMNID9RHXE93oSJs0iolk/JU019ZPjLvBz7NvtkMQYf8BQFn v/QaSepGxtNePRu4wrX67m+Awol6HXE/RBVUnwfjeWabYc+ZxjoiWK/3F4Aa7w4iOGiv6C nnUjg+oAm+Coxg2ulWHSjaQFLtD5n+k= 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-484-tu23A4cANUGb102Lds8Ukg-1; Mon, 19 Jul 2021 03:28:24 -0400 X-MC-Unique: tu23A4cANUGb102Lds8Ukg-1 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 A37341084F56 for ; Mon, 19 Jul 2021 07:28:23 +0000 (UTC) Received: from localhost (unknown [10.36.110.20]) by smtp.corp.redhat.com (Postfix) with ESMTP id CBA7C3B04; Mon, 19 Jul 2021 07:28:15 +0000 (UTC) From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Subject: [PATCH 07/12] ui/vdagent: unregister clipboard peer on finalize Date: Mon, 19 Jul 2021 11:26:49 +0400 Message-Id: <20210719072654.845901-8-marcandre.lureau@redhat.com> In-Reply-To: <20210719072654.845901-1-marcandre.lureau@redhat.com> References: <20210719072654.845901-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 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: -42 X-Spam_score: -4.3 X-Spam_bar: ---- X-Spam_report: (-4.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1.466, 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_H4=-0.01, RCVD_IN_MSPIKE_WL=-0.01, 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: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Gerd Hoffmann Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Marc-André Lureau Signed-off-by: Marc-André Lureau --- ui/vdagent.c | 1 + 1 file changed, 1 insertion(+) diff --git a/ui/vdagent.c b/ui/vdagent.c index 5ae5734c81..bce9f44b7b 100644 --- a/ui/vdagent.c +++ b/ui/vdagent.c @@ -782,6 +782,7 @@ static void vdagent_chr_fini(Object *obj) VDAgentChardev *vd = QEMU_VDAGENT_CHARDEV(obj); buffer_free(&vd->outbuf); + qemu_clipboard_peer_unregister(&vd->cbpeer); } static const TypeInfo vdagent_chr_type_info = { From patchwork Mon Jul 19 07:26:50 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= X-Patchwork-Id: 12384867 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D2F1FC12002 for ; Mon, 19 Jul 2021 07:32:53 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 7F9D861019 for ; Mon, 19 Jul 2021 07:32:53 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7F9D861019 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:48210 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m5Nlk-0001I2-MU for qemu-devel@archiver.kernel.org; Mon, 19 Jul 2021 03:32:52 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42372) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m5Nhg-0001FO-Uk for qemu-devel@nongnu.org; Mon, 19 Jul 2021 03:28:41 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:54899) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m5Nhf-0002Dl-9s for qemu-devel@nongnu.org; Mon, 19 Jul 2021 03:28:40 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1626679718; 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=LtTkugYKfcPe1eLTR2RWwsHw3ND8453W+l6kRaHzz0M=; b=A7AKU/5a0u313D/nUtA1NS3arpWQaX9pZkcX5KVL9KL1i62jXpM/+cpQD7d91JtS49JtbG 59JYBlyKMGkygxRydT3/xuO/6zntx0P8tFZdpeNbnMGGJAl+oGzS7+8ZBSKwlAHwh8Yhek gKMoyciKWBkZQQuUfjeb95vGyz6xr84= 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-512-1G6eS3usNnuDC8sW3uERrA-1; Mon, 19 Jul 2021 03:28:37 -0400 X-MC-Unique: 1G6eS3usNnuDC8sW3uERrA-1 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 9C2CC19251AC for ; Mon, 19 Jul 2021 07:28:36 +0000 (UTC) Received: from localhost (unknown [10.36.110.20]) by smtp.corp.redhat.com (Postfix) with ESMTP id 331FD5D9F0; Mon, 19 Jul 2021 07:28:27 +0000 (UTC) From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Subject: [PATCH 08/12] ui/vdagent: split clipboard recv message handling Date: Mon, 19 Jul 2021 11:26:50 +0400 Message-Id: <20210719072654.845901-9-marcandre.lureau@redhat.com> In-Reply-To: <20210719072654.845901-1-marcandre.lureau@redhat.com> References: <20210719072654.845901-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 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: -42 X-Spam_score: -4.3 X-Spam_bar: ---- X-Spam_report: (-4.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1.466, 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_H4=-0.01, RCVD_IN_MSPIKE_WL=-0.01, 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: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Gerd Hoffmann Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Marc-André Lureau Signed-off-by: Marc-André Lureau --- ui/vdagent.c | 157 +++++++++++++++++++++++++++++---------------------- 1 file changed, 89 insertions(+), 68 deletions(-) diff --git a/ui/vdagent.c b/ui/vdagent.c index bce9f44b7b..f716f2d8c3 100644 --- a/ui/vdagent.c +++ b/ui/vdagent.c @@ -433,13 +433,94 @@ static void vdagent_clipboard_request(QemuClipboardInfo *info, vdagent_send_msg(vd, msg); } +static void vdagent_clipboard_recv_grab(VDAgentChardev *vd, uint8_t s, uint32_t size, void *data) +{ + g_autoptr(QemuClipboardInfo) info = NULL; + + trace_vdagent_cb_grab_selection(GET_NAME(sel_name, s)); + info = 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 >= 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 = true; + break; + default: + break; + } + data += sizeof(uint32_t); + size -= 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 = QEMU_CLIPBOARD_TYPE_TEXT; + break; + default: + return; + } + if (vd->cbinfo[s] && vd->cbinfo[s]->types[type].available && + vd->cbinfo[s]->owner != &vd->cbpeer) { + if (vd->cbinfo[s]->types[type].data) { + vdagent_send_clipboard_data(vd, vd->cbinfo[s], type); + } else { + vd->cbpending[s] |= (1 << type); + qemu_clipboard_request(vd->cbinfo[s], type); + } + } +} + +static void vdagent_clipboard_recv_data(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 = QEMU_CLIPBOARD_TYPE_TEXT; + break; + default: + return; + } + data += 4; + size -= 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 = NULL; + + if (vd->cbinfo[s] && vd->cbinfo[s]->owner == &vd->cbpeer) { + /* set empty clipboard info */ + info = qemu_clipboard_info_new(NULL, s); + qemu_clipboard_update(info); + } +} + static void vdagent_chr_recv_clipboard(VDAgentChardev *vd, VDAgentMessage *msg) { uint8_t s = VD_AGENT_CLIPBOARD_SELECTION_CLIPBOARD; uint32_t size = msg->size; void *data = msg->data; - g_autoptr(QemuClipboardInfo) info = NULL; - QemuClipboardType type; if (have_selection(vd)) { if (size < 4) { @@ -455,75 +536,15 @@ static void vdagent_chr_recv_clipboard(VDAgentChardev *vd, VDAgentMessage *msg) switch (msg->type) { case VD_AGENT_CLIPBOARD_GRAB: - trace_vdagent_cb_grab_selection(GET_NAME(sel_name, s)); - info = 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 >= 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 = true; - break; - default: - break; - } - data += sizeof(uint32_t); - size -= 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 = QEMU_CLIPBOARD_TYPE_TEXT; - break; - default: - return; - } - if (vd->cbinfo[s] && - vd->cbinfo[s]->types[type].available && - vd->cbinfo[s]->owner != &vd->cbpeer) { - if (vd->cbinfo[s]->types[type].data) { - vdagent_send_clipboard_data(vd, vd->cbinfo[s], type); - } else { - vd->cbpending[s] |= (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 = QEMU_CLIPBOARD_TYPE_TEXT; - break; - default: - return; - } - data += 4; - size -= 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 == &vd->cbpeer) { - /* set empty clipboard info */ - info = qemu_clipboard_info_new(NULL, s); - qemu_clipboard_update(info); - } - break; + return vdagent_clipboard_recv_release(vd, s); + default: + g_assert_not_reached(); } } From patchwork Mon Jul 19 07:26:51 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= X-Patchwork-Id: 12384877 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.8 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,UNWANTED_LANGUAGE_BODY autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BD7EEC636C9 for ; Mon, 19 Jul 2021 07:34:29 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 8DD80611AE for ; Mon, 19 Jul 2021 07:34:29 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8DD80611AE Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:55558 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m5NnI-0006Aj-KE for qemu-devel@archiver.kernel.org; Mon, 19 Jul 2021 03:34:28 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42396) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m5Nhs-0001Vl-BT for qemu-devel@nongnu.org; Mon, 19 Jul 2021 03:28:52 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:29379) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m5Nhp-0002Jp-GA for qemu-devel@nongnu.org; Mon, 19 Jul 2021 03:28:52 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1626679725; 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=v6QRjXDmQMZsjGXwsAfRvtkI/inIk6o/FIuNc1J+844=; b=QMAx5zpVDSXVk0wPhSmzfiJ5cTo76Vt9CrENkTjiSxf4csGdDRzemvPg/gKYPrJPPRTPUN /Xlm7I8sc48sAVwIw/FR2C5abISr1Xd2bbjmC2q9yw3VwetLH7hL2CRmQ7UwNh8YbwR130 ifc+X5NPKQCgwcc6uF1a3waYySDZ+yk= 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-564-0p0f8jYvPn-BMWR-YkzxTQ-1; Mon, 19 Jul 2021 03:28:44 -0400 X-MC-Unique: 0p0f8jYvPn-BMWR-YkzxTQ-1 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 AE3C61835ACD for ; Mon, 19 Jul 2021 07:28:43 +0000 (UTC) Received: from localhost (unknown [10.36.110.20]) by smtp.corp.redhat.com (Postfix) with ESMTP id B6B545DEFB; Mon, 19 Jul 2021 07:28:40 +0000 (UTC) From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Subject: [PATCH 09/12] ui/vdagent: use qemu_clipboard_info helper Date: Mon, 19 Jul 2021 11:26:51 +0400 Message-Id: <20210719072654.845901-10-marcandre.lureau@redhat.com> In-Reply-To: <20210719072654.845901-1-marcandre.lureau@redhat.com> References: <20210719072654.845901-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 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: -42 X-Spam_score: -4.3 X-Spam_bar: ---- X-Spam_report: (-4.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1.466, 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_H4=-0.01, RCVD_IN_MSPIKE_WL=-0.01, 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: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Gerd Hoffmann Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Marc-André Lureau Signed-off-by: Marc-André Lureau --- ui/vdagent.c | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/ui/vdagent.c b/ui/vdagent.c index f716f2d8c3..65c9663e0d 100644 --- a/ui/vdagent.c +++ b/ui/vdagent.c @@ -47,7 +47,6 @@ struct VDAgentChardev { /* 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 = info->owner == &vd->cbpeer; - if (info != vd->cbinfo[s]) { - qemu_clipboard_info_unref(vd->cbinfo[s]); - vd->cbinfo[s] = qemu_clipboard_info_ref(info); + if (info != qemu_clipboard_info(s)) { vd->cbpending[s] = 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; if (size < sizeof(uint32_t)) { return; @@ -475,13 +473,14 @@ static void vdagent_clipboard_recv_request(VDAgentChardev *vd, uint8_t s, uint32 default: return; } - if (vd->cbinfo[s] && vd->cbinfo[s]->types[type].available && - vd->cbinfo[s]->owner != &vd->cbpeer) { - if (vd->cbinfo[s]->types[type].data) { - vdagent_send_clipboard_data(vd, vd->cbinfo[s], type); + + info = qemu_clipboard_info(s); + if (info && info->types[type].available && info->owner != &vd->cbpeer) { + if (info->types[type].data) { + vdagent_send_clipboard_data(vd, info, type); } else { vd->cbpending[s] |= (1 << type); - qemu_clipboard_request(vd->cbinfo[s], type); + qemu_clipboard_request(info, type); } } } @@ -489,6 +488,7 @@ static void vdagent_clipboard_recv_request(VDAgentChardev *vd, uint8_t s, uint32 static void vdagent_clipboard_recv_data(VDAgentChardev *vd, uint8_t s, uint32_t size, void *data) { QemuClipboardType type; + QemuClipboardInfo *info; if (size < sizeof(uint32_t)) { return; @@ -502,14 +502,20 @@ static void vdagent_clipboard_recv_data(VDAgentChardev *vd, uint8_t s, uint32_t } data += 4; size -= 4; - qemu_clipboard_set_data(&vd->cbpeer, vd->cbinfo[s], type, size, data, true); + + info = qemu_clipboard_info(s); + if (info->owner == &vd->cbpeer) { + qemu_clipboard_set_data(&vd->cbpeer, info, type, size, data, true); + } } static void vdagent_clipboard_recv_release(VDAgentChardev *vd, uint8_t s) { + QemuClipboardInfo *cur; g_autoptr(QemuClipboardInfo) info = NULL; - if (vd->cbinfo[s] && vd->cbinfo[s]->owner == &vd->cbpeer) { + cur = qemu_clipboard_info(s); + if (cur && cur->owner == &vd->cbpeer) { /* set empty clipboard info */ info = qemu_clipboard_info_new(NULL, s); qemu_clipboard_update(info); From patchwork Mon Jul 19 07:26:52 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= X-Patchwork-Id: 12384883 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 77723C12002 for ; Mon, 19 Jul 2021 07:36:57 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 1ECEC61029 for ; Mon, 19 Jul 2021 07:36:57 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1ECEC61029 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:35000 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m5Npg-0002uJ-8d for qemu-devel@archiver.kernel.org; Mon, 19 Jul 2021 03:36:56 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42418) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m5Ni4-0001zP-Ne for qemu-devel@nongnu.org; Mon, 19 Jul 2021 03:29:04 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:54449) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m5Ni2-0002Ud-4u for qemu-devel@nongnu.org; Mon, 19 Jul 2021 03:29:03 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1626679741; 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=naWthqVYz5yqMdJoDRS9BuxuLlOuNk3D01S56gQ8Pek=; b=WUQm4GkH3zK1IjDhAS4a6NZSKcNgtNUc0H5WdC768lcwLlngu4jkw8+1dnz4aiyKxbXPJX LtRBOY9yKatkv1KWyPJ8xbHK0sfuTpBG2JFClLQ09Swx2YVUdvwOMd4ZQAdxtnf0llNe5j isMvnoz8Lh8JLf5pUWHYu6w9zYKBb7c= 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-175-ZiA3Q9kAPJyBTwQGDxxFpg-1; Mon, 19 Jul 2021 03:29:00 -0400 X-MC-Unique: ZiA3Q9kAPJyBTwQGDxxFpg-1 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 4308A100C611 for ; Mon, 19 Jul 2021 07:28:59 +0000 (UTC) Received: from localhost (unknown [10.36.110.20]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3594E5DA2D; Mon, 19 Jul 2021 07:28:47 +0000 (UTC) From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Subject: [PATCH 10/12] ui/gtk-clipboard: use qemu_clipboard_info helper Date: Mon, 19 Jul 2021 11:26:52 +0400 Message-Id: <20210719072654.845901-11-marcandre.lureau@redhat.com> In-Reply-To: <20210719072654.845901-1-marcandre.lureau@redhat.com> References: <20210719072654.845901-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 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: -42 X-Spam_score: -4.3 X-Spam_bar: ---- X-Spam_report: (-4.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1.466, 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_H4=-0.01, RCVD_IN_MSPIKE_WL=-0.01, 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: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Gerd Hoffmann Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Marc-André Lureau Signed-off-by: Marc-André Lureau --- 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 9516670ebc..60e9cdc39c 100644 --- a/include/ui/gtk.h +++ b/include/ui/gtk.h @@ -139,7 +139,6 @@ struct GtkDisplayState { bool external_pause_update; 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 *clipboard, GtkDisplayState *gd = data; QemuClipboardSelection s = gd_find_selection(gd, clipboard); QemuClipboardType type = QEMU_CLIPBOARD_TYPE_TEXT; - QemuClipboardInfo *info = qemu_clipboard_info_ref(gd->cbinfo[s]); + g_autoptr(QemuClipboardInfo) info = NULL; + + info = qemu_clipboard_info_ref(qemu_clipboard_info(s)); qemu_clipboard_request(info, type); - while (info == gd->cbinfo[s] && + while (info == qemu_clipboard_info(s) && info->types[type].available && info->types[type].data == NULL) { main_loop_wait(false); } - if (info == gd->cbinfo[s] && gd->cbowner[s]) { + if (info == 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); } static void gd_clipboard_clear(GtkClipboard *clipboard, @@ -81,9 +81,7 @@ static void gd_clipboard_notify(Notifier *notifier, void *data) QemuClipboardSelection s = info->selection; bool self_update = info->owner == &gd->cbpeer; - if (info != gd->cbinfo[s]) { - qemu_clipboard_info_unref(gd->cbinfo[s]); - gd->cbinfo[s] = qemu_clipboard_info_ref(info); + if (info != qemu_clipboard_info(s)) { gd->cbpending[s] = 0; if (!self_update) { GtkTargetList *list; From patchwork Mon Jul 19 07:26:53 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= X-Patchwork-Id: 12384863 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 30C09C12002 for ; Mon, 19 Jul 2021 07:32:18 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E1068608FE for ; Mon, 19 Jul 2021 07:32:17 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E1068608FE Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:46316 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m5NlB-0008SI-1p for qemu-devel@archiver.kernel.org; Mon, 19 Jul 2021 03:32:17 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42484) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m5NiG-0002Hp-PW for qemu-devel@nongnu.org; Mon, 19 Jul 2021 03:29:17 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:53599) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m5NiF-0002ej-6g for qemu-devel@nongnu.org; Mon, 19 Jul 2021 03:29:16 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1626679754; 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=bHmi4GFcpQ09u8onnRU4rz8jtX9N+S3HdWepdqiUBWc=; b=V4MOGxP7G+xpEZ70jj5mBUtKRX0WBHxWWiPlQpQ1mnR1c5c7yQxyeBSrKgGOwOhP4ZvcKH g511/5sNk6R1CeBnSixbB4/gIf1QFNFzkOjbgs1AQ2/JiZFL4rlDRtFiRZqLzpNU12qvKD pnhgRBB7kshScWIAbAsUczEsbN/RCKQ= 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-497-_KVNI_H7NM2ZWa0tUI1diQ-1; Mon, 19 Jul 2021 03:29:12 -0400 X-MC-Unique: _KVNI_H7NM2ZWa0tUI1diQ-1 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 F00B9CC622 for ; Mon, 19 Jul 2021 07:29:11 +0000 (UTC) Received: from localhost (unknown [10.36.110.20]) by smtp.corp.redhat.com (Postfix) with ESMTP id AF3F210016F5; Mon, 19 Jul 2021 07:29:03 +0000 (UTC) From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Subject: [PATCH 11/12] ui/vdagent: send release when no clipboard owner Date: Mon, 19 Jul 2021 11:26:53 +0400 Message-Id: <20210719072654.845901-12-marcandre.lureau@redhat.com> In-Reply-To: <20210719072654.845901-1-marcandre.lureau@redhat.com> References: <20210719072654.845901-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 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: -42 X-Spam_score: -4.3 X-Spam_bar: ---- X-Spam_report: (-4.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1.466, 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_H4=-0.01, RCVD_IN_MSPIKE_WL=-0.01, 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: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Gerd Hoffmann Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Marc-André Lureau Signed-off-by: Marc-André Lureau --- ui/vdagent.c | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/ui/vdagent.c b/ui/vdagent.c index 65c9663e0d..34e1c332ee 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); } +static void vdagent_send_clipboard_release(VDAgentChardev *vd, + QemuClipboardInfo *info) +{ + g_autofree VDAgentMessage *msg = g_malloc0(sizeof(VDAgentMessage) + + sizeof(uint32_t)); + + if (have_selection(vd)) { + uint8_t *s = msg->data; + *s = info->selection; + msg->size += sizeof(uint32_t); + } else if (info->selection != QEMU_CLIPBOARD_SELECTION_CLIPBOARD) { + return; + } + + msg->type = VD_AGENT_CLIPBOARD_RELEASE; + vdagent_send_msg(vd, msg); +} + static void vdagent_send_clipboard_data(VDAgentChardev *vd, QemuClipboardInfo *info, QemuClipboardType type) @@ -386,7 +404,11 @@ static void vdagent_clipboard_notify(Notifier *notifier, void *data) if (info != qemu_clipboard_info(s)) { vd->cbpending[s] = 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; } From patchwork Mon Jul 19 07:26:54 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= X-Patchwork-Id: 12384875 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3F271C12002 for ; Mon, 19 Jul 2021 07:34:10 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id DE95961019 for ; Mon, 19 Jul 2021 07:34:09 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org DE95961019 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:54094 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m5Nmz-0005Dc-2o for qemu-devel@archiver.kernel.org; Mon, 19 Jul 2021 03:34:09 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42538) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m5NiT-0002t2-Rw for qemu-devel@nongnu.org; Mon, 19 Jul 2021 03:29:29 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:34347) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m5NiS-0002oq-Bk for qemu-devel@nongnu.org; Mon, 19 Jul 2021 03:29:29 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1626679767; 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=F8+fiOj5htAxTq0Qfeidh0eq3B9OKyUc5EkQ6s2psyQ=; b=BV0mgrePhjn7vqAgk58qkUI7X3DhFm6ZvN0FVYhoP3v8Gc7eSEUFOvkiTNz3Yzq9RLhN60 +YDOXZb6v41HQ6dcYLbgMNajTAKuoot4VY1H4pkzuXWD5zLiT5gDNhH/pD12wlec50vRAr W6dOlHgB4FQOcj2BOHrs73p89oe5D1M= 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-577-p1-6LxExMZKJuoOoB-vXIQ-1; Mon, 19 Jul 2021 03:29:25 -0400 X-MC-Unique: p1-6LxExMZKJuoOoB-vXIQ-1 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 07B4D1835AC2 for ; Mon, 19 Jul 2021 07:29:24 +0000 (UTC) Received: from localhost (unknown [10.36.110.20]) by smtp.corp.redhat.com (Postfix) with ESMTP id 80A925C22A; Mon, 19 Jul 2021 07:29:15 +0000 (UTC) From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Subject: [PATCH 12/12] ui/gtk-clipboard: emit release clipboard events Date: Mon, 19 Jul 2021 11:26:54 +0400 Message-Id: <20210719072654.845901-13-marcandre.lureau@redhat.com> In-Reply-To: <20210719072654.845901-1-marcandre.lureau@redhat.com> References: <20210719072654.845901-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 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: -42 X-Spam_score: -4.3 X-Spam_bar: ---- X-Spam_report: (-4.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1.466, 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_H4=-0.01, RCVD_IN_MSPIKE_WL=-0.01, 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: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Gerd Hoffmann Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Marc-André Lureau Signed-off-by: Marc-André Lureau --- ui/gtk-clipboard.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ui/gtk-clipboard.c b/ui/gtk-clipboard.c index 4e4b3c52bb..16b2e2063e 100644 --- a/ui/gtk-clipboard.c +++ b/ui/gtk-clipboard.c @@ -144,7 +144,7 @@ static void gd_owner_change(GtkClipboard *clipboard, { GtkDisplayState *gd = data; QemuClipboardSelection s = gd_find_selection(gd, clipboard); - QemuClipboardInfo *info; + g_autoptr(QemuClipboardInfo) info = NULL; if (gd->cbowner[s]) { /* ignore notifications about our own grabs */ @@ -158,13 +158,13 @@ static void gd_owner_change(GtkClipboard *clipboard, if (gtk_clipboard_wait_is_text_available(clipboard)) { info->types[QEMU_CLIPBOARD_TYPE_TEXT].available = true; } - - qemu_clipboard_update(info); - qemu_clipboard_info_unref(info); break; default: + info = qemu_clipboard_info_new(NULL, s); + gd->cbowner[s] = false; break; } + qemu_clipboard_update(info); } void gd_clipboard_init(GtkDisplayState *gd)