Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/1571402/?format=api
{ "id": 1571402, "url": "http://patchwork.ozlabs.org/api/patches/1571402/?format=api", "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20211221065855.142578-4-marcandre.lureau@redhat.com/", "project": { "id": 14, "url": "http://patchwork.ozlabs.org/api/projects/14/?format=api", "name": "QEMU Development", "link_name": "qemu-devel", "list_id": "qemu-devel.nongnu.org", "list_email": "qemu-devel@nongnu.org", "web_url": "", "scm_url": "", "webscm_url": "", "list_archive_url": "", "list_archive_url_format": "", "commit_url_format": "" }, "msgid": "<20211221065855.142578-4-marcandre.lureau@redhat.com>", "list_archive_url": null, "date": "2021-12-21T06:58:22", "name": "[PULL,v2,03/36] ui: generalize clipboard notifier", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "aacdc659a75fb43591ce567164f3019d91ea82ee", "submitter": { "id": 66774, "url": "http://patchwork.ozlabs.org/api/people/66774/?format=api", "name": "Marc-André Lureau", "email": "marcandre.lureau@redhat.com" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20211221065855.142578-4-marcandre.lureau@redhat.com/mbox/", "series": [ { "id": 277865, "url": "http://patchwork.ozlabs.org/api/series/277865/?format=api", "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/list/?series=277865", "date": "2021-12-21T06:58:19", "name": "[PULL,v2,01/36] ui/vdagent: add CHECK_SPICE_PROTOCOL_VERSION", "version": 2, "mbox": "http://patchwork.ozlabs.org/series/277865/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/1571402/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/1571402/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>", "X-Original-To": "incoming@patchwork.ozlabs.org", "Delivered-To": "patchwork-incoming@bilbo.ozlabs.org", "Authentication-Results": [ "bilbo.ozlabs.org;\n\tdkim=pass (1024-bit key;\n unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256\n header.s=mimecast20190719 header.b=NqEbJCJT;\n\tdkim-atps=neutral", "ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org\n (client-ip=209.51.188.17; helo=lists.gnu.org;\n envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n receiver=<UNKNOWN>)", "relay.mimecast.com;\n auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=marcandre.lureau@redhat.com" ], "Received": [ "from lists.gnu.org (lists.gnu.org [209.51.188.17])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby bilbo.ozlabs.org (Postfix) with ESMTPS id 4JJ72J5vcfz9s3q\n\tfor <incoming@patchwork.ozlabs.org>; Tue, 21 Dec 2021 18:12:40 +1100 (AEDT)", "from localhost ([::1]:41158 helo=lists1p.gnu.org)\n\tby lists.gnu.org with esmtp (Exim 4.90_1)\n\t(envelope-from <qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>)\n\tid 1mzZKA-0004a0-JP\n\tfor incoming@patchwork.ozlabs.org; Tue, 21 Dec 2021 02:12:38 -0500", "from eggs.gnu.org ([209.51.188.92]:58110)\n by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)\n (Exim 4.90_1) (envelope-from <marcandre.lureau@redhat.com>)\n id 1mzZ85-00025U-B2\n for qemu-devel@nongnu.org; Tue, 21 Dec 2021 02:00:09 -0500", "from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:56247)\n by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)\n (Exim 4.90_1) (envelope-from <marcandre.lureau@redhat.com>)\n id 1mzZ83-0001hn-3w\n for qemu-devel@nongnu.org; Tue, 21 Dec 2021 02:00:09 -0500", "from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com\n [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS\n (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id\n us-mta-438-nav0vnlmOQCRQXMN_zZPew-1; Tue, 21 Dec 2021 01:59:58 -0500", "from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com\n [10.5.11.16])\n (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))\n (No client certificate requested)\n by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 664E0802C91;\n Tue, 21 Dec 2021 06:59:57 +0000 (UTC)", "from localhost (unknown [10.39.208.37])\n by smtp.corp.redhat.com (Postfix) with ESMTP id 708BD838DF;\n Tue, 21 Dec 2021 06:59:44 +0000 (UTC)" ], "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n s=mimecast20190719; t=1640070006;\n h=from:from:reply-to:subject:subject:date:date:message-id:message-id:\n to:to:cc:cc:mime-version:mime-version:content-type:content-type:\n content-transfer-encoding:content-transfer-encoding:\n in-reply-to:in-reply-to:references:references;\n bh=AiN9BUutgkzLtBp/GAyVU25mmPg2j5ZZqIuXUaGx4/4=;\n b=NqEbJCJTg55RSbedWoI01MajEelMRVo8p4gSGJM04gKLPZ7Y6blUSqH5cSbbBTyDe1yzod\n SINxw5OYkNkKwS3vojkGtYLk/l9SfkDrOr5n6ynU4l/ClO7KkoHkL+QkfLxyKrpolse5pI\n Py+FErDZqdMrZV6YFVpGMrLa9Ruhxzw=", "X-MC-Unique": "nav0vnlmOQCRQXMN_zZPew-1", "From": "marcandre.lureau@redhat.com", "To": "qemu-devel@nongnu.org", "Subject": "[PULL v2 03/36] ui: generalize clipboard notifier", "Date": "Tue, 21 Dec 2021 10:58:22 +0400", "Message-Id": "<20211221065855.142578-4-marcandre.lureau@redhat.com>", "In-Reply-To": "<20211221065855.142578-1-marcandre.lureau@redhat.com>", "References": "<20211221065855.142578-1-marcandre.lureau@redhat.com>", "MIME-Version": "1.0", "X-Scanned-By": "MIMEDefang 2.79 on 10.5.11.16", "X-Mimecast-Spam-Score": "0", "X-Mimecast-Originator": "redhat.com", "Content-Type": "text/plain; charset=UTF-8", "Content-Transfer-Encoding": "8bit", "Received-SPF": "pass client-ip=170.10.133.124;\n envelope-from=marcandre.lureau@redhat.com;\n helo=us-smtp-delivery-124.mimecast.com", "X-Spam_score_int": "-29", "X-Spam_score": "-3.0", "X-Spam_bar": "---", "X-Spam_report": "(-3.0 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.203,\n DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,\n RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001,\n SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no", "X-Spam_action": "no action", "X-BeenThere": "qemu-devel@nongnu.org", "X-Mailman-Version": "2.1.29", "Precedence": "list", "List-Id": "<qemu-devel.nongnu.org>", "List-Unsubscribe": "<https://lists.nongnu.org/mailman/options/qemu-devel>,\n <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>", "List-Archive": "<https://lists.nongnu.org/archive/html/qemu-devel>", "List-Post": "<mailto:qemu-devel@nongnu.org>", "List-Help": "<mailto:qemu-devel-request@nongnu.org?subject=help>", "List-Subscribe": "<https://lists.nongnu.org/mailman/listinfo/qemu-devel>,\n <mailto:qemu-devel-request@nongnu.org?subject=subscribe>", "Cc": "peter.maydell@linaro.org, richard.henderson@linaro.org, =?utf-8?q?Marc-A?=\n\t=?utf-8?q?ndr=C3=A9_Lureau?= <marcandre.lureau@redhat.com>", "Errors-To": "qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org", "Sender": "\"Qemu-devel\"\n <qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>" }, "content": "From: Marc-André Lureau <marcandre.lureau@redhat.com>\n\nUse a QemuClipboardNotify union type for extendable clipboard events.\n\nSigned-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>\nAcked-by: Gerd Hoffmann <kraxel@redhat.com>\n---\n include/ui/clipboard.h | 32 ++++++++++++++++++++++++++++++--\n ui/clipboard.c | 12 ++++++++----\n ui/gtk-clipboard.c | 20 ++++++++++++++++----\n ui/vdagent.c | 27 ++++++++++++++++++---------\n ui/vnc-clipboard.c | 20 +++++++++++++++-----\n ui/vnc.c | 2 +-\n ui/cocoa.m | 17 +++++++++++++----\n 7 files changed, 101 insertions(+), 29 deletions(-)", "diff": "diff --git a/include/ui/clipboard.h b/include/ui/clipboard.h\nindex 6298986b15c3..d82cf314811c 100644\n--- a/include/ui/clipboard.h\n+++ b/include/ui/clipboard.h\n@@ -20,8 +20,10 @@\n */\n \n typedef enum QemuClipboardType QemuClipboardType;\n+typedef enum QemuClipboardNotifyType QemuClipboardNotifyType;\n typedef enum QemuClipboardSelection QemuClipboardSelection;\n typedef struct QemuClipboardPeer QemuClipboardPeer;\n+typedef struct QemuClipboardNotify QemuClipboardNotify;\n typedef struct QemuClipboardInfo QemuClipboardInfo;\n \n /**\n@@ -55,18 +57,44 @@ enum QemuClipboardSelection {\n * struct QemuClipboardPeer\n *\n * @name: peer name.\n- * @update: notifier for clipboard updates.\n+ * @notifier: notifier for clipboard updates.\n * @request: callback for clipboard data requests.\n *\n * Clipboard peer description.\n */\n struct QemuClipboardPeer {\n const char *name;\n- Notifier update;\n+ Notifier notifier;\n void (*request)(QemuClipboardInfo *info,\n QemuClipboardType type);\n };\n \n+/**\n+ * enum QemuClipboardNotifyType\n+ *\n+ * @QEMU_CLIPBOARD_UPDATE_INFO: clipboard info update\n+ *\n+ * Clipboard notify type.\n+ */\n+enum QemuClipboardNotifyType {\n+ QEMU_CLIPBOARD_UPDATE_INFO,\n+};\n+\n+/**\n+ * struct QemuClipboardNotify\n+ *\n+ * @type: the type of event.\n+ * @info: a QemuClipboardInfo event.\n+ *\n+ * Clipboard notify data.\n+ */\n+struct QemuClipboardNotify {\n+ QemuClipboardNotifyType type;\n+ union {\n+ QemuClipboardInfo *info;\n+ };\n+};\n+\n /**\n * struct QemuClipboardInfo\n *\ndiff --git a/ui/clipboard.c b/ui/clipboard.c\nindex d7b008d62a07..743b39edf424 100644\n--- a/ui/clipboard.c\n+++ b/ui/clipboard.c\n@@ -8,7 +8,7 @@ static QemuClipboardInfo *cbinfo[QEMU_CLIPBOARD_SELECTION__COUNT];\n \n void qemu_clipboard_peer_register(QemuClipboardPeer *peer)\n {\n- notifier_list_add(&clipboard_notifiers, &peer->update);\n+ notifier_list_add(&clipboard_notifiers, &peer->notifier);\n }\n \n void qemu_clipboard_peer_unregister(QemuClipboardPeer *peer)\n@@ -18,8 +18,7 @@ void qemu_clipboard_peer_unregister(QemuClipboardPeer *peer)\n for (i = 0; i < QEMU_CLIPBOARD_SELECTION__COUNT; i++) {\n qemu_clipboard_peer_release(peer, i);\n }\n-\n- notifier_remove(&peer->update);\n+ notifier_remove(&peer->notifier);\n }\n \n bool qemu_clipboard_peer_owns(QemuClipboardPeer *peer,\n@@ -44,10 +43,15 @@ void qemu_clipboard_peer_release(QemuClipboardPeer *peer,\n \n void qemu_clipboard_update(QemuClipboardInfo *info)\n {\n+ QemuClipboardNotify notify = {\n+ .type = QEMU_CLIPBOARD_UPDATE_INFO,\n+ .info = info,\n+ };\n g_autoptr(QemuClipboardInfo) old = NULL;\n+\n assert(info->selection < QEMU_CLIPBOARD_SELECTION__COUNT);\n \n- notifier_list_notify(&clipboard_notifiers, info);\n+ notifier_list_notify(&clipboard_notifiers, ¬ify);\n \n old = cbinfo[info->selection];\n cbinfo[info->selection] = qemu_clipboard_info_ref(info);\ndiff --git a/ui/gtk-clipboard.c b/ui/gtk-clipboard.c\nindex 35b7a2c22838..44ff810234ff 100644\n--- a/ui/gtk-clipboard.c\n+++ b/ui/gtk-clipboard.c\n@@ -74,10 +74,9 @@ static void gd_clipboard_clear(GtkClipboard *clipboard,\n gd->cbowner[s] = false;\n }\n \n-static void gd_clipboard_notify(Notifier *notifier, void *data)\n+static void gd_clipboard_update_info(GtkDisplayState *gd,\n+ QemuClipboardInfo *info)\n {\n- GtkDisplayState *gd = container_of(notifier, GtkDisplayState, cbpeer.update);\n- QemuClipboardInfo *info = data;\n QemuClipboardSelection s = info->selection;\n bool self_update = info->owner == &gd->cbpeer;\n \n@@ -118,6 +117,19 @@ static void gd_clipboard_notify(Notifier *notifier, void *data)\n */\n }\n \n+static void gd_clipboard_notify(Notifier *notifier, void *data)\n+{\n+ GtkDisplayState *gd =\n+ container_of(notifier, GtkDisplayState, cbpeer.notifier);\n+ QemuClipboardNotify *notify = data;\n+\n+ switch (notify->type) {\n+ case QEMU_CLIPBOARD_UPDATE_INFO:\n+ gd_clipboard_update_info(gd, notify->info);\n+ return;\n+ }\n+}\n+\n static void gd_clipboard_request(QemuClipboardInfo *info,\n QemuClipboardType type)\n {\n@@ -172,7 +184,7 @@ static void gd_owner_change(GtkClipboard *clipboard,\n void gd_clipboard_init(GtkDisplayState *gd)\n {\n gd->cbpeer.name = \"gtk\";\n- gd->cbpeer.update.notify = gd_clipboard_notify;\n+ gd->cbpeer.notifier.notify = gd_clipboard_notify;\n gd->cbpeer.request = gd_clipboard_request;\n qemu_clipboard_peer_register(&gd->cbpeer);\n \ndiff --git a/ui/vdagent.c b/ui/vdagent.c\nindex 64e00170017f..de827aad27ab 100644\n--- a/ui/vdagent.c\n+++ b/ui/vdagent.c\n@@ -417,10 +417,9 @@ static void vdagent_send_empty_clipboard_data(VDAgentChardev *vd,\n vdagent_send_clipboard_data(vd, info, type);\n }\n \n-static void vdagent_clipboard_notify(Notifier *notifier, void *data)\n+static void vdagent_clipboard_update_info(VDAgentChardev *vd,\n+ QemuClipboardInfo *info)\n {\n- VDAgentChardev *vd = container_of(notifier, VDAgentChardev, cbpeer.update);\n- QemuClipboardInfo *info = data;\n QemuClipboardSelection s = info->selection;\n QemuClipboardType type;\n bool self_update = info->owner == &vd->cbpeer;\n@@ -449,6 +448,19 @@ static void vdagent_clipboard_notify(Notifier *notifier, void *data)\n }\n }\n \n+static void vdagent_clipboard_notify(Notifier *notifier, void *data)\n+{\n+ VDAgentChardev *vd =\n+ container_of(notifier, VDAgentChardev, cbpeer.notifier);\n+ QemuClipboardNotify *notify = data;\n+\n+ switch (notify->type) {\n+ case QEMU_CLIPBOARD_UPDATE_INFO:\n+ vdagent_clipboard_update_info(vd, notify->info);\n+ return;\n+ }\n+}\n+\n static void vdagent_clipboard_request(QemuClipboardInfo *info,\n QemuClipboardType qtype)\n {\n@@ -658,9 +670,9 @@ static void vdagent_chr_recv_caps(VDAgentChardev *vd, VDAgentMessage *msg)\n if (have_mouse(vd) && vd->mouse_hs) {\n qemu_input_handler_activate(vd->mouse_hs);\n }\n- if (have_clipboard(vd) && vd->cbpeer.update.notify == NULL) {\n+ if (have_clipboard(vd) && vd->cbpeer.notifier.notify == NULL) {\n vd->cbpeer.name = \"vdagent\";\n- vd->cbpeer.update.notify = vdagent_clipboard_notify;\n+ vd->cbpeer.notifier.notify = vdagent_clipboard_notify;\n vd->cbpeer.request = vdagent_clipboard_request;\n qemu_clipboard_peer_register(&vd->cbpeer);\n }\n@@ -799,7 +811,7 @@ static void vdagent_disconnect(VDAgentChardev *vd)\n if (vd->mouse_hs) {\n qemu_input_handler_deactivate(vd->mouse_hs);\n }\n- if (vd->cbpeer.update.notify) {\n+ if (vd->cbpeer.notifier.notify) {\n qemu_clipboard_peer_unregister(&vd->cbpeer);\n memset(&vd->cbpeer, 0, sizeof(vd->cbpeer));\n }\n@@ -807,11 +819,8 @@ static void vdagent_disconnect(VDAgentChardev *vd)\n \n static void vdagent_chr_set_fe_open(struct Chardev *chr, int fe_open)\n {\n- VDAgentChardev *vd = QEMU_VDAGENT_CHARDEV(chr);\n-\n if (!fe_open) {\n trace_vdagent_close();\n- vdagent_disconnect(vd);\n return;\n }\n \ndiff --git a/ui/vnc-clipboard.c b/ui/vnc-clipboard.c\nindex 67284b556cd8..6a0b1058840e 100644\n--- a/ui/vnc-clipboard.c\n+++ b/ui/vnc-clipboard.c\n@@ -189,10 +189,8 @@ static void vnc_clipboard_provide(VncState *vs,\n vnc_flush(vs);\n }\n \n-static void vnc_clipboard_notify(Notifier *notifier, void *data)\n+static void vnc_clipboard_update_info(VncState *vs, QemuClipboardInfo *info)\n {\n- VncState *vs = container_of(notifier, VncState, cbpeer.update);\n- QemuClipboardInfo *info = data;\n QemuClipboardType type;\n bool self_update = info->owner == &vs->cbpeer;\n uint32_t flags = 0;\n@@ -223,6 +221,18 @@ static void vnc_clipboard_notify(Notifier *notifier, void *data)\n }\n }\n \n+static void vnc_clipboard_notify(Notifier *notifier, void *data)\n+{\n+ VncState *vs = container_of(notifier, VncState, cbpeer.notifier);\n+ QemuClipboardNotify *notify = data;\n+\n+ switch (notify->type) {\n+ case QEMU_CLIPBOARD_UPDATE_INFO:\n+ vnc_clipboard_update_info(vs, notify->info);\n+ return;\n+ }\n+}\n+\n static void vnc_clipboard_request(QemuClipboardInfo *info,\n QemuClipboardType type)\n {\n@@ -316,9 +326,9 @@ void vnc_server_cut_text_caps(VncState *vs)\n caps[1] = 0;\n vnc_clipboard_send(vs, 2, caps);\n \n- if (!vs->cbpeer.update.notify) {\n+ if (!vs->cbpeer.notifier.notify) {\n vs->cbpeer.name = \"vnc\";\n- vs->cbpeer.update.notify = vnc_clipboard_notify;\n+ vs->cbpeer.notifier.notify = vnc_clipboard_notify;\n vs->cbpeer.request = vnc_clipboard_request;\n qemu_clipboard_peer_register(&vs->cbpeer);\n }\ndiff --git a/ui/vnc.c b/ui/vnc.c\nindex af02522e8416..9b603382e75e 100644\n--- a/ui/vnc.c\n+++ b/ui/vnc.c\n@@ -1354,7 +1354,7 @@ void vnc_disconnect_finish(VncState *vs)\n /* last client gone */\n vnc_update_server_surface(vs->vd);\n }\n- if (vs->cbpeer.update.notify) {\n+ if (vs->cbpeer.notifier.notify) {\n qemu_clipboard_peer_unregister(&vs->cbpeer);\n }\n \ndiff --git a/ui/cocoa.m b/ui/cocoa.m\nindex 68a6302184ab..6640a2e80ebb 100644\n--- a/ui/cocoa.m\n+++ b/ui/cocoa.m\n@@ -1808,14 +1808,12 @@ static void cocoa_clipboard_request(QemuClipboardInfo *info,\n \n static QemuClipboardPeer cbpeer = {\n .name = \"cocoa\",\n- .update = { .notify = cocoa_clipboard_notify },\n+ .notifier = { .notify = cocoa_clipboard_notify },\n .request = cocoa_clipboard_request\n };\n \n-static void cocoa_clipboard_notify(Notifier *notifier, void *data)\n+static void cocoa_clipboard_update_info(QemuClipboardInfo *info)\n {\n- QemuClipboardInfo *info = data;\n-\n if (info->owner == &cbpeer || info->selection != QEMU_CLIPBOARD_SELECTION_CLIPBOARD) {\n return;\n }\n@@ -1831,6 +1829,17 @@ static void cocoa_clipboard_notify(Notifier *notifier, void *data)\n qemu_event_set(&cbevent);\n }\n \n+static void cocoa_clipboard_notify(Notifier *notifier, void *data)\n+{\n+ QemuClipboardNotify *notify = data;\n+\n+ switch (notify->type) {\n+ case QEMU_CLIPBOARD_UPDATE_INFO:\n+ cocoa_clipboard_update_info(notify->info);\n+ return;\n+ }\n+}\n+\n static void cocoa_clipboard_request(QemuClipboardInfo *info,\n QemuClipboardType type)\n {\n", "prefixes": [ "PULL", "v2", "03/36" ] }