ui/clipboard: add qemu_clipboard_peer_release() helper
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20210805135715.857938-8-marcandre.lureau@redhat.com> Acked-by: Gerd Hoffmann <kraxel@redhat.com>
This commit is contained in:
parent
482bbaf477
commit
1387865eca
@ -120,6 +120,17 @@ void qemu_clipboard_peer_unregister(QemuClipboardPeer *peer);
|
||||
bool qemu_clipboard_peer_owns(QemuClipboardPeer *peer,
|
||||
QemuClipboardSelection selection);
|
||||
|
||||
/**
|
||||
* qemu_clipboard_peer_release
|
||||
*
|
||||
* @peer: peer information.
|
||||
* @selection: clipboard selection.
|
||||
*
|
||||
* If the peer owns the clipboard, release it.
|
||||
*/
|
||||
void qemu_clipboard_peer_release(QemuClipboardPeer *peer,
|
||||
QemuClipboardSelection selection);
|
||||
|
||||
/**
|
||||
* qemu_clipboard_info
|
||||
*
|
||||
|
@ -24,6 +24,18 @@ bool qemu_clipboard_peer_owns(QemuClipboardPeer *peer,
|
||||
return info && info->owner == peer;
|
||||
}
|
||||
|
||||
void qemu_clipboard_peer_release(QemuClipboardPeer *peer,
|
||||
QemuClipboardSelection selection)
|
||||
{
|
||||
g_autoptr(QemuClipboardInfo) info = NULL;
|
||||
|
||||
if (qemu_clipboard_peer_owns(peer, selection)) {
|
||||
/* set empty clipboard info */
|
||||
info = qemu_clipboard_info_new(NULL, selection);
|
||||
qemu_clipboard_update(info);
|
||||
}
|
||||
}
|
||||
|
||||
void qemu_clipboard_update(QemuClipboardInfo *info)
|
||||
{
|
||||
g_autoptr(QemuClipboardInfo) old = NULL;
|
||||
|
Loading…
Reference in New Issue
Block a user