mirror of
https://github.com/Motorhead1991/qemu.git
synced 2026-02-11 19:39:26 -07:00
ui/clipboard: add vmstate_cbinfo
Add a VMStateDescriptor for QemuClipboardInfo. Each clipboard owner will have to save its QemuClipboardInfo and reregister its owned clipboard after loading. (the global cbinfo has only pointers to owners, so it can't restore the relation with its owner if it was to handle migration) Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
This commit is contained in:
parent
a3f59c70d6
commit
d0de94cbc0
2 changed files with 29 additions and 0 deletions
|
|
@ -2,6 +2,7 @@
|
|||
#define QEMU_CLIPBOARD_H
|
||||
|
||||
#include "qemu/notify.h"
|
||||
#include "migration/vmstate.h"
|
||||
|
||||
/**
|
||||
* DOC: Introduction
|
||||
|
|
@ -27,6 +28,8 @@ typedef struct QemuClipboardNotify QemuClipboardNotify;
|
|||
typedef struct QemuClipboardInfo QemuClipboardInfo;
|
||||
typedef struct QemuClipboardContent QemuClipboardContent;
|
||||
|
||||
extern const VMStateDescription vmstate_cbinfo;
|
||||
|
||||
/**
|
||||
* enum QemuClipboardType
|
||||
*
|
||||
|
|
|
|||
|
|
@ -7,6 +7,32 @@ static NotifierList clipboard_notifiers =
|
|||
|
||||
static QemuClipboardInfo *cbinfo[QEMU_CLIPBOARD_SELECTION__COUNT];
|
||||
|
||||
static const VMStateDescription vmstate_cbcontent = {
|
||||
.name = "clipboard/content",
|
||||
.version_id = 0,
|
||||
.minimum_version_id = 0,
|
||||
.fields = (const VMStateField[]) {
|
||||
VMSTATE_BOOL(available, QemuClipboardContent),
|
||||
VMSTATE_BOOL(requested, QemuClipboardContent),
|
||||
VMSTATE_UINT32(size, QemuClipboardContent),
|
||||
VMSTATE_VBUFFER_ALLOC_UINT32(data, QemuClipboardContent, 0, 0, size),
|
||||
VMSTATE_END_OF_LIST()
|
||||
}
|
||||
};
|
||||
|
||||
const VMStateDescription vmstate_cbinfo = {
|
||||
.name = "clipboard",
|
||||
.version_id = 0,
|
||||
.minimum_version_id = 0,
|
||||
.fields = (const VMStateField[]) {
|
||||
VMSTATE_INT32(selection, QemuClipboardInfo),
|
||||
VMSTATE_BOOL(has_serial, QemuClipboardInfo),
|
||||
VMSTATE_UINT32(serial, QemuClipboardInfo),
|
||||
VMSTATE_STRUCT_ARRAY(types, QemuClipboardInfo, QEMU_CLIPBOARD_TYPE__COUNT, 0, vmstate_cbcontent, QemuClipboardContent),
|
||||
VMSTATE_END_OF_LIST()
|
||||
}
|
||||
};
|
||||
|
||||
void qemu_clipboard_peer_register(QemuClipboardPeer *peer)
|
||||
{
|
||||
notifier_list_add(&clipboard_notifiers, &peer->notifier);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue