summary refs log tree commit diff stats
path: root/ui/vdagent.c
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@redhat.com>2021-08-05 17:57:11 +0400
committerMarc-André Lureau <marcandre.lureau@redhat.com>2021-08-31 17:25:14 +0400
commit3d3f0bc3f7d5d74a7ae14f7336c9c3c209cdb71b (patch)
treed0b45486a7d6f65cf899d4c81be7cfc20f2a5a40 /ui/vdagent.c
parentd2ed2c01c20d739f0ffaa7b178f9020c7ab880b4 (diff)
downloadfocaccia-qemu-3d3f0bc3f7d5d74a7ae14f7336c9c3c209cdb71b.tar.gz
focaccia-qemu-3d3f0bc3f7d5d74a7ae14f7336c9c3c209cdb71b.zip
ui/vdagent: send empty clipboard when unhandled
Rather than leaving the agent timing out or hanging, reply to it with an
empty result.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20210805135715.857938-15-marcandre.lureau@redhat.com>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
Diffstat (limited to 'ui/vdagent.c')
-rw-r--r--ui/vdagent.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/ui/vdagent.c b/ui/vdagent.c
index cd07937a4b..cd49da1ffa 100644
--- a/ui/vdagent.c
+++ b/ui/vdagent.c
@@ -375,6 +375,16 @@ static void vdagent_send_clipboard_data(VDAgentChardev *vd,
     vdagent_send_msg(vd, msg);
 }
 
+static void vdagent_send_empty_clipboard_data(VDAgentChardev *vd,
+                                              QemuClipboardSelection selection,
+                                              QemuClipboardType type)
+{
+    g_autoptr(QemuClipboardInfo) info = qemu_clipboard_info_new(&vd->cbpeer, selection);
+
+    trace_vdagent_send_empty_clipboard();
+    vdagent_send_clipboard_data(vd, info, type);
+}
+
 static void vdagent_clipboard_notify(Notifier *notifier, void *data)
 {
     VDAgentChardev *vd = container_of(notifier, VDAgentChardev, cbpeer.update);
@@ -482,6 +492,8 @@ static void vdagent_clipboard_recv_request(VDAgentChardev *vd, uint8_t s, uint32
             vd->cbpending[s] |= (1 << type);
             qemu_clipboard_request(info, type);
         }
+    } else {
+        vdagent_send_empty_clipboard_data(vd, s, type);
     }
 }