From 349504e5a1533c795cd5f72e629766b996982050 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Date: Wed, 21 Jul 2021 15:19:13 +0400 Subject: ui/clipboard: add qemu_clipboard_check_serial() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Marc-André Lureau Acked-by: Gerd Hoffmann --- ui/clipboard.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'ui') diff --git a/ui/clipboard.c b/ui/clipboard.c index 743b39e..ffbd80e 100644 --- a/ui/clipboard.c +++ b/ui/clipboard.c @@ -41,6 +41,21 @@ void qemu_clipboard_peer_release(QemuClipboardPeer *peer, } } +bool qemu_clipboard_check_serial(QemuClipboardInfo *info, bool client) +{ + if (!info->has_serial || + !cbinfo[info->selection] || + !cbinfo[info->selection]->has_serial) { + return true; + } + + if (client) { + return cbinfo[info->selection]->serial >= info->serial; + } else { + return cbinfo[info->selection]->serial > info->serial; + } +} + void qemu_clipboard_update(QemuClipboardInfo *info) { QemuClipboardNotify notify = { -- cgit v1.1