mirror of https://github.com/proxmox/mirror_qemu
ui/vdagent: send release when no clipboard owner
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20210805135715.857938-17-marcandre.lureau@redhat.com> Acked-by: Gerd Hoffmann <kraxel@redhat.com>master
parent
b702c863bf
commit
314bf50086
24
ui/vdagent.c
24
ui/vdagent.c
|
@ -345,6 +345,24 @@ static void vdagent_send_clipboard_grab(VDAgentChardev *vd,
|
||||||
vdagent_send_msg(vd, msg);
|
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,
|
static void vdagent_send_clipboard_data(VDAgentChardev *vd,
|
||||||
QemuClipboardInfo *info,
|
QemuClipboardInfo *info,
|
||||||
QemuClipboardType type)
|
QemuClipboardType type)
|
||||||
|
@ -396,7 +414,11 @@ static void vdagent_clipboard_notify(Notifier *notifier, void *data)
|
||||||
if (info != qemu_clipboard_info(s)) {
|
if (info != qemu_clipboard_info(s)) {
|
||||||
vd->cbpending[s] = 0;
|
vd->cbpending[s] = 0;
|
||||||
if (!self_update) {
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue