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>
This commit is contained in:
Marc-André Lureau 2024-07-17 21:15:39 +04:00
parent 81c88ce0b8
commit 63a5d4de58
3 changed files with 5 additions and 0 deletions

View File

@ -155,6 +155,8 @@ void qemu_clipboard_reset_serial(void)
QemuClipboardNotify notify = { .type = QEMU_CLIPBOARD_RESET_SERIAL }; QemuClipboardNotify notify = { .type = QEMU_CLIPBOARD_RESET_SERIAL };
int i; int i;
trace_clipboard_reset_serial();
for (i = 0; i < QEMU_CLIPBOARD_SELECTION__COUNT; i++) { for (i = 0; i < QEMU_CLIPBOARD_SELECTION__COUNT; i++) {
QemuClipboardInfo *info = qemu_clipboard_info(i); QemuClipboardInfo *info = qemu_clipboard_info(i);
if (info) { if (info) {

View File

@ -130,6 +130,7 @@ xkeymap_keymap(const char *name) "keymap '%s'"
# clipboard.c # clipboard.c
clipboard_check_serial(int cur, int recv, bool ok) "cur:%d recv:%d %d" clipboard_check_serial(int cur, int recv, bool ok) "cur:%d recv:%d %d"
clipboard_reset_serial(void) ""
# vdagent.c # vdagent.c
vdagent_fe_open(bool fe_open) "fe_open=%d" vdagent_fe_open(bool fe_open) "fe_open=%d"

View File

@ -720,6 +720,8 @@ static void vdagent_chr_recv_caps(VDAgentChardev *vd, VDAgentMessage *msg)
memset(vd->last_serial, 0, sizeof(vd->last_serial)); memset(vd->last_serial, 0, sizeof(vd->last_serial));
if (have_clipboard(vd) && vd->cbpeer.notifier.notify == NULL) { if (have_clipboard(vd) && vd->cbpeer.notifier.notify == NULL) {
qemu_clipboard_reset_serial();
vd->cbpeer.name = "vdagent"; vd->cbpeer.name = "vdagent";
vd->cbpeer.notifier.notify = vdagent_clipboard_notify; vd->cbpeer.notifier.notify = vdagent_clipboard_notify;
vd->cbpeer.request = vdagent_clipboard_request; vd->cbpeer.request = vdagent_clipboard_request;