[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v3 16/18] ui/vdagent: send release when no clipboard owner
From: |
marcandre . lureau |
Subject: |
[PATCH v3 16/18] ui/vdagent: send release when no clipboard owner |
Date: |
Thu, 5 Aug 2021 17:57:13 +0400 |
From: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
ui/vdagent.c | 24 +++++++++++++++++++++++-
1 file changed, 23 insertions(+), 1 deletion(-)
diff --git a/ui/vdagent.c b/ui/vdagent.c
index cd49da1ffa..7d8cb963ff 100644
--- a/ui/vdagent.c
+++ b/ui/vdagent.c
@@ -345,6 +345,24 @@ static void vdagent_send_clipboard_grab(VDAgentChardev *vd,
vdagent_send_msg(vd, msg);
}
+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)
@@ -396,7 +414,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;
}
--
2.32.0.264.g75ae10bc75
- [PATCH v3 07/18] ui/clipboard: add qemu_clipboard_peer_release() helper, (continued)
- [PATCH v3 07/18] ui/clipboard: add qemu_clipboard_peer_release() helper, marcandre . lureau, 2021/08/05
- [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 <=
- [PATCH v3 17/18] ui/gtk-clipboard: emit release clipboard events, marcandre . lureau, 2021/08/05
- [PATCH v3 18/18] ui/vdagent: add a migration blocker, marcandre . lureau, 2021/08/05
- Re: [PATCH v3 00/18] Clipboard fixes (for 6.1?), Marc-André Lureau, 2021/08/27