diff mbox series

[3/4] ui/vdagent: notify clipboard peers of serial reset

Message ID 20240717171541.201525-4-marcandre.lureau@redhat.com
State New
Headers show
Series [1/4] ui: add more tracing for dbus | expand

Commit Message

Marc-André Lureau July 17, 2024, 5:15 p.m. UTC
From: Marc-André Lureau <marcandre.lureau@redhat.com>

Since we reset the serial counters, peers should also be reset to be sync.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
 ui/clipboard.c  | 2 ++
 ui/vdagent.c    | 2 ++
 ui/trace-events | 1 +
 3 files changed, 5 insertions(+)
diff mbox series

Patch

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/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;
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"