[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v3 07/18] ui/clipboard: add qemu_clipboard_peer_release() helper
From: |
marcandre . lureau |
Subject: |
[PATCH v3 07/18] ui/clipboard: add qemu_clipboard_peer_release() helper |
Date: |
Thu, 5 Aug 2021 17:57:04 +0400 |
From: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
include/ui/clipboard.h | 11 +++++++++++
ui/clipboard.c | 12 ++++++++++++
2 files changed, 23 insertions(+)
diff --git a/include/ui/clipboard.h b/include/ui/clipboard.h
index 25e0b470c8..6298986b15 100644
--- a/include/ui/clipboard.h
+++ b/include/ui/clipboard.h
@@ -120,6 +120,17 @@ void qemu_clipboard_peer_unregister(QemuClipboardPeer
*peer);
bool qemu_clipboard_peer_owns(QemuClipboardPeer *peer,
QemuClipboardSelection selection);
+/**
+ * qemu_clipboard_peer_release
+ *
+ * @peer: peer information.
+ * @selection: clipboard selection.
+ *
+ * If the peer owns the clipboard, release it.
+ */
+void qemu_clipboard_peer_release(QemuClipboardPeer *peer,
+ QemuClipboardSelection selection);
+
/**
* qemu_clipboard_info
*
diff --git a/ui/clipboard.c b/ui/clipboard.c
index 490c3220f4..c277247a7f 100644
--- a/ui/clipboard.c
+++ b/ui/clipboard.c
@@ -24,6 +24,18 @@ bool qemu_clipboard_peer_owns(QemuClipboardPeer *peer,
return info && info->owner == peer;
}
+void qemu_clipboard_peer_release(QemuClipboardPeer *peer,
+ QemuClipboardSelection selection)
+{
+ g_autoptr(QemuClipboardInfo) info = NULL;
+
+ if (qemu_clipboard_peer_owns(peer, selection)) {
+ /* set empty clipboard info */
+ info = qemu_clipboard_info_new(NULL, selection);
+ qemu_clipboard_update(info);
+ }
+}
+
void qemu_clipboard_update(QemuClipboardInfo *info)
{
g_autoptr(QemuClipboardInfo) old = NULL;
--
2.32.0.264.g75ae10bc75
- [PATCH v3 00/18] Clipboard fixes (for 6.1?), marcandre . lureau, 2021/08/05
- [PATCH v3 01/18] ui/vdagent: fix leak on error path, marcandre . lureau, 2021/08/05
- [PATCH v3 02/18] ui/vdagent: remove copy-pasta comment, marcandre . lureau, 2021/08/05
- [PATCH v3 03/18] ui/gtk-clipboard: use existing macros, marcandre . lureau, 2021/08/05
- [PATCH v3 04/18] ui/gtk-clipboard: fix clipboard enum typo, marcandre . lureau, 2021/08/05
- [PATCH v3 05/18] ui/clipboard: add helper to retrieve current clipboard, marcandre . lureau, 2021/08/05
- [PATCH v3 06/18] ui/clipboard: add qemu_clipboard_peer_owns() helper, marcandre . lureau, 2021/08/05
- [PATCH v3 07/18] ui/clipboard: add qemu_clipboard_peer_release() helper,
marcandre . lureau <=
- [PATCH v3 08/18] ui/clipboard: release owned grabs on unregister, marcandre . lureau, 2021/08/05
- [PATCH v3 09/18] ui/vdagent: disconnect handlers and reset state on finalize, marcandre . lureau, 2021/08/05
- [PATCH v3 10/18] ui/vdagent: reset outbuf on disconnect, marcandre . lureau, 2021/08/05
- [PATCH v3 11/18] ui/vdagent: split clipboard recv message handling, marcandre . lureau, 2021/08/05
- [PATCH v3 12/18] ui/vdagent: use qemu_clipboard_peer_release helper, marcandre . lureau, 2021/08/05
- [PATCH v3 13/18] ui/vdagent: use qemu_clipboard_info helper, marcandre . lureau, 2021/08/05
- [PATCH v3 14/18] ui/vdagent: send empty clipboard when unhandled, marcandre . lureau, 2021/08/05
- [PATCH v3 15/18] ui/gtk-clipboard: use qemu_clipboard_info helper, marcandre . lureau, 2021/08/05
- [PATCH v3 16/18] ui/vdagent: send release when no clipboard owner, marcandre . lureau, 2021/08/05