summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@redhat.com>2024-07-17 21:15:39 +0400
committerMarc-André Lureau <marcandre.lureau@redhat.com>2024-07-22 12:47:28 +0400
commit63a5d4de589330f0a1c46f59a4b7336adda4635b (patch)
tree5aab25ca0c8305786a0d63928fa06307e327ff85
parent81c88ce0b84db9395463901d79f7e87e9210527a (diff)
downloadfocaccia-qemu-63a5d4de589330f0a1c46f59a4b7336adda4635b.tar.gz
focaccia-qemu-63a5d4de589330f0a1c46f59a4b7336adda4635b.zip
ui/vdagent: notify clipboard peers of serial reset
Since we reset the serial counters, peers should also be reset to be sync.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-Id: <20240717171541.201525-4-marcandre.lureau@redhat.com>
-rw-r--r--ui/clipboard.c2
-rw-r--r--ui/trace-events1
-rw-r--r--ui/vdagent.c2
3 files changed, 5 insertions, 0 deletions
diff --git a/ui/clipboard.c b/ui/clipboard.c
index 4264884a6c..132086eb13 100644
--- a/ui/clipboard.c
+++ b/ui/clipboard.c
@@ -155,6 +155,8 @@ void qemu_clipboard_reset_serial(void)
     QemuClipboardNotify notify = { .type = QEMU_CLIPBOARD_RESET_SERIAL };
     int i;
 
+    trace_clipboard_reset_serial();
+
     for (i = 0; i < QEMU_CLIPBOARD_SELECTION__COUNT; i++) {
         QemuClipboardInfo *info = qemu_clipboard_info(i);
         if (info) {
diff --git a/ui/trace-events b/ui/trace-events
index f5faa149d2..fb253c1666 100644
--- a/ui/trace-events
+++ b/ui/trace-events
@@ -130,6 +130,7 @@ xkeymap_keymap(const char *name) "keymap '%s'"
 
 # clipboard.c
 clipboard_check_serial(int cur, int recv, bool ok) "cur:%d recv:%d %d"
+clipboard_reset_serial(void) ""
 
 # vdagent.c
 vdagent_fe_open(bool fe_open) "fe_open=%d"
diff --git a/ui/vdagent.c b/ui/vdagent.c
index cb74739bc4..2a4b3574b1 100644
--- a/ui/vdagent.c
+++ b/ui/vdagent.c
@@ -720,6 +720,8 @@ static void vdagent_chr_recv_caps(VDAgentChardev *vd, VDAgentMessage *msg)
     memset(vd->last_serial, 0, sizeof(vd->last_serial));
 
     if (have_clipboard(vd) && vd->cbpeer.notifier.notify == NULL) {
+        qemu_clipboard_reset_serial();
+
         vd->cbpeer.name = "vdagent";
         vd->cbpeer.notifier.notify = vdagent_clipboard_notify;
         vd->cbpeer.request = vdagent_clipboard_request;