mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-05 00:33:55 -06:00
ui: generalize clipboard notifier
Use a QemuClipboardNotify union type for extendable clipboard events. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Acked-by: Gerd Hoffmann <kraxel@redhat.com>
This commit is contained in:
parent
5912745288
commit
1b17f1e9f9
7 changed files with 101 additions and 29 deletions
|
@ -189,10 +189,8 @@ static void vnc_clipboard_provide(VncState *vs,
|
|||
vnc_flush(vs);
|
||||
}
|
||||
|
||||
static void vnc_clipboard_notify(Notifier *notifier, void *data)
|
||||
static void vnc_clipboard_update_info(VncState *vs, QemuClipboardInfo *info)
|
||||
{
|
||||
VncState *vs = container_of(notifier, VncState, cbpeer.update);
|
||||
QemuClipboardInfo *info = data;
|
||||
QemuClipboardType type;
|
||||
bool self_update = info->owner == &vs->cbpeer;
|
||||
uint32_t flags = 0;
|
||||
|
@ -223,6 +221,18 @@ static void vnc_clipboard_notify(Notifier *notifier, void *data)
|
|||
}
|
||||
}
|
||||
|
||||
static void vnc_clipboard_notify(Notifier *notifier, void *data)
|
||||
{
|
||||
VncState *vs = container_of(notifier, VncState, cbpeer.notifier);
|
||||
QemuClipboardNotify *notify = data;
|
||||
|
||||
switch (notify->type) {
|
||||
case QEMU_CLIPBOARD_UPDATE_INFO:
|
||||
vnc_clipboard_update_info(vs, notify->info);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
static void vnc_clipboard_request(QemuClipboardInfo *info,
|
||||
QemuClipboardType type)
|
||||
{
|
||||
|
@ -316,9 +326,9 @@ void vnc_server_cut_text_caps(VncState *vs)
|
|||
caps[1] = 0;
|
||||
vnc_clipboard_send(vs, 2, caps);
|
||||
|
||||
if (!vs->cbpeer.update.notify) {
|
||||
if (!vs->cbpeer.notifier.notify) {
|
||||
vs->cbpeer.name = "vnc";
|
||||
vs->cbpeer.update.notify = vnc_clipboard_notify;
|
||||
vs->cbpeer.notifier.notify = vnc_clipboard_notify;
|
||||
vs->cbpeer.request = vnc_clipboard_request;
|
||||
qemu_clipboard_peer_register(&vs->cbpeer);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue