ui/vdagent: notify clipboard peers of serial reset
authorMarc-André Lureau <marcandre.lureau@redhat.com>
Wed, 17 Jul 2024 17:15:39 +0000 (21:15 +0400)
committerMarc-André Lureau <marcandre.lureau@redhat.com>
Mon, 22 Jul 2024 08:47:28 +0000 (12:47 +0400)
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>

ui/clipboard.c
ui/trace-events
ui/vdagent.c

index 4264884a6c472e7d02377feca2c9fe13d2fada56..132086eb1352c8b3d0558807bf08e14903387f76 100644 (file)
@@ -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) {
index f5faa149d23bc51e36a43436ddee384c3532f7bc..fb253c16669cc9758e5f9cc299d97201c8631600 100644 (file)
@@ -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"
index cb74739bc46c6a18c7f32d4aed508c5bfda5c0bf..2a4b3574b13c7836e3a0a383d0ed3cd99bb47802 100644 (file)
@@ -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;