From: marcandre.lureau@redhat.com
To: qemu-devel@nongnu.org
Cc: "Peter Maydell" <peter.maydell@linaro.org>,
"Gerd Hoffmann" <kraxel@redhat.com>,
"Marc-André Lureau" <marcandre.lureau@redhat.com>
Subject: [PULL 06/18] ui/clipboard: add qemu_clipboard_peer_owns() helper
Date: Tue, 31 Aug 2021 17:31:20 +0400 [thread overview]
Message-ID: <20210831133132.1697228-7-marcandre.lureau@redhat.com> (raw)
In-Reply-To: <20210831133132.1697228-1-marcandre.lureau@redhat.com>
From: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20210805135715.857938-7-marcandre.lureau@redhat.com>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
---
include/ui/clipboard.h | 11 +++++++++++
ui/clipboard.c | 8 ++++++++
2 files changed, 19 insertions(+)
diff --git a/include/ui/clipboard.h b/include/ui/clipboard.h
index e9fcb15c66..25e0b470c8 100644
--- a/include/ui/clipboard.h
+++ b/include/ui/clipboard.h
@@ -109,6 +109,17 @@ void qemu_clipboard_peer_register(QemuClipboardPeer *peer);
*/
void qemu_clipboard_peer_unregister(QemuClipboardPeer *peer);
+/**
+ * qemu_clipboard_peer_owns
+ *
+ * @peer: peer information.
+ * @selection: clipboard selection.
+ *
+ * Return TRUE if the peer owns the clipboard.
+ */
+bool qemu_clipboard_peer_owns(QemuClipboardPeer *peer,
+ QemuClipboardSelection selection);
+
/**
* qemu_clipboard_info
*
diff --git a/ui/clipboard.c b/ui/clipboard.c
index 56c14509fe..490c3220f4 100644
--- a/ui/clipboard.c
+++ b/ui/clipboard.c
@@ -16,6 +16,14 @@ void qemu_clipboard_peer_unregister(QemuClipboardPeer *peer)
notifier_remove(&peer->update);
}
+bool qemu_clipboard_peer_owns(QemuClipboardPeer *peer,
+ QemuClipboardSelection selection)
+{
+ QemuClipboardInfo *info = qemu_clipboard_info(selection);
+
+ return info && info->owner == peer;
+}
+
void qemu_clipboard_update(QemuClipboardInfo *info)
{
g_autoptr(QemuClipboardInfo) old = NULL;
--
2.33.0.rc2
next prev parent reply other threads:[~2021-08-31 13:45 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-31 13:31 [PULL 00/18] UI/clipboard fixes marcandre.lureau
2021-08-31 13:31 ` [PULL 01/18] ui/vdagent: fix leak on error path marcandre.lureau
2021-08-31 13:31 ` [PULL 02/18] ui/vdagent: remove copy-pasta comment marcandre.lureau
2021-08-31 13:31 ` [PULL 03/18] ui/gtk-clipboard: use existing macros marcandre.lureau
2021-08-31 13:31 ` [PULL 04/18] ui/gtk-clipboard: fix clipboard enum typo marcandre.lureau
2021-08-31 13:31 ` [PULL 05/18] ui/clipboard: add helper to retrieve current clipboard marcandre.lureau
2021-08-31 13:31 ` marcandre.lureau [this message]
2021-08-31 13:31 ` [PULL 07/18] ui/clipboard: add qemu_clipboard_peer_release() helper marcandre.lureau
2021-08-31 13:31 ` [PULL 08/18] ui/clipboard: release owned grabs on unregister marcandre.lureau
2021-08-31 13:31 ` [PULL 09/18] ui/vdagent: disconnect handlers and reset state on finalize marcandre.lureau
2021-08-31 13:31 ` [PULL 10/18] ui/vdagent: reset outbuf on disconnect marcandre.lureau
2021-08-31 13:31 ` [PULL 11/18] ui/vdagent: split clipboard recv message handling marcandre.lureau
2021-08-31 13:31 ` [PULL 12/18] ui/vdagent: use qemu_clipboard_peer_release helper marcandre.lureau
2021-08-31 13:31 ` [PULL 13/18] ui/vdagent: use qemu_clipboard_info helper marcandre.lureau
2021-08-31 13:31 ` [PULL 14/18] ui/vdagent: send empty clipboard when unhandled marcandre.lureau
2021-08-31 13:31 ` [PULL 15/18] ui/gtk-clipboard: use qemu_clipboard_info helper marcandre.lureau
2021-08-31 13:31 ` [PULL 16/18] ui/vdagent: send release when no clipboard owner marcandre.lureau
2021-08-31 13:31 ` [PULL 17/18] ui/gtk-clipboard: emit release clipboard events marcandre.lureau
2021-08-31 13:31 ` [PULL 18/18] ui/vdagent: add a migration blocker marcandre.lureau
2021-08-31 19:49 ` [PULL 00/18] UI/clipboard fixes Peter Maydell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210831133132.1697228-7-marcandre.lureau@redhat.com \
--to=marcandre.lureau@redhat.com \
--cc=kraxel@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).